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,
sobid TYPE sobid,
END OF ty_orgunit.
TYPES: BEGIN OF ty_0001,
pernr LIKE pa0001-pernr,
endda LIKE pa0001-endda,
begda LIKE pa0001-begda,
orgeh LIKE pa0001-orgeh,
ename LIKE pa0001-ename,
END OF ty_0001.
TYPES: BEGIN OF ty_pa0008,
pernr LIKE pa0008-pernr,
begda LIKE pa0008-begda,
endda LIKE pa0008-endda,
trfar LIKE pa0008-trfar,
trfgb LIKE pa0008-trfgb,
trfgr LIKE pa0008-trfgr,
END OF ty_pa0008.
TYPES: BEGIN OF ty_t510a,
trfar LIKE t510a-trfar,
tartx LIKE t510a-tartx,
END OF ty_t510a.
DATA:it_orgunit TYPE STANDARD TABLE OF ty_orgunit WITH HEADER LINE,
it_0001 TYPE STANDARD TABLE OF ty_0001 WITH HEADER LINE,
it_pa0001 TYPE STANDARD TABLE OF ty_0001 WITH HEADER LINE,
it_pa0008 TYPE STANDARD TABLE OF ty_pa0008 WITH HEADER LINE,
it_t510a TYPE STANDARD TABLE OF ty_t510a WITH HEADER LINE.
START-OF-SELECTION.
SELECT objid
begda
endda
sobid
INTO TABLE it_orgunit
FROM hrp1001
WHERE otype = 'O'
AND objid IN s_objid
AND plvar = '01'.
IF NOT it_orgunit[] IS INITIAL.
LOOP AT it_orgunit .
DATA: v_orgeh TYPE objid.
v_orgeh = it_orgunit-sobid.
SELECT SINGLE pernr
endda
begda
orgeh
ename
FROM pa0001
INTO it_0001
WHERE orgeh = v_orgeh
AND endda >= s_date-low
AND begda <= s_date-high. MOVE it_0001 TO it_pa0001. APPEND it_pa0001. CLEAR it_pa0001.
SELECT objid
begda
endda
sobid
INTO TABLE it_orgunit
FROM hrp1001
WHERE otype = 'O'
AND objid IN s_objid
AND plvar = '01'.
IF NOT it_orgunit[] IS INITIAL.
LOOP AT it_orgunit .
DATA: v_orgeh TYPE objid.
v_orgeh = it_orgunit-sobid.
SELECT SINGLE pernr
endda
begda
orgeh
ename
FROM pa0001
INTO it_0001
WHERE orgeh = v_orgeh
AND endda >= s_date-low
AND begda <= s_date-high. MOVE it_0001 TO it_pa0001. APPEND it_pa0001. CLEAR it_pa0001.
ENDLOOP.
ENDIF.
DELETE ADJACENT DUPLICATES FROM it_pa0001 COMPARING pernr.
IF NOT it_pa0001[] IS INITIAL.
SELECT pernr
endda
begda
trfar
trfgb
trfgr
FROM pa0008
INTO TABLE it_pa0008
FOR ALL ENTRIES IN it_pa0001
WHERE pernr = it_pa0001-pernr
AND endda GE s_date-low
AND begda LE s_date-high.
*---this is for the text of pay scale area
* IF NOT it_pa0008[] IS INITIAL.
* select TRFAR
* TARTX
* from T510A
* into table it_T510A
* for all entries in it_pa0008
* where trfar = it_pa0008-trfar.
*
* ENDIF.
ENDIF.
WRITE:/1 'Personnel NO',
18 'Start Date',
30 'End Date',
44 'Org Unit',
56 'Emp Name',
80 'Pay scale type',
95 'Pay Scale Area',
115 'Pay Scale Group'.
LOOP AT it_pa0001.
WRITE:/1 it_pa0001-pernr,
18 it_pa0001-begda,
30 it_pa0001-endda,
44 it_pa0001-orgeh,
56 it_pa0001-ename.
READ TABLE it_pa0008 WITH KEY pernr = it_pa0001-pernr.
WRITE: 85 it_pa0008-trfar,
100 it_pa0008-trfgb,
120 it_pa0008-trfgr.
ENDLOOP.
ENDIF.
DELETE ADJACENT DUPLICATES FROM it_pa0001 COMPARING pernr.
IF NOT it_pa0001[] IS INITIAL.
SELECT pernr
endda
begda
trfar
trfgb
trfgr
FROM pa0008
INTO TABLE it_pa0008
FOR ALL ENTRIES IN it_pa0001
WHERE pernr = it_pa0001-pernr
AND endda GE s_date-low
AND begda LE s_date-high.
*---this is for the text of pay scale area
* IF NOT it_pa0008[] IS INITIAL.
* select TRFAR
* TARTX
* from T510A
* into table it_T510A
* for all entries in it_pa0008
* where trfar = it_pa0008-trfar.
*
* ENDIF.
ENDIF.
WRITE:/1 'Personnel NO',
18 'Start Date',
30 'End Date',
44 'Org Unit',
56 'Emp Name',
80 'Pay scale type',
95 'Pay Scale Area',
115 'Pay Scale Group'.
LOOP AT it_pa0001.
WRITE:/1 it_pa0001-pernr,
18 it_pa0001-begda,
30 it_pa0001-endda,
44 it_pa0001-orgeh,
56 it_pa0001-ename.
READ TABLE it_pa0008 WITH KEY pernr = it_pa0001-pernr.
WRITE: 85 it_pa0008-trfar,
100 it_pa0008-trfgb,
120 it_pa0008-trfgr.
ENDLOOP.
ALSO READ:
- Employee Pay Scale Report Program.
- Finding Job Code For Position.
- Ordering (Descending ) Org. Unit For An Organization.
- Display Details about Organization unit, Position or Job In HR ABAP.
- First & Last Working Date Of An Employee.
.....Back To Sub-Index On HR ABAP.
.....Back To MAIN INDEX.
No comments:
Post a Comment