SAP HCM CHILE PREVIRED

From SapWiki

Programa

  • HCLCPRVD0 (trn. PC00_M39_RPRV )

Ver formularios

Tablas Previred

Determinar lógica y modificarla para un campo de interfaz PREVIRED

(ver nota SAP 2464261 - How to customized PREVIRED Interface (HCLCPRVD0) )

Digamos que se desea determinar la lógica del campo N° 18 y modificarla, vamos a la tabla T5F99FD con:

T5F99FD-MOLGA = '39'
T5F99FD-APPL = 'PRVD'
T5F99FD-ORDSE = 18

obtenemos T5F99FD-FIELD, en este caso = 'TRAMO'

vamos a tabla T5F99FF con

T5F99FF-MOLGA = '39'
T5F99FF-APPL = 'PRVD'
T5F99FF-FIELD = 'TRAMO'

se observa que T5F99FF-FNAME = 'HR_CL_DAQ_PROCESS_CCAF'

vamos a la trn. SE37 con HR_CL_DAQ_PROCESS_CCAF

se observa que acá esta la lógica para determinar el tramo:

    WHEN 'TRAMO'. "Family Allowance Brackets
      PERFORM get_bracket USING ls_wpbp
                                ls_pay-inter-rt
                                lr_employee->at_p0008
                       CHANGING ls_value-data.

Si queremos modificar la lógica para determinar el tramo debemos copiar la función HR_CL_DAQ_PROCESS_CCAF digamos a ZHR_CL_DAQ_PROCESS_CCAF e incluir la lógica necesaria, en este caso:

FUNCTION zhr_cl_daq_process_ccaf.
*"--------------------------------------------------------------------
*"*"Interfase local
*"  IMPORTING
*"     REFERENCE(IM_DAQ) TYPE  P99SD_CODAQ
*"     REFERENCE(IM_TAB_PAY) TYPE  TABLE
*"     REFERENCE(IM_TAB_TIME) TYPE  TABLE
*"     REFERENCE(IM_TAB_PRELP) TYPE  P99SG_TAB_PRELP OPTIONAL
*"     REFERENCE(IM_TAB_USER) TYPE  TABLE OPTIONAL
*"     REFERENCE(IM_FORM) TYPE REF TO CL_HR99S00_DAQ
*"     REFERENCE(IM_WAFOR) TYPE  P99SD_WAFOR OPTIONAL
*"     REFERENCE(IM_TAB_FODAT) TYPE  P99SD_TAB_FODAT OPTIONAL
*"  EXPORTING
*"     REFERENCE(EX_TAB_VALUE) TYPE  P99SD_TAB_VALUE
*"     REFERENCE(EX_RETURNCODE) TYPE  SY-SUBRC
*"  CHANGING
*"     REFERENCE(CH_TAB_ERROR) TYPE  P99SF_TAB_ERROR OPTIONAL
*"     REFERENCE(CH_MISC) TYPE  ANY OPTIONAL
*"--------------------------------------------------------------------
* data definitions
  DATA ls_value             TYPE p99sd_value.
  DATA ls_employee          TYPE hr99b_hrf_ee_misc.
  DATA lr_employee          TYPE REF TO cl_hrpaycl_employee.
  DATA lt_pay         TYPE hrpaycl_tab_of_results.
  DATA ls_wpbp        TYPE pc205.
  DATA ls_pay         TYPE paycl_result.
  DATA ls_aux_pay     TYPE paycl_result.

  lt_pay = im_tab_pay.

  ls_employee = ch_misc.
  lr_employee ?= ls_employee-employee.

* Get last payroll result whitin period
  LOOP AT lt_pay INTO ls_aux_pay WHERE evp-payty IS INITIAL.
    LOOP AT ls_aux_pay-inter-wpbp INTO ls_wpbp WHERE aktivjn = abap_true.
      ls_pay = ls_aux_pay.
    ENDLOOP.
  ENDLOOP.

  IF ls_wpbp IS INITIAL.
    ls_wpbp-bukrs = lr_employee->a_pernr_el-bukrs.
  ENDIF.

  ls_value-begda = im_daq-begda.
  ls_value-endda = im_daq-endda.

  CASE im_wafor-field.
    WHEN 'TRAMO'. "Family Allowance Brackets

      DATA: lt_p9021 TYPE TABLE OF p9021.
*  leer el tramo del trabajador vía ITP9021 para el pago de asignaciones familiares

      CALL FUNCTION 'HR_READ_INFOTYPE'
        EXPORTING
          pernr           = lr_employee->a_pernr
          infty           = '9021'
        TABLES
          infty_tab       = lt_p9021
        EXCEPTIONS
          infty_not_found = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
* Implement suitable error handling here
      ENDIF.

      LOOP AT lt_p9021 INTO DATA(ls_p9021) WHERE begda <= ls_wpbp-endda AND
                           endda >= ls_wpbp-begda.
      ENDLOOP.
      IF sy-subrc = 0.
        ls_value-data = ls_p9021-tramo.
      ELSE.
        PERFORM get_bracket USING ls_wpbp
                                  ls_pay-inter-rt
                                  lr_employee->at_p0008
                         CHANGING ls_value-data.

      ENDIF.
  ENDCASE.

  APPEND ls_value TO ex_tab_value.
ENDFUNCTION.

por último actualizamos la vista V_T5F99FF (trn. SM30) para field = 'TRAMO' con la nueva función ZHR_CL_DAQ_PROCESS_CCAF

Notas SAP Previred

Varios PREVIRED

CL_HRPAYCL_DAQ_ENGINE  => RUN_1_DAQ

CALL METHOD ar_daq_form->get_values_forms

#####################################################
function HR_99S_DAQ_GET_VALUES
para analizar poner break acá:

        loop at <fs_sectn>-field ASSIGNING <fs_fifor> where field in im_field.

*         init
          wa_form-field = <fs_fifor>-field.
          wa_form-ficon = <fs_fifor>-atrib.  "<--------BREAK-POINT

#####################################################
function HR_99S_DAQ_GET_FIELD

LHR99S00_DAQF02 form daq_wages

HR_CL_IF_PRVD_GENERATE_FILE
transaccion DAQ_UPLOAD

 
function HR_CL_IF_PRVD_FORMAT_FODAT => (clase CL_HRPAYCL_PRVD_TABLE_HANDLER, método FILL_STRUCTURE):

feature CLCAF

HR_CL_READ_T7CL29

###########################################
LHRPAYCL_IF_PRVDF01 656