How to Store Simulation Payroll Result for any Reconciliation

By Sai Kumar Bonakurthi, HCL Technologies This document tells us how to capture runtime pay results and store in custom table during the simulation payroll for any reconciliation. Note: Here I am using Australia Payroll, for any country payroll logic is same. For this first of all we have to create the Payroll Function and insert the function into payroll schema after final processing step of the schema. Create a payroll function using T.code PE04. The Naming convention should be ³Z_´ if we use only ³Z´ it allows only to store in standard package

Now pass the function description. There is option available to create function to corresponding to any countries. Select the Country.

Add Input parameter to the Function..

y y By using Enhancements spots By using access key Here we would be using enhancements spots. .Select the Program There are two ways to write our code for the newly created Function. Choose the Enhancement spot from the Program.

. A spot will be created to write our custom code.Select Show implements enhancement options Place the cursor on the spot and select Create implementation (Edit->Enhancement operation>Create Implementation). Create Enhancement implementation.

. The below code is to take the data form RT table from final result of the simulation payroll and store the data in the table at runtime for the wage types that maintained in the Set or wage type maintenance table.Create a table to store the data.

w_wages-option = 'EQ'. ENDIF. DATA : r_wages TYPE hrpayjp_range_lgart. DATA : lv_check TYPE i. ENDIF. If we run for AUG the data will be over write the existing one. w_wages-low = wa_ab_wage-from. DATA : wa_rt TYPE pc207 .Code PC00_M13_CALC_SIMU' and the data in the table will be store and modify for next time run. COMMIT WORK. Then if we run the simulation payroll for the Sep 09 the all the data store for the Aug be cleared and only sep 09 will be available. w_wages TYPE pjpsk_range_lgart. LOOP AT it_ab_wage INTO wa_ab_wage. MODIFY zhrtr_aus_wt_du FROM TABLE it_final. ENDIF. wa_ab_wage TYPE rgsb4. LOOP AT rt INTO wa_rt WHERE lgart IN r_wages. w_wages-sign = 'I'. if sy-subrc ne 0. APPEND wa_final TO it_final. wa_final TYPE zhrtr_aus_wt_du. append w_wages to r_wages. endform. Let say we run the simulation payroll for the month of Aug 09 all the related amount will be store in the ztable that are maintained in SET. endif. Note : Data will store for one month only ie.* DATA : it_final TYPE TABLE OF zhrtr_aus_wt_du . wa_final-betrg = wa_rt-betrg. CALL FUNCTION 'G_SET_GET_ALL_VALUES' EXPORTING client = sy-mandt setnr = 'ZAUS_WAGE' class = '0000' no_descriptions = ' ' no_rw_info ='' TABLES set_values = it_ab_wage EXCEPTIONS set_not_found = 1 OTHERS = 2. wa_final-begda = PNPDISBD. CLEAR it_final. . IF tst_on = 'X' and sy-tcode = 'PC00_M13_CALC_SIMU' . ENDLOOP. DELETE FROM zhrtr_aus_wt_du. SELECT SINGLE * FROM zhrtr_aus_wt_du INTO wa_final WHERE begda = PNPDISBD . ENDLOOP. *---------------------------------------------------------------------. IF it_final IS NOT INITIAL. DATA :it_ab_wage TYPE TABLE OF rgsb4. wa_final-pernr = p0000-pernr. IF sy-subrc = 0. wa_final-lgart = wa_rt-lgart. IF it_ab_wage IS NOT INITIAL.We have the condition here this will run for the T. ENDIF.

ENDENHANCEMENT. .$*$* Now insert the Function into the Schema. *$*$-End: (1 )-----------------------------------------------------.

To Create a Set to maintain the wage use the T. .code ³GS01´ Now maintain the wage types in Set values.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001. FIELD-SYMBOLS: <fs_final> TYPE STANDARD TABLE. g_save TYPE c VALUE 'A'.TYPE-POOLS: slis. SELECT-OPTIONS s_pernr FOR p0002-pernr MATCHCODE OBJECT perm. c_p TYPE char1 VALUE 'P'. CONSTANTS : c_30 TYPE char2 VALUE '30'. c_7 TYPE char1 VALUE '7'. DATA : g_repid TYPE sy-repid. it_fieldcat TYPE lvc_t_fcat. INCLUDE ZHRREP_AUS_DUMMY_WT_FORMS. DATA : dyn_table TYPE REF TO data. <wa_final> TYPE any. c_2 TYPE char1 VALUE '2'. wa_final TYPE zhrtr_aus_wt_du. dyn_line TYPE REF TO data. . c_13 TYPE char2 VALUE '13'. wa_fcat TYPE slis_fieldcat_alv. DATA : wa_fieldcat TYPE lvc_s_fcat. wa_ab_wage TYPE rgsb4. DATA : it_final TYPE TABLE OF zhrtr_aus_wt_du . SELECTION-SCREEN END OF BLOCK b1. DATA: it_fcat TYPE slis_t_fieldcat_alv. <data> TYPE any. DATA :it_ab_wage TYPE TABLE OF rgsb4. TABLES p0002.

CLEAR wa_fcat. wa_fieldcat-fieldname = 'PERNR'. APPEND wa_fieldcat TO it_fieldcat. SELECT * FROM zhrtr_aus_wt_du INTO TABLE it_final WHERE pernr IN s_pernr. *BEGDA wa_fieldcat-fieldname = 'BEGDA'. *PERNR * wa_fcat-col_pos = 1. g_repid = sy-repid. START-OF-SELECTION. CLEAR wa_fieldcat. PERFORM f_get_data. APPEND wa_fieldcat TO it_fieldcat. .YYYY'. wa_fcat-seltext_l = 'Personnel No'. CLEAR wa_fcat.MM. wa_fcat-col_pos = sy-tabix. CLEAR wa_fieldcat. CLEAR wa_fieldcat. wa_fcat-seltext_l = 'Date'. wa_fieldcat-col_pos = sy-tabix. APPEND wa_fcat TO it_fcat. PERFORM display. wa_fieldcat-fieldname = wa_ab_wage-from . APPEND wa_fcat TO it_fcat.* FORM f_build_filedcat .------------------* *& Include ZFORMS_SK *&--------------------------------------------------------------------. wa_fcat-fieldname = 'PERNR'.* *&--------------------------------------------------------------------. CALL FUNCTION 'G_SET_GET_ALL_VALUES' EXPORTING client = sy-mandt setnr = 'ZAUS_WAGE' class = '0000' no_descriptions = ' ' no_rw_info ='' TABLES set_values = it_ab_wage EXCEPTIONS set_not_found = 1 OTHERS = 2. *BEGDA * wa_fcat-col_pos = 2.INITIALIZATION. LOOP AT it_ab_wage INTO wa_ab_wage. PERFORM f_build_filedcat.* *& Form F_BUILD_FILEDCAT *&--------------------------------------------------------------------. wa_fcat-fieldname = 'BEGDA'. wa_fcat-fieldname = wa_ab_wage-from . *PERNR wa_fieldcat-col_pos = 1. PERFORM f_create_itab_dynamically. *&--------------------------------------------------. wa_fcat-datatype = 'DD.

CLEAR wa_fieldcat. ENDIF.IF wa_fieldcat-fieldname CA '/'. *PERNR ASSIGN COMPONENT 'PERNR' OF STRUCTURE <wa_final> TO <fs_pernr> . " F_BUILD_FILEDCAT *&--------------------------------------------------------------------. wa_fcat-fieldname = wa_ab_wage-from.* FORM f_get_data . * Create dynamic work area and assign to Field Symbol CREATE DATA dyn_line LIKE LINE OF <fs_final> . CONCATENATE wa_final-begda+6(2) wa_final-begda+4(2) wa_final- . wa_fieldcat-intlen = c_30 .* *& Form F_GET_DATA *&--------------------------------------------------------------------. wa_fcat-seltext_l = wa_ab_wage-from. ENDIF. ENDLOOP. ENDIF. APPEND wa_fieldcat TO it_fieldcat. IF wa_final-lgart+0(1) EQ '/'. *begda ASSIGN COMPONENT 'BEGDA' OF STRUCTURE <wa_final> TO <fs_begda> . SORT it_final BY pernr.---* FORM f_create_itab_dynamically . * Create dynamic internal table and assign to Field-Symbol CALL METHOD cl_alv_table_create=>create_dynamic_table EXPORTING it_fieldcatalog = it_fieldcat IMPORTING ep_table = dyn_table. LOOP AT it_final INTO wa_final. TRANSLATE wa_fieldcat-fieldname USING '/ '. APPEND wa_fcat TO it_fcat. TRANSLATE wa_fcat-fieldname USING '/ '. ASSIGN dyn_line->* TO <wa_final> . CONDENSE wa_fcat-fieldname NO-GAPS. CONDENSE wa_fieldcat-fieldname NO-GAPS. ASSIGN dyn_table->* TO <fs_final>. IF wa_fcat-fieldname CA '/'. " F_CREATE_ITAB_DYNAMICALLY *&--------------------------------------------------------------------. ENDFORM. ENDFORM. <fs_pernr> = wa_final-pernr. l_lgart = wa_final-lgart+1(3). CLEAR wa_fcat.* *& Form F_CREATE_ITAB_DYNAMICALLY *&-----------------------------------------------------------------. <fs_lgart> TYPE ANY. FIELD-SYMBOLS : <fs_pernr> TYPE ANY. <fs_begda> TYPE ANY. DATA : l_lgart TYPE char4.

ENDFORM. INSERT <wa_final> INTO TABLE <fs_final>. * if sy-subrc eq 0. <fs_lgart> = wa_final-betrg. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING * * * * * * i_callback_program = g_repid is_layout = wa_layout i_callback_user_command = g_user_command it_fieldcat = it_fcat is_variant = wa_variant i_save = g_save it_events = it_events[] TABLES t_outtab = <fs_final> EXCEPTIONS program_error =1 . AT END OF pernr. ENDLOOP. EXIT. LEAVE LIST-PROCESSING. * <fs_begda> = wa_final-begda. ELSE.* FORM display . IF sy-subrc <> 0. ENDIF. CLEAR l_lgart.begda+0(4) INTO <fs_begda> SEPARATED BY '. FREE : <wa_final>. CLEAR g_repid. ASSIGN COMPONENT l_lgart OF STRUCTURE <wa_final> TO <fs_lgart>.'. ENDAT. " DISPLAY "#EC * "#EC * . " F_GET_DATA *&--------------------------------------------------------------------.* *& Form DISPLAY *&--------------------------------------------------------------------. * READ TABLE it_ab_wage INTO wa_ab_wage with key pernr = <fs-pernr> LGART = l_lgart. ENDFORM.

Sign up to vote on this title
UsefulNot useful