Cluster PCL2/B2 = function module

Hi,
is there a function module for reading table SALDO in CLuster PCL2/B2? I prefer using function models or classes instead of this include stuff.
For payroll results i found suitable FM, but i found nothing for cluster PCL2/B2.
Any hints?
cu
  Rainer

hi,
try using the following include ...in some way it's faster n efficient!!
INCLUDE:
mpzdat02,   " Work tables for daily work
rpppxd00,   " R/3 data definition for PCL1  & pcl2 buffer
rpppxd10,   " Data definition for PCL1, pcl2
pc2rxid0,   " Data definition, cluster IS file pcl2
rpclst00,
rpc2b200,
rptsim00.
and u can fetch saldo after passing the below mentioned key:
b2-key-pabrj = pdate(4).
b2-key-pabrp = pdate+4(2).
b2-key-cltyp = '1'.
b2-key-pernr = it_pernr-pernr.
IMPORT saldo FROM DATABASE pcl2(b2) ID b2-key.
hence on looping this table u can modify n display the result!!
hope this solves ur query!!
plz reward points if it satisfies!!
Regards,
Gunjan

Similar Messages

  • Function modules to read Time clusters B1 and B2 from PCL1 and PCL2

    Hi All
    Are there any function modules or macros to read time clusters B1 & B2?
    I want to read time data in the clusters for reporting purpose.
    Regards,
    Rupesh Mhatre

    You can also call the FM HR_TIME_RESULTS_GET and get the exact cluster you need from B2 like WPBP, ZE, SALDO etc.
    Otherwise if you want to use the older FM declare the GET_TBUFF and GET_BUFFER_DIR as of below structure.
    DATA: BEGIN OF TBUFF OCCURS 5000.                           "XPMK014785
            INCLUDE STRUCTURE PCL1.
            DATA: SGART(2),
          END OF TBUFF.
    DATA: BEGIN OF BUFFER_DIR OCCURS 2000,                      "XPMK014785
            SGART(2),
            CLIENT LIKE PCL1-CLIENT,
            RELID LIKE PCL1-RELID,
            SRTFD LIKE PCL1-SRTFD,
            NTABX LIKE SY-TABIX, "pointer auf aktuellen satz
            OTABX LIKE SY-TABIX, "pointer auf alten satz (falls vorhanden)
            NNUXT LIKE PCL1-SRTF2, "anzahl folgesaetze aktueller Satz
            ONUXT LIKE PCL1-SRTF2, "anzahl folgesaetze alter Satz
          ofset(3) type p,     "offset innerhalb eines entry
          END OF BUFFER_DIR.
    INT_TIME_RESULTS should be of type PTM_TIME_RESULTS.
    Regards
    Ranganath

  • List of function module used for cluster table

    hi,
      I want to know the list of all function module used th extract data from cluster table such as such MONI, STXL.
    thanks,
    john dias

    When inside SE11 for MONI, lets say, press the where-used list button and select the option for FUNCTION MODULE INTERFACES to see a list of FMs that take a structure of type MONI as input/output parameter. Although this will not give an exhaustive list of FMs, it will assist you to a good extent.
    Additionally, you can try FM APPLICATION_DATA_GET.
    For STXL, take a look at FM READ_TEXT and associated include file LSTXDUXX for more functions in this function group SAPLSTXD.
    Regards
    Message was edited by: Shehryar Khan
    Message was edited by: Shehryar Khan

  • Need function module related to PCL2.

    Hi,
    Is there any function module that gives me all the related entries in PCL2 for any personnel number (PERNR) that i enter?
    I will reward all the useful answers.
    Thanks,
    Mohit.
    Edited by: mohit goel on Feb 28, 2008 2:51 PM

    Hi,
    This is not the one I want.
    This FM does not exist : RP_PRINT_PCL (Is the name write?)
    The other FM does not suffice to my requirement. It does not mention anywhere PERNR.
    Thanks,
    Mohit.

  • Function Module for reading PCL2 - B2 FEHLER table

    Hi,
       Is there any function module can use to read the FEHLER table messages? There is a standard program called RPTERL00 that used to read the FEHLER messages. However, I wish to simplified and use FM to get all the FEHLER table data in my customise program. I will need to delete some of the entries in FEHLER table after the correction has been done. Do you know how to do this?
    Thanks in advance.

    Hi, You don't need pass any data for table tgetbuff .
    Try this simple report. It's work for me:
    REPORT  Z_JRQ038R NO STANDARD PAGE HEADING
                     LINE-COUNT 65
                     LINE-SIZE 175.
    * D.A.T.A.
    DATA: IT_FL TYPE PC2B8 OCCURS 0 WITH HEADER LINE.
    DATA:  BEGIN OF tgetbuff occurs 0,
                  x(10),
               END OF tgetbuff.
    * S.E.L.L.E.C.T.I.O.N.  .S.C.R.E.E.N.
      SELECTION-SCREEN BEGIN OF BLOCK BL02 WITH FRAME TITLE TEXT-S20.
        PARAMETERS:
          PERNR LIKE PA0001-PERNR,
          YEAR  LIKE T549Q-PABRJ,
          MONTH LIKE T549Q-PABRP.
      SELECTION-SCREEN END OF BLOCK BL02.
    * M.A.I.N.  .P.R.O.G.R.A.M.
    START-OF-SELECTION.
      CALL FUNCTION 'HR_TIME_RESULTS_GET'
        EXPORTING
          GET_PERNR     = PERNR
          GET_PABRJ     = YEAR
          GET_PABRP     = MONTH
        TABLES
          GET_TBUFF     = TGETBUFF
          GET_FEHLER    = IT_FL
        EXCEPTIONS
          NO_PERIOD_SPECIFIED   = 1
          WRONG_CLUSTER_VERSION = 2
          NO_READ_AUTHORITY     = 3
          CLUSTER_ARCHIVED      = 4
          TECHNICAL_ERROR       = 5
          OTHERS                = 6.
      CHECK IT_FL[] IS NOT INITIAL.
      LOOP AT IT_FL.
        WRITE: / IT_FL-LDATE, SPACE, IT_FL-LTIME, SPACE, IT_FL-ERRTY.
      ENDLOOP.
    Regards,

  • Function Module Syntactically errors

    Dear Experts, 
    This is function module for Extracting the data from Payroll cluster, it is throwing an error.
    can any one look into this..
    Types : Begin of LS_STR,
         PERNR type P_PERNR,
         SEQNR Type  CDSEQ,
         MOLGA Type  MOLGA,
         LGART Type  LGART,
         ANZHL Type  PRANZ,
         BETRG Type  MAXBT,
         WAERS Type  WAERS,
        END OF LS_STR.
      Types : Begin of LS_STR1,
    PERNR type P_PERNR,
    SEQNR Type  CDSEQ,
    FPPER Type  FAPER,
    INPER Type  IPERI,
    FPBEG Type  FPBEG,
    FPEND Type  FPEND,
    SRTZA Type  SRTZA,
    ABKRS Type  ABKRS,
    PAYTY Type  PAYTY,
    RUNDT Type  RUNDT,
    RUNTM Type  RUNTM,
    PAYDT Type  PAY_DATE,
    PAYID Type  PAYID,
    BONDT Type  BONDT,
    OCRSN Type  PAY_OCRSN,
    INOCR Type  PAY_OCRSN,
    IPEND Type  IPEND,
       END OF LS_STR1.
       types  :begin of ty_pernr,
               pernr type persno,
              end of ty_pernr.
      Data :IT_STR TYPE STANDARD TABLE OF LS_STR,
             WA_STR LIKE LINE OF IT_STR,
             IT_STR1 TYPE TABLE OF LS_STR1,
             WA_STR1 LIKE LINE OF IT_STR1,
             PCL_T TYPE TABLE OF ZPSSTR,
             pcl_w type zpsstr,
             LV_RT TYPE LINE OF HRPAY99_RT,
             PCL_T1 TYPE STANDARD TABLE OF PC261, " Output structure of FM CU_READ_RGDIR.
             PCLW_T1 type pc261,
              PCL_T2 TYPE STANDARD TABLE OF PC261,
             PY_RESULT TYPE  PAY99_RESULT,
             IT_HRPAY99_RT TYPE HRPAY99_RT, " output structure of FM PYXX_READ_PAYROLL_RESULT.
             WA_RESULT type LINE OF HRPAY99_RT,
             LT_PA0008 TYPE TABLE OF LS_STR,
             LS_PA0008 LIKE LINE OF  LT_PA0008,
             LS_E_T_DATA LIKE LINE OF E_T_DATA,
             RELID  TYPE  RELID_PCL,
             PI_PERNR TYPE STANDARD TABLE OF ty_pernr,
             PW_PERNR LIKE LINE OF PI_PERNR,
    *         PW_PERNR TYPE PA0008,
             MOLGA_T TYPE c LENGTH 2.
    * Example: DataSource for table SFLIGHT
      TABLES: PCL2.
    * Auxiliary Selection criteria structure
      DATA: L_S_SELECT TYPE SRSC_S_SELECT.
    * Maximum number of lines for DB table
      STATICS: S_S_IF TYPE SRSC_S_IF_SIMPLE,
    * counter
              S_COUNTER_DATAPAKID LIKE SY-TABIX,
    * cursor
              S_CURSOR TYPE CURSOR.
    * Select ranges
      RANGES: L_R_PERNR FOR PA0008-PERNR.
    * Initialization mode (first call by SAPI) or data transfer mode
    * (following calls) ?
      IF I_INITFLAG = SBIWA_C_FLAG_ON.
    * Initialization: check input parameters
    *                 buffer input parameters
    *                 prepare data selection
    * Check DataSource validity
    *    CASE I_DSOURCE.
    *      WHEN '0SAPI_SFLIGHT_SIMPLE'.
    *      WHEN OTHERS.
    *        IF 1 = 2. MESSAGE E009(R3). ENDIF.
    ** this is a typical log call. Please write every error message like this
    *        LOG_WRITE 'E'                  "message type
    *                  'R3'                 "message class
    *                  '009'                "message number
    *                  I_DSOURCE   "message variable 1
    *                  ' '.                 "message variable 2
    *        RAISE ERROR_PASSED_TO_MESS_HANDLER.
    *    ENDCASE.
        APPEND LINES OF I_T_SELECT TO S_S_IF-T_SELECT.
    * Fill parameter buffer for data extraction calls
        S_S_IF-REQUNR    = I_REQUNR.
        S_S_IF-DSOURCE = I_DSOURCE.
        S_S_IF-MAXSIZE   = I_MAXSIZE.
    * Fill field list table for an optimized select statement
    * (in case that there is no 1:1 relation between InfoSource fields
    * and database table fields this may be far from beeing trivial)
        APPEND LINES OF I_T_FIELDS TO S_S_IF-T_FIELDS.
      ELSE.                 "Initialization mode or data extraction ?
    * Data transfer: First Call      OPEN CURSOR + FETCH
    *                Following Calls FETCH only
    * First data package -> OPEN CURSOR
        IF S_COUNTER_DATAPAKID = 0.
    LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'PERNR'.
            MOVE-CORRESPONDING L_S_SELECT TO L_R_PERNR.
            APPEND L_R_PERNR.
          ENDLOOP.
    IF L_R_PERNR IS INITIAL.
            OPEN CURSOR WITH HOLD S_CURSOR FOR
            SELECT DISTINCT PERNR  FROM PA0008.
    ELSEIF L_R_PERNR IS NOT INITIAL.
            OPEN CURSOR WITH HOLD S_CURSOR FOR
            SELECT DISTINCT PERNR FROM PA0008 WHERE PERNR IN L_R_PERNR.
    ENDIF.
    FETCH NEXT CURSOR S_CURSOR
                   APPENDING CORRESPONDING FIELDS
                   OF TABLE PI_PERNR
                   PACKAGE SIZE S_S_IF-MAXSIZE.
    IF PI_PERNR IS NOT INITIAL.
    **      LOOP AT PI_PERNR INTO PW_PERNR.
    * Fill range tables BW will only pass down simple selection criteria
    * of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.
    *SELECT PERNR from Pa0008 into TABLE PI_PERNR where PERNR <> 0.
    *         SORT PI_PERNR BY PERNR.
    *         DELETE ADJACENT DUPLICATES FROM PI_PERNR.
          loop at PI_PERNR into PW_PERNR.
            CALL FUNCTION 'CU_READ_RGDIR'
              EXPORTING
                PERSNR                   = PW_PERNR-PERNR
    *   BUFFER                   =
    *   NO_AUTHORITY_CHECK       = ' '
              IMPORTING
                 MOLGA                    = MOLGA_T
              TABLES
                IN_RGDIR                 = PCL_T1
    * EXCEPTIONS
    *   NO_RECORD_FOUND          = 1
    *   OTHERS                   = 2
            IF SY-SUBRC <> 0.
    * Implement suitable error handling here
            ENDIF.
            CALL FUNCTION 'PYXX_GET_RELID_FROM_PERNR'
              EXPORTING
                EMPLOYEE                    = PW_PERNR-PERNR
              IMPORTING
                RELID                       = relid
    *           MOLGA                       = MOLGA_T
              EXCEPTIONS
                ERROR_READING_INFOTYPE_0001 = 1
                ERROR_READING_MOLGA         = 2
                ERROR_READING_RELID         = 3
                OTHERS                      = 4.
            IF SY-SUBRC <> 0.
    * Implement suitable error handling here
            ENDIF.
            LOOP AT PCL_T1 INTO PCLW_T1.
    *  pcl_w-seqnr = pclw_t1-seqnr.
              CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
                EXPORTING
                  CLUSTERID                          = relid
                  EMPLOYEENUMBER                     = PW_PERNR-PERNR
                  SEQUENCENUMBER                     = PCLW_T1-SEQNR
    *   READ_ONLY_BUFFER                   = ' '
                  READ_ONLY_INTERNATIONAL            = 'X'
    *   ARC_GROUP                          = ' '
    *   CHECK_READ_AUTHORITY               = 'X'
    *   FILTER_CUMULATIONS                 = 'X'
    *   CLIENT                             =
    * IMPORTING
    *   VERSION_NUMBER_PAYVN               =
    *   VERSION_NUMBER_PCL2                =
                CHANGING
                  PAYROLL_RESULT                     =  PY_RESULT
               EXCEPTIONS
                 ILLEGAL_ISOCODE_OR_CLUSTERID       = 1
                 ERROR_GENERATING_IMPORT            = 2
                 IMPORT_MISMATCH_ERROR              = 3
                 SUBPOOL_DIR_FULL                   = 4
                 NO_READ_AUTHORITY                  = 5
                 NO_RECORD_FOUND                    = 6
                 VERSIONS_DO_NOT_MATCH              = 7
                 ERROR_READING_ARCHIVE              = 8
                 ERROR_READING_RELID                = 9
                 OTHERS                             = 10
              IF SY-SUBRC <> 0.
    * Implement suitable error handling here
              ENDIF.
              loop at PY_RESULT-inter-rt into WA_RESULT.
                pcl_w-PERNR =   PW_PERNR-PERNR.              "PW_PERNR-PERNR.
                pcl_w-SEQNR =   PCLW_T1-SEQNR.
                pcl_w-LGART =   WA_RESULT-LGART.
                pcl_w-BETRG =   WA_RESULT-BETRG.
                pcl_w-ANZHL =   WA_RESULT-ANZHL.
                pcl_w-WAERS =   WA_RESULT-RTE_CURR.
                pcl_w-FPPER =   PCLW_T1-FPPER.
                pcl_w-INPER =   PCLW_T1-INPER.
                pcl_w-FPBEG =   PCLW_T1-FPBEG.
                pcl_w-FPEND =   PCLW_T1-FPEND.
                pcl_w-SRTZA =   PCLW_T1-SRTZA.
                pcl_w-ABKRS =   PCLW_T1-ABKRS.
                pcl_w-PAYTY =   PCLW_T1-PAYTY.
                pcl_w-RUNDT =   PCLW_T1-RUNDT.
                pcl_w-RUNTM =   PCLW_T1-RUNTM.
                pcl_w-PAYDT =   PCLW_T1-PAYDT.
                pcl_w-PAYID =   PCLW_T1-PAYID.
                pcl_w-BONDT =   PCLW_T1-BONDT.
                pcl_w-OCRSN =   PCLW_T1-OCRSN.
                pcl_w-INOCR =   PCLW_T1-INOCR.
                pcl_w-IPEND =   PCLW_T1-IPEND.
                pcl_w-MOLGA =  MOLGA_T.
              APPEND  PCL_W to E_T_DATA.
    endloop.
    endloop.
    * READ TABLE pcl_t1 into pclw_t1 WITH Key SEQNR = wa_str-SEQNR.
    *          APPEND  PCL_W to E_T_DATA.
    *     APPEND pclw_t1 to pcl_t2.
    *        ENDLOOP.
    ENDLOOP.
    *  MODIFY E_T_DATA
    *      MOVE-CORRESPONDING  it_str to PCL_T.
    *      MOVE-CORRESPONDING pcl_t1 to PCL_T.
    *      LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CARRID'.
    *        MOVE-CORRESPONDING L_S_SELECT TO L_R_CARRID.
    *        APPEND L_R_CARRID.
    *      ENDLOOP.
    *      LOOP AT S_S_IF-T_SELECT INTO L_S_SELECT WHERE FIELDNM = 'CONNID'.
    *        MOVE-CORRESPONDING L_S_SELECT TO L_R_CONNID.
    *        APPEND L_R_CONNID.
    *      ENDLOOP.
    * Determine number of database records to be read per FETCH statement
    * from input parameter I_MAXSIZE. If there is a one to one relation
    * between DataSource table lines and database entries, this is trivial.
    * In other cases, it may be impossible and some estimated value has to
    * be determined.
    *      OPEN CURSOR WITH HOLD S_CURSOR FOR
    *      SELECT (S_S_IF-T_FIELDS) FROM SFLIGHT
    *                               WHERE CARRID  IN L_R_CARRID AND
    *                                     CONNID  IN L_R_CONNID.
    *    ENDIF.                             "First data package ?
    * Fetch records into interface table.
    *   named E_T_'Name of extract structure'.
    *    FETCH NEXT CURSOR S_CURSOR
    *               APPENDING CORRESPONDING FIELDS
    *               OF TABLE E_T_DATA
    *               PACKAGE SIZE S_S_IF-MAXSIZE.
        IF SY-SUBRC <> 0.
    *      CLOSE CURSOR S_CURSOR.
          RAISE NO_MORE_DATA.
        ENDIF.
        S_COUNTER_DATAPAKID = S_COUNTER_DATAPAKID + 1.
      ENDIF.              "Initialization mode or data extraction ?
    ENDIF.
    ENDIF.
    ENDFUNCTION.
    Regards
    sree

    There are so many threads and documentation available on the same..Please search the same.
    Moreover if you share the error then it would be easy to know the exact problem
    Regards,
    AL

  • Functional module for 12 MONTHS AVERAGE SALARY

    hi all,
    I want to get the average salary for an employee for past 12 months from cluster tables. I believe the cluster table for that is PCL2? . I want to know the name of the function module to get the average salary for an employee for past 12 months from cluster tables. If anyone could explain me with help of the coding how to use that function module  - passing what all parameters, it would be great.
    I anyone have any custom report for extracting payroll data from cluster tables, Please let me know. Please share the coding. My e mail id is [email protected]

    Ribhu,
    You can retrieve the last payroll result for the year & read the YTD Gross (year-to-date) from the CRT table & divide by12 to get the Average Salary..
    ~Suresh

  • Export Cluster PCL2

    Hi Peers,
       Can anyone tell me how to export cluster pcl2. Actually my requirement is I want to change the payroll data from cluster after some modification of the wage types. Am getting the payslip details from cluster by using the function modules. But i dont know how to update these values into pcl2 cluster. Can anyone give me some idea or some sample to export the rt table values into pcl2 cluster?
    Points will be awarded.
    Thanks
    Ravi

    please refer this...
    report zovertime
    line-size 252
    line-count 60(1)
    no standard page heading
    message-id zndc.
    Database Tables & Infotypes
    tables: pcl1, " HR Cluster1
    pcl2, " HR Cluster1
    pa0003, " Master data - Payroll Status
    cskt, " Cost Center Texts
    t528t, " Positions Texts
    t513s, " Job Titles
    pernr, " Logical PNP
    t001p, " Personnel Subarea
    t500p, " Personnel Area
    t501, " Employee Group
    t503k, " Employee Subgroup
    csks. " Cost Center
    infotypes:0000,0001.
    *include rpclst00.
    include rpc2rx00.
    include rpc2rxx0.
    include rpc2cd00.
    *include rpc2ps00.
    *include rpc2pt00.
    *include rpcfvp00.
    *include rpcfdc10.
    *include rpcfdc00.
    include rpppxd00.
    include rpppxd10.
    Declaration of Internal Tables
    Internal Table for Output Data
    data: begin of rep_tab occurs 0,
    kostl like pa0001-kostl, " Cost Center
    pernr like pa0001-pernr, " Personal Number
    ename like pa0001-ename, " Employee Name
    ctext like cskt-ltext, " Cost Center Text
    ptext like t528t-plstx, " Position Text
    ot1 type p decimals 2, " Jan OT Amount
    ot2 type p decimals 2, " Feb OT Amount
    ot3 type p decimals 2, " Mar OT Amount
    ot4 type p decimals 2, " Apr OT Amount
    ot5 type p decimals 2, " May OT Amount
    ot6 type p decimals 2, " Jun OT Amount
    ot7 type p decimals 2, " Jul OT Amount
    ot8 type p decimals 2, " Aug OT Amount
    ot9 type p decimals 2, " Sep OT Amount
    ot10 type p decimals 2, " Oct OT Amount
    ot11 type p decimals 2, " Nov OT Amount
    ot12 type p decimals 2, " Dec OT Amount
    ott type p decimals 2, " Total OT Amount
    end of rep_tab.
    Declaration of Variables
    data: v_mon(2) type n, " Month
    v_no type i, " Data Lines
    v_year(4) type c, " Year
    v_date like sy-datum, " Date
    v_date1 like sy-datum, " Date
    v_seqnr like pc261-seqnr. " Sequence No.
    Declaration of Constants
    data: c_type like hrp1001-otype value 'S', " Object Type
    c_kokrs like cskt-kokrs value '1000', " Controlling Area
    c_date1 like sy-datum value '18000101', " Date
    c_date2 like sy-datum value '99991231', " Date
    c_x type c value 'X', " Sign
    c_mon(2) type c value '01', " Month
    c_val1(2) type c value '31', " Date
    c_val2(2) type c value '12', " Month Type
    c_val like p0041-dar01 value '01', " Date Type
    c_lgart1 like p0008-lga01 value '0722', " Wage Type
    c_lgart2 like p0008-lga01 value '0723', " Wage Type
    c_1(2) type n value '01', " Month1
    c_2(2) type n value '02', " Month2
    c_3(2) type n value '03', " Month3
    c_4(2) type n value '04', " Month4
    c_5(2) type n value '05', " Month5
    c_6(2) type n value '06', " Month6
    c_7(2) type n value '07', " Month7
    c_8(2) type n value '08', " Month8
    c_9(2) type n value '09', " Month9
    c_10(2) type n value '10', " Month10
    c_11(2) type n value '11', " Month11
    c_12(2) type n value '12'. " Month12
    Selection-screen
    parameters:
    p_year like pc2b0-pabrj obligatory. " Payroll Year
    At selection-screen
    at selection-screen.
    Validate the Selection Screen fields
    perform validate_screen.
    Start-of-Selection
    start-of-selection.
    Selection of Period
    perform get_period.
    Get PERNR from LDB
    get pernr.
    Get the Master data from infotype 0001
    perform get_master_data.
    Top-of-page
    top-of-page.
    Write the Report and Column Headings
    perform top_of_page.
    End-of-Page
    end-of-page.
    write /1(252) sy-uline.
    End-of-Selection
    end-of-selection.
    Display the Output Report.
    perform display_report.
    Form-Routines
    *& Form validate_screen
    Validation of selection Screen fields
    form validate_screen.
    Validation of Cost Center
    clear csks.
    if not pnpkostl[] is initial.
    select single kostl
    into csks-kostl
    from csks
    where kostl in pnpkostl.
    if sy-subrc <> 0.
    message e999 with 'Invalid Cost Center'(003).
    endif.
    endif.
    Validation of Personnel Number
    clear pa0003.
    if not pnppernr[] is initial.
    select pernr
    from pa0003 up to 1 rows
    into pa0003-pernr
    where pernr in pnppernr.
    endselect.
    if sy-subrc <> 0.
    message e999 with 'Incorrect Personal Number Entered'(002).
    endif.
    endif.
    Validation of Personnel Area
    clear t500p.
    if not pnpwerks[] is initial.
    select persa
    from t500p up to 1 rows
    into t500p-persa
    where persa in pnpwerks.
    endselect.
    if sy-subrc <> 0.
    message e999 with 'Incorrect Personnel Area Entered'(001).
    endif.
    endif.
    Validation of Personnel Sub Area
    clear t001p.
    if not pnpbtrtl[] is initial.
    select btrtl
    from t001p up to 1 rows
    into t001p-btrtl
    where btrtl in pnpbtrtl.
    endselect.
    if sy-subrc <> 0.
    message e999 with 'Incorrect Personnel Sub Area Entered'(037).
    endif.
    endif.
    Validation of Employee Group
    clear t501.
    if not pnppersg[] is initial.
    select persg
    from t501 up to 1 rows
    into t501-persg
    where persg in pnppersg.
    endselect.
    if sy-subrc <> 0.
    message e999 with 'Incorrect Employee Group Entered'(038).
    endif.
    endif.
    Validation of Employee Sub Group
    clear t503k.
    if not pnppersk[] is initial.
    select persk
    from t503k up to 1 rows
    into t503k-persk
    where persk in pnppersk.
    endselect.
    if sy-subrc <> 0.
    message e999 with 'Incorrect Employee Sub Group Entered'(039).
    endif.
    endif.
    endform. "validate_screen
    *& Form get_period
    Get the Correct Period based on Selection screen selection
    form get_period.
    clear: v_year,v_mon, v_date, v_date1.
    v_year = sy-datum+0(4).
    v_mon = sy-datum+4(2).
    if pnptimr1 = c_x. " Current Date
    pnpbegda = sy-datum.
    pnpendda = sy-datum.
    elseif pnptimr2 = c_x. " Current Month
    concatenate v_year v_mon c_val into v_date.
    concatenate v_year v_mon c_val1 into v_date1.
    pnpbegda = v_date.
    pnpendda = v_date1.
    elseif pnptimr3 = c_x. " Current Year
    concatenate v_year c_val c_val into v_date.
    concatenate v_year c_val2 c_val1 into v_date1.
    pnpbegda = v_date.
    pnpendda = v_date1.
    elseif pnptimr4 = c_x. " Upto Today
    pnpbegda = c_date1.
    pnpendda = sy-datum.
    elseif pnptimr5 = c_x. " From Today
    pnpbegda = sy-datum.
    pnpendda = c_date2.
    else.
    if ( pnpbegda is initial and pnpendda is initial ).
    pnpbegda = c_date1.
    pnpendda = c_date2.
    elseif pnpbegda is initial and not pnpendda is initial.
    pnpbegda = c_date1.
    pnpendda = pnpendda.
    elseif not ( pnpbegda is initial and pnpendda is initial ).
    pnpbegda = pnpbegda.
    pnpendda = pnpendda.
    endif.
    endif.
    endform. "get_period
    *& Form get_master_data
    Get the Master Data from Database Tables PA0001,0002,0003
    form get_master_data.
    Get data from Respective Infotypes
    rp_provide_from_last p0001 space pnpbegda pnpendda.
    if p0001-kostl in pnpkostl.
    rep_tab-kostl = p0001-kostl.
    rep_tab-pernr = p0001-pernr.
    rep_tab-ename = p0001-ename.
    Get the Position Text
    clear t528t-plstx.
    select single plstx into t528t-plstx from t528t
    where plans = p0001-plans and
    otype = c_type and
    sprsl = sy-langu.
    if sy-subrc = 0.
    rep_tab-ptext = t528t-plstx.
    endif.
    Get the Cost Center Text
    clear cskt-ltext.
    select single ltext into cskt-ltext from cskt
    where spras = sy-langu and
    kokrs = c_kokrs and
    kostl = p0001-kostl.
    if sy-subrc = 0.
    rep_tab-ctext = cskt-ltext.
    endif.
    Get the Overtime Payment Data
    perform get_ot_data.
    rep_tab-ott = rep_tab-ot1 + rep_tab-ot2 + rep_tab-ot3 +
    rep_tab-ot4 + rep_tab-ot5 + rep_tab-ot6 +
    rep_tab-ot7 + rep_tab-ot8 + rep_tab-ot9 +
    rep_tab-ot10 + rep_tab-ot11 + rep_tab-ot12.
    append rep_tab.
    clear rep_tab.
    endif.
    sort rep_tab by kostl pernr.
    delete rep_tab where kostl = ' '.
    delete rep_tab where ott = 0.
    endform. "get_master_data
    *& Form get_ot_data
    Get the Overtime Payment Data
    form get_ot_data.
    cd-key = pernr-pernr.
    rp-imp-c2-cd.
    sort rgdir by seqnr.
    To get sequence number for the payroll period
    loop at rgdir where void is initial
    and reversal is initial
    and outofseq is initial
    and srtza eq 'A'.
    if rgdir-fpper+0(4) = p_year.
    To consider offcycle run data
    if not rgdir-ocrsn is initial.
    v_seqnr = rgdir-seqnr.
    exit.
    endif.
    v_seqnr = rgdir-seqnr.
    endif.
    if not v_seqnr is initial.
    perform import_rx.
    endif.
    perform process_wagetypes.
    endloop.
    endform. "get_ot_data
    include rpppxm00.
    *& Form Import_rx
    Import the RX data from Clusters
    form import_rx.
    rx-key-pernr = cd-key-pernr.
    rx-key-seqno = v_seqnr.
    rp-init-buffer.
    rp-imp-c2-rx.
    endform. " Import_rx
    *& Form Process_wagetypes
    Calculate the Overtime Amount based on Wage types
    form process_wagetypes.
    loop at rt.
    if rt-lgart = c_lgart1 or rt-lgart = c_lgart2.
    if rgdir-fpper+0(4) = p_year.
    v_mon = rgdir-fpper+4(2).
    case v_mon .
    when c_1.
    rep_tab-ot1 = rep_tab-ot1 + rt-betrg.
    when c_2.
    rep_tab-ot2 = rep_tab-ot2 + rt-betrg.
    when c_3.
    rep_tab-ot3 = rep_tab-ot3 + rt-betrg.
    when c_4.
    rep_tab-ot4 = rep_tab-ot4 + rt-betrg.
    when c_5.
    rep_tab-ot5 = rep_tab-ot5 + rt-betrg.
    when c_6.
    rep_tab-ot6 = rep_tab-ot6 + rt-betrg.
    when c_7.
    rep_tab-ot7 = rep_tab-ot7 + rt-betrg.
    when c_8.
    rep_tab-ot8 = rep_tab-ot8 + rt-betrg.
    when c_9.
    rep_tab-ot9 = rep_tab-ot9 + rt-betrg.
    when c_10.
    rep_tab-ot10 = rep_tab-ot10 + rt-betrg.
    when c_11.
    rep_tab-ot11 = rep_tab-ot11 + rt-betrg.
    when c_12.
    rep_tab-ot12 = rep_tab-ot12 + rt-betrg.
    endcase.
    endif.
    endif.
    endloop.
    endform. "process_wagetypes
    *& Form top_of_page
    Write the Report and Column Headings
    form top_of_page.
    format color col_heading on.
    write: /1(252) 'NATIONAL DRILLING COMPANY'(010) centered,
    /1(252) 'Overtime Payments Details'(011) centered.
    format color off.
    if pnptimr1 = c_x. " Current Date
    write: /2 'Period From :'(036), sy-datum, 'To:'(006), sy-datum.
    elseif pnptimr2 = c_x. " Current Month
    write: /2 'Period From :'(036), v_date, 'To:'(006), v_date1.
    elseif pnptimr3 = c_x. " Current Year
    write: /2 'Period From :'(036), v_date, 'To:'(006), v_date1.
    elseif pnptimr4 = c_x. " Upto Today
    write: /2 'Period From :'(036), c_date1, 'To:'(006), sy-datum.
    elseif pnptimr5 = c_x. " From Today
    write: /2 'Period From :'(036), sy-datum, 'To:'(006), c_date2.
    else.
    if ( pnpbegda is initial and pnpendda is initial ).
    write: /2 'Period From :'(036), c_date1, 'To:'(006), c_date2.
    elseif pnpbegda is initial and not pnpendda is initial.
    write: /2 'Period From :'(036), c_date1, 'To:'(006), pnpendda.
    elseif not ( pnpbegda is initial and pnpendda is initial ).
    write: /2 'Period From :'(036), pnpbegda,
    'To:'(006), pnpendda.
    endif.
    endif.
    write: 219 'Report Run Date:'(018), sy-datum.
    if not pnpkostl[] is initial.
    if pnpkostl-high is initial.
    write: /2 'Cost Center :'(004), pnpkostl-low,
    219 'Time :'(020), sy-uzeit.
    else.
    write: /2 'Cost Center From:'(005), pnpkostl-low+7(3),
    'To:'(006), pnpkostl-high,
    219 'Time :'(020), sy-uzeit.
    endif.
    else.
    write: /219 'Time :'(020), sy-uzeit.
    endif.
    if not pnppernr[] is initial.
    if pnppernr-high is initial.
    write: /2 'Personal Number :'(007), pnppernr-low,
    219 'User :'(021), sy-uname.
    else.
    write: /2 'Personal No.From:'(008), pnppernr-low,
    'To:'(006), pnppernr-high,
    219 'User :'(021), sy-uname.
    endif.
    else.
    write: /219 'User :'(021), sy-uname.
    endif.
    write: /219 'Page No :'(022), sy-pagno.
    format color col_heading.
    write /1(252) sy-uline.
    write:/1 sy-vline, 10 sy-vline,
    41 sy-vline,
    67 sy-vline, 68(167) 'Overtime Payments(Dirhams)'(013) centered,
    235 sy-vline,252 sy-vline.
    format color col_heading.
    write:/1 sy-vline, 2(8) 'Emp #'(019) centered,
    10 sy-vline, 11(30) 'Employee Name'(012) centered,
    41 sy-vline, 42(25) 'Position'(014) centered,
    67 sy-vline, 68(167) sy-uline,
    235 sy-vline,236(16) 'Total'(017) centered,
    252 sy-vline.
    write:/1 sy-vline, 10 sy-vline,
    41 sy-vline,
    67 sy-vline, 68(13) 'JANUARY'(024) centered,
    81 sy-vline, 82(13) 'FEBRUARY'(025) centered,
    95 sy-vline, 96(13) 'MARCH'(026) centered,
    109 sy-vline,110(13) 'APRIL'(027) centered,
    123 sy-vline,124(13) 'MAY'(028) centered,
    137 sy-vline,138(13) 'JUNE'(029) centered,
    151 sy-vline,152(13) 'JULY'(030) centered,
    165 sy-vline,166(13) 'AUGUST'(031) centered,
    179 sy-vline,180(13) 'SEPTEMBER'(032) centered,
    193 sy-vline,194(13) 'OCTOBER'(033) centered,
    207 sy-vline,208(13) 'NOVEMBER'(034) centered,
    221 sy-vline,222(13) 'DECEMBER'(035) centered,
    235 sy-vline,252 sy-vline.
    format color off.
    write /1(252) sy-uline.
    endform. "top_of_page
    *& Form Display_report
    Write the Report Output
    form display_report.
    clear v_no.
    describe table rep_tab lines v_no.
    if v_no = 0.
    message i999 with
    'No Data found for the entered Selection'(015).
    endif.
    loop at rep_tab.
    format color 3.
    at new kostl.
    read table rep_tab index sy-tabix.
    write:/1 sy-vline, 2(12) 'Cost Center:'(009),
    14(10) rep_tab-kostl,
    25(30) rep_tab-ctext,
    252 sy-vline.
    format color off.
    write /1(252) sy-uline.
    endat.
    format color col_normal.
    write: /1 sy-vline, 2(8) rep_tab-pernr,
    10 sy-vline, 11(30) rep_tab-ename,
    41 sy-vline, 42(25) rep_tab-ptext,
    67 sy-vline, 68(13) rep_tab-ot1 no-zero,
    81 sy-vline, 82(13) rep_tab-ot2 no-zero,
    95 sy-vline, 96(13) rep_tab-ot3 no-zero,
    109 sy-vline,110(13) rep_tab-ot4 no-zero,
    123 sy-vline,124(13) rep_tab-ot5 no-zero,
    137 sy-vline,138(13) rep_tab-ot6 no-zero,
    151 sy-vline,152(13) rep_tab-ot7 no-zero,
    165 sy-vline,166(13) rep_tab-ot8 no-zero,
    179 sy-vline,180(13) rep_tab-ot9 no-zero,
    193 sy-vline,194(13) rep_tab-ot10 no-zero,
    207 sy-vline,208(13) rep_tab-ot11 no-zero,
    221 sy-vline,222(13) rep_tab-ot12 no-zero,
    235 sy-vline,236(16) rep_tab-ott no-zero,
    252 sy-vline.
    at end of kostl.
    write /1(252) sy-uline.
    endat.
    format color off.
    at last.
    sum.
    format color 1.
    write: /1 sy-vline,
    10 sy-vline, 11(30) 'Total'(017) centered,
    41 sy-vline,
    67 sy-vline, 68(13) rep_tab-ot1 no-zero,
    81 sy-vline, 82(13) rep_tab-ot2 no-zero,
    95 sy-vline, 96(13) rep_tab-ot3 no-zero,
    109 sy-vline,110(13) rep_tab-ot4 no-zero,
    123 sy-vline,124(13) rep_tab-ot5 no-zero,
    137 sy-vline,138(13) rep_tab-ot6 no-zero,
    151 sy-vline,152(13) rep_tab-ot7 no-zero,
    165 sy-vline,166(13) rep_tab-ot8 no-zero,
    179 sy-vline,180(13) rep_tab-ot9 no-zero,
    193 sy-vline,194(13) rep_tab-ot10 no-zero,
    207 sy-vline,208(13) rep_tab-ot11 no-zero,
    221 sy-vline,222(13) rep_tab-ot12 no-zero,
    235 sy-vline,236(16) rep_tab-ott no-zero,
    252 sy-vline.
    write /1(252) sy-uline.
    endat.
    format color off.
    endloop.
    endform. "display_report

  • A FUNCTION MODULE FOR THE HR MODULE FOR PAYROLL OF EMPLOYEES

    hi,
    i want some a function module or code where i need to get the payroll details like the basic pay ,hra,special allowance,medical allowance,other allowance of an employee on the monthly basis.
    the data that i have on ot os not on the basis of months it contains datd of more than one month.like the baisc pay of an employee is given on a radom day basis of more than one month.
    but i need to bifercatethe data on monthly basis.
    waiting for the reply.
    thanks and regards

    Hi,
    Use the fun module
    RP_FILL_WAGE_TYPE_TABLE_EXT
    which willget PA0008 results.
    but to get the real payroll results you have to import data from clusters by writing the program. Data will be fetch from RT and CRT internal tables based on the Wage Types
    see the sample code:
    report zporgr0100
           line-size 252
           line-count 60(1)
           no standard page heading
           message-id zndc.
    Database Tables & Infotypes
    tables: pcl1,        " HR Cluster1
            pcl2,        " HR Cluster1
            pa0003,      " Master data - Payroll Status
            cskt,        " Cost Center Texts
            t528t,       " Positions Texts
            t513s,       " Job Titles
            pernr,       " Logical PNP
            t001p,       " Personnel Subarea
            t500p,       " Personnel Area
            t501,        " Employee Group
            t503k,       " Employee Subgroup
            csks.        " Cost Center
    infotypes:0000,0001.
    *include rpclst00.
    include rpc2rx00.
    include rpc2rxx0.
    include rpc2cd00.
    *include rpc2ps00.
    *include rpc2pt00.
    *include rpcfvp00.
    *include rpcfdc10.
    *include rpcfdc00.
    include rpppxd00.
    include rpppxd10.
    Declaration of Internal Tables
    Internal Table for Output Data
    data: begin of rep_tab occurs 0,
            kostl like pa0001-kostl,      " Cost Center
            pernr like pa0001-pernr,      " Personal Number
            ename like pa0001-ename,      " Employee Name
            ctext like cskt-ltext,        " Cost Center Text
            ptext like t528t-plstx,       " Position Text
            ot1   type p decimals 2,      " Jan OT Amount
            ot2   type p decimals 2,      " Feb OT Amount
            ot3   type p decimals 2,      " Mar OT Amount
            ot4   type p decimals 2,      " Apr OT Amount
            ot5   type p decimals 2,      " May OT Amount
            ot6   type p decimals 2,      " Jun OT Amount
            ot7   type p decimals 2,      " Jul OT Amount
            ot8   type p decimals 2,      " Aug OT Amount
            ot9   type p decimals 2,      " Sep OT Amount
            ot10  type p decimals 2,      " Oct OT Amount
            ot11  type p decimals 2,      " Nov OT Amount
            ot12  type p decimals 2,      " Dec OT Amount
            ott   type p decimals 2,      " Total OT Amount
          end of rep_tab.
    Declaration of Variables
    data: v_mon(2) type n,                   " Month
          v_no     type i,                   " Data Lines
          v_year(4)  type c,                 " Year
          v_date   like sy-datum,            " Date
          v_date1  like sy-datum,            " Date
          v_seqnr  like  pc261-seqnr.        " Sequence No.
    Declaration of Constants
    data: c_type   like hrp1001-otype  value 'S',  " Object Type
          c_kokrs  like cskt-kokrs value '1000',   " Controlling Area
          c_date1  like sy-datum value '18000101', " Date
          c_date2  like sy-datum value '99991231', " Date
          c_x       type c value 'X',              " Sign
         c_mon(2)  type c value '01',             " Month
          c_val1(2) type c value '31',             " Date
          c_val2(2) type c value '12',             " Month Type
          c_val    like p0041-dar01 value '01',    " Date Type
          c_lgart1 like p0008-lga01 value '0722',  " Wage Type
          c_lgart2 like p0008-lga01 value '0723',  " Wage Type
          c_1(2)   type n value '01',                           " Month1
          c_2(2)   type n value '02',                           " Month2
          c_3(2)   type n value '03',                           " Month3
          c_4(2)   type n value '04',                           " Month4
          c_5(2)   type n value '05',                           " Month5
          c_6(2)   type n value '06',                           " Month6
          c_7(2)   type n value '07',                           " Month7
          c_8(2)   type n value '08',                           " Month8
          c_9(2)   type n value '09',                           " Month9
          c_10(2)  type n value '10',                           " Month10
          c_11(2)  type n value '11',                           " Month11
          c_12(2)  type n value '12'.                           " Month12
    Selection-screen
    parameters:
      p_year like pc2b0-pabrj obligatory.       " Payroll Year
    At selection-screen
    at selection-screen.
    Validate the Selection Screen fields
      perform validate_screen.
    Start-of-Selection
    start-of-selection.
    Selection of Period
      perform get_period.
    Get PERNR from LDB
    get pernr.
    Get the Master data from infotype 0001
      perform get_master_data.
    Top-of-page
    top-of-page.
    Write the Report and Column Headings
      perform top_of_page.
    End-of-Page
    end-of-page.
      write /1(252) sy-uline.
    End-of-Selection
    end-of-selection.
    Display the Output Report.
      perform display_report.
    Form-Routines
    *&      Form  validate_screen
    Validation of selection Screen fields
    form validate_screen.
    Validation of Cost Center
      clear csks.
      if not pnpkostl[] is initial.
        select single kostl
          into csks-kostl
          from csks
          where kostl in pnpkostl.
        if sy-subrc <> 0.
          message e999 with 'Invalid Cost Center'(003).
        endif.
      endif.
    Validation of Personnel Number
      clear pa0003.
      if not pnppernr[] is initial.
        select pernr
        from pa0003 up to 1 rows
          into pa0003-pernr
          where pernr in pnppernr.
        endselect.
        if sy-subrc <> 0.
          message e999 with 'Incorrect Personal Number Entered'(002).
        endif.
      endif.
    Validation of Personnel Area
      clear t500p.
      if not pnpwerks[] is initial.
        select persa
        from t500p up to 1 rows
          into t500p-persa
          where persa in pnpwerks.
        endselect.
        if sy-subrc <> 0.
          message e999 with 'Incorrect Personnel Area Entered'(001).
        endif.
      endif.
    Validation of Personnel Sub Area
      clear t001p.
      if not pnpbtrtl[] is initial.
        select btrtl
        from t001p up to 1 rows
          into t001p-btrtl
          where btrtl in pnpbtrtl.
        endselect.
        if sy-subrc <> 0.
          message e999 with 'Incorrect Personnel Sub Area Entered'(037).
        endif.
      endif.
    Validation of Employee Group
      clear t501.
      if not pnppersg[] is initial.
        select persg
        from t501 up to 1 rows
          into t501-persg
          where persg in pnppersg.
        endselect.
        if sy-subrc <> 0.
          message e999 with 'Incorrect Employee Group Entered'(038).
        endif.
      endif.
    Validation of Employee Sub Group
      clear t503k.
      if not pnppersk[] is initial.
        select persk
        from t503k up to 1 rows
          into t503k-persk
          where persk in pnppersk.
        endselect.
        if sy-subrc <> 0.
          message e999 with 'Incorrect Employee Sub Group Entered'(039).
        endif.
      endif.
    endform.                  "validate_screen
    *&      Form  get_period
    Get the Correct Period based on Selection screen selection
    form get_period.
      clear: v_year,v_mon, v_date, v_date1.
      v_year = sy-datum+0(4).
      v_mon  = sy-datum+4(2).
      if pnptimr1 = c_x.      " Current Date
        pnpbegda = sy-datum.
        pnpendda = sy-datum.
      elseif pnptimr2 = c_x.  " Current Month
        concatenate v_year v_mon c_val into v_date.
        concatenate v_year v_mon c_val1 into v_date1.
        pnpbegda = v_date.
        pnpendda = v_date1.
      elseif pnptimr3 = c_x.  " Current Year
        concatenate v_year c_val c_val into v_date.
        concatenate v_year c_val2 c_val1 into v_date1.
        pnpbegda = v_date.
        pnpendda = v_date1.
      elseif pnptimr4 = c_x.  " Upto Today
        pnpbegda = c_date1.
        pnpendda = sy-datum.
      elseif pnptimr5 = c_x.  " From Today
        pnpbegda = sy-datum.
        pnpendda = c_date2.
      else.
        if ( pnpbegda is initial and pnpendda is initial ).
          pnpbegda = c_date1.
          pnpendda = c_date2.
        elseif pnpbegda is initial and not pnpendda is initial.
          pnpbegda = c_date1.
          pnpendda = pnpendda.
        elseif not ( pnpbegda is initial and pnpendda is initial ).
          pnpbegda = pnpbegda.
          pnpendda = pnpendda.
        endif.
      endif.
    endform.              "get_period
    *&      Form  get_master_data
    Get the Master Data from Database Tables PA0001,0002,0003
    form get_master_data.
    Get data from Respective Infotypes
      rp_provide_from_last p0001 space pnpbegda pnpendda.
      if p0001-kostl in pnpkostl.
        rep_tab-kostl = p0001-kostl.
        rep_tab-pernr = p0001-pernr.
        rep_tab-ename = p0001-ename.
    Get the Position Text
        clear t528t-plstx.
        select single plstx into t528t-plstx from t528t
                where plans = p0001-plans and
                      otype = c_type and
                      sprsl = sy-langu.
        if sy-subrc = 0.
          rep_tab-ptext = t528t-plstx.
        endif.
    Get the Cost Center Text
        clear cskt-ltext.
        select single ltext into cskt-ltext from cskt
                where spras = sy-langu and
                      kokrs = c_kokrs and
                      kostl = p0001-kostl.
        if sy-subrc = 0.
          rep_tab-ctext = cskt-ltext.
        endif.
    Get the Overtime Payment Data
        perform get_ot_data.
        rep_tab-ott = rep_tab-ot1 + rep_tab-ot2 + rep_tab-ot3 +
                      rep_tab-ot4 + rep_tab-ot5 + rep_tab-ot6 +
                      rep_tab-ot7 + rep_tab-ot8 + rep_tab-ot9 +
                      rep_tab-ot10 + rep_tab-ot11 + rep_tab-ot12.
        append rep_tab.
        clear  rep_tab.
      endif.
      sort rep_tab by kostl pernr.
      delete rep_tab where kostl = ' '.
      delete rep_tab where ott = 0.
    endform.                 "get_master_data
    *&      Form  get_ot_data
    Get the Overtime Payment Data
    form get_ot_data.
      cd-key = pernr-pernr.
      rp-imp-c2-cd.
      sort rgdir by seqnr.
    To get sequence number for the payroll period
      loop at rgdir where void     is initial
                        and reversal is initial
                        and outofseq is initial
                        and srtza    eq 'A'.
        if rgdir-fpper+0(4) = p_year.
    To consider offcycle run data
          if not rgdir-ocrsn is initial.
            v_seqnr = rgdir-seqnr.
            exit.
          endif.
          v_seqnr = rgdir-seqnr.
        endif.
        if not v_seqnr is initial.
          perform import_rx.
        endif.
        perform process_wagetypes.
      endloop.
    endform.                 "get_ot_data
    include rpppxm00.
    *&      Form  Import_rx
    Import the RX data from Clusters
    form import_rx.
      rx-key-pernr = cd-key-pernr.
      rx-key-seqno = v_seqnr.
      rp-init-buffer.
      rp-imp-c2-rx.
    endform.                    " Import_rx
    *&      Form  Process_wagetypes
    Calculate the Overtime Amount based on Wage types
    form process_wagetypes.
      loop at rt.
        if  rt-lgart = c_lgart1 or rt-lgart = c_lgart2.
          if rgdir-fpper+0(4) = p_year.
            v_mon = rgdir-fpper+4(2).
            case v_mon .
              when c_1.
                rep_tab-ot1 = rep_tab-ot1 + rt-betrg.
              when c_2.
                rep_tab-ot2 = rep_tab-ot2 + rt-betrg.
              when c_3.
                rep_tab-ot3 = rep_tab-ot3 + rt-betrg.
              when c_4.
                rep_tab-ot4 = rep_tab-ot4 + rt-betrg.
              when c_5.
                rep_tab-ot5 = rep_tab-ot5 + rt-betrg.
              when c_6.
                rep_tab-ot6 = rep_tab-ot6 + rt-betrg.
              when c_7.
                rep_tab-ot7 = rep_tab-ot7 + rt-betrg.
              when c_8.
                rep_tab-ot8 = rep_tab-ot8 + rt-betrg.
              when c_9.
                rep_tab-ot9 = rep_tab-ot9 + rt-betrg.
              when c_10.
                rep_tab-ot10 = rep_tab-ot10 + rt-betrg.
              when c_11.
                rep_tab-ot11 = rep_tab-ot11 + rt-betrg.
              when c_12.
                rep_tab-ot12 = rep_tab-ot12 + rt-betrg.
            endcase.
          endif.
        endif.
      endloop.
    endform.          "process_wagetypes
    *&      Form  top_of_page
    Write the Report and Column Headings
    form top_of_page.
      format color col_heading on.
      write: /1(252) 'NATIONAL DRILLING COMPANY'(010) centered,
             /1(252) 'Overtime Payments Details'(011) centered.
      format color off.
      if pnptimr1 = c_x.      " Current Date
        write: /2 'Period From     :'(036), sy-datum, 'To:'(006), sy-datum.
      elseif pnptimr2 = c_x.  " Current Month
        write: /2 'Period From     :'(036), v_date, 'To:'(006), v_date1.
      elseif pnptimr3 = c_x.  " Current Year
        write: /2 'Period From     :'(036), v_date, 'To:'(006), v_date1.
      elseif pnptimr4 = c_x.  " Upto Today
        write: /2 'Period From     :'(036), c_date1, 'To:'(006), sy-datum.
      elseif pnptimr5 = c_x.  " From Today
        write: /2 'Period From     :'(036), sy-datum, 'To:'(006), c_date2.
      else.
        if ( pnpbegda is initial and pnpendda is initial ).
          write: /2 'Period From     :'(036), c_date1, 'To:'(006), c_date2.
        elseif pnpbegda is initial and not pnpendda is initial.
          write: /2 'Period From     :'(036), c_date1, 'To:'(006), pnpendda.
        elseif not ( pnpbegda is initial and pnpendda is initial ).
          write: /2 'Period From     :'(036), pnpbegda,
                   'To:'(006), pnpendda.
        endif.
      endif.
      write: 219 'Report Run Date:'(018), sy-datum.
      if not pnpkostl[] is initial.
        if pnpkostl-high is initial.
          write: /2 'Cost Center     :'(004), pnpkostl-low,
                219 'Time           :'(020), sy-uzeit.
        else.
          write: /2 'Cost Center From:'(005), pnpkostl-low+7(3),
                                    'To:'(006), pnpkostl-high,
                219 'Time           :'(020), sy-uzeit.
        endif.
      else.
        write: /219  'Time           :'(020), sy-uzeit.
      endif.
      if not pnppernr[] is initial.
        if pnppernr-high is initial.
          write: /2 'Personal Number :'(007), pnppernr-low,
                 219 'User           :'(021), sy-uname.
        else.
          write: /2 'Personal No.From:'(008),  pnppernr-low,
                                    'To:'(006), pnppernr-high,
                 219 'User           :'(021), sy-uname.
        endif.
      else.
        write: /219 'User           :'(021), sy-uname.
      endif.
      write: /219 'Page No        :'(022), sy-pagno.
      format color col_heading.
      write /1(252) sy-uline.
      write:/1 sy-vline, 10 sy-vline,
            41 sy-vline,
            67 sy-vline, 68(167) 'Overtime Payments(Dirhams)'(013) centered,
           235 sy-vline,252 sy-vline.
      format color col_heading.
      write:/1 sy-vline,  2(8)  'Emp #'(019) centered,
            10 sy-vline, 11(30) 'Employee Name'(012) centered,
            41 sy-vline, 42(25) 'Position'(014) centered,
            67 sy-vline, 68(167)  sy-uline,
           235 sy-vline,236(16)  'Total'(017) centered,
           252 sy-vline.
      write:/1 sy-vline, 10 sy-vline,
            41 sy-vline,
            67 sy-vline, 68(13)  'JANUARY'(024) centered,
            81 sy-vline, 82(13)  'FEBRUARY'(025) centered,
            95 sy-vline, 96(13)  'MARCH'(026) centered,
           109 sy-vline,110(13)  'APRIL'(027) centered,
           123 sy-vline,124(13)  'MAY'(028) centered,
           137 sy-vline,138(13)  'JUNE'(029) centered,
           151 sy-vline,152(13)  'JULY'(030) centered,
           165 sy-vline,166(13)  'AUGUST'(031) centered,
           179 sy-vline,180(13)  'SEPTEMBER'(032) centered,
           193 sy-vline,194(13)  'OCTOBER'(033) centered,
           207 sy-vline,208(13)  'NOVEMBER'(034) centered,
           221 sy-vline,222(13)  'DECEMBER'(035) centered,
           235 sy-vline,252 sy-vline.
      format color off.
      write /1(252) sy-uline.
    endform.            "top_of_page
    *&      Form  Display_report
    Write the Report Output
    form display_report.
      clear v_no.
      describe table rep_tab lines v_no.
      if v_no = 0.
        message i999 with
         'No Data found for the entered Selection'(015).
      endif.
      loop at rep_tab.
        format color 3.
        at new kostl.
          read table rep_tab index sy-tabix.
          write:/1 sy-vline, 2(12) 'Cost Center:'(009),
                 14(10) rep_tab-kostl,
                 25(30) rep_tab-ctext,
                252 sy-vline.
          format color off.
          write /1(252) sy-uline.
        endat.
        format color col_normal.
        write: /1 sy-vline, 2(8)   rep_tab-pernr,
              10 sy-vline, 11(30)  rep_tab-ename,
              41 sy-vline, 42(25)  rep_tab-ptext,
              67 sy-vline, 68(13)  rep_tab-ot1 no-zero,
              81 sy-vline, 82(13)  rep_tab-ot2 no-zero,
              95 sy-vline, 96(13)  rep_tab-ot3 no-zero,
             109 sy-vline,110(13)  rep_tab-ot4 no-zero,
             123 sy-vline,124(13)  rep_tab-ot5 no-zero,
             137 sy-vline,138(13)  rep_tab-ot6 no-zero,
             151 sy-vline,152(13)  rep_tab-ot7 no-zero,
             165 sy-vline,166(13)  rep_tab-ot8 no-zero,
             179 sy-vline,180(13)  rep_tab-ot9 no-zero,
             193 sy-vline,194(13)  rep_tab-ot10 no-zero,
             207 sy-vline,208(13)  rep_tab-ot11 no-zero,
             221 sy-vline,222(13)  rep_tab-ot12 no-zero,
             235 sy-vline,236(16)  rep_tab-ott no-zero,
             252 sy-vline.
        at end of kostl.
          write /1(252) sy-uline.
        endat.
        format color off.
        at last.
          sum.
          format color 1.
          write: /1 sy-vline,
                10 sy-vline, 11(30) 'Total'(017) centered,
                41 sy-vline,
                67 sy-vline, 68(13)  rep_tab-ot1 no-zero,
                81 sy-vline, 82(13)  rep_tab-ot2 no-zero,
                95 sy-vline, 96(13)  rep_tab-ot3 no-zero,
               109 sy-vline,110(13)  rep_tab-ot4 no-zero,
               123 sy-vline,124(13)  rep_tab-ot5 no-zero,
               137 sy-vline,138(13)  rep_tab-ot6 no-zero,
               151 sy-vline,152(13)  rep_tab-ot7 no-zero,
               165 sy-vline,166(13)  rep_tab-ot8 no-zero,
               179 sy-vline,180(13)  rep_tab-ot9 no-zero,
               193 sy-vline,194(13)  rep_tab-ot10 no-zero,
               207 sy-vline,208(13)  rep_tab-ot11 no-zero,
               221 sy-vline,222(13)  rep_tab-ot12 no-zero,
               235 sy-vline,236(16)  rep_tab-ott no-zero,
               252 sy-vline.
          write /1(252) sy-uline.
        endat.
        format color off.
      endloop.
    endform.          "display_report
    reward points if useful
    regards,
    Anji

  • Not able to Access R/3 Tables, Function Modules through Crystal Reports

    Hi Gurus,
    I am working on Crystal Reports 2008 - V12.2.0,  When I am trying to connect SAP R/3 system through the Data  connectivity SAP Table,Cluster or FM, 
    I could see only the very few tables ,  and cannot see all Tables and not any Info sets or Function Modules, 
    But, I can access BW system,  problem facing only with SAP R/3 system,
    Suggest me on this,
    Thanks
    Siva

    Hey here..,,
    There is a limitation to show all Tables, Function Modules in Crystal reports for R/3. To see them,
    In Options:
    You will see Table_Name Like%: Text box, go there and give the starting or ending characters of FM's.
    Eg: Z% or %Z
    Then Click on Ok.
    Now try to connect to R/3 again or Refresh the Connection, it will list out as you opted.
    Hope it should help you.
    Thank You!!

  • Function Module for Bundled Items for a document in FS CD

    Hi,
    Is there an FM to get Bundled Items for a Document(tcode: FPE3) in FS-CD ?
    Suitable points will be given if helpful..
    Thanks
    Prakash

    I have a FI object to be generated so input screen variable are all FI fields. Now I have to connect this to the sales order. I can retrieve the GL account from the input given.
    So now i need to find the billing document related to the GL account, which can be done through table BSEG. AS BSEG is a cluster table, at runtime it takes very long time to retrieve the data. So can u suggest me any other method to get billing document.
    , like any Function module etc.

  • HR ABAP-Payroll Function Module

    Hi pple,
    Well, When I am trying to run the payroll function module PYXX_READ_PAYROLL_RESULT, I am getting a DUMP.
    I checked the corresponding input data from PCL2 table. But still it is dumping.
    Can anyone send me some sample code, so that I too will learn the usage of this function module.
    Regards,
    Raja Sekhar

    hi,
    just having a look in google i found this example.
      CALL FUNCTION 'CU_READ_RGDIR'
          EXPORTING
               persnr          = p0001-pernr
          IMPORTING
               molga           = country
          TABLES
               in_rgdir        = rgdir
          EXCEPTIONS
               no_record_found = 1
               OTHERS          = 2.
    LOOP AT rgdir WHERE void = space AND
                         fpbeg GE pn-begps AND
                         fpend LE pn-endps AND
                         srtza EQ 'A'.
       v_pernr = p0001-pernr.
       v_seqnr = rgdir-seqnr.
       CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
         EXPORTING
          clusterid                       = 'RU'
           employeenumber                 = v_pernr
           sequencenumber                 = v_seqnr
      READ_ONLY_BUFFER                   = ' '
      READ_ONLY_INTERNATIONAL            = ' '
      ARC_GROUP                          = ' '
      CHECK_READ_AUTHORITY               = 'X'
      FILTER_CUMULATIONS                 = 'X'
      CLIENT                             * IMPORTING
      VERSION_NUMBER_PAYVN               *   VERSION_NUMBER_PCL2                      CHANGING
           payroll_result                     = payroll
        EXCEPTIONS
          illegal_isocode_or_clusterid       = 1
          error_generating_import            = 2
          import_mismatch_error              = 3
          subpool_dir_full                   = 4
          no_read_authority                  = 5
          no_record_found                    = 6
          versions_do_not_match              = 7
          error_reading_archive              = 8
          error_reading_relid                = 9
          OTHERS                             = 10.
    Hope it helps.
    Best regards.

  • Error in ERM: Function module does not exist

    Hi all,
    Lately, we are experiencing a frequent error in ERM (5.3 SP 15.0) that we had not had before. We are unsure what caused the error. The message displayed to the user is "Unhandled error". The log error message is "Message Code is 651 Messsage Details Function module  does not exist Message Type is E" (see full logs below).
    The error occurs for example, when users are trying to generate derived roles after saving the org values for the derived role during the methodology process, or when administrators are trying to update the impacted derived roles after for org value mappings.
    Has anyone experienced this or someting similar before? Any ideas what could be the reason here?
    Thanks!
    Patrick
    Edited by: Patrick Weyers on Sep 15, 2011 9:36 AM

    Log extract:
    2011-09-15 09:05:15,103 [SAPEngine_Application_Thread[impl:3]_18] ERROR Message Code is 651 Messsage Details Function module  does not exist Message Type is E
    java.lang.Throwable: Message Code is 651 Messsage Details Function module  does not exist Message Type is E
         at com.virsa.re.service.sap.dao.ManageAuthDataDAO.getAuthorizationData(ManageAuthDataDAO.java:1064)
         at com.virsa.re.bo.impl.AuthorizationDataBO.getNewTransactionObjects(AuthorizationDataBO.java:821)
         at com.virsa.re.role.actions.AuthAuthorizationDataAction.addObjsForNewTxns(AuthAuthorizationDataAction.java:3527)
         at com.virsa.re.role.actions.AuthAuthorizationDataAction.reloadTransactions(AuthAuthorizationDataAction.java:4128)
         at com.virsa.re.role.actions.AuthAuthorizationDataAction.execute(AuthAuthorizationDataAction.java:157)
         at com.virsa.framework.NavigationEngine.execute(NavigationEngine.java:273)
         at com.virsa.framework.servlet.VFrameworkServlet.service(VFrameworkServlet.java:230)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.doWork(RequestDispatcherImpl.java:321)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:377)
         at com.virsa.framework.servlet.VFrameworkServlet.service(VFrameworkServlet.java:286)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.runServlet(FilterChainImpl.java:117)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:62)
         at com.virsa.comp.history.filter.HistoryFilter.doFilter(HistoryFilter.java:43)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:58)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:384)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(AccessController.java:219)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)
    2011-09-15 09:05:15,105 [SAPEngine_Application_Thread[impl:3]_18] ERROR com.virsa.re.role.actions.AuthAuthorizationDataAction
    java.lang.Throwable: java.lang.NullPointerException
         at com.virsa.re.service.sap.dao.ManageAuthDataDAO.getAuthorizationData(ManageAuthDataDAO.java:1084)
         at com.virsa.re.bo.impl.AuthorizationDataBO.getNewTransactionObjects(AuthorizationDataBO.java:821)
         at com.virsa.re.role.actions.AuthAuthorizationDataAction.addObjsForNewTxns(AuthAuthorizationDataAction.java:3527)
         at com.virsa.re.role.actions.AuthAuthorizationDataAction.reloadTransactions(AuthAuthorizationDataAction.java:4128)
         at com.virsa.re.role.actions.AuthAuthorizationDataAction.execute(AuthAuthorizationDataAction.java:157)
         at com.virsa.framework.NavigationEngine.execute(NavigationEngine.java:273)
         at com.virsa.framework.servlet.VFrameworkServlet.service(VFrameworkServlet.java:230)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.doWork(RequestDispatcherImpl.java:321)
         at com.sap.engine.services.servlets_jsp.server.runtime.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:377)
         at com.virsa.framework.servlet.VFrameworkServlet.service(VFrameworkServlet.java:286)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.runServlet(FilterChainImpl.java:117)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:62)
         at com.virsa.comp.history.filter.HistoryFilter.doFilter(HistoryFilter.java:43)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:58)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:384)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(AccessController.java:219)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)

  • Function Module to read RT values of simulation payroll results

    Hi experts
    Is there any function module where I can pass parameter to run payroll simulation and get RT cluster data or the final amount, before running the actual payroll.
    Thanks ,
    Saikumar

    Hi,
      Check the following function modules.
    AISC_CALC_EXPIRED_USEFUL_LIFE.
    Check the following link it might be of some help to you.
    Re: asset useful life
    Regards,
    Ram.

  • Function Module to read simulation payroll results in HCM

    Hi experts
    Is there any function module where I can pass parameter to run payroll simulation and get RT cluster data or the final amount, before running the actual payroll.

    Hi Nick,
    Thankyou very much for the response.
    The Function Module /SAPDMC/LSM_F4_SERVER_FILE is interactive wherein we can select only one file.
    But my requirement is I need to collect (probably in an internal table) all the files exixting in the given UNIX directory.
    Can you please find in that direction. I would be very grateful.
    Thanks.
    Sunil

Maybe you are looking for

  • Problems with a powered Belkin hub

    Can anyone tell me whether there's it's normal to have problems with externally-powered hubs plugged into a macbook or with certain hubs? Mine is a Belkin Hi-Speed USB 2.0 4-port P5U234. (I don't think the following problem ever happened in my old iM

  • In Cp 6, background color becomes pixelated

    Hello, I'm using Cp 6 and my background color (blue desktop) is pixelated in my recording.  I've  changed the Video Color Mode from 16 bit to 32 bit but the background still comes out pixelated.  Not sure if that's the right description but the blue

  • Leading garbage characters when using CipherInputStream

    So, after receiving an encrypted message, I can decrypt it perfectly except that I get a random amount of leading garbabe characters. Using the same plaintext, here are examples of the beginning of the output file for two runs (using od -c to look at

  • Installing ZCM11.2.1 Agent on SLED11SP2

    Good day, I was trying to install the ZCM11.2.1 Agent onto a SLED11Sp2 desktop, I have JRE 1.7.0_05-fcs and novell-zenworks-jre-links 1.6.0_16-2 installed, however; when I run the Preagent..bin file I get the following, Cannot continue - JRE version

  • Price List

    Hi   I have created a Price List and attached to Busness Partner in "Payment Terms" price list but when i create sales order it does not show rates entered in price list Thanks