*----------------------------------------------------------------------* * DECLARATIONS * *----------------------------------------------------------------------* DATA: gv_plvar TYPE PLVAR. *----------------------------------------------------------------------* * EVENTS * *----------------------------------------------------------------------* AT SELECTION-SCREEN. CALL FUNCTION 'RH_GET_PLVAR' IMPORTING plvar = gv_plvar. *----------------------------------------------------------------------* * FORM RETRIEVE_MANAGER * *----------------------------------------------------------------------* FORM retrieve_manager USING pv_org_unit TYPE SOBID CHANGING pv_manager TYPE PD_OBJID_R pv_plans TYPE PLANS. DATA BEGIN OF lt_objec OCCURS 0. INCLUDE STRUCTURE OBJEC. DATA END OF lt_objec. DATA: lv_found TYPE C, lv_sobid TYPE sobid. lv_sobid = pv_org_unit. WHILE lv_found IS INITIAL. CALL FUNCTION 'RH_STRUC_GET' EXPORTING ACT_OTYPE = 'O' ACT_OBJID = lv_sobid ACT_WEGID = 'BOSSONLY' ACT_PLVAR = gv_plvar TABLES RESULT_OBJEC = lt_objec EXCEPTIONS NO_PLVAR_FOUND = 1 NO_ENTRY_FOUND = 2 OTHERS = 3. IF SY-SUBRC <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. READ TABLE lt_objec WITH KEY otype = 'P'. IF SY-SUBRC = 0. pv_manager = lt_objec-objid. READ TABLE lt_objec WITH KEY otype = 'S'. pv_plans = lt_objec-objid. lv_found = 'X'. ELSE. SELECT SINGLE sobid FROM hrp1001 INTO lv_sobid WHERE otype = 'O' AND objid = lv_sobid AND plvar = gv_plvar AND rsign = 'A' AND relat = '002' AND begda <= SY-DATUM AND endda >= SY-DATUM. ENDIF. ENDWHILE. ENDFORM. "retrieve_manager *----------------------------------------------------------------------*
martedì 25 ottobre 2016
Recuperare il manager di una Unità Organizzativa
Iscriviti a:
Commenti sul post (Atom)
Nessun commento:
Posta un commento