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

HR ABAP - Get All The Existing Organization Units.

REPORT Ztest .

tables: hrp1000.

select-options:s_objid for hrp1000-objid,
s_date for sy-datum .

data: roots type HRROOTOB occurs 0 with header line.

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.
*--Check for Org.unit entered or not.

IF s_objid[] IS INITIAL.
*--If no org unit entered, get root orgs
CALL FUNCTION 'RH_STRUC_HELP_ROOTS_GET'
EXPORTING
SEARCH_PLVAR = '01'
SEARCH_OTYPE = 'O'
SEARCH_BEGDA = s_date-low
SEARCH_ENDDA = s_date-high
TABLES
ROOTS = roots.

IF SY-SUBRC = 0.
loop at roots.
s_objid-sign = 'I'.
s_objid-option = 'EQ'.
s_objid-low = roots-objid.
append s_objid.
endloop.
ENDIF.
endif.

start-of-selection.

SELECT objid
begda
endda
INTO table it_orgunit
FROM hrp1000
WHERE otype = 'O'
AND objid IN s_objid
AND plvar = '01'.

end-of-selection.

loop at it_orgunit.
write:/ it_orgunit-objid.
endloop.



ALSO READ:

- Obtain All The Sub Org Units Under An Organization Unit.

- 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.

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

.....Back To MAIN INDEX.


No comments:

Post a Comment