DATA : v_objid LIKE hrp1001-objid, v_sobid LIKE hrp1001-sobid, v_pernr LIKE pa0001-pernr, v_first LIKE pa0002-nachn, v_last LIKE pa0002-vorna, v_name LIKE pa0002-nachn, v_date type datum.

*To fetch Selection Screen Date. v_date = pn-begda. refresh it_hrp1001. SELECT begda objid subty sobid FROM hrp1001 INTO corresponding fields of table it_hrp1001 WHERE objid = p0001-plans AND subty = 'A002' AND begda LE v_date.

if not it_hrp1001[] is INITIAL. SORT it_hrp1001 BY begda DESCENDING . LOOP AT it_hrp1001 INTO wa_hrp1001. v_objid = wa_hrp1001-objid. ON CHANGE OF v_objid. v_sobid = wa_hrp1001-sobid. ENDON. CLEAR : wa_hrp1001,v_objid. ENDLOOP. *Concatinating First Name And Last Name SELECT single pernr FROM pa0001 INTO v_pernr WHERE plans = v_sobid. SELECT single vorna nachn FROM pa0002 INTO (v_first, v_last) WHERE pernr = v_pernr. CONCATENATE v_first v_last INTO g_mname SEPARATED BY space. clear: v_objid, v_sobid,

UNIT and ACT_WEGID = 'ORGCHART' This FM fetches Organizational structure with Managers here ACT_WEGID is the evaluation path which gets stored in T778A . OR These are the paramters to pass . IF sy-subrc NE 0.:- Use FM RH_STRUC_GET where ACT_OTYPE = 'O' ACT_OBJID = MAIN ORG. endif.. .so that it picksup the managers of child Orgunit as well.v_pernr. v_last. ENDIF. v_first. EX2: FM TO FIND THE MANAGER FOR AN PERSONNEL NO. CALL FUNCTION 'RH_STRUC_GET' EXPORTING act_otype = c_o act_objid = w_orgunitid act_wegid = 'ORGCHART' act_plvar = '01' act_begda = sy-datum act_endda = '99991231' TABLES result_tab = t_restab result_objec = t_resobj result_struc = t_reslt EXCEPTIONS no_plvar_found = 1 no_entry_found = 2 OTHERS = 3. wa_hrp1001. It is not the orgunit id should be passed hear in your case it is manin orgunit ..

Sign up to vote on this title
UsefulNot useful