ABAP_Hr FM:CD_READ_LAST
Hi..
Im developing a report in which im passing the Fm CD_READ_LAST to get the sequence number and then latter im using this seq.num in FM "PYXX_READ_PAYROLL_RESULT" to read the RT results..But it has come to my notice that while using CD_READ_LAST,the FM is not importing the correct seq.number to the exprt parametrs,begin date and date date.As the report is showing wrong values ,Please can anyone explain this..and wat can be the alternative...???
Thanks In advance
Hi,
Use the below function module.
Below function module will pick only last seqnr.
it does not consider the dates.
CD_READ_LAST_RESULT_IN_RGDIR
Or else get the seqnr by this way.
DATA: v_seqnr like pc261-seqnr.
*loop at rgdir where paydt >= begin_date
and paydt <= end_date.
*endloop.
loop at rgdir where ipend BETWEEN p_begda AND p_endda
endloop.
if sy-subrc = 0.
v_seqnr = rgdir-seqnr.
endif.
Message was edited by:
Velangini Showry Maria Kumar Bandanadham
Similar Messages
-
Unable to read the wage type amount in payroll report output...
Hi all,
In the program below I am not able to see the car amount incurred by the office in the output, please find the error....
Regards
john
*& Report ZHR_PY_REPORT1 *
REPORT ZHR_PY_REPORT1 .
TABLES
TABLES : PERNR.
INFOTYPES
INFOTYPES : 0000,
0001,
0002,
0006,
0105.
STRUCTURES
TYPES : BEGIN OF T_FINAL,
PERNR TYPE PERNR_D,
STAT2 TYPE STAT2,
BUKRS TYPE BUKRS,
PLANS TYPE PLANS,
ORGEH TYPE ORGEH,
ABKRS TYPE ABKRS,
VORNA TYPE VORNA,
NACHN TYPE NACHN,
GBDAT TYPE GBDAT,
STRAS TYPE STRAS,
ORT01 TYPE ORT01,
PSTLZ TYPE PSTLZ,
MAILID TYPE CHAR255,
CARAT TYPE CHAR15,
END OF T_FINAL.
INTERNAL TABLES
DATA : IT_FINAL TYPE STANDARD TABLE OF T_FINAL.
WORK AREAS
DATA : WA_FINAL TYPE T_FINAL.
PARAMETER : P_DOWN AS CHECKBOX.
START-OF-SELECTION.
GET PERNR.
*SUBROUTINE TO FETCH DATA FROM INFOTYPES
PERFORM F_FETCH_DATA_FROM_INFTY.
END-OF-SELECTION.
*SUBROUTINE TO DISPLAY DATA
PERFORM F_DISPLAY_DATA.
*& Form F_FETCH_DATA_FROM_INFTY
text
FORM F_FETCH_DATA_FROM_INFTY .
RP_PROVIDE_FROM_LAST P0000 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '1'.
WA_FINAL-PERNR = P0000-PERNR.
WA_FINAL-STAT2 = P0000-STAT2.
ENDIF.
RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '1'.
WA_FINAL-BUKRS = P0001-BUKRS.
WA_FINAL-PLANS = P0001-PLANS.
ENDIF.
RP_PROVIDE_FROM_LAST P0002 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '1'.
WA_FINAL-VORNA = P0002-VORNA.
WA_FINAL-NACHN = P0002-NACHN.
ENDIF.
RP_PROVIDE_FROM_LAST P0006 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '1'.
WA_FINAL-STRAS = P0006-STRAS.
WA_FINAL-ORT01 = P0006-ORT01.
ENDIF.
RP_PROVIDE_FROM_LAST P0105 '0010' PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '1'.
WA_FINAL-MAILID = P0105-USRID_LONG.
ENDIF.
*SUBROUTINE TO FETCH EMPLOYEE PAYROLL RESULTS
PERFORM F_FETCH_PAYROLL_DATA.
APPEND WA_FINAL TO IT_FINAL.
CLEAR WA_FINAL.
ENDFORM. " F_FETCH_DATA_FROM_INFTY
*& Form F_DISPLAY_DATA
text
FORM F_DISPLAY_DATA .
LOOP AT IT_FINAL INTO WA_FINAL.
AT FIRST.
WRITE : / 'EMP.NO',
10 'FIRST NAME',
20 'COMPANY CODE'.
ENDAT.
WRITE : / WA_FINAL-PERNR,
10 WA_FINAL-VORNA,
20 WA_FINAL-BUKRS,
30 WA_FINAL-CARAT.
ENDLOOP.
ENDFORM. " F_DISPLAY_DATA
*& Form F_FETCH_PAYROLL_DATA
text
FORM F_FETCH_PAYROLL_DATA .
DATA : W_MOLGA TYPE MOLGA,
W_SEQNR TYPE CDSEQ,
W_RELID TYPE RELID_PCL2.
DATA : IT_RGDIR TYPE STANDARD TABLE OF PC261,
IT_RESULT TYPE PAY99_RESULT.
DATA : WA_RT TYPE PC207.
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
PERSNR = P0000-PERNR
IMPORTING
MOLGA = W_MOLGA
TABLES
IN_RGDIR = IT_RGDIR
EXCEPTIONS
NO_RECORD_FOUND = 1
OTHERS = 2.
IF SY-SUBRC EQ 0.
CALL FUNCTION 'CD_READ_LAST'
EXPORTING
BEGIN_DATE = PN-BEGDA
END_DATE = PN-ENDDA
IMPORTING
OUT_SEQNR = W_SEQNR
TABLES
RGDIR = IT_RGDIR
EXCEPTIONS
NO_RECORD_FOUND = 1
OTHERS = 2.
IF SY-SUBRC EQ 0.
SELECT SINGLE RELID FROM T500L INTO W_RELID WHERE MOLGA = W_MOLGA
IF SY-SUBRC EQ 0.
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTING
CLUSTERID = w_relid
EMPLOYEENUMBER = P0000-PERNR
SEQUENCENUMBER = W_SEQNR
READ_ONLY_INTERNATIONAL = 'X'
CHANGING
PAYROLL_RESULT = IT_RESULT
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
OTHERS = 8.
IF SY-SUBRC EQ 0.
LOOP AT IT_RESULT-INTER-RT INTO WA_RT.
IF WA_RT-LGART EQ 'M810'.
WA_FINAL-CARAT = WA_RT-BETRG.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " F_FETCH_PAYROLL_DATAHi all,
In the program below I am not able to see the car amount incurred by the office in the output, please find the error....
Regards
john
*& Report ZHR_PY_REPORT1 *
REPORT ZHR_PY_REPORT1 .
TABLES
TABLES : PERNR.
INFOTYPES
INFOTYPES : 0000,
0001,
0002,
0006,
0105.
STRUCTURES
TYPES : BEGIN OF T_FINAL,
PERNR TYPE PERNR_D,
STAT2 TYPE STAT2,
BUKRS TYPE BUKRS,
PLANS TYPE PLANS,
ORGEH TYPE ORGEH,
ABKRS TYPE ABKRS,
VORNA TYPE VORNA,
NACHN TYPE NACHN,
GBDAT TYPE GBDAT,
STRAS TYPE STRAS,
ORT01 TYPE ORT01,
PSTLZ TYPE PSTLZ,
MAILID TYPE CHAR255,
CARAT TYPE CHAR15,
END OF T_FINAL.
INTERNAL TABLES
DATA : IT_FINAL TYPE STANDARD TABLE OF T_FINAL.
WORK AREAS
DATA : WA_FINAL TYPE T_FINAL.
PARAMETER : P_DOWN AS CHECKBOX.
START-OF-SELECTION.
GET PERNR.
*SUBROUTINE TO FETCH DATA FROM INFOTYPES
PERFORM F_FETCH_DATA_FROM_INFTY.
END-OF-SELECTION.
*SUBROUTINE TO DISPLAY DATA
PERFORM F_DISPLAY_DATA.
*& Form F_FETCH_DATA_FROM_INFTY
text
FORM F_FETCH_DATA_FROM_INFTY .
RP_PROVIDE_FROM_LAST P0000 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '1'.
WA_FINAL-PERNR = P0000-PERNR.
WA_FINAL-STAT2 = P0000-STAT2.
ENDIF.
RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '1'.
WA_FINAL-BUKRS = P0001-BUKRS.
WA_FINAL-PLANS = P0001-PLANS.
ENDIF.
RP_PROVIDE_FROM_LAST P0002 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '1'.
WA_FINAL-VORNA = P0002-VORNA.
WA_FINAL-NACHN = P0002-NACHN.
ENDIF.
RP_PROVIDE_FROM_LAST P0006 SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '1'.
WA_FINAL-STRAS = P0006-STRAS.
WA_FINAL-ORT01 = P0006-ORT01.
ENDIF.
RP_PROVIDE_FROM_LAST P0105 '0010' PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND EQ '1'.
WA_FINAL-MAILID = P0105-USRID_LONG.
ENDIF.
*SUBROUTINE TO FETCH EMPLOYEE PAYROLL RESULTS
PERFORM F_FETCH_PAYROLL_DATA.
APPEND WA_FINAL TO IT_FINAL.
CLEAR WA_FINAL.
ENDFORM. " F_FETCH_DATA_FROM_INFTY
*& Form F_DISPLAY_DATA
text
FORM F_DISPLAY_DATA .
LOOP AT IT_FINAL INTO WA_FINAL.
AT FIRST.
WRITE : / 'EMP.NO',
10 'FIRST NAME',
20 'COMPANY CODE'.
ENDAT.
WRITE : / WA_FINAL-PERNR,
10 WA_FINAL-VORNA,
20 WA_FINAL-BUKRS,
30 WA_FINAL-CARAT.
ENDLOOP.
ENDFORM. " F_DISPLAY_DATA
*& Form F_FETCH_PAYROLL_DATA
text
FORM F_FETCH_PAYROLL_DATA .
DATA : W_MOLGA TYPE MOLGA,
W_SEQNR TYPE CDSEQ,
W_RELID TYPE RELID_PCL2.
DATA : IT_RGDIR TYPE STANDARD TABLE OF PC261,
IT_RESULT TYPE PAY99_RESULT.
DATA : WA_RT TYPE PC207.
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
PERSNR = P0000-PERNR
IMPORTING
MOLGA = W_MOLGA
TABLES
IN_RGDIR = IT_RGDIR
EXCEPTIONS
NO_RECORD_FOUND = 1
OTHERS = 2.
IF SY-SUBRC EQ 0.
CALL FUNCTION 'CD_READ_LAST'
EXPORTING
BEGIN_DATE = PN-BEGDA
END_DATE = PN-ENDDA
IMPORTING
OUT_SEQNR = W_SEQNR
TABLES
RGDIR = IT_RGDIR
EXCEPTIONS
NO_RECORD_FOUND = 1
OTHERS = 2.
IF SY-SUBRC EQ 0.
SELECT SINGLE RELID FROM T500L INTO W_RELID WHERE MOLGA = W_MOLGA
IF SY-SUBRC EQ 0.
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTING
CLUSTERID = w_relid
EMPLOYEENUMBER = P0000-PERNR
SEQUENCENUMBER = W_SEQNR
READ_ONLY_INTERNATIONAL = 'X'
CHANGING
PAYROLL_RESULT = IT_RESULT
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
OTHERS = 8.
IF SY-SUBRC EQ 0.
LOOP AT IT_RESULT-INTER-RT INTO WA_RT.
IF WA_RT-LGART EQ 'M810'.
WA_FINAL-CARAT = WA_RT-BETRG.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDFORM. " F_FETCH_PAYROLL_DATA -
Hi all,
How to retrive the payroll data while using PNPCE logical databse.
plz help me out in this case.
thanks and regards,
RavikiranHi Ravikiran,
you have to fetch the data using Function Modules.
(1) function module CU_READ_RGDIR reads table RGDIR from cluster CU
(2) function module CD_READ_LAST determines the current payroll result for a for- period to be evaluated
(3) function module PYXX_READ_PAYROLL_RESULT to read a complete
payroll result from the database table PCL2 or from the buffer.
check the following code for reference.
tables: pernr.
nodes: peras.
infotypes: 0001.
start-of-selection.
get peras.
rp_provide_from_last p0001 space pn-begda pn-endda.
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
persnr = p0001-pernr
IMPORTING
molga = country
TABLES
in_rgdir = rgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
IF sy-subrc = 1.
WRITE: / 'No records found for '(001), pernr-pernr.
REJECT.
ENDIF.
CALL FUNCTION 'CD_READ_LAST'
EXPORTING
begin_date = pn-begda
end_date = pn-endda
IMPORTING
out_seqnr = number
TABLES
rgdir = rgdir
EXCEPTIONS
no_record_found = 1
OTHERS = 2.
IF sy-subrc = 1.
WRITE: / 'No payroll result found for'(002), pn-paper.
ELSE.
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTING
clusterid = 'RX'
employeenumber = p0001-pernr
sequencenumber = number
READ_ONLY_BUFFER = ' '
READ_ONLY_INTERNATIONAL = ' '
CHECK_READ_AUTHORITY = 'X'
IMPORTING
VERSION_NUMBER_PAYVN =
VERSION_NUMBER_PCL2 =
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
OTHERS = 8.
IF sy-subrc = 0.
PERFORM print_rx.
ELSE.
WRITE: / 'Result could not be read (003).
ENDIF.
ENDIF.
Hope it will help you.
regards,
Abhijit Zope -
How to Call Total Amount field from t.code - PC00_M40_ANN in driver program
Hi,
There is a standard Transaction for Payroll Annual display - PC00_M40_ANN. From this transaction we can see the Pension Amount month wise and in Totals as well as.
In my report, we want to call Total Amount (from T.Code PC00_M40_ANN).
For Ref., I have design a Smartform with its driver program. In driver program i required this Value...
Plz guide..Hi,
Please check the below code ....
Declare variables , structures .....
call function 'CU_READ_RGDIR'
exporting
persnr = pernr-pernr <--- pass the pernr
importing
molga = w_molga
tables
in_rgdir = itrgdir
exceptions
no_record_found = 1
others = 2.
if not w_molga is initial.
call function 'CD_READ_LAST'
exporting
begin_date = pn-begda
end_date = pn-endda
importing
out_seqnr = w_seqnr
tables
rgdir = itrgdir
exceptions
no_record_found = 1
others = 2.
endif.
if itrgdir is initial.
continue.
else.
select single relid from t500l into w_relid where molga = w_molga.
call function 'PYXX_READ_PAYROLL_RESULT'
exporting
clusterid = w_relid
employeenumber = pernr-pernr
sequencenumber = w_seqnr
read_only_international = 'X'
changing
payroll_result = itresult
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
error_reading_archive = 8
error_reading_relid = 9
others = 10.
get all the earnings and deductions
loop at itresult-inter-rt into wa_rt.
case wa_rt-lgart.
to get the net pay
when '/560'.
wa_pernr-npay = wa_rt-betrg.
v_npay = wa_rt-betrg.
endcase.
endloop. -
ABAP HR - PYXX_READ_PAYROLL_RESULT not fetching results
My first 2 FM's are fetching the correct values . Now I am passing the SEQNR(00005 in my case) returned by 2nd FM to the 3rd FM ( PYXX_READ_PAYROLL_RESULT ) , the table payroll remains empty.I checked in debug mode also that payroll-INTER-RT is empty whereas in debugger mode i can see that SEQNR has been set correctly by the 2nd FM. Below is my code
TABLES : PERNR.
TYPES: BEGIN OF RGDIR.
INCLUDE STRUCTURE PC261.
TYPES: END OF RGDIR.
DATA: RGDIR TYPE TABLE OF RGDIR WITH HEADER LINE,
SEQNR LIKE PC261-SEQNR,
payroll TYPE pay99_result,
rt_line TYPE LINE OF hrpay99_rt.
GET PERNR.
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
PERSNR = PERNR-PERNR
TABLES
IN_RGDIR = RGDIR
CALL FUNCTION 'CD_READ_LAST'
EXPORTING
BEGIN_DATE = PN-BEGDA
END_DATE = PN-ENDDA
IMPORTING
OUT_SEQNR = SEQNR
TABLES
RGDIR = RGDIR.
CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
EXPORTING
CLUSTERID = 'RX'
EMPLOYEENUMBER = PERNR-PERNR
SEQUENCENUMBER = SEQNR
CHANGING
PAYROLL_RESULT = payroll
LOOP AT payroll-INTER-RT INTO rt_line.
write:/ rt_line-LGART.
ENDLOOP.amber22 wrote:
I made the following changes as u suggested.The GET_RELID function is fetching value of rel_id as 'IN' which i think should be correct since I am executing Indian Payroll. But the last FM gives runtime error "illegal type'. I tried passing the value of clusterid as constant "IN" but still it gives the same error. Only when i give its value as 'RX' , it doesnt give error but then it doenst fetches any result also.
>
>
>
rel_id LIKE PCL2-RELID..
>
> CALL FUNCTION 'PYXX_GET_RELID_FROM_PERNR'
> EXPORTING
> EMPLOYEE = PERNR-PERNR
> IMPORTING
> RELID = rel_id.
>
> CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
> EXPORTING
> CLUSTERID = rel_id
> EMPLOYEENUMBER = PERNR-PERNR
> SEQUENCENUMBER = SEQNR
> CHANGING
> PAYROLL_RESULT = payroll.
>
> LOOP AT payroll-INTER-RT INTO rt_line.
> write:/ rt_line-LGART.
> ENDLOOP.
Since you are reading the payroll results of India, you have to change the declaration of 'payroll' as below
DATA:
payroll TYPE payin_result,
the current declaration
DATA:
payroll TYPE pay99_result,
would only give you the international part of the payroll and you have to inform the FM that you only want to read the international part through the importing parameter 'READ_ONLY_INTERNATIONAL'.
and 'CLUSTERID' is a optional parameter of the FM, if you don't feed any value to that it itself determines its value.
-Rajesh. -
ABAP-HR Inteview questions requierd
Hi Experts,
I need ABAP_HR technical questions for interview. Reward points assured.You can send it my mail id also : [email protected] Thanks in advance.Hi Chris
Keep up the comments as you are the only one that seems to willing to call out folks on the board.
Just yesterday I saw a question saying something of the effect " I am a consultant and the client is asking me to prepare configuration material on garnishment and taxes please help"
I almost did a "Chris" response but decided to hold tight and just say nothing though part of me wishes I have the clients email address so they could be aware of what a joker they are paying to help them.
Jarret -
Hi all,
I need to fetch last payroll record of a pernr,from transaction pc_payresult.
I am using the LDB PNP.
After calling GET PERNR, I am using functions CU_READ_RGDIR and then PYXX_READ_PAYROLL_RESULT to fetch the last active payroll record.
But is there any way to <b>directly</b> fetch the last active payroll record,based on the pernr? Please suggest a way.
Thanks&Regards
AnanyaHi
To get the payroll results, you need to read the cluster CU to get RGDIR. For this CU_READ_RGDIR is used and almost all standard programs also use this FM.
Simple Report using LDBs to get latest payroll result.
report ythr_read_payroll .
data: t_rgdir type pc261 occurs 0,
t_result type payus_result,
w_bt type line of hrpay99_bt,
out_seqnr like pc261-seqnr.
tables: pernr.
get pernr.
call function 'CU_READ_RGDIR_NEW'
exporting
persnr = pernr-pernr
tables
in_rgdir = t_rgdir
exceptions
no_record_found = 1
import_mismatch_error = 2
no_read_authority = 3
others = 4.
if sy-subrc <> 0.
write:/1 'No payroll results for ', pernr-pernr.
endif.
call function 'CD_READ_LAST'
exporting
begin_date = pn-begda
end_date = pn-endda
importing
out_seqnr = out_seqnr
tables
rgdir = t_rgdir
exceptions
no_record_found = 1
others = 2.
if sy-subrc <> 0.
write:/1 'Error for ', pernr-pernr.
endif.
call function 'PYXX_READ_PAYROLL_RESULT'
exporting
clusterid = 'RU'
employeenumber = pernr-pernr
sequencenumber = out_seqnr
changing
payroll_result = t_result
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
error_reading_archive = 8
error_reading_relid = 9
others = 10.
if sy-subrc <> 0.
write:/1 'Error for ', pernr-pernr.
endif.
loop at t_result-inter-bt into w_bt.
write:/1 pernr-pernr, out_seqnr, w_bt-bankl, w_bt-bankn.
endloop.
Regards
Navneet -
Hi Friends,
I am using the FM: CD_READ_LAST
Here I am passing the pn-begda and pn-endda to get the sequnce number.
In my case for some date range its giving the sequnce number, and for some other date range its not giving the seq no, in that case its showing the sy-subrc = 1.
can u plz tell me how to handle this case....plz tell me the functionality of this FM: CD_READ_LAST.
thanks and regards,
S.MageshHi,
Before using FM 'CD_READ_LAST', you need to fetch RGDIR data (Can use FM 'CU_READ_RGDIR')
Once you get the RGDIR data pass this to FM 'CD_READ_LAST' along with Begin and End dates. Basic functionality is to get the last recent sequence number from the multiple sequence numbers between begin and end dates. With that sequence number you can read the entire record and use as required.
Probably in your case there might not have sequence numbers between the date range you selected. Debug the function module you can get more understanings on which record is matching to your requirement after executing the report RPCALCU0.
Regards,
Thrilleswar. -
"PERNR" is not defined for the current logical database.
Hi Experts,
I have developed a program for HR salary variance but when i execute i getting error in the line " get PERNR"
the "PERNR" is not defined for the current logical database. so plz suggest me to avoid this issue.
Thanks,
Rajeshthe codes are has below,
*& Report ZHRSAL_COMP
REPORT ZHRSAL_COMP.
tables: pernr,
t512t. "Wage type texts
infotypes: 0001. "Organizational Assignment
*Tables data containing directory to PCL2 payroll results file.
data: begin of rgdir occurs 100.
include structure pc261.
data: end of rgdir.
data: result type pay99_result.
data: rt_header type line of hrpay99_rt.
data: country like t001p-molga,
number like pc261-seqnr. "Number of last payroll result
types :begin of struc_p0001,
pernr type p0001-pernr,
ename type p0001-ename,
werks type p0001-werks,
btrtl type p0001-btrtl,
end of struc_p0001.
data : gtab_p0001 type table of struc_p0001,
gwa_p0001 type struc_p0001.
types : begin of struc_payroll,
text(10) type c,
date type dats,
month(2) type c,
year(4) type c,
abkrs(2) type c,
end of struc_payroll.
data : gtab_payroll type table of struc_payroll,
gwa_payroll type struc_payroll.
types : begin of struc_result,
lgart type lgart,
lgtxt type t512t-lgtxt,
betrg type betrg,
end of struc_result.
data : gtab_result type table of struc_result,
gwa_result type struc_result.
get pernr.
rp_provide_from_last p0001 space pn-begda pn-endda.
call function 'CU_READ_RGDIR'
exporting
pernr = p0001-pernr
importing
molga = country
tables
in_rgdir = rgdir
exceptions
no_record_found = 1
others = 2.
if sy-subrc = 1.
write: / 'No records found for '(001), pernr-pernr.
endif.
call function 'CD_READ_LAST'
exporting
begin_date = pn-begda
end_date = SY-DATUM
importing
out_seqnr = number
tables
rgdir = rgdir
exceptions
no_record_found = 1
others = 2.
if sy-subrc = 1.
write: / 'No payroll result found for'(002), pn-paper.
else.
call function 'PYXX_READ_PAYROLL_RESULT'
exporting
clusterid = 'RX'
employeenumber = p0001-pernr
sequencenumber = number
READ_ONLY_BUFFER = ' '
READ_ONLY_INTERNATIONAL = ' '
CHECK_READ_AUTHORITY = 'X'
IMPORTING
VERSION_NUMBER_PAYVN =
VERSION_NUMBER_PCL2 =
changing
payroll_result = result
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
others = 8.
if sy-subrc = 0.
perform print_rx.
else.
write: / 'Result could not be read (003)'.
endif.
endif.
FORM PRINT_RX *
Print Payroll Result *
form print_rx.
format intensified on.
write: / p0001-pernr,
p0001-ename(15),
p0001-werks,
p0001-btrtl.
format intensified off.
skip 1.
move p0001-pernr to gwa_p0001-pernr.
move p0001-ename(15) to gwa_p0001-ename.
move p0001-werks to gwa_p0001-werks.
move p0001-btrtl to gwa_p0001-btrtl.
append gwa_p0001 to gtab_p0001.
write: / 'For period/payroll area: '(004),
30 result-inter-versc-fpper+4(2),
result-inter-versc-fpper+0(4),
result-inter-versc-abkrs,
/ 'In-period/payroll area: '(005),
30 result-inter-versc-inper+4(2),
result-inter-versc-inper+0(4),
result-inter-versc-iabkrs.
skip 1.
gwa_payroll-text = 'For'.
move result-inter-versc-fpper to gwa_payroll-date.
move result-inter-versc-fpper+4(2) to gwa_payroll-month.
move result-inter-versc-fpper+0(4) to gwa_payroll-year.
move result-inter-versc-abkrs to gwa_payroll-abkrs.
append gwa_payroll to gtab_payroll.
gwa_payroll-text = 'In'.
move result-inter-versc-fpper to gwa_payroll-date.
move result-inter-versc-inper+4(2) to gwa_payroll-month.
move result-inter-versc-inper+0(4) to gwa_payroll-year.
move result-inter-versc-iabkrs to gwa_payroll-abkrs.
append gwa_payroll to gtab_payroll.
write: 'Results table: '(006).
skip 1.
loop at result-inter-rt into rt_header.
perform re512t using result-inter-versc-molga
rt_header-lgart.
write: / rt_header-lgart,
t512t-lgtxt,
rt_header-betrg currency rt_header-amt_curr.
move rt_header-lgart to gwa_result-lgart.
move t512t-lgtxt to gwa_result-lgtxt.
move rt_header-betrg to gwa_result-betrg.
append gwa_result to gtab_result.
endloop.
endform. "print_rx
FORM RE512T *
Read Wage Type Texts
form re512t using value(country_grouping)
value(wtype).
check t512t-sprsl ne sy-langu
or t512t-molga ne country_grouping
or t512t-lgart ne wtype.
select single * from t512t
where sprsl eq sy-langu
and molga eq country_grouping
and lgart eq wtype.
if sy-subrc ne 0.
clear t512t.
endif.
endform. "re512t -
Hi All,
I am new in HR ABAP. Plz guide me how to get information/read data from
Wagetype 2RTH, 7RTH, 2RCU, 7RCU.
I need to add WT 2RTH + 7RTH, WT 2RCU + 7RCU and display in report.
RegardsYou should read the payroll result to get the wagetype amount and display in the report.
First you have to know in which table these wage types are stored in the payroll results. EX RT or CRT or TCRT then typical steps would be to
1. Read the RGDIR directory - use CU_READ_RGDIR
2. Get the sequence number. If you just need some accumulated wage types or last payroll result then use CD_READ_LAST
3. Read payroll results - PYXX_READ_PAYROLL_RESULT using the sequence number in previous step.
4. then read appropriate table to get the amount. -
When using PNPCE LDB, how to retrive payroll record for an employee.
Regards
ManviHi,
Please refer to the following code.
Basically the payroll data is stored in the Cluster tables PCL1 and PCL2.
If help ful please reward points.
Regards,
Irfan Hussain
*& Report ZHR_READ_CLUSTER *
REPORT ZHR_READ_CLUSTER .
TABLES : PERNR,
PCL1,
PCL2.
Infotypes : 0001,
0002.
Data : molga like t001p-molga,
num like pc261-seqnr.
STANDARD INCLUDES *
INCLUDE rpc2cd09. " Data Definition - CD Cluster INCLUDE rpc2ca00. " Data Definition Import/Export Macros for ClusterCA INCLUDE rpc2ruu0. " Data Definition for Cluster RU (USA) INCLUDE rpc2rx09. " Cluster RU Data-Definition internat. part INCLUDE rpppxd00. " Data befinition buffer PCL1/PCL2 INCLUDE rpppxd10. " Common part buffer PCL1/PCL2 INCLUDE rpppxm00. " Buffer handling routine
Start-Of-Selection.
Get Pernr.
rp_provide_from_last p0001 space pn-begda pn-endda.
CALL FUNCTION 'CU_READ_RGDIR'
EXPORTING
persnr = pernr-pernr
IMPORTING
MOLGA = molga
tables
in_rgdir = rgdir
EXCEPTIONS
NO_RECORD_FOUND = 1
OTHERS = 2
IF sy-subrc = 1.
write /: 'No Records Found'.
ENDIF.
CALL FUNCTION 'CD_READ_LAST'
EXPORTING
begin_date = pn-begda
end_date = pn-endda
IMPORTING
OUT_SEQNR = num
tables
rgdir = rgdir
EXCEPTIONS
NO_RECORD_FOUND = 1
OTHERS = 2
IF sy-subrc = 1.
write :/ ' No Payroll Exist'.
ELSE.
rx-key-pernr = pernr-pernr.
rx-key-seqno = num.
rp-imp-c2-ru.
IF SY-SUBRC = 0.
PERFORM PRINT_FORM.
ELSE.
WRITE :/ 'Results Could not be read this time'.
endif.
ENDIF.
*& Form PRINT_FORM
text
--> p1 text
<-- p2 text
form PRINT_FORM .
DATA : l_betrg LIKE p0008-bet01,
l_betrg1 like p0008-bet01.
read table rgdir with key seqnr = num.
IF sy-subrc = 0.
WRITE: /1 'Empd id' COLOR 1,20 p0001-pernr COLOR 5,
/1 'Name' COLOR 1,20 p0001-ename COLOR 5,
/1 'Personnel Area' COLOR 1,20 p0001-werks COLOR 5,
/1 'Personnel Subarea' COLOR 1 ,20 p0001-btrtl COLOR 5.
SKIP 1.
WRITE: / 'For-period' COLOR 1, 30 rgdir-fpper COLOR 3,
/ 'In-period' COLOR 1, 30 rgdir-inper COLOR 3.
SKIP 1.
ENDIF.
loop at crt where lgart = '/101' or lgart = '\5UH' .
if crt-cumty = 'Q'.
l_betrg = l_betrg + crt-betrg.
endif.
endloop.
loop at crt where lgart = '/102' and cumty = 'Y'.
l_betrg1 = l_betrg1 + crt-betrg.
endloop.
l_betrg1 = l_betrg1 / 4.
l_betrg = l_betrg + l_betrg1.
write :/ l_betrg.
endform. " PRINT_FORM -
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..
The question would be siliy, but i would like to know abt the diff between ABAP and HR abap... Any one can clear it.......
ThanksHi Aruna,
The following concepts are defined in HR which differs this module with other modules
1. Use of Infotypes
2. The use of Logical Database
3. Use of Macros
4. Storage and Access of data
5 Authorization checks
Go through the links,
hr-abap
ABAP-HR
HR ABAP
ABAP-HR Interview questions.
Re: ABAP_HR
Regards,
Azaz Ali. -
Calculate salary of employee from April to December ??
Hi all,
I want to find the salary of the employee from April to December month for that particular year entered on the selection screen, and then from January to March as well.
How is it possible?
I tried looking into various infotypes, but I couldn't find how to resolve this.
Any help would be apperciated and rewarded.
Regards
TarunHi all,
I am using the below code for my problem.
data: l_pernr like pa0000-pernr.
deviding the date and month
month = date+4(2).
*date = date+6(2).
curr_year = date+0(4).
IF month GT 3.
next_year = curr_year + 1.
ELSE.
next_year = curr_year.
curr_year = curr_year - 1.
ENDIF.
*CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = mydate
I_MONMIT = 00
i_periv = 'XX'
IMPORTING
E_BUPER =
E_GJAHR = curr_year
EXCEPTIONS
INPUT_FALSE = 1
T009_NOTFOUND = 2
T009B_NOTFOUND = 3
OTHERS = 4
CONCATENATE curr_year '04' '01' INTO p_begda.
CONCATENATE curr_year '12' '31' INTO p_endda.
call function 'CU_READ_RGDIR'
exporting
persnr = ls_tds_1-pernr
importing
molga = w_molga
tables
in_rgdir = it_rgdir1
exceptions
no_record_found = 1
others = 2.
if not w_molga is initial.
call function 'CD_READ_LAST'
exporting
begin_date = p_begda
end_date = p_endda
importing
out_seqnr = w_seqnr
tables
rgdir = it_rgdir
exceptions
no_record_found = 1
others = 2.
endif.
sort it_rgdir by fpend descending.
loop at it_rgdir into wa_itrgdir. "where fpbeg le p_endda and fpend = p_endda.
w_seqnr = wa_itrgdir-seqnr.
endloop.
select single relid from t500l into w_relid where molga = 'W_MOLGA'.
l_pernr = ls_tds_1-pernr .
call function 'PYXX_READ_PAYROLL_RESULT'
exporting
clusterid = w_relid
employeenumber = l_pernr
sequencenumber = w_seqnr "'00003'
read_only_international = 'X'
changing
payroll_result = it_result
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
error_reading_archive = 8
error_reading_relid = 9
others = 10.
loop at it_result-inter-rt into wa_rt. " MAIN DATA THAT CAME FROM RT TABLE FROM FN MODULE... LIKE FINAL PAYMENT I.E IN AMNT 19
wagetype = wa_rt-lgart.
case wagetype.
when '1000'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg.
when '1010'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '1020'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '1030'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '1100'. " HRA REPAYMENT
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '1040'. " HRA BALANCE
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '1050'. " STAFF ADVANCE REPAYMENT
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '1060'. " STAFF ADVANCE BALANCE
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '1080'. " STAFF LOAN REPAYMENT
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '1090'. " STAFF LOAN REPAYMENT
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '1120'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '1130'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '1140'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '3010'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '1160'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '/3E1'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '/3E2'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '/460'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '/3P1'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '9000'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg . " BONUS
when '4000'.
ls_tds-up_to_april = ls_tds-up_to_april + ( -1 * wa_rt-betrg ). " ADVANCE
when '4020'.
ls_tds-up_to_april = ls_tds-up_to_april + ( -1 * wa_rt-betrg ).
when '4080'.
ls_tds-up_to_april = ls_tds-up_to_april + ( -1 * wa_rt-betrg ).
when '4030'.
ls_tds-up_to_april = ls_tds-up_to_april + ( -1 * wa_rt-betrg ).
when '4045'.
ls_tds-up_to_april = ls_tds-up_to_april + ( -1 * wa_rt-betrg ).
when '4070'.
ls_tds-up_to_april = ls_tds-up_to_april + ( -1 * wa_rt-betrg ).
when '4010'.
ls_tds-up_to_april = ls_tds-up_to_april + ( -1 * wa_rt-betrg ).
when '/3W1'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
when '1170'.
ls_tds-up_to_april = ls_tds-up_to_april + wa_rt-betrg .
endcase.
endloop.
The first fm is giving me all the date periods which are there in pc_payresult, but the second fm is not giving me anything in it_rgdir. What is the reason for that.
Further, i am using all this code in a form, and calling this form inside a loop for all the pernrs.
And now seqnr will be different for different date periods. so suppose for 1.4.2011 to 31.12.2011, will have 9 different seqnr's, so i will have to call the last fm(3rd fm) 9 times to get complete sum, or any other solution is available?? -
What are the sequence of function modules executed in payroll result
Dear all,
what are the sequence of function modules executed while retrivieng pryroll result.or
functionmodule sequence in payroll programming.
By
boseHi Bose,
The sequence of FM executed in payroll result are
1. cu_read_rgdir ---> from this u will get the country key.
2. cd_read_last -
> from this fm u will identify the seqnr for the latest record and finally for the payroll result
3. pyxx_read_payroll_result.
Maybe you are looking for
-
Camera Raw and Mac 10.5.6, CS3 and Canon 5D Mark II
Just got the 5D Mark II and have CS3 installed (Mac OS). Is there an update for Camera Raw - Photoshop cannot read the files
-
Document Check In Fails Communication Error.
While locally editing a document, I save it locally and the hit the check in button. It looks like the file is uploading but, then the directory screen comes back with a red exclamation point stating "a communications error has occurred, document co
-
Hi, Does anybody have any info about: 1. Comparison between NetWeaver's Content Management and FileNet's Web Content Management. 2. Integration between Netweaver and FileNet's Web Content Management. Any info will help me. Warm Regards, Manish
-
How does the delta works for changes made to Sales Document
Hi Experts, How does delta for 2LIS_11_VAITM for the changes made to Sales Order Header..... Example: If a sales order had 10 line items any changes at the item level are captured by 2LIS_11_VAITM Could you please update me on how the changes made at
-
ExecuteNonQuery doesnt return number of rows affected when used with PL/SQL
ExecuteNonQuery doesn't return number of rows affected when used with PL/SQL but returns -1. The documentation says ExecuteNonQuery method of OracleCommand returns the number of raws affected but when used with PL/SQL, it returns -1 even the update s