Sunday, 15 September 2013

HR report from cummulate results table

HR report from Cummulate results table

-----Original Message-----
Subject: HR report from Cummulate results table
Very new to HR-ABAP - need report desperately - I can see the totals I need when I use the following path but don't know how to get at them for the report. We are using 4.0 w/4.6 GUI frontend.
Path is: Human Resources->Payroll->key in 10->key in 10->Tools->Payroll Results->Display--> Dbl click on a week-->select CRT-->dbl click on the name Cumulated Results Table. All the totals I need for the report are there. 
Report column headers are YTD totals for:
reg/hrs...O/T hrs...Prm/Hours...Total YTD/Hrs...Reg/Cost...O/T 
Cost...Prm/Cost...Standby/Cost...Misc/Cost...Total YTD Cost
The total hrs & YTD total costs I can sum from the fields shown in this table. I just can't figure out how to extract them from there or how they got there. 
Can somebody please help - time is running out for me - I'm already at my deadline. Everytime I try something- it's a dead end. 

-----Reply Message-----
Subject: RE: HR report from Cummulate results table
A program has to be written to extract the CRT data based on the particular employee and payroll period you are getting.
Try this.
TABLES: PERNR,
        PCL2.
*----------------------------------------------------------------------*
*   INCLUDE ZHR_PCL2_CU_DATA - Payroll results.                        *
*----------------------------------------------------------------------*
* Data declarations for the IMPORT of database PCL2 for cluster RU.    *
*----------------------------------------------------------------------*
DATA: CD_NEXT_SEQ    TYPE I,               "Next available seq number
      CD_LAST_PAY    TYPE D.               "Last payroll run date
DATA: BEGIN OF OCD_VERSION.
        INCLUDE STRUCTURE PC201.  "Technical Version
*DATA:   molga  LIKE t001p-molga.    "country identifier
DATA: END OF OCD_VERSION.
DATA: BEGIN OF RGDIR OCCURS 100.
         INCLUDE STRUCTURE PC261.  "(For Export and Import of Payroll Res
DATA: END OF RGDIR.
* Key for database PCL2 cluster RU
DATA BEGIN OF RX_KEY.
       INCLUDE STRUCTURE PC200.  "Payroll Results Key
DATA: END OF RX_KEY.
* country dependent
DATA: BEGIN OF  RU-VERSION.
        INCLUDE STRUCTURE PC201.  "Technical Version
DATA: END OF  RU-VERSION.
DATA: BEGIN OF ORU_VERSION.
        INCLUDE STRUCTURE PC201.  "Technical Version
DATA: END OF ORU_VERSION.
* Cumulated-result table
DATA:  BEGIN OF CRT OCCURS 30.
         INCLUDE STRUCTURE PC22Y.  "Cumulated result table (USA)
DATA:  END   OF CRT.
GET PERNR.
  IMPORT CD_VERSION TO OCD_VERSION
                       CD_LAST_PAY
                       CD_NEXT_SEQ
                       RGDIR
         FROM DATABASE PCL2(CU) ID PERNR-PERNR.
  CHECK SY-SUBRC EQ 0.
* This is where you select the particular period you are searching for.  The
* selection will change based on what dates you are looking for.
  LOOP AT RGDIR WHERE FPPER EQ P_PERIOD
                AND   INPER EQ P_PERIOD
                AND ( RUNDT GT Z_RUNDT
                OR  ( RUNDT EQ Z_RUNDT
                AND   RUNTM GT Z_RUNTI ) )
                AND   SRTZA =  'A'
                AND   PAYTY =  ' '
                AND   VOID  NE 'V'.
    CHECK SY-SUBRC = 0.
    MOVE PERNR-PERNR TO RX_KEY-PERNR.
    MOVE RGDIR-SEQNR TO RX_KEY-SEQNO.
   IMPORT RU-VERSION TO ORU-VERSION
          CRT
     FROM DATABASE PCL2(RU) ID RX_KEY.
     CHECK SY_SUBRC = 0.
   LOOP AT CRT.
     Process crt data.
   ENDLOOP.

  ENDLOOP.  

No comments:

Post a Comment