*&---------------------------------------------------------------------*
REPORT ZHCM_RPT MESSAGE-ID SY.
*----------------------------------------------------------------------*
* DEFINICIÓN DE INFOTIPOS
*----------------------------------------------------------------------*
INFOTYPES: 0001,0002,0006,0008,0014,0185.
*----------------------------------------------------------------------*
* DEFINICIÓN DE TABLAS
*----------------------------------------------------------------------*
TABLES: PERNR,PYORGSCREEN, PYTIMESCREEN.
NODES: PAYROLL TYPE PAY99_RESULT.
*----------------------------------------------------------------------*
* DEFINICIÓN DE VARIABLES
*----------------------------------------------------------------------*
DATA: GV_MOLGA TYPE MOLGA. * PAYROLL
DATA MYLIST LIKE PC261 OCCURS 0 .
DATA WA_MYLIST LIKE LINE OF MYLIST.
DATA PAY TYPE REF TO CL_PAY. "GLOBAL CLASS
DATA: WA_RT LIKE LINE OF PAYROLL-INTER-RT,
IT_VERSC TYPE PC202 OCCURS 0 WITH HEADER LINE,
IT_RT TYPE PC207 OCCURS 0 WITH HEADER LINE,
IT_BT TYPE PC209 OCCURS 0 WITH HEADER LINE,
IT_EVP TYPE PC261 OCCURS 0 WITH HEADER LINE,
IT_V0 TYPE PC20C OCCURS 0 WITH HEADER LINE. *
DATA: BEGIN OF GT_CLUSTER OCCURS 0,
SEQNR TYPE CDSEQ, "Nº de secuencia
EVP TYPE PC261,
VERSC TYPE PC202,
RT TYPE STANDARD TABLE OF PC207,
END OF GT_CLUSTER. DATA: LV_INPER LIKE PC261-INPER. *-----------------------------------------------------------------------
* DEFINICION DE INCLUDES
*-----------------------------------------------------------------------
INCLUDE SBAL_CONSTANTS. "STANDAR
INCLUDE ZHCM_RPT_SIN_ZOOESTE_ALV.
*-----------------------------------------------------------------------
INITIALIZATION.
*-----------------------------------------------------------------------
START-OF-SELECTION.
*-----------------------------------------------------------------------
LV_INPER(4) = PYABRJ0.
LV_INPER+4(2) = PYABRP0.
"PN_PAPER
PN_PAPER-PABRJ = PYABRJ0.
PN_PAPER-PABRP = PYABRP0.
"PNP - PY-
PNPPABRJ = PNPDISPJ = PYABRJ1 = PYABRJ0.
PNPPABRP = PNPDISPP = PYABRP1 = PYABRP0.
PNPBEGDA = PNPBEGPS = PNPDISBD = PYBEGDA.
PNPENDDA = PNPENDPS = PNPDISED = PYENDDA.
"PN
PN-PAPER-PABRJ = PN-PABRJ = PYABRJ0.
PN-PAPER-PABRP = PN-PABRP = PYABRP0.
PN-BEGDA = PN-BEGPS = PN-BEGMC = PYBEGDA.
PN-ENDDA = PN-ENDPS = PN-ENDMC = PYENDDA.
"Area de Nómina
PYABKRS-SIGN = 'I'.
PYABKRS-OPTION = 'EQ'.
PYABKRS-LOW = PYXABKR.
PYABKRS-HIGH = ''.
APPEND PYABKRS.
*-----------------------------------------------------------------------
GET PERNR.
*-----------------------------------------------------------------------
CLEAR MYLIST. REFRESH MYLIST.
CLEAR: GT_CLUSTER. REFRESH GT_CLUSTER[].
"Leo RGDIR
CREATE OBJECT PAY.
CALL METHOD PAY->READ_RESULT
IMPORTING
LIST = MYLIST.
"Filtro RGDIR
DELETE MYLIST WHERE FPPER NE LV_INPER.
DELETE MYLIST WHERE OCRSN NE SPACE.
DELETE MYLIST WHERE SRTZA NE 'A'."Actual
"Cargo RGDIR
CALL METHOD PAY->WRITE_RESULT
EXPORTING
LIST = MYLIST.
*-----------------------------------------------------------------------
GET PERNR LATE.
*-----------------------------------------------------------------------
RP-PROVIDE-FROM-LAST P0001 SPACE PYBEGDA PYENDDA.
RP-PROVIDE-FROM-LAST P0002 SPACE PYBEGDA PYENDDA.
RP-PROVIDE-FROM-LAST P0006 '1' PYBEGDA PYENDDA.
RP-PROVIDE-FROM-LAST P0008 SPACE PYBEGDA PYENDDA.
RP-PROVIDE-FROM-LAST P0185 SPACE PYBEGDA PYENDDA.
PERFORM GET_MOLGA USING PERNR-PERNR GV_MOLGA.
LOOP AT GT_CLUSTER.
CLEAR: IT_VERSC[], IT_EVP[], IT_V0[], IT_RT[], IT_BT[].
MOVE-CORRESPONDING GT_CLUSTER-VERSC TO IT_VERSC.
APPEND LINES OF GT_CLUSTER-RT TO IT_RT. *
I_OUTPUT_LIST-PERNR = PERNR-PERNR.
READ TABLE P0014 WITH KEY LGART = '2S22'.
IF ( SY-SUBRC EQ 0 ).
IF ( P0014-ANZHL EQ 1 ).
I_OUTPUT_LIST-AFILI = 'S'.
ELSE.
I_OUTPUT_LIST-AFILI = 'N'.
ENDIF.
ELSE.
I_OUTPUT_LIST-AFILI = 'N'.
ENDIF.
READ TABLE IT_RT WITH KEY LGART = '/101'.
IF ( SY-SUBRC EQ 0 ).
I_OUTPUT_LIST-TO_RE = IT_RT-BETRG.
ENDIF.
READ TABLE IT_RT WITH KEY LGART = '/106'.
IF ( SY-SUBRC EQ 0 ).
I_OUTPUT_LIST-TO_IM = IT_RT-BETRG.
ENDIF.
READ TABLE IT_RT WITH KEY LGART = '9000'.
IF ( SY-SUBRC EQ 0 ).
I_OUTPUT_LIST-JO_HO = IT_RT-ANZHL.
ENDIF.
I_OUTPUT_LIST-TO_AC = 0.
LOOP AT IT_RT WHERE LGART EQ '2S05'
OR LGART EQ '2S22'
OR LGART EQ '2S23'.
I_OUTPUT_LIST-TO_AC = I_OUTPUT_LIST-TO_AC + IT_RT-BETRG.
ENDLOOP.
I_OUTPUT_LIST-WAERS = 'USD'.
APPEND I_OUTPUT_LIST.
ENDLOOP. *
*-----------------------------------------------------------------------
GET PAYROLL.
*-----------------------------------------------------------------------
CLEAR: IT_VERSC[], IT_EVP[], IT_V0[], IT_RT[], IT_BT[]. *
MOVE-CORRESPONDING PAYROLL-INTER-VERSC TO IT_VERSC.
MOVE-CORRESPONDING PAYROLL-EVP TO IT_EVP. *
LOOP AT PAYROLL-INTER-RT INTO IT_RT
WHERE LGART EQ '/101'
OR LGART EQ '2S22'
OR LGART EQ '9000'
OR LGART EQ '2S05'
OR LGART EQ '2S23'
OR LGART EQ '/106'.
APPEND IT_RT.
ENDLOOP. * Paso los datos a la tabla interna
GT_CLUSTER-SEQNR = PAYROLL-EVP-SEQNR.
MOVE-CORRESPONDING IT_EVP TO GT_CLUSTER-EVP.
MOVE-CORRESPONDING IT_VERSC TO GT_CLUSTER-VERSC.
APPEND LINES OF IT_RT TO GT_CLUSTER-RT.
APPEND GT_CLUSTER.
*-----------------------------------------------------------------------
END-OF-SELECTION.
*-----------------------------------------------------------------------
PERFORM MUESTRA_ALV.
*-----------------------------------------------------------------------
*Forms
*-----------------------------------------------------------------------
FORM GET_MOLGA USING PERNR TYPE PERNR_D MOLGA TYPE MOLGA.
... ENDFORM.
*-----------------------------------------------------------------------
Definicion de la clase de reporte de Nómina
y como siempre les comento, si hay otra forma mas facil me avisan