Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

REPORT zhr_master_data.

*----------------------------------------------------------------*

* Type pools

*----------------------------------------------------------------*

TYPE-POOLS: slis.

*----------------------------------------------------------------*

* Tables

*----------------------------------------------------------------*

TABLES: pa0001.

types : begin of ty_final2,

pernr type pa0001-pernr,

ename type pa0001-ename,

bukrs type pa0001-bukrs,

werks type pa0001-werks,

persg type pa0001-persg,

persk type pa0001-persk,

btrtl type pa0001-btrtl,

abkrs type pa0001-abkrs,

ansvh type pa0001-ansvh,

kostl type pa0001-kostl,

orgeh type pa0001-orgeh,

plans type pa0001-plans,

stell type pa0001-stell,

sacha type pa0001-sacha,

sachp type pa0001-sachp,

sachz type pa0001-sachz,

kokrs type pa0001-kokrs,

btext type t001p-btext,

ptext1 type t501t-ptext,

butxt type t001-butxt,

name1 type t500p-name1,

ptext type t503t-ptext,

atext type t549t-atext,

atx type t542t-atx,

ltext type cskt-ltext,

orgtx type t527x-orgtx,

plstx type t528t-plstx,

stltx type t513s-stltx,

bezei type tka01-bezei,

sbmod type pa0001-sbmod,

aname1 type char40,

aname2 type char40,

aname3 type char40,

end of ty_final2.

types : begin of ty_pa0001,

pernr type pa0001-pernr,

begda type pa0001-begda,

endda type pa0001-endda,

bukrs type pa0001-bukrs,

werks type pa0001-werks,

persg type pa0001-persg,

persk type pa0001-persk,

btrtl type pa0001-btrtl,

abkrs type pa0001-abkrs,

ansvh type pa0001-ansvh,

kostl type pa0001-kostl,

orgeh type pa0001-orgeh,

plans type pa0001-plans,

stell type pa0001-stell,

sacha type pa0001-sacha,

sachp type pa0001-sachp,

sachz type pa0001-sachz,

sbmod type pa0001-sbmod,

kokrs type pa0001-kokrs,

ename type pa0001-ename,

end of ty_pa0001.

types : begin of ty_t001,

bukrs type t001-bukrs,

butxt type t001-butxt,

end of ty_t001.

types :begin of ty_t500p,

persa type t500p-persa,

molga type t500p-molga,

name1 type t500p-name1,

end of ty_t500p.

types : begin of ty_t501t,

persg type t501t-persg,

ptext type t501t-ptext,

end of ty_t501t.

types :begin of ty_t503t,

persk type t503t-persk,

ptext type t503t-ptext,

end of ty_t503t.

types : begin of ty_t549t,

abkrs type t549t-abkrs,

atext type t549t-atext,

end of ty_t549t.

types : begin of ty_t542t,

molga type t542t-molga,

ansvh type t542t-ansvh,

atx type t542t-atx,

end of ty_t542t.

types : begin of ty_cskt,

kostl type cskt-kostl,

ltext type cskt-ltext,

end of ty_cskt.

types : begin of ty_t527x,

orgeh type t527x-orgeh,

orgtx type t527x-orgtx,

end of ty_t527x.

types : begin of ty_t528t,

plans type t528t-plans,

plstx type t528t-plstx,

end of ty_t528t.

types: begin of ty_t513s,

stell type t513s-stell,

stltx type t513s-stltx,

end of ty_t513s.

types: begin of ty_t526,

werks type t526-werks,

sachx type t526-sachx,

sachn type t526-sachn,

anrde type t526-anrde,

telnr type t526-telnr ,

usrid type t526-usrid,

end of ty_t526.

types :begin of ty_tka01,

kokrs type tka01-kokrs,

bezei type tka01-bezei,

end of ty_tka01.

types: begin of ty_t001p,

werks type t001p-werks,

btrtl type t001p-btrtl,

btext type t001p-btext,

molga type t001p-molga,

end of ty_t001p.

DATA : it_fieldcat2 TYPE slis_t_fieldcat_alv,

wa_fieldcat LIKE LINE OF it_fieldcat2,

wa_layout TYPE slis_layout_alv.

DATA : it_final2 TYPE TABLE OF ty_final2 WITH HEADER LINE,

it_pa0001 type table of ty_pa0001 with header line,

it_t001 type table of ty_t001 with header line,

it_t001p type table of ty_t001p with header line,

it_t500p type table of ty_t500p with header line,

it_t501t type table of ty_t501t with header line,

it_t503t type table of ty_t503t with header line,

it_t549t type table of ty_t549t with header line,

it_t542t type table of ty_t542t with header line,

it_cskt type table of ty_cskt with header line,

it_t527x type table of ty_t527x with header line,

it_t528t type table of ty_t528t with header line,

it_t513s type table of ty_t513s with header line,

it_tka01 type table of ty_tka01 with header line,

it_t526 type table of ty_t526 with header line.

SELECT-OPTIONS: s_pernr for pa0001-pernr,

s_bukrs for pa0001-bukrs,

s_werks for pa0001-werks,

s_persg for pa0001-persg,

s_persk for pa0001-persk,

s_btrtl for pa0001-btrtl,

s_abkrs for pa0001-abkrs,

s_kostl for pa0001-kostl,

s_orgeh for pa0001-orgeh,

s_plans for pa0001-plans,

s_stell for pa0001-stell.

PARAMETERS: p_begda TYPE pa0001-begda ,

p_endda TYPE pa0001-endda .

*----------------------------------------------------------------*

* Start of selection

*----------------------------------------------------------------*

START-OF-SELECTION.

select pernr

begda

endda

bukrs

werks

persg

persk

btrtl

abkrs

ansvh

kostl

orgeh

plans

stell

sacha

sachp

sachz

sbmod

kokrs

ename

from pa0001

into table it_pa0001

where pernr in s_pernr

and begda le p_endda

and endda ge p_begda

and bukrs in s_bukrs

and werks in s_werks

and persg in s_persg

and persk in s_persk

and btrtl in s_btrtl

and abkrs in s_abkrs

and kostl in s_kostl

and orgeh in s_orgeh

and plans in s_plans

and stell in s_stell .

if sy-subrc = 0.

.

select bukrs

butxt

from t001

into table it_t001

for all entries in it_pa0001

where bukrs = it_pa0001-bukrs.

select persa

molga

name1

from t500p

into table it_t500p

for all entries in it_pa0001

where persa = it_pa0001-werks.

select persg

ptext

from t501t

into table it_t501t

for all entries in it_pa0001

where persg = it_pa0001-persg

and sprsl = sy-langu.

select persk

ptext

from t503t

into table it_t503t

for all entries in it_pa0001

where persk = it_pa0001-persk

and sprsl = sy-langu.

select abkrs

atext

from t549t

into table it_t549t

for all entries in it_pa0001

where abkrs = it_pa0001-abkrs

and sprsl = sy-langu.

select werks

btrtl

btext

molga

from t001p

into table it_t001p

for all entries in it_pa0001

where werks = it_pa0001-werks

and btrtl = it_pa0001-btrtl.

select molga

ansvh

atx

from t542t

into table it_t542t

for all entries in it_pa0001

where ansvh = it_pa0001-ansvh.

select kostl

ktext from cskt

into table it_cskt

for all entries in it_pa0001

where kostl = it_pa0001-kostl

and spras = sy-langu.

select orgeh

orgtx

from t527x

into table it_t527x

for all entries in it_pa0001

where orgeh = it_pa0001-orgeh

and sprsl = sy-langu.

select plans

plstx

from t528t

into table it_t528t

for all entries in it_pa0001

where plans = it_pa0001-plans

and sprsl = sy-langu..

select stell

stltx

from t513s

into table it_t513s

for all entries in it_pa0001

where stell = it_pa0001-stell

and sprsl = sy-langu.

select werks

sachx

sachn

anrde

telnr

usrid

from t526

into table it_t526

for all entries in it_pa0001

where werks = it_pa0001-werks.

endif.

END-OF-SELECTION.

loop at it_pa0001.

move-corresponding it_pa0001 to it_final2.

read table it_t001 with key bukrs = it_pa0001-bukrs.

if sy-subrc = 0.

it_final2-butxt = it_t001-butxt.

endif.

read table it_t500p with key persa = it_pa0001-werks.

if sy-subrc = 0.

it_final2-name1 = it_t500p-name1.

endif.

read table it_t503t with key persk = it_pa0001-persk.

if sy-subrc = 0.

it_final2-ptext = it_t503t-ptext.

endif.

read table it_t549t with key abkrs = it_pa0001-abkrs.

if sy-subrc = 0.

it_final2-atext = it_t549t-atext.

endif.

read table it_cskt with key kostl = it_pa0001-kostl.

if sy-subrc = 0.

it_final2-ltext = it_cskt-ltext.

endif.

read table it_t527x with key orgeh = it_pa0001-orgeh.

if sy-subrc = 0.

it_final2-orgtx = it_t527x-orgtx.

endif.

read table it_t528t with key plans = it_pa0001-plans.

if sy-subrc = 0.

it_final2-plstx = it_t528t-plstx.

endif.

read table it_t513s with key stell = it_pa0001-stell.

if sy-subrc = 0.

it_final2-stltx = it_t513s-stltx.

endif.

read table it_tka01 with key kokrs = it_pa0001-kokrs.

if sy-subrc = 0.

it_final2-bezei = it_tka01-bezei.

endif.

read table it_t501t with key persg = it_pa0001-persg.

if sy-subrc = 0.

it_final2-ptext1 = it_t501t-ptext.

endif.

read table it_t001p with key btrtl = it_pa0001-btrtl.

if sy-subrc = 0.

it_final2-btext = it_t001p-btext.

endif.

read table it_t542t with key ansvh = it_pa0001-ansvh .

if sy-subrc = 0.

it_final2-atx = it_t542t-atx.

endif.

read table it_t526 with key werks = it_pa0001-werks

sachx = it_pa0001-sacha.

if sy-subrc = 0.

it_final2-aname1 = it_t526-sachn.

endif.

read table it_t526 with key werks = it_pa0001-werks

sachx = it_pa0001-sachp.

if sy-subrc = 0.

it_final2-aname2 = it_t526-sachn.

endif.

read table it_t526 with key werks = it_pa0001-werks

sachx = it_pa0001-sachz.

if sy-subrc = 0.

it_final2-aname3 = it_t526-sachn.

endif.

append it_final2.

clear it_final2.

endloop.

perform build_fcat using 'PERNR' 'Emp Number' ''.

perform build_fcat using 'ENAME' 'Emp Name ' '' .

perform build_fcat using 'BUKRS' 'Comp Code' ''.

perform build_fcat using 'BUTXT' 'Company Code Text' ''.

perform build_fcat using 'WERKS' 'Pers. Area' ''.

perform build_fcat using 'NAME1' 'Pers. Area Text' ''.

perform build_fcat using 'PERSG' 'Emp Group' ''.

perform build_fcat using 'PTEXT1' 'Emp Group Text' ''.

perform build_fcat using 'PERSK' 'Emp Subgroup' ''.

perform build_fcat using 'PTEXT' 'Emp Subgroup Name' ''.

perform build_fcat using 'BTRTL' 'Personnel Subarea' ''.

perform build_fcat using 'BTEXT' 'Personnel Subarea Text' ''.

perform build_fcat using 'ABKRS' 'Payroll Area' ''.

perform build_fcat using 'ATEXT' 'Payroll Area Text' ''.

perform build_fcat using 'ANSVH' 'Work Contract' ''.

perform build_fcat using 'ATX' 'Work Contract Text' ''.

perform build_fcat using 'KOSTL' 'Cost Center' ''.

perform build_fcat using 'LTEXT' 'Cost Center Text' ''.

perform build_fcat using 'ORGEH' 'Org Unit' ''.

perform build_fcat using 'ORGTX' 'Org Unit Text' ''.

perform build_fcat using 'PLANS' 'Position' ''.

perform build_fcat using 'PLSTX' 'Position Text' ''.

perform build_fcat using 'STELL' 'Job' ''.

perform build_fcat using 'STLTX' 'Job Title' ''.

perform build_fcat using 'KOKRS' 'Controlling Area' ''.

perform build_fcat using 'BEZEI' 'Controlling Area Text' ''.

perform build_fcat using 'SBMOD' 'Admin Group' ''.

perform build_fcat using 'SACHA' 'Payroll Admin' ''.

perform build_fcat using 'ANAME1' 'Admin Name' ''.

perform build_fcat using 'SACHP' 'Pres. Admin' ''.

perform build_fcat using 'ANAME2' 'Admin Name' ''.

perform build_fcat using 'SACHZ' 'Time Admin' ''.

perform build_fcat using 'ANAME3' 'Admin Name' ''.

wa_layout-zebra = 'X'.

wa_layout-colwidth_optimize = 'X'.

wa_layout-totals_text = 'Totals:'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

i_callback_top_of_page = 'TOP_OF_PAGE'

is_layout = wa_layout

it_fieldcat = it_fieldcat2

TABLES

t_outtab = it_final2.

*&---------------------------------------------------------------------*

*& Form BUILD_FCAT

*----------------------------------------------------------------------*

FORM build_fcat USING value(p_0107)

value(p_0108)

value(p_0109).

wa_fieldcat-fieldname = p_0107.

wa_fieldcat-reptext_ddic = p_0108.

wa_fieldcat-do_sum = p_0109.

APPEND wa_fieldcat TO it_fieldcat2.

CLEAR wa_fieldcat.

ENDFORM. "build_fcat

  • No labels