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

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

REPORT yztexts no standard page heading
line-size 450. .

*----database tables used
TABLES: pa0001.

*---types for Personnel Subarea Text
TYPES: BEGIN OF ty_text,
btrtl TYPE t001p-btrtl,
btext TYPE t001p-btext,
END OF ty_text,
*---Employee group text
BEGIN OF ty_text1,
persg TYPE t501t-persg,
ptext TYPE t501t-ptext,
END OF ty_text1,
*---Employee subgroup text
BEGIN OF ty_text2,
persk TYPE t503t-persk,
ptext1 TYPE t503t-ptext,
END OF ty_text2,
*---Cost center text
BEGIN OF ty_text3,
kostl TYPE cskt-kostl,
ltext TYPE cskt-ltext,
END OF ty_text3,
*---Organizational unit short text
BEGIN OF ty_text4,
orgeh TYPE t527x-orgeh,
orgtx TYPE t527x-orgtx,
END OF ty_text4,

BEGIN OF ty_pa0001,
pernr LIKE pa0001-pernr,
begda LIKE pa0001-begda,
endda LIKE pa0001-endda,
bukrs LIKE pa0001-bukrs,
werks LIKE pa0001-werks,
persg LIKE pa0001-persg,
persk LIKE pa0001-persk,
btrtl LIKE pa0001-btrtl,
kostl LIKE pa0001-kostl,
kokrs LIKE pa0001-kokrs,
orgeh LIKE pa0001-orgeh,
END OF ty_pa0001.

*---internal tables
DATA: it_pa0001 TYPE TABLE OF ty_pa0001 WITH HEADER LINE,
it_text TYPE TABLE OF ty_text WITH HEADER LINE,
it_text1 TYPE TABLE OF ty_text1 WITH HEADER LINE,
it_text2 TYPE TABLE OF ty_text2 WITH HEADER LINE,
it_text3 TYPE TABLE OF ty_text3 WITH HEADER LINE,
it_text4 TYPE TABLE OF ty_text4 WITH HEADER LINE.

*--selection screen
SELECT-OPTIONS: s_pernr FOR pa0001-pernr.

*---start of selection
START-OF-SELECTION.

perform get_data.

SELECT pernr
begda
endda
bukrs
werks
persg
persk
btrtl
kostl
kokrs
orgeh
FROM pa0001
INTO TABLE it_pa0001
WHERE pernr IN s_pernr.

IF NOT it_pa0001[] IS INITIAL.
* Personnel Subarea Text
SELECT btrtl btext
FROM t001p
INTO TABLE it_text
FOR ALL ENTRIES IN it_pa0001
WHERE werks = it_pa0001-werks
AND btrtl = it_pa0001-btrtl.

* Employee group text
SELECT persg ptext
FROM t501t
INTO TABLE it_text1
FOR ALL ENTRIES IN it_pa0001
WHERE sprsl = sy-langu
AND persg = it_pa0001-persg.

* Employee subgroup text
SELECT persk ptext
FROM t503t
INTO TABLE it_text2
FOR ALL ENTRIES IN it_pa0001
WHERE sprsl = sy-langu
AND persk = it_pa0001-persk.

* Cost center text
SELECT kostl ltext
FROM cskt
INTO TABLE it_text3
FOR ALL ENTRIES IN it_pa0001
WHERE spras = sy-langu
AND kokrs = it_pa0001-kokrs
AND kostl = it_pa0001-kostl.

* Organizational unit short text
SELECT orgeh orgtx
INTO TABLE it_text4
FROM t527x
FOR ALL ENTRIES IN it_pa0001
where orgeh = it_pa0001-orgeh
AND SPRSL = sy-langu .
ENDIF.

format color 7.

write:/1 'personnel number',
30 'begin date',
60 'end date',
90 'company code',
120 'Employee Group',
150 'Employee Group text',
180 'Employee Subgroup',
210 'Employee Subgroup text',
240 'Personnel Subarea',
270 'Personnel Subarea text',
300 'cost center',
330 'cost center text',
360 'orgnization unit',
390 'organization unit text'.

format color off.

LOOP AT it_pa0001.

WRITE:/1 it_pa0001-pernr,
30 it_pa0001-begda,
60 it_pa0001-endda,
90 it_pa0001-bukrs,
120 it_pa0001-werks,
150 it_pa0001-persg.
READ TABLE it_text1 WITH KEY persg = it_pa0001-persg.
WRITE: 180 it_text1-ptext,
210 it_pa0001-persk.
READ TABLE it_text2 WITH KEY persk = it_pa0001-persk.
WRITE: 240 it_text2-ptext1.

READ TABLE it_text WITH KEY btrtl = it_pa0001-btrtl.
WRITE: 270 it_text-bte t,
300 it_pa0001-kostl.
READ TABLE it_text3 WITH KEY kostl = it_pa0001-kostl.
WRITE: 330 it_text3-ltext,
360 it_pa0001-orgeh.
READ TABLE it_text4 WITH KEY orgeh = it_pa0001-orgeh.
WRITE: 390 it_text4-orgtx.
ENDLOOP.

the selection screen is like this:...



and the output is like this :




ALSO READ:

- Minimum & Maximum Salaries For The Employees.

- Handling User Exits In HR ABAP.

- Termination Workbench Report In HR ABAP.

- Service Calculation Report In HR ABAP.

- Use Of BAPI HR_MAINTAIN_MASTERDATA For Updating HR DATA.

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

.....Back To MAIN INDEX.


No comments:

Post a Comment