PCL2 cluster copying
Hello Guru's,
I am trying to copy PCL2 cluster table from client to client using IMPORT / EXPORT macros. Can anyone have sample code ? plz let me know.
Thanks in advance.
Cerlac.
hi,
try this demo prog!
DATA: V_PERNR TYPE P0000-PERNR VALUE '00016',
IN_RGDIR TYPE TABLE OF PC261,
PAYROLL TYPE PAY99_RESULT,
LS_RGDIR like line of in_rgdir.
DATA:PERNR LIKE PC200-PERNR,
SEQNR LIKE PC261-SEQNR.
CALL FUNCTION 'CU_READ_RGDIR_NEW'
EXPORTING
PERSNR = V_PERNR
CHECK_READ_AUTHORITY = 'X'
IMP_CLIENT =
IMPORTING
MOLGA =
TABLES
IN_RGDIR = IN_RGDIR
EXCEPTIONS
NO_RECORD_FOUND = 1
IMPORT_MISMATCH_ERROR = 2
NO_READ_AUTHORITY = 3
OTHERS = 4
CHECK SY-SUBRC = 0.
LOOP AT in_RGDIR INTO LS_RGDIR.
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTING
CLUSTERID = 'RX'
EMPLOYEENUMBER = '000016'"PERNR
SEQUENCENUMBER = ls_rgdir-seqnr
READ_ONLY_INTERNATIONAL = 'X'
CHANGING
PAYROLL_RESULT = PAYROLL
EXCEPTIONS
ILLEGAL_ISOCODE_OR_CLUSTERID = 1
ERROR_GENERATING_IMPORT = 2
IMPORT_MISMATCH_ERROR = 3
SUBPOOL_DIR_FULL = 4
NO_READ_AUTHORITY = 5
NO_RECORD_FOUND = 6
VERSIONS_DO_NOT_MATCH = 7.
CHECK SY-SUBRC = 0.
WRITE LS_RGDIR-SEQNR.
ENDLOOP.
write 'Nothing found'.
Similar Messages
-
How to get the data from pcl2 cluster for TCRT table.
Hi frndz,
How to get the data from pcl2 cluster for tcrt table for us payroll.
Thanks in advance.
Harisumanth.ChPL take a look at the sample Program EXAMPLE_PNP_GET_PAYROLL in your system. There are numerous other ways to read payroll results.. Pl use the search forum option & you sure will get a lot of hits..
~Suresh -
How to Pull Data From CRT table PCL2 Cluster
Hi,
I want to show a Report, below is the Fields in the Report
<b>Descripton</b>----
<b>Table Name</b>
Total Current Month Salary----
CRT table PCL2 cluster
monthly member contribution-----CRT table PCL2 cluster
Net difference in Pay----
CRT table PCL2 cluster
How to get the Data from the CRT table PCL2 cluster in BW
is there any procedure to get the payroll data in BW?
I think CRT table is a internal Table.
any good idea's will be appricated...
Thanks
PriyaHi,
check whether is it populating when u call
Function Module - PYX X_READ_PAYROLL_RESULT .
If not Use this Marcro.
RP-IMP-C2-IN.
Call this macro and check EPF[ ].This marco will populate both RT and EPF.
Check transaction - PC00_M40_ EPF
Cheers,
Manoj. -
Hi Peers,
Can anyone tell me how to export cluster pcl2. Actually my requirement is I want to change the payroll data from cluster after some modification of the wage types. Am getting the payslip details from cluster by using the function modules. But i dont know how to update these values into pcl2 cluster. Can anyone give me some idea or some sample to export the rt table values into pcl2 cluster?
Points will be awarded.
Thanks
Raviplease refer this...
report zovertime
line-size 252
line-count 60(1)
no standard page heading
message-id zndc.
Database Tables & Infotypes
tables: pcl1, " HR Cluster1
pcl2, " HR Cluster1
pa0003, " Master data - Payroll Status
cskt, " Cost Center Texts
t528t, " Positions Texts
t513s, " Job Titles
pernr, " Logical PNP
t001p, " Personnel Subarea
t500p, " Personnel Area
t501, " Employee Group
t503k, " Employee Subgroup
csks. " Cost Center
infotypes:0000,0001.
*include rpclst00.
include rpc2rx00.
include rpc2rxx0.
include rpc2cd00.
*include rpc2ps00.
*include rpc2pt00.
*include rpcfvp00.
*include rpcfdc10.
*include rpcfdc00.
include rpppxd00.
include rpppxd10.
Declaration of Internal Tables
Internal Table for Output Data
data: begin of rep_tab occurs 0,
kostl like pa0001-kostl, " Cost Center
pernr like pa0001-pernr, " Personal Number
ename like pa0001-ename, " Employee Name
ctext like cskt-ltext, " Cost Center Text
ptext like t528t-plstx, " Position Text
ot1 type p decimals 2, " Jan OT Amount
ot2 type p decimals 2, " Feb OT Amount
ot3 type p decimals 2, " Mar OT Amount
ot4 type p decimals 2, " Apr OT Amount
ot5 type p decimals 2, " May OT Amount
ot6 type p decimals 2, " Jun OT Amount
ot7 type p decimals 2, " Jul OT Amount
ot8 type p decimals 2, " Aug OT Amount
ot9 type p decimals 2, " Sep OT Amount
ot10 type p decimals 2, " Oct OT Amount
ot11 type p decimals 2, " Nov OT Amount
ot12 type p decimals 2, " Dec OT Amount
ott type p decimals 2, " Total OT Amount
end of rep_tab.
Declaration of Variables
data: v_mon(2) type n, " Month
v_no type i, " Data Lines
v_year(4) type c, " Year
v_date like sy-datum, " Date
v_date1 like sy-datum, " Date
v_seqnr like pc261-seqnr. " Sequence No.
Declaration of Constants
data: c_type like hrp1001-otype value 'S', " Object Type
c_kokrs like cskt-kokrs value '1000', " Controlling Area
c_date1 like sy-datum value '18000101', " Date
c_date2 like sy-datum value '99991231', " Date
c_x type c value 'X', " Sign
c_mon(2) type c value '01', " Month
c_val1(2) type c value '31', " Date
c_val2(2) type c value '12', " Month Type
c_val like p0041-dar01 value '01', " Date Type
c_lgart1 like p0008-lga01 value '0722', " Wage Type
c_lgart2 like p0008-lga01 value '0723', " Wage Type
c_1(2) type n value '01', " Month1
c_2(2) type n value '02', " Month2
c_3(2) type n value '03', " Month3
c_4(2) type n value '04', " Month4
c_5(2) type n value '05', " Month5
c_6(2) type n value '06', " Month6
c_7(2) type n value '07', " Month7
c_8(2) type n value '08', " Month8
c_9(2) type n value '09', " Month9
c_10(2) type n value '10', " Month10
c_11(2) type n value '11', " Month11
c_12(2) type n value '12'. " Month12
Selection-screen
parameters:
p_year like pc2b0-pabrj obligatory. " Payroll Year
At selection-screen
at selection-screen.
Validate the Selection Screen fields
perform validate_screen.
Start-of-Selection
start-of-selection.
Selection of Period
perform get_period.
Get PERNR from LDB
get pernr.
Get the Master data from infotype 0001
perform get_master_data.
Top-of-page
top-of-page.
Write the Report and Column Headings
perform top_of_page.
End-of-Page
end-of-page.
write /1(252) sy-uline.
End-of-Selection
end-of-selection.
Display the Output Report.
perform display_report.
Form-Routines
*& Form validate_screen
Validation of selection Screen fields
form validate_screen.
Validation of Cost Center
clear csks.
if not pnpkostl[] is initial.
select single kostl
into csks-kostl
from csks
where kostl in pnpkostl.
if sy-subrc <> 0.
message e999 with 'Invalid Cost Center'(003).
endif.
endif.
Validation of Personnel Number
clear pa0003.
if not pnppernr[] is initial.
select pernr
from pa0003 up to 1 rows
into pa0003-pernr
where pernr in pnppernr.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Personal Number Entered'(002).
endif.
endif.
Validation of Personnel Area
clear t500p.
if not pnpwerks[] is initial.
select persa
from t500p up to 1 rows
into t500p-persa
where persa in pnpwerks.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Personnel Area Entered'(001).
endif.
endif.
Validation of Personnel Sub Area
clear t001p.
if not pnpbtrtl[] is initial.
select btrtl
from t001p up to 1 rows
into t001p-btrtl
where btrtl in pnpbtrtl.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Personnel Sub Area Entered'(037).
endif.
endif.
Validation of Employee Group
clear t501.
if not pnppersg[] is initial.
select persg
from t501 up to 1 rows
into t501-persg
where persg in pnppersg.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Employee Group Entered'(038).
endif.
endif.
Validation of Employee Sub Group
clear t503k.
if not pnppersk[] is initial.
select persk
from t503k up to 1 rows
into t503k-persk
where persk in pnppersk.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Employee Sub Group Entered'(039).
endif.
endif.
endform. "validate_screen
*& Form get_period
Get the Correct Period based on Selection screen selection
form get_period.
clear: v_year,v_mon, v_date, v_date1.
v_year = sy-datum+0(4).
v_mon = sy-datum+4(2).
if pnptimr1 = c_x. " Current Date
pnpbegda = sy-datum.
pnpendda = sy-datum.
elseif pnptimr2 = c_x. " Current Month
concatenate v_year v_mon c_val into v_date.
concatenate v_year v_mon c_val1 into v_date1.
pnpbegda = v_date.
pnpendda = v_date1.
elseif pnptimr3 = c_x. " Current Year
concatenate v_year c_val c_val into v_date.
concatenate v_year c_val2 c_val1 into v_date1.
pnpbegda = v_date.
pnpendda = v_date1.
elseif pnptimr4 = c_x. " Upto Today
pnpbegda = c_date1.
pnpendda = sy-datum.
elseif pnptimr5 = c_x. " From Today
pnpbegda = sy-datum.
pnpendda = c_date2.
else.
if ( pnpbegda is initial and pnpendda is initial ).
pnpbegda = c_date1.
pnpendda = c_date2.
elseif pnpbegda is initial and not pnpendda is initial.
pnpbegda = c_date1.
pnpendda = pnpendda.
elseif not ( pnpbegda is initial and pnpendda is initial ).
pnpbegda = pnpbegda.
pnpendda = pnpendda.
endif.
endif.
endform. "get_period
*& Form get_master_data
Get the Master Data from Database Tables PA0001,0002,0003
form get_master_data.
Get data from Respective Infotypes
rp_provide_from_last p0001 space pnpbegda pnpendda.
if p0001-kostl in pnpkostl.
rep_tab-kostl = p0001-kostl.
rep_tab-pernr = p0001-pernr.
rep_tab-ename = p0001-ename.
Get the Position Text
clear t528t-plstx.
select single plstx into t528t-plstx from t528t
where plans = p0001-plans and
otype = c_type and
sprsl = sy-langu.
if sy-subrc = 0.
rep_tab-ptext = t528t-plstx.
endif.
Get the Cost Center Text
clear cskt-ltext.
select single ltext into cskt-ltext from cskt
where spras = sy-langu and
kokrs = c_kokrs and
kostl = p0001-kostl.
if sy-subrc = 0.
rep_tab-ctext = cskt-ltext.
endif.
Get the Overtime Payment Data
perform get_ot_data.
rep_tab-ott = rep_tab-ot1 + rep_tab-ot2 + rep_tab-ot3 +
rep_tab-ot4 + rep_tab-ot5 + rep_tab-ot6 +
rep_tab-ot7 + rep_tab-ot8 + rep_tab-ot9 +
rep_tab-ot10 + rep_tab-ot11 + rep_tab-ot12.
append rep_tab.
clear rep_tab.
endif.
sort rep_tab by kostl pernr.
delete rep_tab where kostl = ' '.
delete rep_tab where ott = 0.
endform. "get_master_data
*& Form get_ot_data
Get the Overtime Payment Data
form get_ot_data.
cd-key = pernr-pernr.
rp-imp-c2-cd.
sort rgdir by seqnr.
To get sequence number for the payroll period
loop at rgdir where void is initial
and reversal is initial
and outofseq is initial
and srtza eq 'A'.
if rgdir-fpper+0(4) = p_year.
To consider offcycle run data
if not rgdir-ocrsn is initial.
v_seqnr = rgdir-seqnr.
exit.
endif.
v_seqnr = rgdir-seqnr.
endif.
if not v_seqnr is initial.
perform import_rx.
endif.
perform process_wagetypes.
endloop.
endform. "get_ot_data
include rpppxm00.
*& Form Import_rx
Import the RX data from Clusters
form import_rx.
rx-key-pernr = cd-key-pernr.
rx-key-seqno = v_seqnr.
rp-init-buffer.
rp-imp-c2-rx.
endform. " Import_rx
*& Form Process_wagetypes
Calculate the Overtime Amount based on Wage types
form process_wagetypes.
loop at rt.
if rt-lgart = c_lgart1 or rt-lgart = c_lgart2.
if rgdir-fpper+0(4) = p_year.
v_mon = rgdir-fpper+4(2).
case v_mon .
when c_1.
rep_tab-ot1 = rep_tab-ot1 + rt-betrg.
when c_2.
rep_tab-ot2 = rep_tab-ot2 + rt-betrg.
when c_3.
rep_tab-ot3 = rep_tab-ot3 + rt-betrg.
when c_4.
rep_tab-ot4 = rep_tab-ot4 + rt-betrg.
when c_5.
rep_tab-ot5 = rep_tab-ot5 + rt-betrg.
when c_6.
rep_tab-ot6 = rep_tab-ot6 + rt-betrg.
when c_7.
rep_tab-ot7 = rep_tab-ot7 + rt-betrg.
when c_8.
rep_tab-ot8 = rep_tab-ot8 + rt-betrg.
when c_9.
rep_tab-ot9 = rep_tab-ot9 + rt-betrg.
when c_10.
rep_tab-ot10 = rep_tab-ot10 + rt-betrg.
when c_11.
rep_tab-ot11 = rep_tab-ot11 + rt-betrg.
when c_12.
rep_tab-ot12 = rep_tab-ot12 + rt-betrg.
endcase.
endif.
endif.
endloop.
endform. "process_wagetypes
*& Form top_of_page
Write the Report and Column Headings
form top_of_page.
format color col_heading on.
write: /1(252) 'NATIONAL DRILLING COMPANY'(010) centered,
/1(252) 'Overtime Payments Details'(011) centered.
format color off.
if pnptimr1 = c_x. " Current Date
write: /2 'Period From :'(036), sy-datum, 'To:'(006), sy-datum.
elseif pnptimr2 = c_x. " Current Month
write: /2 'Period From :'(036), v_date, 'To:'(006), v_date1.
elseif pnptimr3 = c_x. " Current Year
write: /2 'Period From :'(036), v_date, 'To:'(006), v_date1.
elseif pnptimr4 = c_x. " Upto Today
write: /2 'Period From :'(036), c_date1, 'To:'(006), sy-datum.
elseif pnptimr5 = c_x. " From Today
write: /2 'Period From :'(036), sy-datum, 'To:'(006), c_date2.
else.
if ( pnpbegda is initial and pnpendda is initial ).
write: /2 'Period From :'(036), c_date1, 'To:'(006), c_date2.
elseif pnpbegda is initial and not pnpendda is initial.
write: /2 'Period From :'(036), c_date1, 'To:'(006), pnpendda.
elseif not ( pnpbegda is initial and pnpendda is initial ).
write: /2 'Period From :'(036), pnpbegda,
'To:'(006), pnpendda.
endif.
endif.
write: 219 'Report Run Date:'(018), sy-datum.
if not pnpkostl[] is initial.
if pnpkostl-high is initial.
write: /2 'Cost Center :'(004), pnpkostl-low,
219 'Time :'(020), sy-uzeit.
else.
write: /2 'Cost Center From:'(005), pnpkostl-low+7(3),
'To:'(006), pnpkostl-high,
219 'Time :'(020), sy-uzeit.
endif.
else.
write: /219 'Time :'(020), sy-uzeit.
endif.
if not pnppernr[] is initial.
if pnppernr-high is initial.
write: /2 'Personal Number :'(007), pnppernr-low,
219 'User :'(021), sy-uname.
else.
write: /2 'Personal No.From:'(008), pnppernr-low,
'To:'(006), pnppernr-high,
219 'User :'(021), sy-uname.
endif.
else.
write: /219 'User :'(021), sy-uname.
endif.
write: /219 'Page No :'(022), sy-pagno.
format color col_heading.
write /1(252) sy-uline.
write:/1 sy-vline, 10 sy-vline,
41 sy-vline,
67 sy-vline, 68(167) 'Overtime Payments(Dirhams)'(013) centered,
235 sy-vline,252 sy-vline.
format color col_heading.
write:/1 sy-vline, 2(8) 'Emp #'(019) centered,
10 sy-vline, 11(30) 'Employee Name'(012) centered,
41 sy-vline, 42(25) 'Position'(014) centered,
67 sy-vline, 68(167) sy-uline,
235 sy-vline,236(16) 'Total'(017) centered,
252 sy-vline.
write:/1 sy-vline, 10 sy-vline,
41 sy-vline,
67 sy-vline, 68(13) 'JANUARY'(024) centered,
81 sy-vline, 82(13) 'FEBRUARY'(025) centered,
95 sy-vline, 96(13) 'MARCH'(026) centered,
109 sy-vline,110(13) 'APRIL'(027) centered,
123 sy-vline,124(13) 'MAY'(028) centered,
137 sy-vline,138(13) 'JUNE'(029) centered,
151 sy-vline,152(13) 'JULY'(030) centered,
165 sy-vline,166(13) 'AUGUST'(031) centered,
179 sy-vline,180(13) 'SEPTEMBER'(032) centered,
193 sy-vline,194(13) 'OCTOBER'(033) centered,
207 sy-vline,208(13) 'NOVEMBER'(034) centered,
221 sy-vline,222(13) 'DECEMBER'(035) centered,
235 sy-vline,252 sy-vline.
format color off.
write /1(252) sy-uline.
endform. "top_of_page
*& Form Display_report
Write the Report Output
form display_report.
clear v_no.
describe table rep_tab lines v_no.
if v_no = 0.
message i999 with
'No Data found for the entered Selection'(015).
endif.
loop at rep_tab.
format color 3.
at new kostl.
read table rep_tab index sy-tabix.
write:/1 sy-vline, 2(12) 'Cost Center:'(009),
14(10) rep_tab-kostl,
25(30) rep_tab-ctext,
252 sy-vline.
format color off.
write /1(252) sy-uline.
endat.
format color col_normal.
write: /1 sy-vline, 2(8) rep_tab-pernr,
10 sy-vline, 11(30) rep_tab-ename,
41 sy-vline, 42(25) rep_tab-ptext,
67 sy-vline, 68(13) rep_tab-ot1 no-zero,
81 sy-vline, 82(13) rep_tab-ot2 no-zero,
95 sy-vline, 96(13) rep_tab-ot3 no-zero,
109 sy-vline,110(13) rep_tab-ot4 no-zero,
123 sy-vline,124(13) rep_tab-ot5 no-zero,
137 sy-vline,138(13) rep_tab-ot6 no-zero,
151 sy-vline,152(13) rep_tab-ot7 no-zero,
165 sy-vline,166(13) rep_tab-ot8 no-zero,
179 sy-vline,180(13) rep_tab-ot9 no-zero,
193 sy-vline,194(13) rep_tab-ot10 no-zero,
207 sy-vline,208(13) rep_tab-ot11 no-zero,
221 sy-vline,222(13) rep_tab-ot12 no-zero,
235 sy-vline,236(16) rep_tab-ott no-zero,
252 sy-vline.
at end of kostl.
write /1(252) sy-uline.
endat.
format color off.
at last.
sum.
format color 1.
write: /1 sy-vline,
10 sy-vline, 11(30) 'Total'(017) centered,
41 sy-vline,
67 sy-vline, 68(13) rep_tab-ot1 no-zero,
81 sy-vline, 82(13) rep_tab-ot2 no-zero,
95 sy-vline, 96(13) rep_tab-ot3 no-zero,
109 sy-vline,110(13) rep_tab-ot4 no-zero,
123 sy-vline,124(13) rep_tab-ot5 no-zero,
137 sy-vline,138(13) rep_tab-ot6 no-zero,
151 sy-vline,152(13) rep_tab-ot7 no-zero,
165 sy-vline,166(13) rep_tab-ot8 no-zero,
179 sy-vline,180(13) rep_tab-ot9 no-zero,
193 sy-vline,194(13) rep_tab-ot10 no-zero,
207 sy-vline,208(13) rep_tab-ot11 no-zero,
221 sy-vline,222(13) rep_tab-ot12 no-zero,
235 sy-vline,236(16) rep_tab-ott no-zero,
252 sy-vline.
write /1(252) sy-uline.
endat.
format color off.
endloop.
endform. "display_report -
Hi there,
I need to share with you a problem which is going me crazy regarding IMPORT/EXPORT from Database clusters.
I have to backup contents from cluster PCL2 index B2 to a cluster-copy ZPCL2, same index.
So, structure are exactly equals, and I tried this:
-> get records from PCL2 by select on table-keys
<- insert fetched records into ZPCL2
No problem for that, after the select an INSERT ZPCL2 FROM TABLE <rec> works perfectly.
Now, there is the issue:
I wrote a little program which reads contents from Backup Cluster ZPCL2, using the IMPORT statement.
At import time, it abends with CX_SY_COMPRESSION_FAILED -> run-time error IMPORT_DECOMPRESSION_ERROR.
OSS Note 457835 talks about a fixed lock at read/write time of a Cluster table, but this lock still lives until the end of the session. This is not my case, I'am running two different programs and so two different sessions.
So i tried out this, in the backup program:
-> select from pcl2 -> IMPORT of data -> EXPORT of data in ZPCL2.
And the reading program now works...
Seems that the system uses a compression algorithm that is different table by table and then data compressed for table PCL2 cannot be decompressed if copied in an another table...
Anyone knows something???The behaviour you describe makes sense to me - as we know that cluster tables are different. The SAP documentation says: Besides the actual data values, the data string contains information on the structure of the data and which table it comes from.
This may be why your straightforward SELECT/INSERT failed. The structural information was inconsistent with the new table. What would be interesting, would be to see the hex of the VARDATA field for apparently identical records in each table.
matt -
i want to read how many hours are worked under each wage type so that i can calculate pay accordingly. i was told this information will be available in zl cluster of pcl2 table. how do i read this table.
Hi
Welcome to SDN forum
You have to use IMPORT..EXPORT commands to fetch the Payroll data from clusters like PCL2
see the sample code which is used to fetch some payroll data from PCL2 cluster into RT table and based on wage types we take the amounts
report zporgr0100
line-size 252
line-count 60(1)
no standard page heading
message-id zx.
Database Tables & Infotypes
tables: pcl1, " HR Cluster1
pcl2, " HR Cluster1
pa0003, " Master data - Payroll Status
cskt, " Cost Center Texts
t528t, " Positions Texts
t513s, " Job Titles
pernr, " Logical PNP
t001p, " Personnel Subarea
t500p, " Personnel Area
t501, " Employee Group
t503k, " Employee Subgroup
csks. " Cost Center
infotypes:0000,0001.
*include rpclst00.
include rpc2rx00.
include rpc2rxx0.
include rpc2cd00.
*include rpc2ps00.
*include rpc2pt00.
*include rpcfvp00.
*include rpcfdc10.
*include rpcfdc00.
include rpppxd00.
include rpppxd10.
Declaration of Internal Tables
Internal Table for Output Data
data: begin of rep_tab occurs 0,
kostl like pa0001-kostl, " Cost Center
pernr like pa0001-pernr, " Personal Number
ename like pa0001-ename, " Employee Name
ctext like cskt-ltext, " Cost Center Text
ptext like t528t-plstx, " Position Text
ot1 type p decimals 2, " Jan OT Amount
ot2 type p decimals 2, " Feb OT Amount
ot3 type p decimals 2, " Mar OT Amount
ot4 type p decimals 2, " Apr OT Amount
ot5 type p decimals 2, " May OT Amount
ot6 type p decimals 2, " Jun OT Amount
ot7 type p decimals 2, " Jul OT Amount
ot8 type p decimals 2, " Aug OT Amount
ot9 type p decimals 2, " Sep OT Amount
ot10 type p decimals 2, " Oct OT Amount
ot11 type p decimals 2, " Nov OT Amount
ot12 type p decimals 2, " Dec OT Amount
ott type p decimals 2, " Total OT Amount
end of rep_tab.
Declaration of Variables
data: v_mon(2) type n, " Month
v_no type i, " Data Lines
v_year(4) type c, " Year
v_date like sy-datum, " Date
v_date1 like sy-datum, " Date
v_seqnr like pc261-seqnr. " Sequence No.
Declaration of Constants
data: c_type like hrp1001-otype value 'S', " Object Type
c_kokrs like cskt-kokrs value '1000', " Controlling Area
c_date1 like sy-datum value '18000101', " Date
c_date2 like sy-datum value '99991231', " Date
c_x type c value 'X', " Sign
c_mon(2) type c value '01', " Month
c_val1(2) type c value '31', " Date
c_val2(2) type c value '12', " Month Type
c_val like p0041-dar01 value '01', " Date Type
c_lgart1 like p0008-lga01 value '0722', " Wage Type
c_lgart2 like p0008-lga01 value '0723', " Wage Type
c_1(2) type n value '01', " Month1
c_2(2) type n value '02', " Month2
c_3(2) type n value '03', " Month3
c_4(2) type n value '04', " Month4
c_5(2) type n value '05', " Month5
c_6(2) type n value '06', " Month6
c_7(2) type n value '07', " Month7
c_8(2) type n value '08', " Month8
c_9(2) type n value '09', " Month9
c_10(2) type n value '10', " Month10
c_11(2) type n value '11', " Month11
c_12(2) type n value '12'. " Month12
Selection-screen
parameters:
p_year like pc2b0-pabrj obligatory. " Payroll Year
At selection-screen
at selection-screen.
Validate the Selection Screen fields
perform validate_screen.
Start-of-Selection
start-of-selection.
Selection of Period
perform get_period.
Get PERNR from LDB
get pernr.
Get the Master data from infotype 0001
perform get_master_data.
Top-of-page
top-of-page.
Write the Report and Column Headings
perform top_of_page.
End-of-Page
end-of-page.
write /1(252) sy-uline.
End-of-Selection
end-of-selection.
Display the Output Report.
perform display_report.
Form-Routines
*& Form validate_screen
Validation of selection Screen fields
form validate_screen.
Validation of Cost Center
clear csks.
if not pnpkostl[] is initial.
select single kostl
into csks-kostl
from csks
where kostl in pnpkostl.
if sy-subrc <> 0.
message e999 with 'Invalid Cost Center'(003).
endif.
endif.
Validation of Personnel Number
clear pa0003.
if not pnppernr[] is initial.
select pernr
from pa0003 up to 1 rows
into pa0003-pernr
where pernr in pnppernr.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Personal Number Entered'(002).
endif.
endif.
Validation of Personnel Area
clear t500p.
if not pnpwerks[] is initial.
select persa
from t500p up to 1 rows
into t500p-persa
where persa in pnpwerks.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Personnel Area Entered'(001).
endif.
endif.
Validation of Personnel Sub Area
clear t001p.
if not pnpbtrtl[] is initial.
select btrtl
from t001p up to 1 rows
into t001p-btrtl
where btrtl in pnpbtrtl.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Personnel Sub Area Entered'(037).
endif.
endif.
Validation of Employee Group
clear t501.
if not pnppersg[] is initial.
select persg
from t501 up to 1 rows
into t501-persg
where persg in pnppersg.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Employee Group Entered'(038).
endif.
endif.
Validation of Employee Sub Group
clear t503k.
if not pnppersk[] is initial.
select persk
from t503k up to 1 rows
into t503k-persk
where persk in pnppersk.
endselect.
if sy-subrc <> 0.
message e999 with 'Incorrect Employee Sub Group Entered'(039).
endif.
endif.
endform. "validate_screen
*& Form get_period
Get the Correct Period based on Selection screen selection
form get_period.
clear: v_year,v_mon, v_date, v_date1.
v_year = sy-datum+0(4).
v_mon = sy-datum+4(2).
if pnptimr1 = c_x. " Current Date
pnpbegda = sy-datum.
pnpendda = sy-datum.
elseif pnptimr2 = c_x. " Current Month
concatenate v_year v_mon c_val into v_date.
concatenate v_year v_mon c_val1 into v_date1.
pnpbegda = v_date.
pnpendda = v_date1.
elseif pnptimr3 = c_x. " Current Year
concatenate v_year c_val c_val into v_date.
concatenate v_year c_val2 c_val1 into v_date1.
pnpbegda = v_date.
pnpendda = v_date1.
elseif pnptimr4 = c_x. " Upto Today
pnpbegda = c_date1.
pnpendda = sy-datum.
elseif pnptimr5 = c_x. " From Today
pnpbegda = sy-datum.
pnpendda = c_date2.
else.
if ( pnpbegda is initial and pnpendda is initial ).
pnpbegda = c_date1.
pnpendda = c_date2.
elseif pnpbegda is initial and not pnpendda is initial.
pnpbegda = c_date1.
pnpendda = pnpendda.
elseif not ( pnpbegda is initial and pnpendda is initial ).
pnpbegda = pnpbegda.
pnpendda = pnpendda.
endif.
endif.
endform. "get_period
*& Form get_master_data
Get the Master Data from Database Tables PA0001,0002,0003
form get_master_data.
Get data from Respective Infotypes
rp_provide_from_last p0001 space pnpbegda pnpendda.
if p0001-kostl in pnpkostl.
rep_tab-kostl = p0001-kostl.
rep_tab-pernr = p0001-pernr.
rep_tab-ename = p0001-ename.
Get the Position Text
clear t528t-plstx.
select single plstx into t528t-plstx from t528t
where plans = p0001-plans and
otype = c_type and
sprsl = sy-langu.
if sy-subrc = 0.
rep_tab-ptext = t528t-plstx.
endif.
Get the Cost Center Text
clear cskt-ltext.
select single ltext into cskt-ltext from cskt
where spras = sy-langu and
kokrs = c_kokrs and
kostl = p0001-kostl.
if sy-subrc = 0.
rep_tab-ctext = cskt-ltext.
endif.
Get the Overtime Payment Data
perform get_ot_data.
rep_tab-ott = rep_tab-ot1 + rep_tab-ot2 + rep_tab-ot3 +
rep_tab-ot4 + rep_tab-ot5 + rep_tab-ot6 +
rep_tab-ot7 + rep_tab-ot8 + rep_tab-ot9 +
rep_tab-ot10 + rep_tab-ot11 + rep_tab-ot12.
append rep_tab.
clear rep_tab.
endif.
sort rep_tab by kostl pernr.
delete rep_tab where kostl = ' '.
delete rep_tab where ott = 0.
endform. "get_master_data
*& Form get_ot_data
Get the Overtime Payment Data
form get_ot_data.
cd-key = pernr-pernr.
rp-imp-c2-cd.
sort rgdir by seqnr.
To get sequence number for the payroll period
loop at rgdir where void is initial
and reversal is initial
and outofseq is initial
and srtza eq 'A'.
if rgdir-fpper+0(4) = p_year.
To consider offcycle run data
if not rgdir-ocrsn is initial.
v_seqnr = rgdir-seqnr.
exit.
endif.
v_seqnr = rgdir-seqnr.
endif.
if not v_seqnr is initial.
perform import_rx.
endif.
perform process_wagetypes.
endloop.
endform. "get_ot_data
include rpppxm00.
*& Form Import_rx
Import the RX data from Clusters
form import_rx.
rx-key-pernr = cd-key-pernr.
rx-key-seqno = v_seqnr.
rp-init-buffer.
rp-imp-c2-rx.
endform. " Import_rx
*& Form Process_wagetypes
Calculate the Overtime Amount based on Wage types
form process_wagetypes.
loop at rt.
if rt-lgart = c_lgart1 or rt-lgart = c_lgart2.
if rgdir-fpper+0(4) = p_year.
v_mon = rgdir-fpper+4(2).
case v_mon .
when c_1.
rep_tab-ot1 = rep_tab-ot1 + rt-betrg.
when c_2.
rep_tab-ot2 = rep_tab-ot2 + rt-betrg.
when c_3.
rep_tab-ot3 = rep_tab-ot3 + rt-betrg.
when c_4.
rep_tab-ot4 = rep_tab-ot4 + rt-betrg.
when c_5.
rep_tab-ot5 = rep_tab-ot5 + rt-betrg.
when c_6.
rep_tab-ot6 = rep_tab-ot6 + rt-betrg.
when c_7.
rep_tab-ot7 = rep_tab-ot7 + rt-betrg.
when c_8.
rep_tab-ot8 = rep_tab-ot8 + rt-betrg.
when c_9.
rep_tab-ot9 = rep_tab-ot9 + rt-betrg.
when c_10.
rep_tab-ot10 = rep_tab-ot10 + rt-betrg.
when c_11.
rep_tab-ot11 = rep_tab-ot11 + rt-betrg.
when c_12.
rep_tab-ot12 = rep_tab-ot12 + rt-betrg.
endcase.
endif.
endif.
endloop.
endform. "process_wagetypes
*& Form top_of_page
Write the Report and Column Headings
form top_of_page.
format color col_heading on.
write: /1(252) 'NATIONAL DRILLING COMPANY'(010) centered,
/1(252) 'Overtime Payments Details'(011) centered.
format color off.
if pnptimr1 = c_x. " Current Date
write: /2 'Period From :'(036), sy-datum, 'To:'(006), sy-datum.
elseif pnptimr2 = c_x. " Current Month
write: /2 'Period From :'(036), v_date, 'To:'(006), v_date1.
elseif pnptimr3 = c_x. " Current Year
write: /2 'Period From :'(036), v_date, 'To:'(006), v_date1.
elseif pnptimr4 = c_x. " Upto Today
write: /2 'Period From :'(036), c_date1, 'To:'(006), sy-datum.
elseif pnptimr5 = c_x. " From Today
write: /2 'Period From :'(036), sy-datum, 'To:'(006), c_date2.
else.
if ( pnpbegda is initial and pnpendda is initial ).
write: /2 'Period From :'(036), c_date1, 'To:'(006), c_date2.
elseif pnpbegda is initial and not pnpendda is initial.
write: /2 'Period From :'(036), c_date1, 'To:'(006), pnpendda.
elseif not ( pnpbegda is initial and pnpendda is initial ).
write: /2 'Period From :'(036), pnpbegda,
'To:'(006), pnpendda.
endif.
endif.
write: 219 'Report Run Date:'(018), sy-datum.
if not pnpkostl[] is initial.
if pnpkostl-high is initial.
write: /2 'Cost Center :'(004), pnpkostl-low,
219 'Time :'(020), sy-uzeit.
else.
write: /2 'Cost Center From:'(005), pnpkostl-low+7(3),
'To:'(006), pnpkostl-high,
219 'Time :'(020), sy-uzeit.
endif.
else.
write: /219 'Time :'(020), sy-uzeit.
endif.
if not pnppernr[] is initial.
if pnppernr-high is initial.
write: /2 'Personal Number :'(007), pnppernr-low,
219 'User :'(021), sy-uname.
else.
write: /2 'Personal No.From:'(008), pnppernr-low,
'To:'(006), pnppernr-high,
219 'User :'(021), sy-uname.
endif.
else.
write: /219 'User :'(021), sy-uname.
endif.
write: /219 'Page No :'(022), sy-pagno.
format color col_heading.
write /1(252) sy-uline.
write:/1 sy-vline, 10 sy-vline,
41 sy-vline,
67 sy-vline, 68(167) 'Overtime Payments(Dirhams)'(013) centered,
235 sy-vline,252 sy-vline.
format color col_heading.
write:/1 sy-vline, 2(8) 'Emp #'(019) centered,
10 sy-vline, 11(30) 'Employee Name'(012) centered,
41 sy-vline, 42(25) 'Position'(014) centered,
67 sy-vline, 68(167) sy-uline,
235 sy-vline,236(16) 'Total'(017) centered,
252 sy-vline.
write:/1 sy-vline, 10 sy-vline,
41 sy-vline,
67 sy-vline, 68(13) 'JANUARY'(024) centered,
81 sy-vline, 82(13) 'FEBRUARY'(025) centered,
95 sy-vline, 96(13) 'MARCH'(026) centered,
109 sy-vline,110(13) 'APRIL'(027) centered,
123 sy-vline,124(13) 'MAY'(028) centered,
137 sy-vline,138(13) 'JUNE'(029) centered,
151 sy-vline,152(13) 'JULY'(030) centered,
165 sy-vline,166(13) 'AUGUST'(031) centered,
179 sy-vline,180(13) 'SEPTEMBER'(032) centered,
193 sy-vline,194(13) 'OCTOBER'(033) centered,
207 sy-vline,208(13) 'NOVEMBER'(034) centered,
221 sy-vline,222(13) 'DECEMBER'(035) centered,
235 sy-vline,252 sy-vline.
format color off.
write /1(252) sy-uline.
endform. "top_of_page
*& Form Display_report
Write the Report Output
form display_report.
clear v_no.
describe table rep_tab lines v_no.
if v_no = 0.
message i999 with
'No Data found for the entered Selection'(015).
endif.
loop at rep_tab.
format color 3.
at new kostl.
read table rep_tab index sy-tabix.
write:/1 sy-vline, 2(12) 'Cost Center:'(009),
14(10) rep_tab-kostl,
25(30) rep_tab-ctext,
252 sy-vline.
format color off.
write /1(252) sy-uline.
endat.
format color col_normal.
write: /1 sy-vline, 2(8) rep_tab-pernr,
10 sy-vline, 11(30) rep_tab-ename,
41 sy-vline, 42(25) rep_tab-ptext,
67 sy-vline, 68(13) rep_tab-ot1 no-zero,
81 sy-vline, 82(13) rep_tab-ot2 no-zero,
95 sy-vline, 96(13) rep_tab-ot3 no-zero,
109 sy-vline,110(13) rep_tab-ot4 no-zero,
123 sy-vline,124(13) rep_tab-ot5 no-zero,
137 sy-vline,138(13) rep_tab-ot6 no-zero,
151 sy-vline,152(13) rep_tab-ot7 no-zero,
165 sy-vline,166(13) rep_tab-ot8 no-zero,
179 sy-vline,180(13) rep_tab-ot9 no-zero,
193 sy-vline,194(13) rep_tab-ot10 no-zero,
207 sy-vline,208(13) rep_tab-ot11 no-zero,
221 sy-vline,222(13) rep_tab-ot12 no-zero,
235 sy-vline,236(16) rep_tab-ott no-zero,
252 sy-vline.
at end of kostl.
write /1(252) sy-uline.
endat.
format color off.
at last.
sum.
format color 1.
write: /1 sy-vline,
10 sy-vline, 11(30) 'Total'(017) centered,
41 sy-vline,
67 sy-vline, 68(13) rep_tab-ot1 no-zero,
81 sy-vline, 82(13) rep_tab-ot2 no-zero,
95 sy-vline, 96(13) rep_tab-ot3 no-zero,
109 sy-vline,110(13) rep_tab-ot4 no-zero,
123 sy-vline,124(13) rep_tab-ot5 no-zero,
137 sy-vline,138(13) rep_tab-ot6 no-zero,
151 sy-vline,152(13) rep_tab-ot7 no-zero,
165 sy-vline,166(13) rep_tab-ot8 no-zero,
179 sy-vline,180(13) rep_tab-ot9 no-zero,
193 sy-vline,194(13) rep_tab-ot10 no-zero,
207 sy-vline,208(13) rep_tab-ot11 no-zero,
221 sy-vline,222(13) rep_tab-ot12 no-zero,
235 sy-vline,236(16) rep_tab-ott no-zero,
252 sy-vline.
write /1(252) sy-uline.
endat.
format color off.
endloop.
endform. "display_report
<b>Reward points for useful Answers</b>
Regards
Anji -
I can easily read PCL2 data by using "IMPORT blah blah.... FROM DATABASE PCL2(RU)".
Somehow, someway, SAP takes what is strored in PCL2-CLUSTD and converts it into meaningful variables via the "IMPORT ... FROM DATABASE" syntax.
[[I want to see the code SAP uses to do this]]
Actually, what I really want is to take normal data say, employee name and say payroll dollars for a given period and then convert it back into PCL2-CLUSTD without updating PCL2.
IDEAS?hi goldstein,
pls refer the below liks once.u may get clear idea about wat u want.
sap.ionelburlacu.ro/abap/sap2/SAP_Reports.html - 26k
www.experts-exchange.com/Database/Software/HR_HCM/SAP/Q_23189513.html - 112k -
www.sap-img.com/hr021.htm - 8k -
www.sapbrainsonline.com/REFERENCES/StandardReports/SAP_standard_reports_list.html - 39k
Best PDF file to learn HR Programming
http://www.melayu.plus.com/SAP%20HR%20Programming.pdf
HR deals with the INFOTYPES which are similar to Tables in General ABAP.
There are different ways of fetching data from these infotypes.
There are different areas in HR LIKE Personal Admn, Orgn Management, Benefits, Time amangement, Event Management, Payroll etc
Infotypes for these areas are different from one another area.
storing of records data in each type of area is different
LDBS like PNP are used in HR programing.
Instead of Select.. we use some ROUTINES and PROVIDE..ENDPROVIDE.. etc
and in the case of Pay roll we use Clusters and we Import and Export them for data fetching.
On the whole Normal ABAP is different from HR abap.
For Personal Admn the Infotypes start with PA0000 to PA1999
Time Related Infotypes start with PA2000 to PA2999.
Orgn related Infotypes start with HRP1000 to HRP1999.
All custom developed infotypes stsrat with PA9000 onwards.
In payroll processing we use Clusters like PCL1,2,3 and 4.
Instead of Select query we use PROVIDE and ENDPROVIDE..
You have to assign a Logical Database in the attributes PNP.
Go through the SAp doc for HR programming and start doing.
http://www.sapdevelopment.co.uk/hr/hrhome.htm
See:
http://help.sap.com/saphelp_46c/helpdata/en/4f/d5268a575e11d189270000e8322f96/content.htm
sites regarding hr-abap:
http://www.sapdevelopment.co.uk/hr/hrhome.htm
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPA/PAPA.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPD/PAPD.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PYINT/PYINT_BASICS.pdf
http://www.atomhr.com/training/Technical_Topics_in_HR.htm
http://www.planetsap.com/hr_abap_main_page.htm
You can see some Standard Program examples in this one ...
http://www.sapdevelopment.co.uk/programs/programshr.htm
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci1030179,00.html?Offer=SAlgwn12604#Certification
http://www.erpgenie.com/faq/hr.htm.
http://www.planetsap.com/hr_abap_main_page.htm
http://www.sapbrain.com/TUTORIALS/FUNCTIONAL/HR_tutorial.html
These are the FAQ's that might helps you as well.
http://www.sap-img.com/human/hr-faq.htm
http://www.sapgenie.com/faq/hr.htm
http://www.planetsap.com/hr_abap_main_page.htm
http://www.atomhr.com/library_full.htm
HR Long texts Upload
Look at the below link
HR
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPA/PAPA.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPD/PAPD.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PYINT/PYINT_BASICS.pdf
http://www.atomhr.com/training/Technical_Topics_in_HR.htm
http://www.planetsap.com/hr_abap_main_page.htm
you can see some Standard Program examples in this one..
http://www.sapdevelopment.co.uk/programs/programshr.htm
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci1030179,00.html?Offer=SAlgwn12604#Certification
These are the FAQ's that might helps you
http://www.sap-img.com/human/hr-faq.htm
http://www.sapgenie.com/faq/hr.htm
http://www.erpgenie.com/faq/hr.htm.
www.sap-img.com
http://www.planetsap.com/hr_abap_main_page.htm
http://www.sapbrain.com/TUTORIALS/FUNCTIONAL/HR_tutorial.html
http://www.sapfans.com/forums/viewtopic.php?p=498530&sid=d7ec5866e3fb26880da129de45ce79de
http://www.sapcookbook.com/preview_hr_questions.htm
http://www.atomhr.com/library_full.htm
http://www.sapdevelopment.co.uk/hr/hrhome.htm
http://www.planetsap.com/hr_abap_main_page.htm
http://expertanswercenter.techtarget.com/eac/knowledgebaseAnswer/0,295199,sid63_gci983590,00.html
http://www.allsaplinks.com/HRmaterial.html
http://www.allsaplinks.com/timemanagement.html
http://www.allsaplinks.com/payrollcompletefunctional.html
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/HRINF/HRINF.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PYXXFORM/PYINT_FORMBUILDER.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCBMTWFMPA/BCBMTWFMPA.pdfhttp://help.sap.com/printdocu/core/Print46c/en/data/pdf/MYSAP/SR_HR.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PAPA/PAPA.pdf
http://www.planetsap.com/hr_abap_main_page.htm
Regards,
karthik
<REMOVED BY MODERATOR>
Few notes are below:
InfoSets in the HR Application
You can use SAP Query in HR to report on HR data. Queries are maintained as described in Creating Queries. The special features of queries created for HR are described in Maintaining Queries in the Human Resources Application. The maintenance procedure for HR InfoSets differs from the described procedure inasmuch as HR data fields are grouped together in infotypes.
InfoSet management in SAP Query is also used for InfoSet Query. For further information, see Functions for Managing InfoSets.
If you want to create InfoSets for HR, you can use logical databases PNP, PNPCE, PAP, and PCH (see HR Logical Databases). The database you must use to create your InfoSet depends on the component in which the data you want to report on is stored.
The reports you can execute using InfoSets based on logical databases PNP (or PNPCE) or PCH are similar, but differ in that they can select different objects. The following table describes the connection between the logical database, and the infotypes you can include in an InfoSet. It also provides you with one or two examples of reports that you can execute using the appropriate InfoSets.
Logical database PNP/PNPCE* PCH PAP
Selection of Persons Objects from Personnel Planning Applicants
Infotypes that can be included in the InfoSet Infotypes for· Personnel Administration (0000-0999) · Time Management (2000-2999) · Payroll infotypes · Infotypes for Personnel Planning objects that can be related to persons If the object type is specified:· Infotypes for the object type · Infotypes for objects that can be related to the specified object typeIf the object type is not specified:· All infotypes · Infotypes for Recruitment (4000-4999)· Some infotypes for Personnel Administration (such as 0001 and 0002)
· Customer infotypes
Reporting examples · Selection of all persons who participated in a specific business event, output of prices for reserved business events · Selection of all persons assigned to a specific personnel area, output of qualifications held by these persons · Selection of all business events held in London in March, output of all persons who participated in these business events · Selection of all positions assigned to a specific organizational unit, output of all persons assigned to the positions · Selection of all applicants hired last year to work on special projects, output of addresses for the applicants selected
Logical database PNPCE (PNP Concurrent Employment) functions just like logical database PNP. The procedure for creating InfoSets is also the same. It only becomes significant if you work with Concurrent Employment.
Creating InfoSets
The maintenance procedure for HR InfoSets differs from the procedure described so far in this section inasmuch as HR data fields are grouped together in infotypes. To set up an InfoSet for the HR application, proceed as follows:
1. On the initial screen for maintaining InfoSets, enter a name for the InfoSet and choose Create.
2. On the next screen, enter a name for the InfoSet and select one of the HR logical databases in accordance with your reporting requirements.
Customer infotypes can be created on all HR logical databases. In each individual case, therefore, you must decide which database to select so that you can report on customer infotypes.
This screen enables you to enter an authorization group. All of the queries that are subsequently created using this InfoSet can only be executed by persons who have this authorization group.
3. Choose .
This takes you to the Infotype Selection for InfoSet .
Fill data object
Export record
EXPORT TABLE1 TO DATABASE PCLn (xy) ID xy-KEY.
IF SY-SUBRC EQ 0.
WRITE: / 'Update successful'.
ENDIF.
Export Cluster data using the macro
. Export data using macro RP-EXP-Cn-xy.
When data records are exported using macro, they are not written to the database but to a main memory buffer.
To save data, use the PREPARE_UPDATE routine with the USING parameter 'V'.
REPORT ZHREXPRT.
*Buffer definition
INCLUDE RPPPXD00. INCLUDE RPPPXM00. "Buffer management
DATA: BEGIN OF COMMON PART 'BUFFER'.
INCLUDE RPPPXD10.
DATA: END OF COMMON PART 'BUFFER'.
RP-EXP-Cn-xy.
IF SY-SUBRC EQ 0.
PERFORM PREPARE_UPDATE USING V.
ENDIF.
Importing Cluster Data using standard include
The IMPORT command causes data objects with the specified key values to be read from PCLn.
If the import is successful, SY-SUBRC is 0; if not, it is 4.
REPORT RPIMPORT.
TABLES: PCLn.
INCLUDE RPCnxxy0. "Cluster definition
Fill cluster Key
Import record
IMPORT TABLE1 FROM DATABASE PCLn (xy) ID xy-KEY.
IF SY-SUBRC EQ 0.
Display data object
ENDIF.
Importing Cluster data using Macro
Import data using macro RP-IMP-Cn-xy.
Check return code SY-SUBRC. If 0, it is successful. If 4, error.
Need include buffer management routines RPPPXM00
Example
REPORT RPIMPORT.
*Buffer definition
INCLUDE RPPPXD00.
DATA: BEGIN OF COMMON PART 'BUFFER'.
INCLUDE RPPPXD10.
DATA: END OF COMMON PART 'BUFFER'.
*Import data to buffer
RP-IMP-Cn-xy.
*Buffer management routines
INCLUDE RPPPXM00.
Cluster Authorization
Simple EXPORT/IMPORT statement does not check for cluster authorization.
Use EXPORT/IMPORT via buffer, the buffer management routines check for cluster
authorization.
How to read the Payroll Results
Payroll results are stored in cluster Rn of PCL2 as field string and internal tables.
n - Country identifier.
Standard reports read the results from cluster Rn. Report RPCLSTRn lists all payroll results;
Report RPCEDTn0 lists the results on a payroll form.
The cluster definition of payroll results is stored in two INLCUDE reports:
include: rpc2rx09. "Definition Cluster Ru (I)
include: rpc2ruu0.Definition Cluster Ru (II)
o This first INCLUDE defines the country-independent part; the second
INCLUDE defines the country-specific part (US).
o The cluster key is stored in the field string RX-KEY.
All the field string and internal tables stored in PCL2 are defined in the ABAP/4 dictionary. This allows you to use the same structures in different definitions and nonetheless maintain data consistency.
The structures for cluster definition comply with the name convention PCnnn
Unfortunately 'nnn' can be any set of alphanumeric characters.
*Key definition
DATA: BEGIN OF RX-KEY.
INCLUDE STRUCTURE PC200.
DATA: END OF RX-KEY.
*Payroll directory
DATA: BEGIN OF RGDIR OCCURS 100.
INCLUDE STRUCTURE PC261.
DATA: END OF RGDIR.
How to retrieve Payroll results
o To read payroll results, you need two keys: pernr and seqno
o You can get SEQNO by importing the cluster directory (CD) first.
Example
REPORT ZHRIMPRT.
TABLES: PERNR, PCL1, PCL2.
INLCUDE: rpc2cd09. "Definition cluster CD
PARAMETERS: PERSON LIKE PERNR-PERNR.
RP-INIT-BUFFER.
*Import cluster Directory
CD-KEY-PERNR = PERNR-PERNR.
RP-IMP-C2-CU.
CHECK SY-SUBRC = 0.
LOOP AT RGDIR.
RX-KEY-PERNR = PERSON.
UNPACK RGDIR-SEQNR TO RX-KEY-SEQNO.
*Import data from PCL2
RP-IMP-C2-RU.
ENDLOOP.
o Reading records from the Payroll directory
after importing the payroll directory, which record to read is up to the programmer
o Each payroll result has a status.
'P' - previous result
'A' - current (actual) result
'O' - old result
o Function module CD_EVALUATION_PERIODS will restore the payroll result status for a period when that payroll is initially run. It also will select all the relevant periods to be evaluated.
Example
Call function 'CD_EVALUATION_PERIODS'
exporting
bonus_date = ref_periods-bondt
inper_modif = pn-permo
inper = ref_periods-inper
pay_type = ref_periods-payty
pay_ident = ref_periods-payid
tables
rgdir = rgdir
evpdir = evp
iabkrs = pnpabkrs
exceptions
no_record_found = 1.
Authorization Check
Authorization for Persons
In the authorization check for persons, the system determines whether the user has the authorizations required for the organizational features of the employees selected with GET PERNR.
Recruits for which the user has no authorization are skipped and appear in a list at the end of the report.
Authorization object: 'HR: Master data'
Authorization for Data
In the authorization check for data, the system determines whether the user is authorized to read the infotypes specified in the report.
If the authorization for a particular infotype is missing, the evaluation is terminated and an error message is displayed.
Deactivating the Authorization Check
In certain reports, it may be useful to deactivate the authorization check in order to improve performance. (E.g. when running payroll)
You can store this information in the object 'HR: Reporting'.
2.1.6 Concepts of Macros (Import/Export etc.)
Macros:
Introduction
Programs that process the cluster data (for example, RX) do not access the cluster independently. The data is accessed using a defined interface created with macros.
Macro contains some part of source code, which it will be useful for number of applications. Macro is module, which is stored
Naming Conventions of Macro:
RP-aaa-bb-cc
aaa is the type of Macro. It takes two values
o IMP Import Macro
o EXP Export Macro
bb is the Database table where the data is saved:
o C1 Database object PCL1
o C2 Database object PCL2
o C3 Database object PCL3
o C4 Database object PCL4
Cc is the cluster, it may take
o RX Cluster object RX
o RD Cluster object RD
o B2 Cluster object B2 and so on.
Defining and Calling the Macros
Defining:
There are two options for defining the Macros
Macros are defined using the ABAP Commands DEFINE . END-OF-DEFINITION. A macro can be used within a report or within include. If a macro is used in a report, and the macro is defined in include with the DEFINE command, include must be integrated.
Macros can also be defined as RMAC macros. The source code of these modules is stored in the function section of the control table TRMAC. The coding is grouped under a specific name in the table key.
According to conventions, the first two letters of the name must stand for the application. The rest of the name is freely definable.
Difference between the two methods is:
If a macro is changed, each report using this macro is automatically regenerated when it is executed.
When you change a RMAC macro in the table TRMAC, the reports that use this macro are not regenerated automatically. You must regenerate them manually.
Standard HR Macros
o The macro RP-PROVIDE-FROM-FRST retrieves the first (start) data record, which is valid in the data selection period.
o The macro RP-PROVIDE-FROM-LAST retrieves the last (latest) data record, which is valid in the data selection period.
o The macro RP-READ-INFOTYPE retrieves the data record(s), which is valid in the data selection period.
How to check whether the macro operation is successful or not
For every macro, whether the operation was successful or not will be checked with
PNP-SW-FOUND.
If PNP-SW-FOUND = 1, then the operation is successful.
Where exactly the Macrocode is stored
The program code pertaining to this macro is stored in the control table RMAC
Guidelines for how and when to use the Standard Macros
o RP_PROVIDE_FROM_FRST
Use macro RP_PROVIDE_FROM_FRST in programs for the logical databases PNP and PAP where the first data record for a period (can be a subtype) is read from an infotype table. The infotype table has been filled earlier (for example, with GET PERNR or RP_READ_INFOTYPE). This macro is only helpful if the infotype has time constraint 1 or 2.
Prerequisites
The validity begin date of the time period must be before or the same as the validity end date.
Validity start and end dates are correct (preferably of the type DATE).
The infotype table is sorted in ascending order. Otherwise, you would receive the first fitting table entry that might not necessarily correspond to the first time entry.
Features
The first entry for a specified period is placed in the table header entry from an internal infotype table.
Parameters
RP_PROVIDE_FROM_FRST inftytab subty beg end
IN: 1) Name of the internal table
2) Subtype required or SPACE if no subtype is being specified
3) Validity start date of the time interval
4) Validity end date of the time interval
OUT: 1) PNP-SW-FOUND: has the value 0 if there is no matching entry in the infotype table in the given time period. Otherwise it has the value 1.
2) The matching table header entry if PNP-SW-FOUND = 1 or
the initial table header entry if PNP-SW-FOUND = 0
Example
(RP_PROVIDE_FROM_FRST inftytab subty beg end)
RP_PROVIDE_FROM_FIRST P0021 '1' PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '1'.
ENDIF.
or
RP_PROVIDE_FROM_FRST P0001 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '0'.
WRITE: / 'Error: Org. assignment is missing' REJECT.
ENDIF.
o RP_PROVIDE_FROM_LAST
You use macro RP_PROVIDE_FROM_LAST in programs for the logical databases PNP and PAP where the last data record for a period (can be a subtype) is read from an infotype table. The infotype table has been filled earlier (for example, with GET PERNR or RP_READ_INFOTYPE). This macro is only helpful if the infotype (or subtype) has time constraint 1 or 2.
Prerequisites
The validity begin date of the time period must be before or the same as the validity end date.
Validity start and end dates are correct (preferably of the type DATE).
The infotype table is sorted in ascending order. Otherwise, you would receive the last fitting table entry that might not necessarily correspond to the last time entry.
Features
The macro RP_PROVIDE_FROM_LAST makes sure that the last entry for a specified period is placed in the table header entry of the report output list.
Parameters
RP_PROVIDE_FROM_LAST inftytab subty beg end
IN: 1) Name of the internal table
2) Subtype required or SPACE if no subtype is being specified
3) Validity begin date of the time interval
4) Validity end date of the time interval
OUT: 1) PNP-SW-FOUND: has the value 0 if there is no matching entry in the infotype table in the given time period. Otherwise it has the value 1.
2) The matching table header entry if PNP-SW-FOUND = 1 or
the cleared table header entry if PNP-SW-FOUND = 0
Example:
RP_PROVIDE_FROM_LAST P0021 '1' PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '1'.
ENDIF.
OR
RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '0'.
WRITE: / 'Error: Org. assignment is missing'. REJECT.
ENDIF.
RP_READ_INFOTYPE
You can use the macro in all programs at any point. You can also use it in function modules. In database PNP, an infotype is usually read with GET PERNR. Using macro RP_READ_INFOTYPE is an exception.
You can also use the function module HR_READ_INFOTYPE. For information on how to use the function module, see the documentation on Function Modules.
Prerequisites
The validity begin date of the time period must be before or the same as the validity end date.
Validity begin and end are correct date specifications (preferably of the type DATE).
The infotype table must match the infotype number.
The program using the macro must contain the include DBPNPMAC.
Features
The macro RP_READ_INFOTYPE makes sure that all data records for a person for the specified period are placed in an internal infotype table.
Parameters
RP_READ_INFOTYPE pernr infty inftytab beg end
IN: 1) Personnel number of the person requested
2) Infotype number of the required infotype
3) Name of the internal infotype table
4) Validity start date of the time interval
5) Validity end date of the time interval
OUT: 1) PNP-SW-FOUND = 0, if there is no matching record in the dataset
PNP-SW-FOUND = 1, if there is no matching record in the dataset
2) PNP-SW-AUTH-SKIPPED-RECORD = 0, if the HR authorization check has not retained any records due to incorrect authorizations.
PNP-SW-AUTH-SKIPPED-RECORD = 1 , if the HR authorization check has retained at least one record due to lack of authorization
3) Internal infotype table, containing all matching records for which the user is authorized (this table can also be empty).
Example
(RP_READ_INFOTYPE pernr infty inftytab beg end)
INFOTYPES: 0001.
RP-LOWDATE-HIGHDATE.
DATA: PERNR LIKE P0001-PERNR.
DATA: BEGDA LIKE P0001-BEGDA, ENDDA LIKE P0001-ENDDA.
PERNR = '12345678'.
BEGDA = LOW-DATE + 15
ENDDA = HIGH-DATE - 5.
RP-READ-INFOTYPE PERNR 0001 P0001 BEGDA ENDDA.
IF PNP-SW-AUT-SKIPPED-RECORD EQ '1'.
WRITE: / 'Insufficient authorization'. STOP.
ENDIF.
IF PNP-SW-FOUND EQ '0'.
WRITE: / 'Infotype 0001 missing'. STOP.
ENDIF.
2.1.7 Retrieval of data using LDBs (PNP/PAP/APP/PCH) without LDBs.
Logical database
A logical database is a special ABAP/4 program which combines the contents of certain database tables. Using logical databases facilitates the process of reading database tables.
HR Logical Database is PNP
Main Functions of the logical database PNP:
Standard Selection screen
Data Retrieval
Authorization check
To use logical database PNP in your program, specify in your program attributes.
Standard Selection Screen
Date selection
Date selection delimits the time period for which data is evaluated. GET PERNR retrieves all records of the relevant infotypes from the database. When you enter a date selection period, the PROVIDE loop retrieves the infotype records whose validity period overlaps with at least one day of this period.
Person selection
Person selection is the 'true' selection of choosing a group of employees for whom the report is to run.
Sorting Data
The standard sort sequence lists personnel numbers in ascending order.
SORT function allows you to sort the report data otherwise. All the sorting fields are from infotype 0001.
Report Class
You can suppress input fields, which are not used on the selection screen by assigning a report class to your program.
If SAP standard delivered report classes do not satisfy your requirements, you can create your own report class through the IMG.
Data Retrieval from LDB
1. Create data structures for infotypes.
INFOTYPES: 0001, "ORG ASSIGNMENT
0002, "PERSONAL DATA
0008. "BASIC PAY
2. Fill data structures with the infotype records.
Start-of-selection.
GET PERNR.
End-0f-selection.
Read Master Data
Infotype structures (after GET PERNR) are internal tables loaded with data.
The infotype records (selected within the period) are processed sequentially by the PROVIDE - ENDPROVIDE loop.
GET PERNR.
PROVIDE * FROM Pnnnn BETWEEN PN/BEGDA AND PN/ENDDA
If Pnnnn-XXXX = ' '. write:/ Pnnnn-XXXX. Endif.
ENDPROVIDE.
Period-Related Data
All infotype records are time stamped.
IT0006 (Address infotype)
01/01/1990 12/31/9999 present
Which record to be read depends on the date selection period specified on the
selection screen. PN/BEGDA PN/ENDDA.
Current Data
IT0006 Address - 01/01/1990 12/31/9999 present
RP-PROVIDE-FROM-LAST retrieves the record, which is valid in the data selection period.
For example, pn/begda = '19990931' pn/endda = '99991231'
IT0006 subtype 1 is resident address
RP-PROVIDE-FROM-LAST P0006 1 PN/BEGDA PN/ENDDA.
2.2 Personnel Administration (PA)
PA involves administrating employee data, commonly referred to Master Data. Master Data contains all employee data used in HR processing. Master Data includes Personal (E.g. address), Organizational (Position description), Benefits (Insurance, Pension), Time & Payroll.
Master Data is stored in Infotypes. Infotypes are tables (for user Data entry screen) that contain logically related employee data. Data can be stored for specific periods, which includes current and historical.
Components of PA:
Personnel Area: represents a division of a company code into subunits. It is an organizational entity representing an area within an organization defined by specific aspects of personnel administration, time management and payroll. Personnel areas are subdivided into personnel subareas. Personnel area is specific to HR and is a four character alphanumeric identification. E.g. Personnel area 100 is for employees in Karnataka, 200 is for Chennai.
Personnel Subarea: is a further subdivision of Personnel area. It may represent geographical locations. Functions include:
1. Set groupings for Time Management, so that work schedules, substitution and absence and leave types can be setup for individual personnel subareas.
2. Generate default pay scale type and area for an employee's basic pay.
3. Define public holiday calendar.
Employee Groups: divides or groups employees into various categories. E.g. Active employees, Retired employees, Contractors Employee groups are used to generate default values for payroll accounting area and basic pay.
Employee Subgroups: are further differentiated within the employee group. E.g. Salaried employees, Hourly employees, unionized employees, Executives The employee subgroup grouping for the payroll rule allows you to define different payroll procedures for different employee subgroups. For e.g. you can specify whether an employee's pay should be determined on hourly or monthly basis. The employee subgroup grouping for the work schedule defines the validity of work schedule, and the attendance or absence quota type determines the validity of time quotas.
Here a Data Model
2.2.1 Importance of Dates and periods in payroll
Here is a simple ABAP example of reading DATE types stored in infotype 0041.
There can be a maximum of 12 dates stored in this infotype. Here is an example of an infotype 0041 record:
The date types are stored in PA0041-DAR01, PA0041-DAR02, etc.
In the example above, PA0041-DAR01 is 01, PA0041-DAR02 is 09.
The dates themselves are stored in PA0041-DAT01, PA0041-DAT02, etc
To read through this in ABAP, the easiest way is to use the DO VARYING statement. Here is a simple demonstration ABAP:
Note: to print the text of the date type, e.g. Leave year entry select from table T548T.
REPORT ZDATES1.
TABLES: PERNR.
DATA: BEGIN OF MYDATES,
DAR LIKE P0041-DAR01,
DAT LIKE P0041-DAT01,
END OF MYDATES.
INFOTYPES 0041.
GET PERNR.
WRITE: PERNR-PERNR, PERNR-ENAME. "Show employee number and name
RP-PROVIDE-FROM-LAST P0041 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND = 1.
DO 12 TIMES VARYING MYDATES
FROM P0041-DAR01
NEXT P0041-DAR02.
If mydates-dar ne space.
WRITE: /, MYDATES-DAR, MYDATES-DAT.
Endif.
ENDDO.
ENDIF.
2.2.2 Overview of date fields and period-Ex. for period/in-period/ payroll
FOR-PERIOD: Payroll period (start and end date of a period) for which a payroll result is created or generated.
IN-PERIOD: The payroll period (start and end date of a period) in which a payroll result is created or generated.
Example: For every employee payroll should be run, it may be bi-weekly, monthly, or quarterly. Say it is monthly, then for an employee a payroll should be run for this month and it is run next month then. For-period start date is 01/9/2003 and end date is 30 and in-period end date will be the date it is run 15/10/2003.
In-Period View
An in-period view is a selection of payroll results from the payroll directory (for example, RPCLSTRD Payroll Result for Germany,) for a number of in-periods. The payroll results that were generated for the required number of payroll periods in the selected period are selected.
Payroll Result
For-Period View
A for-period view is a selection of payroll results from the payroll directory (for example, RPCLSTRC Payroll Result for Switzerland) for a number of for-periods. The payroll results that were generated in the required number of payroll periods for the selected period are selected.
Example: For-Period View / In-Period View
Payroll
result For-period
view Start date
for-per. view End date
for-per. view In-period
view End date
in-per. view
1 01/1997 01.01.1997. 31.01.1997 02/1997 28.02.1997
2 02/1997 01.02.1997 28.02.1997 02/1997 28.02.1997
Explanation
The payroll result 1 for the payroll period (for-period) 01/1997 has the start date 01.01.1997 and the end date 31.01.1997. This payroll result was generated in the payroll period (in-period) 02/1997.
2.2.3 Repetitive Structures processing
In many master data infotypes the data is stored in the form of repetitive structures. For example infotype 0008, the structure wage type line is available for 20 times, that is an employee is eligible for having 20 different wage types based on his benefits. When evaluating repeat structures, you must ensure that all fields are entered. In the case of the Basic Pay infotype, 20 * 5 = 100 fields are queried.
To use this method of evaluation, define a field string whose structure corresponds to the fields in one line of the repetitive structure.
Example for understanding the repetitive Structure
Say, for an employee you want to know that for what all wage types an employee is eligible for the latest period you mentioned on the selection screen.
Using LDB (PNP)
Program:
Report zhk_repstru.
Tables Pernr.
Infotypes 0008.
You have to declare a structure same as repetitive structure in the 0008 infotype
Data: begin of s_wagetypes,
Wagetype type p0008-lga01,
Amount type p0008-bet01,
Hours type p0008-anz01,
Unit type p0008-ein01,
Ind type p0008-opk01,
End of s_wagetypes,
Selecting data from the Data base Get pernr
Getting the latest record based on the selection period.
RP_PROVIDE_FROM_LAST P0008 SPACE PN-BEGDA PN-ENDDA.
Now knowing for what all wage types the employee is eligible.
Do 20 times varying s_wagetypes from p0008-lga01 next p0008-lga02. If s_wagetypes-wagetype is initial.
o Here the data is stored sequentially, i.e., if the employee is eligible for 5 wage types then all the 5 wage types are stored sequentially in lga01 to lga05 respectively. So, if say the lga05 is initial then it is understood that, employee is eligible for only 4 wage types and from lga05 to lga20 structures will be empty so, we need not process further
Exit.
Else.
Write: / s_wagetypes-wagetype,
S_wagetypes-amount.
Endif.
Enddo.
2.2.4 Guidelines to retrieve Payroll data (Mainly US/UK/Ireland)
Before directly going into the Guidelines to retrieve Payroll Data let us look in to the basic concepts of the Payroll.
Introduction to Payroll
To calculate the remuneration for work done for each employee
Payroll does not just involve the calculation of remuneration, but consists of a variety of processes that are becoming increasingly important due to the employers increased obligation to supply benefits and medical welfare. These benefits are products of:
Labor law
Tax law
Contribution law
Benefits law
Civil law
Reporting law
Information law
Statistics law
Payroll in the SAP System: In the SAP Human Resources Management System, payroll accounting is executed using the Payroll driver.
Process Flow:
When you access Payroll, the payroll driver calls the accompanying payroll schema, which consists of a sequence of functions. For each activity, the individual functions import data from internal tables and payroll relevant files.
Payroll Integration:
Payroll can be integrated in Personnel Administration, Time Management, Incentive Wages and Accounting:
Standardized data retention enables you to use master data and other payroll relevant data from Personnel Administration.
Time data, entered via Time Management, is automatically included in the Payroll and is valuated during the payroll run. Data from the Incentive Wages component is used to calculate piecework wages and premium wages directly in Payroll.
Information on expenses and payables from Payroll is posted for accounting directly in Financial Accounting, and you assign the costs to the appropriate cost center. You can also control the financial system of third-party providers.
Payroll Driver
Payroll driver is a special report for Payroll.
SAP has developed country-specific payroll drivers, which are based on report RPCALCx0.
The country-specific net calculation of pay must be developed explicitly for every country.
Separate country programs, which meet the tax and insurance requirements of the respective country, can be created from the basic report RPCALCx0. Since the payroll driver has a modular structure, you can use the Customizing functions to quickly modify the payroll procedure to meet the particular requirements of your enterprise.
Integration
Calculation rules and other reports are stored in an accompanying schema, which also contains the activities carried out by the payroll driver during payroll. All data is stored in internal tables and saved in files with a cluster structure.
When you access Payroll, the payroll driver calls the accompanying payroll schema, which consists of a sequence of functions. For each activity, the individual functions import data from internal tables and payroll relevant files.
Payroll Schema:
It contains calculation rules to be used by the payroll driver during payroll.
SAP has developed country-specific schemas, which are based on schema X000.
With country-specific reports, the first character in the name refers to the country indicator.
For example,
D for Germany
F for France
U for USA
Schema Structure A schema consists of the following parts:
1. Initialization
Where system performs the following steps:
Updates the databases
Imports required infotypes
2. Gross calculation of pay
Where system performs the following steps:
Processes basic data and time data
Reads payroll account of the last period accounted
Processes time data and calculate the individual gross values
Performs factoring
3. Net calculation of pay
where system performs the following steps:
Calculates net remuneration
Performs bank transfers
Example:
The classic example is the payroll for salaried employees at the end of the month in contrast to the wage accounting of hourly workers in the middle of the following month.
Enter the organizational assignment of employees to a payroll accounting area (ABKRS) in Infotype 0001. Payroll accounting area also determines the two functions necessary for payroll accounting:
The summarization of personnel numbers to be accounted and
The determination of the exact payroll period.
Select Personnel Numbers:
Personnel numbers are selected for payroll accounting by specifying a payroll area in the payroll driver. Infotype 0001 Organizational Assignment enables you to assign an employee to the appropriate payroll area.
These Pernrs are locked during Payroll Run.
Determine Payroll Period:
On the Selection screen, you can give Payroll Period Parameter as per the requirement else you can give Payroll Area, by which system calculates the payroll period.
Finding Payroll Results for a Specific Query:
Payroll results are stored in cluster Rx of the PCL2. The cluster key is not mnemonic; it contains only the PERNR (personnel number) and SEQNO (sequential number) fields.
The internal table RGDIR (PC261 - Cluster Directory for Export and Import of Payroll Results) contains a directory entry for each payroll result.
This entry is a sequential number (RGDIR-SEQNR), which uniquely identifies the payroll result.
Payroll results can only be imported if the payroll cluster key (PC200) contains the personnel number and sequential number.
Function Modules for Selecting Payroll Results
You will probably always have the same queries when importing payroll records. For example, "Which payroll results (original and retroactively accounted records) were written for a specific payroll run (defined by IN payroll category, IN payroll area, IN period)"? To save programmers from having to write their own reports for this functionality, standard modules are available for the most important queries. The employee's payroll directory is always transferred to the function modules using the table RGDIR (PC261). The modules then transfer the payroll records, which satisfy the specified selection criteria using a table whose type corresponds to that of the RGDIR (PC261) but which has a different name.
Exporting Pernr Personal Number
Importing Molga Country
Tables Rgdir Payroll Results Directory
This Function Module populates payroll results of all employees with PERNR & SEQNR as key.
Macro Modules:
We have populated Results Directory & retrieved Sequential Number, we need to call an import macro module for retrieving the required payroll results. For this we need to pass the unique identification of an Employee payroll Result i.e. rx-key-pernr = v_pernr.
rx-key-seqno = v_seqnr.
To that import macro.
Calling Import Module: RP-imp-c2-RU.
This Macro populates all the cluster tables required for Payroll, by importing from PCL2 Cluster Directory. After that we can loop through these cluster tables for required fields.
Guideline to write a program, which retrieves the data for, specified country
Use Logical Database As per the Requirement.
Include Payroll Driver with reference to Country- Specific modules which inturn includes Country-specific Schemas etc.
Get the PERNRs for which you want to obtain payroll results.
Populate Results Directory RGDIR with PERNR & Molga (Country) calling FM CU_READ_RGDIR.
Get the Unique Sequential Number with PERNR, From Date & Last Date calling CD_READ_LAST.
Pass these KEY Field (PERNR, SEQNR) to IMPORT MACRO
RP-IMP-C2- RU to import all the relevant field entries from PCL2
DIRECTORY to all the cluster tables
Get the required fields by looping through cluster tables.
Integration
All data is stored in internal tables and saved in files with a cluster structure.
Internal Tables: Internal tables store data during payroll.
The system imports data to these tables and used them to calculate new data. This data is then also saved in internal tables.
At the start of the payroll run, the system reads the values from the results tables to the old results table (ORT). Data from the previous period is, therefore, available in the current payroll period.
The most important internal tables are:
Input table (IT)
Table IT contains data that can be edited. The table exists only during processing.
Output table (OT)
Table OT contains the results of an activity. These results are written to the input table for further processing. The table exists only during processing.
Results table (RT)
Table RT contains the results of the period for which payroll has been run. The system saves this data in the PCL2 file in cluster RX.
Interaction of IT, OT and RT:
The necessary data for the respective processing step is loaded into the input table and is thus available for various processing procedures. The results of a processing step are stored either in the output table or the results table. At the end of a processing step, the data from the OT is loaded back into the IT, where it is available for further processing steps. The IT and OT are only temporarily filled, whereas the RT is stored on the database. In one of the first processing steps, the RT of the last payroll accounting period is imported into the old results table (ORT) and can consequently be used for further processing.
Payroll Relevant Files:
Payroll files contain data for payroll and payroll results.
Structure
The system requires the following files for payroll:
Pnnnn (nnnn = number of the infotype)
The Pnnnn files contain data that has been entered in the respective infotypes for an employee.
Example
P0000 - Actions Infotype
P0008 - Basic Pay Infotype
PCL1
The PCL1 file contains primary information, in other words, data from the master data and time recording systems.
PCL2
The PCL2 file contains secondary information, in other words, derived data and all generated schemas
Integration
When you start payroll, the system imports the relevant master data from the Pnnnn files (for example, basic pay and tax class) and imports the time data from the PCL1 file to the IT table.
The system imports the payroll results from the previous month from table ORT (for example, to form averages).
The system processes this data and saves the payroll results and generated schemas in the PCL2 file.
Payroll Control
Edited by: Alvaro Tejada Galindo on Apr 8, 2008 5:09 PM -
Hi Gurus,
I have to an internal table with me to export to PCL2 cluster in EPF(employee provident fund) table.
I am using the following statements:
rx-key-pernr = pernr-pernr.
EXPORT epf TO DATABASE PCL2(RX) ID RX-KEY.
IF SY-SUBRC EQ 0.
WRITE: / 'Update successful'.
ENDIF.
My query is that I am not passing anywhere that data has to go in EPF table and how will the data go and sit there.
Awaiting ur reply.
Regards,
NehaHi,
Thanks for the prompt reply.
The issue is that due to some configurational issue, even the EPF data has gone and sat in RT table. So now i have to write a report where in i have to get Provident Fund (EPF) specific wagetypes data from RT and push it in EPF table.
I have done the extraction and kept in the internal table EPF in my report and now the issue is how to export it to EPF table in PCL2.
I was wondering if I am going in the direction because I am not getting the right result.
Please help.
Thanks,
Neha -
Is there any transaction I can run to obtain a list of available HR standard reports within the system?
Thanks in advance!Hi Some standard reports
Program Description
H99CWTR0 Wage Type Reporter. Returns pay for particular wage types. To submit from new report you will need to create copy and export value to memory.
RHGRENZ0 Delimit IT1000 and related 1001s. Program will delete any 1001 infotypes whose start date is after the delimit date.
RHGRENZ1 Extend the end date on delimited records. Very useful when you delimit a bunch of records incorrectly, and need to change the end date.
RHGRENZ2 Delimit infotypes (IT1001)
RPCMPYG0 Statutory Maternity Pay(SMP)
RPCSSPG0_HIST Statutory Sickness History(SSP)
RPDTRA00 List all HR transactions and there uses
RPTPSH10 Personal work schedule, also accessed via PA20/PA30 infotype 2001
RPUAUD00 HR Report to list all logged changes in infotype data for an employee. Uses the PCL4 Audit Cluster.
RPUAUDDL HR Report to delete audit data from the PCL4 Audit Cluster
RPUDELPN Delete all info for an employee number, including cluster data and infotypes
RPUP1D00 View/Delete records from PCL1 Cluster
RPUP2D00 View/Delete records from PCL2 Cluster
RPUP3D00 View/Delete records from PCL3 Cluster
RPUP4D00 View/Delete records from PCL4 Cluster -
List of all Reports in SAP Module wise
hi all,
i have one requirement, that is List of all Reports in SAP.
what is the tcode or table name to get all only reports in sap module wise. i have tryed in TSTC table, but it is showing all tcodes including standard screen programs. i want only reports, that list have to convert in excel file. please help me in this..
Thank you.The following are the most commonly used reports across various modules:
RGUGBR00 Substitution/Validation utility
RHGENZ0/HRGRENZ2 Notes RHGRENZ0/2 will abend if there are any inconsistencies between PD and PA (i.e. people in a different controlling area than the position they belong to).
RHGRENZ0 Delimit IT1000 and related 1001s. Program will delete any 1001 infotypes whose start date is after the delimit date.
RHGRENZ1 Extend the end date on delimited records. Very useful when you delimit a bunch of records incorrectly, and need to change the end date.
RHGRENZ2 Delimit IT1001 only.
RKCTSEAR Search source code for up to two strings. Also see RSRSCAN1 and RPR_ABAP_SOURCE_SCAN.
RPDTRA00 List all HR transactions.
RPR_ABAP_SOURCE_SCAN Search ABAP code for a string. Has many more options for selecting the ABAPs to search than RSRSCAN1 or RKCTSEAR.
RPUAUD00 HR Report to list all logged changes for an employee. Uses the PCL4 Audit Cluster.
RPUAUDDL HR Report to delete audit data from the PCL4 Audit Cluster.
RPUDELPN Delete all info for an employee number, including cluster data and infotypes
RPUP1D00/10 View/Delete data from PCL1 Cluster
RPUP2D00/10 View/Delete data from PCL2 Cluster
RPUP3D00/10 View/Delete data from PCL3 Cluster
RPUP4D00/10 View/Delete data from PCL4 Cluster
RSABAPIV Mass print/display of ABAP/4 help text
RSAVGL00 Table adjustment across clients
RSBDCBTC Submit a BDC job with an internal batch number and wait for the end of the batch input session.
RSBDCDRU Prints the contents of a Batch Input session. No options for error transactions only.
RSBDCOS0 Execute UNIX commands. Looks similar to the old SAPMSOS0 program that disappeared in 3.0
RSBDCSUB Release batch input sessions automatically
RSBTCDEL Clean the old background job records
RSCLTCOP Copy tables across clients
RSDBCREO Clean batch input session log
RSINCL00 Extended program list
RSORAREL Get the Oracle Release
RSPARAM Display all instance parameters
RSPO0041 Removing old spooling objects
RSRSCAN1 Search source code for a given string. Will also search includes. Also see RKCTSEAR and RPR_ABAP_SOURCE_SCAN.
RSSNAPDL Clean the old ABAP error dumps
RSTBSERV Compare a contents of a table between clients
RSTXFCON Converts SAPScript page formats
RSTXSCRP Save a SAPScript layout set to disk, and load it back into SAP.
RSTXSCRP Transport SAPscript files across systems
RSTXSCRP Upload and download SAPScript layout sets
RSTXTRAN Add standard texts to a transport so they can be moved between systems.
RSUSR003 Check the passwords of users SAP* and DDIC in all clients
RSUSR006 List users last login
RSWBO052 Change development class of a sapscript (provided by Alan Cecchini)
RSWBO060 put objects into a request and transport it to any other system
RFSKPL00 Global chart of accounts(General data)+B106
RFSKVZ00 Local chart of accounts(Ccode specific)
RFBELJ00 transaction journal
RFSLD00 Trial balance
RFBILA00 balance sheet /P&L
RFHABU00 balance audit trail
RFSKTH00 Financial policy manual
RFBUSU00 Postings totla
RFSABL00 Changes to g/l account
RFEPOJ00 Line item journal
SAPMV45A Sales Order Processing
SAPMM06E Purchase Order Processing
SAPMF02K Vendor master
SAPMM03M Material master
SAPLF0180 Balance sheet readjustment
RSWBO052 Change Development Class
RSTXLDMC
RSTXFCON Converts page format
RSTXSCRP pload/Download layout sets
RSTXCHKO To Correct Inconsistencies in Copying Script
RAALTD11 Asset master upload
Regards, -
Report to export class to a local file.
Hi,
Is there any report program which exports the class from ABAP systems
to a local file. There was one report program but it was exporting only the methods of the class and it was not exporting the implemeted methods of an interface in that class.
Any help would be greatly awarded.
Thanks,
Rashmi.Hi,
i think it not available the following are the reports available in sap
REKH0004 SAP demo program that shows how to do 2D, 3D, and 4D graphics.
RGUGBR00 Substitution/Validation utility
RHGEN00 Regen PD and PA inconsistencies
RHGRENZ0 Delimit IT1000 and related 1001s. Program will delete any 1001 infotypes whose start date is after the delimit date.
RHGRENZ1 Extend the end date on delimited records. Very useful when you delimit a bunch of records incorrectly, and need to change the end date.
RHGRENZ2 Delimit IT1001 only.
RKCTSEAR Search source code for up to two strings. Also see RSRSCAN1 and RPR_ABAP_SOURCE_SCAN.
RPDTRA00 List all HR transactions.
RPR_ABAP_SOURCE_SCAN Search ABAP code for a string. Has many more options for selecting the ABAPs to search than RSRSCAN1 or RKCTSEAR.
RPUAUD00 HR Report to list all logged changes for an employee. Uses the PCL4 Audit Cluster.
RPUAUDDL HR Report to delete audit data from the PCL4 Audit Cluster.
RPUDELPN Delete all info for an employee number, including cluster data and infotypes
RPUP1D00/10 View/Delete data from PCL1 Cluster
RPUP2D00/10 View/Delete data from PCL2 Cluster
RPUP3D00/10 View/Delete data from PCL3 Cluster
RPUP4D00/10 View/Delete data from PCL4 Cluster
RSABAPIV Mass print/display of ABAP/4 help text
RSAVGL00 Table adjustment across clients
RSBDCBTC Submit a BDC job with an internal batch number and wait for the end of the batch input session.
RSBDCDRU Prints the contents of a Batch Input session. No options for error transactions only.
RSBDCOS0 Execute UNIX commands. Looks similar to the old SAPMSOS0 program that disappeared in 3.0
RSBDCSUB Release batch input sessions automatically
RSBTCDEL Clean the old background job records
RSSDOCTB R/3 Table Manual - prints a list of all fields in the selected tables with the field name and the field documentation.
RSCLTCOP Copy tables across clients
RSDBCREO Clean batch input session log
RSINCL00 Extended program list
RSNASTED Process message control output for entries in the NAST table
RSORAREL Get the Oracle Release
RSPARAM Display all instance parameters
RSPO0041 Removing old spooling objects
RSRSCAN1 Search source code for a given string. Will also search includes. Also see RKCTSEAR and RPR_ABAP_SOURCE_SCAN.
RSSNAPDL Clean the old ABAP error dumps
RSTBSERV Compare a contents of a table between clients
RSTXFCON Converts SAPScript page formats
RSTXSCRP Save a SAPScript layout set to disk, and load it back into SAP.
RSTXSCRP Transport SAPscript files across systems
RSTXSCRP Upload and download SAPScript layout sets
RSTXTPDF4 Pass the spool number of a report's output to this program to have the output converted to PDF format.
RSTXTRAN Add standard texts to a transport so they can be moved between systems.
RSUSR003 Check the passwords of users SAP* and DDIC in all clients
RSUSR006 List users last login
RSWBO052 Change development class of a sapscript (provided by Alan Cecchini)
RSWBO060 put objects into a request and transport it to any other system
********please reward points if the information is helpful to you*********** -
SAP Human Capital Best Practice Reports
Hi friends!!!
I'm currently working with a client that is looking for a list of SAP Human Capital Best Practice Reports. I'm having difficulty finding a list of SAP HCM best practice reports. Does anyone have a list? Or can you point me in the right direction?
Thanks in Advance
Thanks & RegardsHi
Program Description
H99CWTR0
Wage Type Reporter. Returns pay for particular wage types. To submit from new report you will need to create copy and export value to memory.
RHGRENZ0
Delimit IT1000 and related 1001s. Program will delete any 1001 infotypes whose start date is after the delimit date.
RHGRENZ1
Extend the end date on delimited records. Very useful when you delimit a bunch of records incorrectly, and need to change the end date.
RHGRENZ2
Delimit infotypes (IT1001)
RPCMPYG0
Statutory Maternity Pay(SMP)
RPCSSPG0_HIST
Statutory Sickness History(SSP)
RPDTRA00
List all HR transactions and there uses
RPTPSH10
Personal work schedule, also accessed via PA20/PA30 infotype 2001
RPUAUD00
HR Report to list all logged changes in infotype data for an employee. Uses the PCL4 Audit Cluster.
RPUAUDDL
HR Report to delete audit data from the PCL4 Audit Cluster
RPUDELPN
Delete all info for an employee number, including cluster data and infotypes
RPUP1D00
View/Delete records from PCL1 Cluster
RPUP2D00
View/Delete records from PCL2 Cluster
RPUP3D00
View/Delete records from PCL3 Cluster
RPUP4D00
View/Delete records from PCL4 Cluster
you can find more in the link
http://www.sapdevelopment.co.uk/programs/programshr.htm
Regards
Sri -
Hi, what are Standard Internal Tables and Standard reports, and can I have names of some 'Standard Internal Tables' and 'Standard Reports' plz ?
Thnx.these are some of the standard reports\
REKH0004
SAP demo program that shows how to do 2d 3D, and 4D graphics.
RGUGBR00
Substitution/Validation utility
RHGEN00
Regen PD and PA inconsistencies
RHGRENZ0
Delimit IT1000 and related 1001s. Program will delete any 1001 infotypes whose start date is after the delimit date.
RHGRENZ1
Extend the end date on delimited records. Very useful when you delimit a bunch of records incorrectly, and need to change the end date.
RHGRENZ2
Delimit IT1001 only.
RKCTSEAR
Search source code for up to two strings. Also see RSRSCAN1 and RPR_ABAP_SOURCE_SCAN.
RPDTRA00
List all HR transactions.
RPR_ABAP_SOURCE_SCAN
Search ABAP code for a string. Has many more options for selecting the ABAPs to search than RSRSCAN1 or RKCTSEAR.
RPUAUD00
HR Report to list all logged changes for an employee. Uses the PCL4 Audit Cluster.
RPUAUDDL
HR Report to delete audit data from the PCL4 Audit Cluster.
RPUDELPN
Delete all info for an employee number, including cluster data and infotypes
RPUP1D00/10
View/Delete data from PCL1 Cluster
RPUP2D00/10
View/Delete data from PCL2 Cluster
RPUP3D00/10
View/Delete data from PCL3 Cluster
RPUP4D00/10
View/Delete data from PCL4 Cluster
RSABAPIV
Mass print/display of ABAP/4 help text
RSAVGL00
Table adjustment across clients
RSBDCBTC
Submit a BDC job with an internal batch number and wait for the end of the batch input session.
RSBDCDRU
Prints the contents of a Batch Input session. No options for error transactions only.
RSBDCOS0
Execute UNIX commands. Looks similar to the old SAPMSOS0 program that disappeared in 3.0
RSBDCSUB
Release batch input sessions automatically
RSBTCDEL
Clean the old background job records
RSSDOCTB
R/3 Table Manual - prints a list of all fields in the selected tables with the field name and the field documentation.
RSCLTCOP
Copy tables across clients
RSDBCREO
Clean batch input session log
RSINCL00
Extended program list
RSNASTED
Process message control output for entries in the NAST table
RSORAREL
Get the Oracle Release
RSPARAM
Display all instance parameters
RSPO0041
Removing old spooling objects
RSRSCAN1
Search source code for a given string. Will also search includes. Also see RKCTSEAR and RPR_ABAP_SOURCE_SCAN.
RSSNAPDL
Clean the old ABAP error dumps
RSTBSERV
Compare a contents of a table between clients
RSTXFCON
Converts SAPScript page formats
RSTXSCRP
Save a SAPScript layout set to disk, and load it back into SAP.
RSTXSCRP
Transport SAPscript files across systems
RSTXSCRP
Upload and download SAPScript layout sets
RSTXTPDF4
Pass the spool number of a report's output to this program to have the output converted to PDF format.
RSTXTRAN
Add standard texts to a transport so they can be moved between systems.
RSUSR003
Check the passwords of users SAP* and DDIC in all clients
RSUSR006
List users last login
RSWBO052
Change development class of a sapscript (provided by Alan Cecchini)
RSWBO060
put objects into a request and transport it to any other system
inernal tables
INTERNAL TABLES IN ABAP:
There are two ways of accessing the records in an internal table:
By copying individual records into a work area. The work area must be compatible with the line type of the internal table.
You can access the work area in any way, as long as the component you are trying to access is not itself an internal table. If one of the components is an internal table, you must use a further work area, whose line type is compatible with that of the nested table.
When you change the internal table, the contents of the work area are either written back to the table or added as a new record.
By assigning the individual data records to an appropriate field symbol. Once the system has read an entry, you can address its components directly via its address. There is no copying to and from the work area. This method is particularly appropriate for accessing large or complex tables.
If you want to read more than one record, you must use a LOOP... ENDLOOP structure. You can then change or delete the line that has just been read, and the system applies the change to the table body. You can also change or delete lines using a logical condition.
When you use the above statements with sorted tables, you must ensure that the sort sequence is maintained.
Within a loop, the INSERT statement adds the data record before the current record in the table. If you want to insert a set of lines from an internal table into another index table, you should use the INSERT LINES OF variant instead.
When you read single data records, you can use two further additions:
In the COMPARING addition, the system compares the field contents of a data record with those in the work area for equality.
In the TRANSPORTING addition, you can restrict the data transport to selected fields.
Other statements for standard tables
SORT [ASCENDING|DESCENDING]
[BY [ASCENDING|DESCENDING] ..
[ASCENDING|DESCENDING]][AS TEXT] [STABLE].
These statements sort the table by the table key or the specified field sequence. If you do not use an addition, the system sorts ascending. If you use the AS TEXT addition, character fields are sorted in culture-specific sequence. The relative order of the data records with identical sort keys only remain constant if you use the STABLE addition.
APPEND INTO SORTED BY .
This statement appends the work area to the ranked list in descending order. The ranked list may not be longer than the specified INITIAL SIZE, and the work area must satisfy the sort order of the table.
The statements listed here can be used freely with both standard and sorted tables.
When you change a single line, you can specify the fields that you want to change using the TRANSPORTING addition. Within a loop, MODIFY changes the current data record.
If you want to delete a set of lines from an index table, use the variant DELETE FROM... TO.. or WHERE... instead of a loop. You can program almost any logical expression after WHERE.
The only restriction is that the first field in each comparison must be a component of the line structure (see the corresponding Open SQL statements). You can pass component names dynamically.
If you want to delete the entire internal table , use the statement CLEAR .
In the LOOP AT... ENDLOOP structure, the statements within the loop are applied to each data record in turn. The INTO addition copies entries one at a time into the work area.
The system places the index of the current loop pass in the system field sy-tabix. When the loop has finished, sy-tabix has the same value that it had before the loop started.
Inserting and deleting lines within a loop affects the following loop passes.
Access to a hashed table is imple mented using a hash algorithm. Simplified, this means that the data records are distributed randomly but evenly over a particular memory area.. The addresses are stored in a special table called the hashing table .
There is a hash function, which determines the address at which the pointer to a data record with a certain key can be found. The function is not injective, that is, there can be several data records stored at a single address. This is implemented internally as a chained list. Therefore, although the system still has to search sequentially within these areas, it only has to read a few data records (usually no more than three). The graphic illustrates the simplest case, that is, in which there is only one data record stored at each address.
Using a hash technique means that the access time no longer depends on the total number of entries in the table. On the contrary, it is always very fast. Hash tables are therefore particularly useful for large tables with which you use predominantly read access.
Data records are not inserted into the table in a sorted order. As with standard tables, you can sort hashed tables using the SORT statement:
SORT [ASCENDING|DESCENDING]
[BY [ASCENDING|DESCENDING] ..
[ASCENDING|DESCENDING]][AS TEXT].
Sorting the table can be useful if you later want to use a loop to access the table.
You can use the statements listed here with tables of all three types. Apart from a few special cases, you can recognize the statements from the extra keyword TABLE. The technical implementation of the statements varies slightly according to the table type.
As a rule, index access to an internal table is quickest. However, it sometimes makes more sense to access data using key values. A unique key is only possible with sorted and hashed tables. If you use the syntax displayed here, your program coding is independent of the table type (generic type specification, easier maintenance).
With a standard table, inserting an entry has the same effect as appending. With sorted tables with a non-unique key, the entry is inserted before the first (if any) entry with the same key.
To read individual data records using the first variant, all fields of that are key fields of must be filled. and can be identical. If you use the WITH TABLE KEY addition in the second variant, you must also specify the key fully. Otherwise, the system searches according to the sequence of fields that you have specified, using a binary search where possible. You can force the system to use a binary search with a standard table using the BINARY SEARCH addition.
In this case, you must sort the table by the corresponding fields first. The system returns the first entry that meets the selection criteria.
Similarly to when you read entries, when you change and delete entries using the key and a work area, you must specify all of the key fields.
You can prevent fields from being transported into the work area during loop processing by using the TRANSPORTING NO FIELDS addition in the WHERE condition. (You can use this to count the number of a particular kind of entry.)
Other statements for all table types
DELETE ADJACENT DUPLICATES FROM
[COMPARING .. | A L L F I E L }|ALL FIELDS}].
The system deletes all adjacent entries with the same key field contents apart from the first entry. You can prevent the system from only comparing the key field using the COMPARING addition. If you sort the table by the required fields beforehand, you can be sure that only unique entries will remain in the table after the DELETE ADJACENT DUPLICATES statement.
Searches all lines of the table for the string . If the search is successful, the system sets the fields sy-tabix and sy-fdpos.
FREE .
Unlike CLEAR, which only deletes the contents of the table, FREE releases the memory occupied by it as well.
If you want to access your data using the index and do not need your table to be kept in sorted order or to have a unique key, that is, when the sequence of the entries is the most important thing, not sorting by key or having unique entries, you should use standard tables. (If you decide you need to sort the table or access it using the key or a binary search, you can always program these functions by hand.)
This example is written to manage a waiting list.
Typical functions are:
Adding a single entry,
Deleting individual entries according to certain criteria,
Displaying and then deleting the first entry from the list,
Displaying someone's position in the list.
For simplicity, the example does not encapsulate the functions in procedures.
The first thing we do in the example is to declare line and table type, from which we can then declare a work area and our internal table. We also require an elementary field for passing explicit index values.
This example omits the user dialogs and data transport, assuming that you understand the principles involved. We really only want to concentrate on the table access:
Adding new entries
The data record for a waiting customer is only added to the table if it does not already exist in it. If the table had a unique key, you would not have had to have programmed this check yourself.
Deleting single entries according to various criteria
The criterion is the key field. However, other criteria would be possible - for example, deleting data records older than a certain insertion date reg_date.
Displaying and deleting the first entry from the list
Once a customer comes to the top of the waiting list, you can delete his or her entry. If the waiting list is empty, such an action has no effect. Consequently, you do not have to check whether there are entries in the list before attempting the deletion.
Displaying the position of a customer in the waiting list
As above, you do not need to place any data in the work area. We are only interested in the values of sy-subrc and sy-tabix. If the entry is not in the table, sy-tabix is set to zero.
At this stage, let us return to the special case of the restricted ranked list:
DATA {TYPE|LIKE} STANDARD TABLE OF ... INITIAL SIZE . ... APPEND INTO SORTED BY .
When you choose to use a sorted table, it will normally be because you want to define a unique key.
The mere fact that the table is kept in sorted order is not that significant, since you can sort any kind of internal table. However, with sorted tables (unlike hashed tables), new data records are inserted in the correct sort order. If you have a table with few entries but lots of accesses that change the contents, a sorted table may be more efficient than a hashed table in terms of runtime.
The aim of the example here is to modify the contents of a database table. The most efficient way of doing this is to create a local copy of the table in the program, make the changes to the copy, and then write all of its data back to the database table. When you are dealing with large amounts of data, this method both saves runtime and reduces the load on the database server. Since the internal table represents a database table in this case, you should ensure that its records have unique keys.
This is assured by the key definition. Automatic sorting can also bring further advantages.
When you change a group of data records, only the fields price and currency are copied from the work area.
This means that, with larger tables, the access time is reduced significantly in comparison with a binary search. In a loop, however, the hashed table has to search the entire table (full table scan). Since the table entries are stored unsorted, it would be better to use a sorted table if you needed to run a loop through a left-justified portion of the key.
It can also be worth using a hashed table but sorting it. A typical use for hashed tables is to buffer detailed information that you need repeatedly and can identify using a unique key. You should bear in mind that you can also set up table buffering for a table in the ABAP Dictionary to cover exactly the same case. However, whether the tables are buffered on the application table depends on the size of the database table.
Buffering in the program using hashed tables also allows you to restrict the dataset according to your own needs, or to buffer additional data as required.
In this example, we want to allow the user to enter the name of a city, and the system to display its geographical coordinates.
First, we fill our "buffer table" city_list with values from the database table sgeocity. Then, we read an entry from the hashed table, specifying the full key.
The details are displayed as a simple list. At this point, it is worth repeating that you should only use this buffering technique if you want to keep large amounts of data locally in the program. You must ensure that you design your hashed table so that it is possible to specify the full key when you access it from your program.
You can define internal tables either with (WITH HEADER LINE addition) or without header lines. An internal table with header line consists of a work area (header line) and the actual table body. You address both objects using the same name. The way in which the system interprets the name depends on the context. For example, the MOVE statement applies to the header line, but the SEARCH statement applies to the body of the table.
To avoid confusion, you are recommended to use internal tables without header lines. This is particularly important when you use nested tables. However, internal tables with header line do offer a shorter syntax in several statements (APPEND, INSERT, MODIFY, COLLECT, DELETE, READ, LOOP).
hope this is helpful
do reward -
FI-Stand reopt with t.code
please send all standard report in FI with t.Code
Thanks in Advance
Regards
PraveenHi
List of Standard Reports
REKH0004 SAP demo program that shows how to do 2D, 3D, and 4D graphics.
RGUGBR00 Substitution/Validation utility
RHGEN00 Regen PD and PA inconsistencies
RHGRENZ0 Delimit IT1000 and related 1001s. Program will delete any 1001 infotypes whose start date is after the delimit date.
RHGRENZ1
Extend the end date on delimited records. Very useful when you delimit a bunch of records incorrectly, and need to change the end date.
RHGRENZ2 Delimit IT1001 only.
RKCTSEAR Search source code for up to two strings. Also see RSRSCAN1 and RPR_ABAP_SOURCE_SCAN.
RPDTRA00 List all HR transactions.
RPR_ABAP_SOURCE_SCAN Search ABAP code for a string. Has many more options for selecting the ABAPs to search than RSRSCAN1 or RKCTSEAR.
RPUAUD00 HR Report to list all logged changes for an employee. Uses the PCL4 Audit Cluster.
RPUAUDDL HR Report to delete audit data from the PCL4 Audit Cluster.
RPUDELPN Delete all info for an employee number, including cluster data and infotypes
RPUP1D00/10 View/Delete data from PCL1 Cluster
RPUP2D00/10 View/Delete data from PCL2 Cluster
RPUP3D00/10 View/Delete data from PCL3 Cluster
RPUP4D00/10 View/Delete data from PCL4 Cluster
RSABAPIV Mass print/display of ABAP/4 help text
RSAVGL00 Table adjustment across clients
RSBDCBTC Submit a BDC job with an internal batch number and wait for the end of the batch input session.
RSBDCDRU Prints the contents of a Batch Input session. No options for error transactions only.
RSBDCOS0 Execute UNIX commands. Looks similar to the old SAPMSOS0 program that disappeared in 3.0
RSBDCSUB Release batch input sessions automatically
RSBTCDEL Clean the old background job records
RSSDOCTB R/3 Table Manual - prints a list of all fields in the selected tables with the field name and the field documentation.
RSCLTCOP Copy tables across clients
RSDBCREO Clean batch input session log
RSINCL00 Extended program list
RSNASTED Process message control output for entries in the NAST table
RSORAREL Get the Oracle Release
RSPARAM Display all instance parameters
RSPO0041 Removing old spooling objects
RSRSCAN1 Search source code for a given string. Will also search includes. Also see RKCTSEAR and RPR_ABAP_SOURCE_SCAN.
RSSNAPDL Clean the old ABAP error dumps
RSTBSERV Compare a contents of a table between clients
RSTXFCON Converts SAPScript page formats
RSTXSCRP Save a SAPScript layout set to disk, and load it back into SAP.
RSTXSCRP Transport SAPscript files across systems
RSTXSCRP Upload and download SAPScript layout sets
RSTXTPDF4 Pass the spool number of a report's output to this program to have the output converted to PDF format.
RSTXTRAN Add standard texts to a transport so they can be moved between systems.
RSUSR003 Check the passwords of users SAP* and DDIC in all clients
RSUSR006 List users last login
RSWBO052 Change development class of a sapscript (provided by Alan Cecchini)
RSWBO060 put objects into a request and transport it to any other system
Please assign points if helpful.
Regards,
Nitin Aggarwal -
Report for employees net and gross pay for a pay period
Hi Gurus
How should I approach to write a report which gives employees net pay, gross pay and cost center for a pay period?
Do i have to use cluster tables?
As I am new to this module any help will be appreciated.
Thanks in AdvanceUnless you store your payroll results in Infotypes then yes you would have to retrieve this information from the PCL2 Cluster. The Cost Center information would come from the WPBP table and the Gross and Net Pay from the RT table.
Maybe you are looking for
-
MM - Pedidos de Compra - Cambio de Cuenta de Imputación
Buenos días consultores MM. Tengo una consulta SOS para Uds. Sucede que tengo un Pedido de Compras de muchas posiciones que fue creado imputándose a una cuenta contable X. Este pedido tuvo algunas recepciones de factura por MIRO en todas sus posicion
-
I no longer have access to the back up email address I used when I set up my apple ID. I have since forgotten the answers to my security questions and am having a problem making changes to my account. What can I do?
-
Drives in favourites bar won't go away
Hi all, Since upgrading/migrating from MacPro Lion to MacMini Mountain Lion I have had a few problems, some have resolved, but others... well here goes. Finder: I have re-applied a new command (new email with selection ⌃⌥⌘N) but it does not work at a
-
I was told that with Mountain Lion I would be able to view my computer through the router onto my TV screen through Apple TV. How?
-
Burning 2 quicktime movies onto one DVD using iDVD
I wonder if you could help me. I have 2 Quick time movies - created in FCP - one hour and 10 mins each . Is it possible to put both on one DVD using iDVD? (one is the front view and other side view of a performance). I have version 5.0.2 iDVD and am