Google Search - Blog...........

HR ABAP - Obtain All The Sub Org Units Under An Organization Unit

report.

TABLES: hrp1000.

TYPES: BEGIN OF ty_orgunit,
objid TYPE objid,
begda TYPE begda,
endda TYPE endda,
END OF ty_orgunit.

DATA:it_orgunit TYPE STANDARD TABLE OF ty_orgunit WITH HEADER LINE.
DATA:root_org TYPE STANDARD TABLE OF hrwpc_s_hrobject WITH HEADER LINE.
DATA:t_objec TYPE STANDARD TABLE OF hrwpc_s_objec WITH HEADER LINE.
DATA:t_struc TYPE STANDARD TABLE OF hrwpc_s_struc WITH HEADER LINE.

SELECT-OPTIONS:s_objid FOR hrp1000-objid,
s_date FOR sy-datum .

START-OF-SELECTION.
*--For all the org.units entered in the selection.

LOOP AT s_objid.
CLEAR it_orgunit.
REFRESH it_orgunit.
root_org-objid = s_objid-low.
root_org-plvar = '01'.
root_org-otype = 'O'.

*--Get the sub org.unts for the given selection.
CALL FUNCTION 'HRWPC_RFC_STRUCTURE_GET'
EXPORTING
root = root_org
evpath = 'O-O_DOWN'
begda = s_date-low
endda = s_date-high
TABLES
t_objec = t_objec
t_struc = t_struc
EXCEPTIONS
nothing_found = 1
internal_error = 2
OTHERS = 3.

*--Prepare final sub org.units tabl.
LOOP AT t_objec WHERE objid NE s_objid-low.
WRITE:/ t_objec-objid .
ENDLOOP.
ENDLOOP.


ALSO READ:

- Display Texts For Personnel Subarea, Employee Group, Employee Subgroup, Cost Center & Organizational Unit.

- Minimum & Maximum Salaries For The Employees.

- Handling User Exits In HR ABAP.

- Termination Workbench Report In HR ABAP.

- Service Calculation Report In HR ABAP.

.....Back To Sub-Index On HR ABAP.

.....Back To MAIN INDEX.


1 comment:

  1. THANKS FOR YOUR SHARE.
    I am looking of a way to find out all the org. and their sub org. in the inner table for the select-options field PNPORGEH of the PNP logical DB.The way up here which you wrote just find out all the sub org. of the s_objid-low field. I wonder if you could help me? It's really grateful for your help!
    I’m looking forward to hearing from you soon.
    MY E-MAIL ADDRESS IS goonan@126.com.

    ReplyDelete