Skip to Content
avatar image
Former Member

Retrieving data from Clusters

hi,

I need to develop a report for pay roll.

one of the field called "Net Sal" from a cluster.

How do i retrieve data from the clusters?

Thanks & Regards

Chetana

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Apr 21, 2006 at 12:13 PM

    Hi Chetana,

    If you need to do a form to report wages and the data is stored in the PCL4 Cluster.

    You can look at this example report or form that retrieves data from this cluster based on several parameters that are entered when the report is executed online (like employee number and tax year).

    In SE38 or SA38, execute the sample program EXAMPLE_PNP_GET_PAYROLL

    Cheers

    VJ

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 21, 2006 at 12:13 PM

    hi

    plz refer the following program and use logical database PNP in the LDB section and modify the wagetypes in rt-lgart in the program to suit ur needs.

    reward points if it helps!!

    gunjan

    &----


    *& Report ZHR_PAYROLL

    *&

    &----


    *&

    *&

    &----


    REPORT ZHR_PAYROLL.

    TABLES: PCL1,PCL2,PERNR,PA0001,PA0002,PA0008.

    INCLUDE RPC2CD09. "Cluster CD data definition

    INCLUDE RPC2CA00. "Cluster CA Data-Definition

    INCLUDE RPPPXD00. "Data Definition buffer PCL1/PCL2 Buffer

    INCLUDE RPPPXD10. "Common part buffer PCL1/PCL2

    INCLUDE RPPPXM00. "Buffer Handling routine

    *COUNTRY SPECIFIC INCLUDE

    INCLUDE PC2RXIN0. "Cluster IN data definition

    INCLUDE RPC2RX09. "Data Definition for Cluster RD in PCL2

    *For Error records

    DATA: BEGIN OF HR_ERROR OCCURS 10.

    INCLUDE STRUCTURE HRERROR.

    DATA: END OF HR_ERROR.

    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

    PARAMETERS:P_PAYTYP LIKE PC261-PAYTY,

    P_RUNDAT LIKE PC261-BONDT.

    SELECTION-SCREEN END OF BLOCK B1 .

    DATA: BEGIN OF T_MAIN OCCURS 0,

    W_PERNR LIKE PA0001-PERNR,

    W_ENAME LIKE PA0001-ENAME,

    W_GROSS TYPE P DECIMALS 2,

    W_SALARY TYPE P DECIMALS 2,

    END OF T_MAIN.

    START-OF-SELECTION.

    GET PERNR.

    PERFORM GET_RT_DETAILS.

    END-OF-SELECTION.

    PERFORM DISPLAY_RESULT.

    &----


    *& Form GET_RT_DETAILS

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM GET_RT_DETAILS .

    CLEAR RGDIR.

    **IMPORT CLUSTER RESULTS FROM CLUSTER DIRECTORY**

    CD-KEY-PERNR = PERNR-PERNR.

    RP-IMP-C2-CU.

    • RETURN CODE FROM IMPORT.

    IF RP-IMP-CD-SUBRC <> 0.

    • MESSAGE S124(HRPADIN01) WITH PERNR-PERNR.

    • Payroll results not found for the employee no. &

    PERFORM BUILD_ERROR TABLES HR_ERROR

    USING PERNR-PERNR 'HRPADIN01'

    '124' PERNR-PERNR SPACE SPACE SPACE.

    REJECT.

    ENDIF.

    =====================================================================

    • SAPGUI Progress indicator

    =====================================================================

    • MESSAGE w_progress TYPE 'S' DISPLAY LIKE 'I'.

    SORT RGDIR BY FPPER DESCENDING.

    LOOP AT RGDIR WHERE FPBEG GE PN-BEGDA AND FPEND LE PN-ENDDA

    AND SRTZA = 'A' AND PAYTY = P_PAYTYP AND BONDT = P_RUNDAT.

    • PERFORM progress_indicator.

    **IMPORT RESULTS FROM INDIA PAYROLL CLUSTER**

    RX-KEY-SEQNO = RGDIR-SEQNR.

    RX-KEY-PERNR = PERNR-PERNR.

    RP-IMP-C2-IN.

    • RETURN CODE FROM IMPORT.

    IF RP-IMP-IN-SUBRC <> 0.

    CONTINUE.

    ENDIF.

    PERFORM FILL_T_MAINTAB.

    ENDLOOP. " RGDIR

    ENDFORM. " GET_RT_DETAILS

    &----


    *& Form FILL_T_MAINTAB

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM FILL_T_MAINTAB .

    LOOP AT RT.

    CASE RT-LGART.

    WHEN '/101'.

    ADD RT-BETRG TO T_MAIN-W_GROSS.

    CLEAR RT-BETRG.

    WHEN '1002'.

    ADD RT-BETRG TO T_MAIN-W_SALARY.

    CLEAR RT-BETRG.

    ENDCASE.

    ENDLOOP.

    APPEND T_MAIN.

    CLEAR T_MAIN.

    ENDFORM. " FILL_T_MAINTAB

    &----


    *& Form BUILD_ERROR

    &----


    • text

    ----


    • -->HR_ERROR text

    • -->$PERNR text

    • -->$MSGID text

    • -->$MSGNO text

    • -->$MSGV1 text

    • -->$MSGV2 text

    • -->$MSGV3 text

    • -->$MSGV4 text

    ----


    FORM BUILD_ERROR TABLES HR_ERROR STRUCTURE HR_ERROR

    USING $PERNR

    $MSGID

    $MSGNO

    $MSGV1

    $MSGV2

    $MSGV3

    $MSGV4.

    HR_ERROR-PERNR = $PERNR.

    HR_ERROR-ARBGB = $MSGID.

    HR_ERROR-MSGTY = 'E'.

    HR_ERROR-MSGNO = $MSGNO.

    HR_ERROR-MSGV1 = $MSGV1.

    HR_ERROR-MSGV2 = $MSGV2.

    HR_ERROR-MSGV3 = $MSGV3.

    HR_ERROR-MSGV4 = $MSGV4.

    APPEND HR_ERROR.

    ENDFORM. "BUILD_ERROR

    &----


    *& Form DISPLAY_RESULT

    &----


    • text

    ----


    • --> p1 text

    • <-- p2 text

    ----


    FORM DISPLAY_RESULT .

    LOOP AT T_MAIN.

    FORMAT COLOR 1.

    WRITE:/12 T_MAIN-W_PERNR,22 T_MAIN-W_ENAME,56 T_MAIN-W_GROSS,67 T_MAIN-W_SALARY.

    ENDLOOP.

    ENDFORM. " DISPLAY_RESULT

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 21, 2006 at 12:18 PM

    hi,

    use following satement

    IMPORT obj1 ... objn FROM DATABASE dbtab(ar) ID key.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 21, 2006 at 12:20 PM

    Hi Chetana,

    You will first have to read the RGDIR & the read the Payroll result by looping at it.. You can use the function modules CU_READ_RGDIR_NEW & PYXX_READ_PAYROLL_RESULT for that. The output of the second function will be an itab with a deep structure.. You will have to loop at it with a statement like

    <i><b>loop at t_payroll_result-inter-rt.. where lgart = '/560'</b></i>

    to get the 'Net Sal' value..

    Hope this helps..

    Regards,

    Suresh datti

    Add comment
    10|10000 characters needed characters exceeded