Tuesday, May 28, 2013
Steps to get Reporting manager
Method 1:
CALL FUNCTION 'RH_STRUC_GET' EXPORTING ACT_OTYPE = 'O' ACT_OBJID = ORGEH ACT_WEGID = 'BOSSONLY' ACT_PLVAR = '01' ACT_BEGDA = SY-DATUM ACT_ENDDA = SY-DATUM * ACT_TDEPTH = 0 TABLES * result_tab = lt_result_tab RESULT_OBJEC = LT_RESULT_OBJEC * result_struc = lt_result_struc EXCEPTIONS NO_PLVAR_FOUND = 1 NO_ENTRY_FOUND = 2.
Method 2:
- Get position of manager using Employee Org.unit.
- If manager position is not found,
- Get next level org.Unit to whom employee org.unit is reporting to.
*&--------------------------------------------------------------* *& Form GET_NEXTLVL_ORGUNIT *&--------------------------------------------------------------* FORM GET_NEXTLVL_ORGUNIT USING P_ORGEH P_BEGDA P_ENDDA CHANGING P_ORGEH_N P_SUBRC. DATA:LT_1001 TYPE STANDARD TABLE OF P1001 WITH HEADER LINE. CALL FUNCTION 'RH_READ_INFTY_1001' EXPORTING AUTHORITY = 'DISP' WITH_STRU_AUTH = 'X' PLVAR = '01' OTYPE = 'O' OBJID = P_ORGEH ISTAT = '1' SUBTY = 'A002' BEGDA = P_BEGDA ENDDA = P_ENDDA TABLES I1001 = LT_1001 EXCEPTIONS NOTHING_FOUND = 1 WRONG_CONDITION = 2 WRONG_PARAMETERS = 3 OTHERS = 4. P_SUBRC = SY-SUBRC. SORT LT_1001 DESCENDING BY BEGDA ENDDA. DELETE LT_1001 WHERE SCLAS <> 'O'. READ TABLE LT_1001 INDEX 1. CHECK SY-SUBRC = 0. P_ORGEH_N = LT_1001-SOBID. ENDFORM. " GET_NEXTLVL_ORGUNIT
- Get position of manager using Org.unit which we got in the last step.
*&-------------------------------------------------------------* *& Form GET_POS_OF_MANAGER *&-------------------------------------------------------------* FORM GET_POS_OF_MANAGER USING P_ORGEH P_BEGDA P_ENDDA CHANGING P_PLANS P_SUBRC. DATA:LT_1001 TYPE STANDARD TABLE OF P1001 WITH HEADER LINE. "Get Position >Who manages Org.Unit CALL FUNCTION 'RH_READ_INFTY_1001' EXPORTING AUTHORITY = 'DISP' WITH_STRU_AUTH = 'X' PLVAR = '01' OTYPE = 'O' OBJID = P_ORGEH ISTAT = '1' SUBTY = 'B012' BEGDA = P_BEGDA ENDDA = P_ENDDA TABLES I1001 = LT_1001 EXCEPTIONS NOTHING_FOUND = 1 WRONG_CONDITION = 2 WRONG_PARAMETERS = 3 OTHERS = 4. P_SUBRC = SY-SUBRC. SORT LT_1001 DESCENDING BY ENDDA. DELETE LT_1001 WHERE SCLAS <> 'S'. READ TABLE LT_1001 INDEX 1. CHECK SY-SUBRC = 0. P_PLANS = LT_1001-SOBID. ENDFORM. " GET_POS_OF_MANAGER
- Use steps (I) and (II) until we find the position of manager.
- If manager position is found.
- Get Manager Employee number.
CALL FUNCTION 'RH_READ_INFTY_1001' EXPORTING AUTHORITY = 'DISP' WITH_STRU_AUTH = 'X' PLVAR = '01' OTYPE = 'S' OBJID = P_PLANS ISTAT = '1' SUBTY = 'A008' BEGDA = P_BEGDA ENDDA = P_ENDDA TABLES I1001 = LT_1001 EXCEPTIONS NOTHING_FOUND = 1 WRONG_CONDITION = 2 WRONG_PARAMETERS = 3 OTHERS = 4. SORT LT_1001 DESCENDING BY ENDDA. DELETE LT_1001 WHERE SCLAS <> 'P'. READ TABLE LT_1001 INDEX 1. CHECK SY-SUBRC = 0. P_PERNR = LT_1001-SOBID.
*&-------------------------------------------------------------------* *& Form GET_POS_OF_MANAGER *&-------------------------------------------------------------------* FORM GET_POS_OF_MANAGER USING P_ORGEH P_BEGDA P_ENDDA CHANGING P_PLANS P_SUBRC. DATA:LT_1001 TYPE STANDARD TABLE OF P1001 WITH HEADER LINE. "Get Position >Who manages Org.Unit CALL FUNCTION 'RH_READ_INFTY_1001' EXPORTING AUTHORITY = 'DISP' WITH_STRU_AUTH = 'X' PLVAR = '01' OTYPE = 'O' OBJID = P_ORGEH ISTAT = '1' SUBTY = 'B012' BEGDA = P_BEGDA ENDDA = P_ENDDA TABLES I1001 = LT_1001 EXCEPTIONS NOTHING_FOUND = 1 WRONG_CONDITION = 2 WRONG_PARAMETERS = 3 OTHERS = 4. P_SUBRC = SY-SUBRC. SORT LT_1001 DESCENDING BY ENDDA. DELETE LT_1001 WHERE SCLAS <> 'S'. READ TABLE LT_1001 INDEX 1. CHECK SY-SUBRC = 0. P_PLANS = LT_1001-SOBID. ENDFORM. " GET_POS_OF_MANAGER
Followers
Popular Posts
- ABAP - ALV Report example with steps
- ABAP - Step by step tutorial on Smart Forms - Template Node
- ABAP - Sending email with pdf attachment
- SAP Adobe Form - Steps to create simple ADOBE Form and calling it from ABAP Program
- SAP ABAP - CL_ABAP_CHAR_UTILITIES class usage
- ABAP - Multiple value selection from F4 help for SELECT-OPTIONS
- Execute ABAP Report using SUBMIT statement
- ABAP - Select all or Deselect all in ALV or Check box handling in ALV
- Web Dynpro ABAP ALV - ON_CLICK event
- ABAP - Dynamic WHERE clause
0 comments:
Post a Comment
Your useful comments, suggestions are appreciated.Your comments are moderated.