1. To Calculate years, months, days & calender days between 2 given dates
call function 'HR_SGPBS_YRS_MTHS_DAYS'
exporting
beg_da = wa_final-duedate
end_da = p_date
importing
* NO_DAY =
* NO_MONTH =
* NO_YEAR =
no_cal_day = w_days
* EXCEPTIONS
* DATEINT_ERROR = 1
* OTHERS = 2
.
if sy-subrc <> 0.
* Implement suitable error handling here
endif.
2. To get month name
data: emonth_name TYPE t247-ktx,
CALL FUNCTION 'ISP_GET_MONTH_NAME'
EXPORTING
date = exit_date
language = 'E'
IMPORTING
shorttext = emonth_name
EXCEPTIONS
calendar_id = 1
date_error = 2
not_found = 3
wrong_input = 4
OTHERS = 5.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
EXPORTING
date = exit_date
language = 'E'
IMPORTING
shorttext = emonth_name
EXCEPTIONS
calendar_id = 1
date_error = 2
not_found = 3
wrong_input = 4
OTHERS = 5.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
3. To find HR joining Date and leaving date
CALL FUNCTION 'HR_ENTRY_DATE' "TO FIND EMPLOYEE JOIN DATE
EXPORTING
persnr = pernr-pernr
begda = '18000101'
endda = '99991231'
IMPORTING
entrydate = entry_date
EXCEPTIONS
entry_date_not_found = 1
pernr_not_assigned = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
EXPORTING
persnr = pernr-pernr
begda = '18000101'
endda = '99991231'
IMPORTING
entrydate = entry_date
EXCEPTIONS
entry_date_not_found = 1
pernr_not_assigned = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
CALL FUNCTION 'HR_LEAVING_DATE' "TO READ EMPLOYEE EXIT DATE
EXPORTING
persnr = pernr-pernr
begda = '18000101'
endda = '99991231'
IMPORTING
leavingdate = exit_date
EXCEPTIONS
leaving_date_not_found = 1
pernr_not_assigned = 2
OTHERS = 3.
IF sy-subrc <> 0.
*** Implement suitable error handling here
ENDIF.
EXPORTING
persnr = pernr-pernr
begda = '18000101'
endda = '99991231'
IMPORTING
leavingdate = exit_date
EXCEPTIONS
leaving_date_not_found = 1
pernr_not_assigned = 2
OTHERS = 3.
IF sy-subrc <> 0.
*** Implement suitable error handling here
ENDIF.
4.To find Employee country Group
CALL FUNCTION 'HR_COUNTRYGROUPING_GET'
EXPORTING
pernr = pernr-pernr
tclas = 'A'
begda = '18000101'
endda = '99991231'
IMPORTING
molga = g_molga
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
5. To read data from logical database
rp-provide-from-last p0185 '02' pn-begda pn-endda. "TO READ PAN NUMBER
IF pnp-sw-found EQ '1'.
wa_final-pannum = p0185-icnum.
ENDIF.
IF pnp-sw-found EQ '1'.
wa_final-pannum = p0185-icnum.
ENDIF.
02 -> suptype for infotype 0185
rp-provide-from-last p0008 space pn-begda pn-endda.
IF pnp-sw-found EQ '1'.
wa_final-grade = p0008-trfgr.
ENDIF.
IF pnp-sw-found EQ '1'.
wa_final-grade = p0008-trfgr.
ENDIF.
space -> no suptype for infotype 0008.
7.To fill the Wagetype Table
START-OF-SELECTION.
************************************************************************
************************GET PERNR***************************************
************************************************************************
GET pernr.
************************************************************************
************************GET PERNR***************************************
************************************************************************
GET pernr.
PROVIDE * FROM p0008 BETWEEN pn-begda AND pn-endda.
ENDPROVIDE.
CALL FUNCTION 'RP_FILL_WAGE_TYPE_TABLE_EXT' "TO FILL THE WAGE TYPE TABLE
EXPORTING
begda = p0008-begda
endda = p0008-endda
infty = '0008'
tclas = 'A'
pernr = pernr-pernr
TABLES
pp0001 = p0001
pp0007 = p0007
pp0008 = p0008
ppbwla = it_pbwla
EXCEPTIONS
error_at_indirect_evaluation = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
READ TABLE it_pbwla WITH KEY lgart = '1000'. "BASIC
IF sy-subrc = 0.
g_bet = it_pbwla-betrg * 12.
ENDIF.
wa_final-basic = g_bet.
CLEAR g_bet.
READ TABLE it_pbwla WITH KEY lgart = '1001'. "HRA
IF sy-subrc = 0.
g_bet = it_pbwla-betrg * 12.
ENDIF.
wa_final-hra = g_bet.
CLEAR g_bet.
READ TABLE it_pbwla WITH KEY lgart = '1002'. "TRANSPORT ALLOWANCE
IF sy-subrc = 0.
g_bet = it_pbwla-betrg * 12.
ENDIF.
wa_final-ta = g_bet.
CLEAR g_bet.
READ TABLE it_pbwla WITH KEY lgart = '1003'. "SPECIAL ALLOWANCE
IF sy-subrc = 0.
g_bet = it_pbwla-betrg * 12.
ENDIF.
wa_final-sa = g_bet.
CLEAR g_bet.
READ TABLE it_pbwla WITH KEY lgart = '1004'. "STATUTORY BONUS
IF sy-subrc = 0.
g_bet = it_pbwla-betrg * 12.
ENDIF.
wa_final-sbonus = g_bet.
CLEAR g_bet.
** READ TABLE it_pbwla WITH KEY lgart = '1005'. "EMPLOYER PROVIDENT FUND
** IF sy-subrc = 0.
** g_bet = it_pbwla-betrg * 12.
** ENDIF.
** wa_final-epf = g_bet.
** CLEAR g_bet.
READ TABLE it_pbwla WITH KEY lgart = '1006'. "MEDICAL
IF sy-subrc = 0.
g_bet = it_pbwla-betrg * 12.
ENDIF.
wa_final-medallow = g_bet.
CLEAR g_bet.
** READ TABLE it_pbwla WITH KEY lgart = '2001'. "LANGUAGE ALLOWANCE
** IF sy-subrc = 0.
** g_bet = it_pbwla-betrg.
** ENDIF.
**
** wa_final-lallow = g_bet.
** CLEAR g_bet.
rp-provide-from-last p9012 space pn-begda pn-endda.
IF pnp-sw-found EQ '1'.
wa_final-epf = p9012-emp_pf.
wa_final-lallow = p9012-lng_alw.
ENDIF.
wa_final-ctcg = wa_final-basic + wa_final-hra + wa_final-ta + wa_final-sa
+ wa_final-sbonus + wa_final-medallow. "CTC GROSS
wa_final-ctct = wa_final-ctcg + wa_final-epf. "CTC TOTAL
*
ENDPROVIDE.
CALL FUNCTION 'RP_FILL_WAGE_TYPE_TABLE_EXT' "TO FILL THE WAGE TYPE TABLE
EXPORTING
begda = p0008-begda
endda = p0008-endda
infty = '0008'
tclas = 'A'
pernr = pernr-pernr
TABLES
pp0001 = p0001
pp0007 = p0007
pp0008 = p0008
ppbwla = it_pbwla
EXCEPTIONS
error_at_indirect_evaluation = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
READ TABLE it_pbwla WITH KEY lgart = '1000'. "BASIC
IF sy-subrc = 0.
g_bet = it_pbwla-betrg * 12.
ENDIF.
wa_final-basic = g_bet.
CLEAR g_bet.
READ TABLE it_pbwla WITH KEY lgart = '1001'. "HRA
IF sy-subrc = 0.
g_bet = it_pbwla-betrg * 12.
ENDIF.
wa_final-hra = g_bet.
CLEAR g_bet.
READ TABLE it_pbwla WITH KEY lgart = '1002'. "TRANSPORT ALLOWANCE
IF sy-subrc = 0.
g_bet = it_pbwla-betrg * 12.
ENDIF.
wa_final-ta = g_bet.
CLEAR g_bet.
READ TABLE it_pbwla WITH KEY lgart = '1003'. "SPECIAL ALLOWANCE
IF sy-subrc = 0.
g_bet = it_pbwla-betrg * 12.
ENDIF.
wa_final-sa = g_bet.
CLEAR g_bet.
READ TABLE it_pbwla WITH KEY lgart = '1004'. "STATUTORY BONUS
IF sy-subrc = 0.
g_bet = it_pbwla-betrg * 12.
ENDIF.
wa_final-sbonus = g_bet.
CLEAR g_bet.
** READ TABLE it_pbwla WITH KEY lgart = '1005'. "EMPLOYER PROVIDENT FUND
** IF sy-subrc = 0.
** g_bet = it_pbwla-betrg * 12.
** ENDIF.
** wa_final-epf = g_bet.
** CLEAR g_bet.
READ TABLE it_pbwla WITH KEY lgart = '1006'. "MEDICAL
IF sy-subrc = 0.
g_bet = it_pbwla-betrg * 12.
ENDIF.
wa_final-medallow = g_bet.
CLEAR g_bet.
** READ TABLE it_pbwla WITH KEY lgart = '2001'. "LANGUAGE ALLOWANCE
** IF sy-subrc = 0.
** g_bet = it_pbwla-betrg.
** ENDIF.
**
** wa_final-lallow = g_bet.
** CLEAR g_bet.
rp-provide-from-last p9012 space pn-begda pn-endda.
IF pnp-sw-found EQ '1'.
wa_final-epf = p9012-emp_pf.
wa_final-lallow = p9012-lng_alw.
ENDIF.
wa_final-ctcg = wa_final-basic + wa_final-hra + wa_final-ta + wa_final-sa
+ wa_final-sbonus + wa_final-medallow. "CTC GROSS
wa_final-ctct = wa_final-ctcg + wa_final-epf. "CTC TOTAL
*
APPEND wa_final TO it_final.
CLEAR wa_final.
CLEAR wa_final.
END-OF-SELECTION.
PERFORM fieldcatalog.
PERFORM layout.
PERFORM display_alv.
PERFORM fieldcatalog.
PERFORM layout.
PERFORM display_alv.
No comments:
Post a Comment