How to Store Simulation Payroll Result for any Reconciliation

...Previous

Now maintain the wage types in Set values.  

TYPE-POOLS: slis.
TABLES p0002.
DATA : it_final TYPE TABLE OF zhrtr_aus_wt_du ,
       wa_final 
TYPE zhrtr_aus_wt_du.

DATA :it_ab_wage  TYPE TABLE OF rgsb4,
       wa_ab_wage 
TYPE  rgsb4.

DATA : wa_fieldcat TYPE lvc_s_fcat,
       it_fieldcat 
TYPE lvc_t_fcat.

DATA: it_fcat TYPE slis_t_fieldcat_alv,
      wa_fcat 
TYPE slis_fieldcat_alv,
      g_save  
TYPE c VALUE 'A'.

DATA : dyn_table TYPE REF TO data,
       dyn_line  
TYPE REF TO data.
DATA : g_repid   TYPE sy-repid.

FIELD-SYMBOLS: <fs_final> TYPE STANDARD TABLE,
               <wa_final> 
TYPE any,
               <data>  
TYPE any.

CONSTANTS : c_30 TYPE char2  VALUE '30',
            c_13 
TYPE char2  VALUE '13',
            c_2  
TYPE char1  VALUE '2',
            c_7  
TYPE char1  VALUE '7',
            c_p  
TYPE char1  VALUE 'P'.

SELECTION-
SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS s_pernr FOR p0002-pernr MATCHCODE OBJECT perm.
SELECTION-
SCREEN END OF BLOCK b1.  

INCLUDE ZHRREP_AUS_DUMMY_WT_FORMS.

INITIALIZATION.
  g_repid = sy-repid.

START-
OF-SELECTION.
  
PERFORM f_build_filedcat.
  
PERFORM f_create_itab_dynamically.
  
PERFORM f_get_data.
  
PERFORM display.  

*&---------------------------------------------------------------------*
*&  Include           ZFORMS_SK
*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Form  F_BUILD_FILEDCAT
*&---------------------------------------------------------------------*

FORM f_build_filedcat .
  
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.

  
SELECT * FROM zhrtr_aus_wt_du INTO TABLE it_final WHERE pernr IN s_pernr.
*PERNR
  wa_fieldcat-col_pos = 
1.
  wa_fieldcat-fieldname  = 
'PERNR'.
  
APPEND wa_fieldcat TO it_fieldcat.
  
CLEAR wa_fieldcat.
*BEGDA
  wa_fieldcat-fieldname  = 
'BEGDA'.
  
APPEND wa_fieldcat TO it_fieldcat.
  
CLEAR wa_fieldcat.
*PERNR
*    wa_fcat-col_pos = 1.
  wa_fcat-fieldname  = 
'PERNR'.
  wa_fcat-seltext_l = 
'Personnel No'.
  
APPEND wa_fcat TO it_fcat.
  
CLEAR wa_fcat.
*BEGDA
*    wa_fcat-col_pos = 2.
  wa_fcat-fieldname  = 
'BEGDA'.
  wa_fcat-seltext_l = 
'Date'.
  wa_fcat-datatype  = 
'DD.MM.YYYY'.
  
APPEND wa_fcat TO it_fcat.
  
CLEAR wa_fcat.
  
LOOP AT it_ab_wage INTO wa_ab_wage.
    
CLEAR wa_fieldcat.

    wa_fieldcat-col_pos    =  sy-tabix.
    wa_fieldcat-fieldname  = wa_ab_wage-
from .
    wa_fcat-col_pos    =  sy-tabix.
    wa_fcat-fieldname  = wa_ab_wage-
from .
    
IF wa_fieldcat-fieldname CA '/'.
      
TRANSLATE wa_fieldcat-fieldname USING '/ '.
      
CONDENSE wa_fieldcat-fieldname NO-GAPS.
    
ENDIF.

    wa_fcat-fieldname =  wa_ab_wage-
from.
    
IF wa_fcat-fieldname CA '/'.
      
TRANSLATE wa_fcat-fieldname USING '/ '.
      
CONDENSE wa_fcat-fieldname NO-GAPS.
    
ENDIF.
    wa_fieldcat-intlen   = c_30 .
    wa_fcat-seltext_l = wa_ab_wage-
from.

    
APPEND wa_fieldcat TO it_fieldcat.
    
CLEAR wa_fieldcat.

    
APPEND wa_fcat TO it_fcat.
    
CLEAR wa_fcat.
  
ENDLOOP.
ENDFORM.                    " F_BUILD_FILEDCAT
*&---------------------------------------------------------------------*
*&      Form  F_CREATE_ITAB_DYNAMICALLY
*&---------------------------------------------------------------------*

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.

  
ASSIGN dyn_table->* TO <fs_final>.
* Create dynamic work area and assign to Field Symbol
  
CREATE DATA dyn_line LIKE LINE OF <fs_final> .

  
ASSIGN dyn_line->* TO <wa_final> .

ENDFORM.                    " F_CREATE_ITAB_DYNAMICALLY
*&---------------------------------------------------------------------*
*&      Form  F_GET_DATA
*&---------------------------------------------------------------------*

FORM f_get_data .
  
FIELD-SYMBOLS : <fs_pernr> TYPE ANY,
                  <fs_begda> 
TYPE ANY,
                  <fs_lgart> 
TYPE ANY.
  
DATA : l_lgart     TYPE char4.
  
SORT it_final BY pernr.

  
LOOP AT it_final INTO wa_final.
*PERNR
    
ASSIGN COMPONENT 'PERNR' OF STRUCTURE <wa_final> TO <fs_pernr> .
    <fs_pernr> = wa_final-pernr.
    
IF wa_final-lgart+0(1EQ '/'.
      l_lgart = wa_final-lgart+
1(3).
    
ENDIF.
*begda
    
ASSIGN COMPONENT 'BEGDA' OF STRUCTURE <wa_final> TO <fs_begda> .
    
CONCATENATE wa_final-begda+6(2) wa_final-begda+4(2) wa_final-begda+0(4INTO <fs_begda> SEPARATED BY '.'.
*    <fs_begda> = wa_final-begda.
*    READ TABLE it_ab_wage INTO wa_ab_wage with key pernr = <fs-pernr> LGART = l_lgart.
*    if sy-subrc eq 0.
    
ASSIGN COMPONENT l_lgart OF STRUCTURE <wa_final> TO <fs_lgart>.
    <fs_lgart> = wa_final-betrg.
    
CLEAR l_lgart.
    
AT END OF pernr.
      
INSERT <wa_final> INTO TABLE <fs_final>.
      
FREE : <wa_final>.
    
ENDAT.
  
ENDLOOP.
ENDFORM.                    " F_GET_DATA
*&---------------------------------------------------------------------*
*&      Form  DISPLAY
*&---------------------------------------------------------------------*

FORM display .
  
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                                            "#EC *
        program_error                     = 
1  .
  
IF sy-subrc <> 0.                                         "#EC *
    
EXIT.
  
ELSE.
    
LEAVE LIST-PROCESSING.
  
ENDIF.
  
CLEAR g_repid.
ENDFORM.                    " DISPLAY  

 

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image