Total No of Customised Function Modules

Hi,
Is there any way (any table) to know how many user exits and customised (Z)function modules (as seperate from function modules implemented as part of user exits) have been implemented in the SAP R/3 system.
Any help would be greatly appreciated.
Thanks and Regards,
Mick

Hi,
Please check this tables.
MODACT
TFDIR
Regards,
Ferry Lianto

Similar Messages

  • Wants to find out customise function module in SAP

    Hi all There,
    I want to find out Customize Function Module in SAP,
    I am not able to find out though SE03.
    Pl provide the detail solution
    Regards
    Sagar

    hi,
    Custom function module start with Z or Y.So go to table TFDIR and enter z* and y* on input screen field function module name and then check number on entries by pressing tab number of entries on application toolbar.
    So number of custom function module =  z(number of entries) + y(Number of entries) .
    Thanks
    Mohit

  • Regarding hr function modules

    if to read the data from a RT table which of the following function module will be best
    . <b>pyxx_read_payroll_result</b> or <b>RP_FILL_WAGE_TYPE_TABLE</b>
    what i am doing is i am filling the rgdir table using the function module <b>cu_read_rgdir</b>
    as looking at the query you can see i am totally confused in these function modules
    can anone please let me know that  how i can get data from rt using these function modules coz i am not using ldb PNP in my program and i have got all the data wihtout using it now the only issue left is PF that i can get only from RT TABLE.
    if there is any other way also for that please let me know
    the wage types for pf are /3f1,/3f2./3f3
    if anynobdy can help me in this i can complete rest of the parts by today ..
    sorry for disturbing you all have asked too many questions on rt table
    please dont mind
    just wanted to have a grip on it thats y asking so many queries and thanks for all your replies that you all have given
    pelase help me in this last one also:)

    Hi,
    refer
    Retrieve record from RT
    Re: regarding RT tables
    Hope this solves your purpose.
    Award points if it helps.
    -Gaurang

  • Function Module Not Getting Activated

    Hi,
    We are using a customised function module which we are calling in a user exit. We would like to call this function module in update task in the user exit to populate data in a custom table.
    We have given the following parameters to the function module
    Import Parameters
    ITAB     LIKE     ZPRUNDAT
    Export Parameters
    l_subrc     TYPE     sy-subrc
    On the attributes tab of the function module, Update Module has been selected under processing type.
    When we try to activate this function module we get the following message
    EXPORTING parameters are not allowed in the update task.
    and the function module does not get activated. What should we change to get the function module activated?
    Mick

    Hi,
    Please try this....
    In function module
    In tables Section add this...
    RETURN TYPE BAPIRET2 and then activate.
    if its useful reward points

  • Plz hlp me in understanding thz  report and function modules used in it

    TABLES: BKPF,
            BSEG,
            KNA1,
            SKAT,
            USR02,
            T001W.
    SELECTION-SCREEN: BEGIN OF BLOCK HEAD WITH FRAME TITLE TEXT-T01.
    PARAMETERS    : WERKS LIKE T001W-WERKS OBLIGATORY,
                  : HKONT LIKE BSEG-HKONT OBLIGATORY.
    SELECT-OPTIONS: BUDAT FOR BKPF-BUDAT OBLIGATORY.
    PARAMETERS    : USNAM LIKE BKPF-USNAM.
    SELECTION-SCREEN END OF BLOCK HEAD.
    DATA: BEGIN OF ITAB OCCURS 50,
          BUDAT LIKE BKPF-BUDAT,
          BELNR LIKE BKPF-BELNR,
          XBLNR LIKE BKPF-XBLNR,           " City
          BKTXT(15),                       " Drawee Bank
          WRBTR LIKE BSEG-WRBTR,
          KUNNR LIKE BSEG-KUNNR,
          HKONT LIKE BSEG-HKONT,
          SGTXT(15),                 " Instrument Type CHQ / DD/ PAY ORDER
          ZUONR(10),                       " Instrument No
          VALUT LIKE BSEG-VALUT,           " Instrument Date
          NAME1(25),
          END OF ITAB.
    DATA: TXT50 LIKE SKAT-TXT50,
          PGNO  TYPE I,
          JUMP  LIKE SY-LINCT,
          DNAM(20).
    DATA : FIELD LIKE HELP_VALUE OCCURS 0 WITH HEADER LINE.
    DATA : CONTENTS(12) OCCURS 0 WITH HEADER LINE.
    DATA : FLD(12).
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR USNAM.
      FLD = 'usnam'.
      PERFORM VALUES CHANGING FLD.
      USNAM = FLD.
    TOP-OF-PAGE.
      PERFORM HEADER.
    END-OF-PAGE.
      WRITE: /10 'Prepared By',
              45 'Checked By',
              85 'Authorized By',
             125 'Bank Officials Seal & Signature'.
      WRITE: /0(170) SY-ULINE.
      PGNO = PGNO + 1.
      WRITE: /120 'Page No : ', PGNO.
    START-OF-SELECTION.
      PERFORM %BKPF.
      PERFORM %BSEG.
      PERFORM %KNA1.
      PERFORM %SKAT.
      PERFORM %WRITE.
    END-OF-SELECTION.
      JUMP = SY-LINCT - SY-LINNO - 2.
      SKIP JUMP.
      WRITE:/.
    *&      Form  %BKPF
          text
    -->  p1        text
    <--  p2        text
    FORM %BKPF.
      SELECT BELNR
             XBLNR
             BUDAT
             BKTXT
      INTO   (ITAB-BELNR,
             ITAB-XBLNR,
             ITAB-BUDAT,
             ITAB-BKTXT)
      FROM   BKPF
      WHERE  BUKRS = 'GMKT' AND
             BLART = 'DZ'   AND
             USNAM = USNAM AND
             BUDAT IN BUDAT.
        IF SY-SUBRC EQ 0.
          APPEND ITAB.
          CLEAR  ITAB.
        ENDIF.
      ENDSELECT.
      SELECT SINGLE ORT01 INTO DNAM FROM T001W WHERE WERKS = WERKS.
    ENDFORM.                               " %BKPF
    *&      Form  %BSEG
          text
    -->  p1        text
    <--  p2        text
    FORM %BSEG.
      LOOP AT ITAB.
        SELECT WRBTR
               HKONT
               SGTXT
               ZUONR
               VALUT
        INTO   (ITAB-WRBTR,
               ITAB-HKONT,
               ITAB-SGTXT,
               ITAB-ZUONR,
               ITAB-VALUT)
        FROM   BSEG
        WHERE  BUKRS = 'GMKT' AND
               BSCHL = '40' AND
               SHKZG = 'S' AND
               BELNR = ITAB-BELNR AND
               HKONT = HKONT.
          IF SY-SUBRC EQ 0.
            MODIFY ITAB.
            CLEAR  ITAB.
          ENDIF.
        ENDSELECT.
      ENDLOOP.
      DELETE ITAB WHERE HKONT <> HKONT.
      LOOP AT ITAB.
        SELECT SINGLE KUNNR
        INTO   (ITAB-KUNNR)
        FROM   BSEG
        WHERE  BUKRS = 'GMKT' AND
               ( BSCHL = '15' OR BSCHL = '19' ) AND
               SHKZG = 'H' AND
               BELNR = ITAB-BELNR.
        IF SY-SUBRC EQ 0.
          MODIFY ITAB.
          CLEAR  ITAB.
        ENDIF.
      ENDLOOP.
    ENDFORM.                               " %BSEG
    *&      Form  %KNA1
          text
    -->  p1        text
    <--  p2        text
    FORM %KNA1.
      LOOP AT ITAB.
        SELECT NAME1
        INTO   (ITAB-NAME1)
        FROM   KNA1
        WHERE  KUNNR = ITAB-KUNNR.
          IF SY-SUBRC EQ 0.
            MODIFY ITAB.
            CLEAR  ITAB.
          ENDIF.
        ENDSELECT.
      ENDLOOP.
    ENDFORM.                               " %KNA1
    *&      Form  %WRITE
          text
    -->  p1        text
    <--  p2        text
    FORM %WRITE.
      SORT ITAB BY BUDAT BELNR.
      LOOP AT ITAB.
        WRITE:/ SY-TABIX,
                ITAB-BELNR,
                ITAB-BUDAT,
                ITAB-SGTXT,
                ITAB-ZUONR,
                ITAB-VALUT,
                ITAB-KUNNR,
                ITAB-NAME1,
                ITAB-BKTXT,
                ITAB-XBLNR,
                ITAB-WRBTR.
        AT LAST.
          SUM.
          WRITE: /0(170) SY-ULINE.
          WRITE: /126 ' Total Amount  :', ITAB-WRBTR COLOR 3.
        ENDAT.
      ENDLOOP.
      WRITE: /0(170) SY-ULINE.
    ENDFORM.                               " %WRITE
    *&      Form  %SKAT
          text
    -->  p1        text
    <--  p2        text
    FORM %SKAT.
      SELECT TXT50
      INTO   TXT50
      FROM   SKAT
      WHERE  SAKNR = HKONT AND
             SPRAS = 'EN' AND
             KTOPL = 'GMKT'.
      ENDSELECT.
    ENDFORM.                               " %SKAT
    *&      Form  HEADER
          text
    -->  p1        text
    <--  p2        text
    FORM HEADER.
      CONCATENATE DNAM  '-' 'Depot' INTO DNAM.
      WRITE: /50 'Grasim Industries Limited'.
      WRITE: /55 DNAM.
      WRITE: /40 'Pay-in-Slip for Cheques / Drafts / Pay-Order'.
      SKIP 3.
      WRITE:/ 'Account Number :', HKONT, 135 'Payslip No :'.
      WRITE:/ 'Account Name   :', TXT50, 135 'Date       :'.
      SKIP 1.
      WRITE: /0(170) SY-ULINE.
      WRITE: /07 'Sl No', 13 'Voucher No', 27 'Date', 36 ' Inst Type ',
              51 'Ins Number', 65 'Date', 73 'Party Code',
              87 'Name of the Party',
             114 'Drawee Bank', 130 'City', 147 'Amount in Rs',
             162 'Remarks'.
      WRITE: /0(170) SY-ULINE.
    ENDFORM.                               " HEADER
    *&      Form  VALUES
          text
         <--P_FLD  text                                                  *
    FORM VALUES CHANGING P_FLD.
      REFRESH CONTENTS.
      REFRESH FIELD.
      CLEAR CONTENTS.
      CLEAR FIELD.
      FIELD-TABNAME = 'USR02'.
      FIELD-FIELDNAME = 'BNAME'.
      FIELD-SELECTFLAG = 'X'.
      APPEND FIELD.
      SELECT * FROM USR02.
        CONTENTS = USR02-BNAME.
        APPEND CONTENTS.
      ENDSELECT.
    CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'
         EXPORTING
            CUCOL                         = 0
            CUROW                         = 0
            DISPLAY                       = ' '
              FIELDNAME                     = 'BNAME'
              TABNAME                       = 'USR02'
            NO_MARKING_OF_CHECKVALUE      = ' '
            TITLE_IN_VALUES_LIST          = ' '
            TITEL                         = ' '
            SHOW_ALL_VALUES_AT_FIRST_TIME = ' '
            NO_CONVERSION                 = ' '
         IMPORTING
              SELECT_VALUE                  = FLD
         TABLES
              FIELDS                        = FIELD
              VALUETAB                      = CONTENTS
         EXCEPTIONS
              FIELD_NOT_IN_DDIC             = 1
              MORE_THEN_ONE_SELECTFIELD     = 2
              NO_SELECTFIELD                = 3
              OTHERS                        = 4.
    ENDFORM.                               " VALUES

    Hi Surinder,
    the program gives u the o/p based on input parametrs in the following format.
    <b>TOP-OF-PAGE</b>
    CET TECHNOLOGIES PTE LTD.                                 
    PAGE:         2
    LIST OF ALL VENDOR BY VALUE (FOREIGN)
    DATE:     07/05/2007
    DATE RAISED FROM: 06/01/2007  TO 06/06/2007    
    TIME:     15:34:27
    FOR ALL PURCHASING GROUPS
    (Following are the columns of the output tabel, becz of space constraint, i am writing it horizontaly).
    - S/No
    - SUPPLIER Name
    - AMOUNT(S$)  => At last, it will calculate Total Amount in $
    - % OF AMOUNT
    - CUML OF Total amount
    - NO OF PO
    - NO OF ITEMS
                                                                                    TOTAL:                       0.00         0
    Function module is used to convert the amount from Singapore$ to local curreny.
    (Suppose, total amount is S$100, and u r calculating for US, FM will convert the S$100 into corresponding value in US$ or
    Let us take India - For India, say S$1 = INR 27, then say the supplier from India, quotes Rs. 2700, it will then be converted and shown as S$27)
    Hope this will be useful to understand
    Reward if useful
    Thnks
    Sujay

  • SPELL_AMOUNT function module

    Hi frnds,
    If i input 1,00,000 then the fn.module is giving one hundred thousand as output.
    But for me the output should be "One lakh".
    Is there anyother fn.module to get this?...
    OR any additional parameter i have to pass in the SPELL_AMOUNT fn.module to get the same.....
    Regards,
    Renga

    hi,
    this is my own customised Function Module..You can use this...
    import
    AMOUNT     TYPE     KONV-KAWRT                               Condition base value
    CURRENCY     TYPE     CHAR3                               3-Byte field
    export
    WORDS     TYPE     C
    FUNCTION zconvert_amnt_to_words.
    ""Local Interface:
    *"  IMPORTING
    *"     REFERENCE(AMOUNT) TYPE  KONV-KAWRT
    *"     REFERENCE(CURRENCY) TYPE  CHAR3
    *"  EXPORTING
    *"     REFERENCE(WORDS) TYPE  C
      DATA: w_amount(255)  TYPE c,
              w_out_amt(255) TYPE c,
              amt_in_inr TYPE pc207-betrg.
      amt_in_inr = amount.
      IF currency = 'INR'.
        CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
          EXPORTING
            amt_in_num         = amt_in_inr
          IMPORTING
            amt_in_words       = w_amount
          EXCEPTIONS
            data_type_mismatch = 1
            OTHERS             = 2.
        IF sy-subrc  0.
       RAISE data_type_mismatch.
        ENDIF.
        IF w_amount CS 'Rupee' AND w_amount NS 'Rupees'.
          IF w_amount CS 'Paise'.
            REPLACE 'Rupee' WITH 'And' INTO w_amount.
          ELSE.
            REPLACE 'Rupee' WITH space INTO w_amount.
          ENDIF.
          CONCATENATE  w_amount ' Only' INTO w_amount.
        ELSEIF w_amount CS 'Rupees'.
          IF w_amount CS 'Paise'.
            REPLACE 'Rupees' WITH 'And' INTO w_amount.
          ELSE.
            REPLACE 'Rupees' WITH space INTO w_amount.
          ENDIF.
          CONCATENATE  w_amount ' Only' INTO w_amount.
        ELSE.
          CONCATENATE w_amount ' Only' INTO w_amount.
        ENDIF.
        TRANSLATE w_amount TO UPPER CASE.
        words = w_amount.
      ENDIF.
    ENDFUNCTION.
    regards
    siva

  • Function module to find total for delivey for delivery no.

    is there any function module to find total price for delivery no.

    If you want to add tax, ... conditions, you could try to read conditions (good luck).
    here it's a sample code for sales order (the table are different, but the function the same)
      DATA : is_vbak TYPE vbak ,
             is_vbap TYPE vbap .
    * Check if the sales order exist.
      SELECT SINGLE *
             INTO is_vbak
             FROM vbak
             WHERE vbeln EQ vbeln.
      IF sy-subrc NE space.
        RAISE sales_order_unknown.
      ENDIF.
    * Check if the sales order item exist.
      SELECT SINGLE *
             INTO is_vbap
             FROM vbap
             WHERE vbeln EQ vbeln
             AND   posnr EQ posnr.
      IF sy-subrc NE space.
        RAISE sales_order_item_unknown.
      ENDIF.
    * Set data.
      MOVE : is_vbak-mandt    TO isg_komk-mandt ,
             is_vbak-kalsm    TO isg_komk-kalsm ,
             is_vbak-fkara    TO isg_komk-fkart ,
             'V'              TO isg_komk-kappl ,
             is_vbak-waerk    TO isg_komk-waerk ,
             is_vbak-knumv    TO isg_komk-knumv ,
             is_vbak-vbtyp    TO isg_komk-vbtyp ,
             is_vbak-bukrs_vf TO isg_komk-bukrs ,
             is_vbak-vbeln    TO isg_komk-belnr ,
             is_vbap-posnr    TO isg_komp-kposn .
      MOVE-CORRESPONDING : is_vbak TO isg_komk ,
                           is_vbap TO isg_komp.
    * Get the KOMV table.
      CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
        EXPORTING
          comm_head_i = isg_komk
          comm_item_i = isg_komp
        TABLES
          tkomv       = itg_komv
          tkomvd      = itg_komvd.
    * Get the 'Marge'.
      CALL FUNCTION 'PRICING_BUILD_XKOMV'
        EXPORTING
          i_komk           = isg_komk
          i_komp           = isg_komp
          calculation_type = 'E'
        TABLES
          tkomv            = itg_komv
          e_xkomv          = itg_komv2
        EXCEPTIONS
          OTHERS           = 2.

  • Creating function module related to total length of lay

    how to total the planned lengths for all work orders for lay and abandon opertions separatly

    Hi all,
             I am still seraching for the perfect solution, I am looking for the function module to get summarized actual and planned data from COPA, if any idea, Please replay ASAP.
    Thanks
    -Anmol

  • Function Module to Find Actual costs and Total Cost Commitments

    Hi PS Experts ,
    Please let me know if there  is any function module to  find Acutal costs and Total cost commitments by passing WBS element as Input .
    Regards,
    Karan

    Hi Karan,
    I think for actual cost - there is definately one FM availbale. Try to find it out.
    Just ensure - if you are using Network Activity then you may have to pass NWA OBJNR into this FM to get actual cost. As some entry posting happens against NWA like Timesheet. Hope it will give you some idea to get rid on your issue.

  • Function module for finding sales order GT total value(vbak-netwr)

    Can anyone tell which function module is used to find the Sales order  greater than the input parameter which is  total value(vbak-netwr).Output should be the details of sales order satisfying the condition.ie greater than the total value.

    Hi chandra
    I hope you are giving the logic to the ABAP'ers . By giving the input and the outputs. So here , VBAK-NETWR are related to functional consultants .
    Based on the requirement , SD,FI etc the give the logic but mostly it is related to SD consultants only
    Reagrds
    Srinath

  • How to attached class or function module in FD03

    Hi Guys
    I want to attached CL_ATTACHMENT_LIST for retriving attachment list from fd03 please help to attached the function module in my program?
    regards
    Piroz
    report zfir_aged_debtors no standard page heading
                             line-size 255.
    Type group
    type-pools:
      slis.                        " ALV types
    Tables
    tables:
      adrc,               " Addresses
      bsad,               " Accounting: Customer secondary index (Cleared)
      bsid,               " Accounting: Customer secondary index (Open)
      kna1,               " Customer master: General data
      knkk,               " Customer master: Credit management
      knvk.               " Customer master: Contact persons
    Types
    types:
      begin of ty_bsadbsid,
        bukrs like bsad-bukrs,              " Company code
        kunnr like bsad-kunnr,              " Customer
        gjahr like bsad-gjahr,              " Fiscal year
        belnr like bsad-belnr,              " Accounting document number
        buzei like bsad-buzei,              " Line item
        budat like bsad-budat,              " Posting date
        bldat like bsad-bldat,              " Document date
        waers like bsad-waers,              " Currency
        xblnr like bsad-xblnr,              " Reference
        shkzg like bsad-shkzg,              " Debit/credit indicator
        dmbtr like bsad-dmbtr,              " Amount
        zfbdt like bsad-zfbdt,              " Baseline date for due date
                                            " calculation
        zbd1t like bsad-zbd1t,              " Cash discount days 1
        zbd2t like bsad-zbd2t,              " Cash discount days 2
        zbd3t like bsad-zbd3t,              " Net payment terms period
        rebzg like bsad-rebzg,              " Number of the invoice
        rebzt like bsad-rebzt,              " Follow on document type
      end of ty_bsadbsid,
      ty_it_bsadbsid type ty_bsadbsid occurs 0,
      begin of ty_merged,
        kunnr      like kna1-kunnr,         " Customer number
        name1      like adrc-name1,         " Name
        city1      like adrc-city1,         " City
        post_code1 like adrc-post_code1,    " Post code
        street     like adrc-street,        " Street
        house_num1 like adrc-house_num1,    " House number
        tel_number like adrc-tel_number,    " Telephone number
        fax_number like adrc-fax_number,    " Fax number
        namev      like knvk-namev,         " First name
        namew      like knvk-name1,         " Last name
        telf1      like knvk-telf1,         " Telephone number
        klimk      like knkk-klimk,         " Credit limit
        skfor      like knkk-skfor,         " Total receivables
        total      like bsad-dmbtr,         " Total amount
        rast1      like bsad-dmbtr,         " Amount period 1
        rast2      like bsad-dmbtr,         " Amount period 2
        rast3      like bsad-dmbtr,         " Amount period 3
        rast4      like bsad-dmbtr,         " Amount period 4
        rast5      like bsad-dmbtr,         " Amount period 5
        rast6      like bsad-dmbtr,         " Amount period 6
      end of ty_merged,
      ty_it_merged type ty_merged occurs 0.
    Internal tables
    data:
    Internal table to store customer line items from BSAD and BSID
      it_bsadbsid type ty_it_bsadbsid,
    Internal table to store field catalog for ALV function call
      it_fieldcat type slis_t_fieldcat_alv,
    Internal table to store summarised data for report output
      it_merged   type ty_it_merged.
    Structures
    data:
    Display variant structures
      st_tvariant  like disvariant,
      st_variant   like disvariant.
    Constants
    constants:
      co_delim_dash    type c
                       value '-',
      co_false         type c                      " False
                       value space,
      co_koart_d       like faede-koart            " Customer account type
                       value 'D',
      co_save_u        type c                      " User display variant
                       value 'U',                  " saving allowed.
      co_shkzg_h       like bsid-shkzg             " Debit/Credit indicator
                       value 'H',                  " for credit
      co_shkzg_s       like bsid-shkzg             " Debit/Credit indicator
                       value 'S',                  " for debit
      co_selected      type c                      " Value of selected radio
                       value 'X',                  " button or checkbox
      co_true          type c                      " True
                       value co_selected.
    Variables
    data:
      va_exit          type c.
    Selection screen definition
    selection-screen: begin of block b1 with frame title text-001.
    select-options:
      s_kunnr for bsad-kunnr.                     " Customer number
    parameters:
      p_kkber like knkk-kkber,                    " Credit control area
      p_pafkt like knvk-pafkt,                    " Contact function
      p_datum like sy-datum.                      " Report date
    selection-screen: begin of line,
                      comment 01(30) text-006,
                      position pos_low.
    parameters:
      rastbis1 like rfpdo1-allgrogr               " Due date sorted 1
               default '000',
      rastbis2 like rfpdo1-allgrogr               " Due date sorted 2
               default '000',
      rastbis3 like rfpdo1-allgrogr               " Due date sorted 3
               default '000',
      rastbis4 like rfpdo1-allgrogr               " Due date sorted 4
               default '000',
      rastbis5 like rfpdo1-allgrogr               " Due date sorted 5
               default '000'.
    selection-screen: end of line.
    selection-screen: end of block b1,
                      begin of block b2 with frame title text-002.
    parameters:
      p_varint like disvariant-variant.           " Display variant.
    selection-screen: end of block b2.
    Initialisation
    initialization.
    Provide default periods for due date sorted list.
      rastbis1 = 0.
      rastbis2 = 30.
      rastbis3 = 60.
      rastbis4 = 90.
      rastbis5 = 120.
    Default report date to current.
      p_datum = sy-datlo.
    Default credit control area to BP01.
      p_kkber = 'BP01'.
    At selection screen on value request for
    at selection-screen on value-request for p_varint.
    Provide display variant list for this program.
      call function 'REUSE_ALV_VARIANT_F4'
        exporting
          is_variant = st_variant
          i_save     = co_save_u
        importing
          e_exit     = va_exit
          es_variant = st_tvariant
        exceptions
          not_found  = 2.
      if sy-subrc eq 2.
        message id sy-msgid type 'S'
                number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      else.
        if va_exit eq space.
          st_variant = st_tvariant.
          p_varint = st_tvariant-variant.
        endif.
      endif.
    At selection screen
    at selection-screen.
    Load display variant.
      if not p_varint is initial.
        move st_variant to st_tvariant.
        move p_varint to st_tvariant-variant.
        call function 'REUSE_ALV_VARIANT_EXISTENCE'
          exporting
            i_save     = co_save_u
          changing
            cs_variant = st_tvariant.
        st_variant = st_tvariant.
      else.
        clear st_variant.
        st_variant-report = sy-repid.
      endif.
      if p_kkber is initial.
      Ensure credit control area is specified.
        message e000(zgen) with 'Credit control area must be specified'.
      endif.
      if p_pafkt is initial.
      Ensure contact person function is specified.
        message e000(zgen) with 'Contact person function must be specified'.
      endif.
    Start of selection
    start-of-selection.
    Extract open customer items from BSID
      select bukrs kunnr gjahr belnr buzei budat bldat waers xblnr shkzg
             dmbtr zfbdt zbd1t zbd2t zbd3t rebzg rebzt
             from  bsid
             into  table it_bsadbsid
             where kunnr in s_kunnr
             and   budat le p_datum.
    Extracct cleared customer items from BSAD
      select bukrs kunnr gjahr belnr buzei budat bldat waers xblnr shkzg
             dmbtr zfbdt zbd1t zbd2t zbd3t rebzg rebzt
             from  bsad
             appending table it_bsadbsid
             where kunnr in s_kunnr
             and   budat le p_datum
             and   augdt ge p_datum.
    Ensure that items were not selected twice while getting data from the
    open and cleared items tables (Only if transaction occured during
    report run).
      sort it_bsadbsid by bukrs belnr gjahr buzei.
      delete adjacent duplicates from it_bsadbsid
             comparing bukrs belnr gjahr buzei.
      if it_bsadbsid[] is initial.
      No data found for selection
        message s001(zgen).
        exit.
      endif.
    Merge data for report output
      perform merge_data tables it_bsadbsid
                                it_merged.
    Build field catalog
      perform build_field_catalog tables it_fieldcat.
    Output report via ALV
      perform output_report_via_alv tables it_fieldcat
                                           it_merged.
    *&      Form  merge_data
          text
    form merge_data  tables   pa_it_bsadbsid type ty_it_bsadbsid
                              pa_it_merged   type ty_it_merged.
    Local work areas
    data:
      lwa_bsadbsid type ty_bsadbsid,
      lwa_merged   type ty_merged.
    Local structures
    data:
      lst_faede    like faede.
    Local variables
    data:
      lva_daysover type i,
      lva_merged_tabix like sy-tabix.
      loop at pa_it_bsadbsid into lwa_bsadbsid.
      Lookup merged entry for customer
        clear lwa_merged.
        read table pa_it_merged into lwa_merged
                                with key kunnr = lwa_bsadbsid-kunnr
                                binary search.
        lva_merged_tabix = sy-tabix.
        if sy-subrc ne 0.
        Create new merged record for customer
          lwa_merged-kunnr = lwa_bsadbsid-kunnr.
        Get customer details from KNA1
          clear kna1.
          select single *
                 from   kna1
                 where  kunnr eq lwa_bsadbsid-kunnr.
        Get customer address details from ADRC
          clear adrc.
          select single *
                 from   adrc
                 where  addrnumber eq kna1-adrnr
                 and    date_from  le p_datum.
          lwa_merged-name1      = adrc-name1.
          lwa_merged-city1      = adrc-city1.
          lwa_merged-post_code1 = adrc-post_code1.
          lwa_merged-street     = adrc-street.
          lwa_merged-house_num1 = adrc-house_num1.
          lwa_merged-tel_number = adrc-tel_number.
          lwa_merged-fax_number = adrc-fax_number.
        Get credit limit details from KNKK
          clear knkk.
          select single *
                 from   knkk
                 where  kunnr eq lwa_bsadbsid-kunnr
                 and    kkber eq p_kkber.
          lwa_merged-klimk = knkk-klimk.
          lwa_merged-skfor = knkk-skfor.
        Get customer contact person details from KNVK
          clear knvk.
          select single *
                 from   knvk
                 where  kunnr eq lwa_bsadbsid-kunnr
                 and    pafkt eq p_pafkt.
          lwa_merged-namev = knvk-namev.
          lwa_merged-namew = knvk-name1.
          lwa_merged-telf1 = knvk-telf1.
          insert lwa_merged into pa_it_merged index lva_merged_tabix.
        endif.
      Interpret debit/credit indicator
        case lwa_bsadbsid-shkzg.
          when co_shkzg_h.
          Credit
            lwa_bsadbsid-dmbtr = 0 - lwa_bsadbsid-dmbtr.
          when co_shkzg_s.
          Debit
        endcase.
      Perform ageing
        clear lst_faede.
        move-corresponding lwa_bsadbsid to lst_faede.
        lst_faede-koart = co_koart_d.
        call function 'DETERMINE_DUE_DATE'
          exporting
            i_faede = lst_faede
          importing
            e_faede = lst_faede
          exceptions
            others  = 1.
        lva_daysover = p_datum - lst_faede-netdt.
      Accumulate total.
        add lwa_bsadbsid-dmbtr to lwa_merged-total.
        if lva_daysover le rastbis1.
          add lwa_bsadbsid-dmbtr to lwa_merged-rast1.
        else.
          if lva_daysover le rastbis2 or
             rastbis3 is initial.
            add lwa_bsadbsid-dmbtr to lwa_merged-rast2.
          else.
            if lva_daysover le rastbis3 or
               rastbis4 is initial.
              add lwa_bsadbsid-dmbtr to lwa_merged-rast3.
            else.
              if lva_daysover le rastbis4 or
                 rastbis5 is initial.
                add lwa_bsadbsid-dmbtr to lwa_merged-rast4.
              else.
                if lva_daysover le rastbis5.
                  add lwa_bsadbsid-dmbtr to lwa_merged-rast5.
                else.
                  add lwa_bsadbsid-dmbtr to lwa_merged-rast6.
                endif.
              endif.
            endif.
          endif.
        endif.
      Update the merged record
        modify pa_it_merged from lwa_merged index lva_merged_tabix.
      endloop.
    endform.                    " merge_data
    *&      Form  build_field_catalog
          text
    form build_field_catalog tables pa_it_fieldcat type slis_t_fieldcat_alv.
    Local work areas
      data:
        lwa_fieldcat   type slis_fieldcat_alv.
    --WG1K903216: Start Insert-
      data: v_datum type datum,
            v_mdmth type datum,
            v_datxt type string,
            v_noday type i.
    --WG1K903216: End Insert---
      refresh pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'KUNNR'.
      lwa_fieldcat-ref_tabname   = 'KNA1'.
      lwa_fieldcat-ref_fieldname = 'KUNNR'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '1'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'NAME1'.
      lwa_fieldcat-ref_tabname   = 'ADRC'.
      lwa_fieldcat-ref_fieldname = 'NAME1'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '2'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'CITY1'.
      lwa_fieldcat-ref_tabname   = 'ADRC'.
      lwa_fieldcat-ref_fieldname = 'CITY1'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '3'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'POST_CODE1'.
      lwa_fieldcat-ref_tabname   = 'ADRC'.
      lwa_fieldcat-ref_fieldname = 'POST_CODE1'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '4'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'STREET'.
      lwa_fieldcat-ref_tabname   = 'ADRC'.
      lwa_fieldcat-ref_fieldname = 'STREET'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '5'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'HOUSE_NUM1'.
      lwa_fieldcat-ref_tabname   = 'ADRC'.
      lwa_fieldcat-ref_fieldname = 'HOUSE_NUM1'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '6'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'TEL_NUMBER'.
      lwa_fieldcat-ref_tabname   = 'ADRC'.
      lwa_fieldcat-ref_fieldname = 'TEL_NUMBER'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '7'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'FAX_NUMBER'.
      lwa_fieldcat-ref_tabname   = 'ADRC'.
      lwa_fieldcat-ref_fieldname = 'FAX_NUMBER'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '8'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'NAMEV'.
      lwa_fieldcat-ref_tabname   = 'KNVK'.
      lwa_fieldcat-ref_fieldname = 'NAMEV'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '9'.
      lwa_fieldcat-seltext_l     = 'Contact first name'.
      lwa_fieldcat-seltext_m     = 'Contact Fname'.
      lwa_fieldcat-seltext_s     = 'Ctct Fname'.
      lwa_fieldcat-ddictxt       = 'L'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'NAMEW'.
      lwa_fieldcat-ref_tabname   = 'KNVK'.
      lwa_fieldcat-ref_fieldname = 'NAME1'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '10'.
      lwa_fieldcat-seltext_l     = 'Contact last name'.
      lwa_fieldcat-seltext_m     = 'Contact Lname'.
      lwa_fieldcat-seltext_s     = 'Ctxt Lname'.
      lwa_fieldcat-ddictxt       = 'L'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'TELF1'.
      lwa_fieldcat-ref_tabname   = 'KNVK'.
      lwa_fieldcat-ref_fieldname = 'TELF1'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '11'.
      lwa_fieldcat-seltext_l     = 'Contact phone no.'.
      lwa_fieldcat-seltext_m     = 'Contact phone'.
      lwa_fieldcat-seltext_s     = 'Ctct Phne'.
      lwa_fieldcat-ddictxt       = 'L'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'KLIMK'.
      lwa_fieldcat-ref_tabname   = 'KNKK'.
      lwa_fieldcat-ref_fieldname = 'KLIMK'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '12'.
      lwa_fieldcat-seltext_l     = 'Credit limit'.
      lwa_fieldcat-seltext_m     = 'Credit limit'.
      lwa_fieldcat-seltext_s     = 'Crdt limit'.
      lwa_fieldcat-ddictxt       = 'L'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'SKFOR'.
      lwa_fieldcat-ref_tabname   = 'KNKK'.
      lwa_fieldcat-ref_fieldname = 'SKFOR'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '13'.
      lwa_fieldcat-seltext_l     = 'Credit used'.
      lwa_fieldcat-seltext_m     = 'Credit used'.
      lwa_fieldcat-seltext_s     = 'Crdt used'.
      lwa_fieldcat-ddictxt       = 'L'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'TOTAL'.
      lwa_fieldcat-ref_tabname   = 'BSAD'.
      lwa_fieldcat-ref_fieldname = 'DMBTR'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '14'.
      lwa_fieldcat-seltext_l     = 'Total'.
      lwa_fieldcat-seltext_m     = 'Total'.
      lwa_fieldcat-seltext_s     = 'Total'.
      lwa_fieldcat-ddictxt       = 'L'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'RAST1'.
      lwa_fieldcat-ref_tabname   = 'BSAD'.
      lwa_fieldcat-ref_fieldname = 'DMBTR'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '15'.
    --WG1K903216: Start Delete-
    concatenate '<'
                 rastbis2
                 into lwa_fieldcat-seltext_l
                 separated by space.
    --WG1K903216: End Delete---
    --WG1K903216: Start Insert-
      clear: v_datum,
             v_datxt.
      v_noday = rastbis2.
    Always use the middle of the report month as a heading reference date.
      concatenate p_datum+0(6) '15' into v_mdmth.
      call function 'ZWAG_DATE_CALCULATOR'
        exporting  i_datum         = v_mdmth
                   i_noday         = v_noday
                   i_oprnd         = '+'
        importing  e_datum         = v_datum
        exceptions invalid_operand = 1.
      call function 'ZWAG_END_MONTH'
        exporting  i_datum         = v_datum
        importing  e_datum         = v_datum
                   e_datxt         = v_datxt
        exceptions invalid_date    = 1.
      concatenate 'Due' v_datxt into lwa_fieldcat-seltext_l
        separated by space.
    --WG1K903216: End Insert---
      lwa_fieldcat-seltext_m     = lwa_fieldcat-seltext_l.
      lwa_fieldcat-seltext_s     = lwa_fieldcat-seltext_l.
      lwa_fieldcat-ddictxt       = 'L'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'RAST2'.
      lwa_fieldcat-ref_tabname   = 'BSAD'.
      lwa_fieldcat-ref_fieldname = 'DMBTR'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '16'.
    --WG1K903216: Start Delete-
    concatenate rastbis1
                 rastbis2
                 into lwa_fieldcat-seltext_l
                 separated by co_delim_dash.
    --WG1K903216: End Delete---
    --WG1K903216: Start Insert-
      clear: v_datum,
             v_datxt.
      v_noday = rastbis1.
      call function 'ZWAG_DATE_CALCULATOR'
        exporting  i_datum         = v_mdmth
                   i_noday         = v_noday
                   i_oprnd         = '+'
        importing  e_datum         = v_datum
        exceptions invalid_operand = 1.
      call function 'ZWAG_END_MONTH'
        exporting  i_datum         = v_datum
        importing  e_datum         = v_datum
                   e_datxt         = v_datxt
        exceptions invalid_date    = 1.
      concatenate 'Due' v_datxt into lwa_fieldcat-seltext_l
        separated by space.
    --WG1K903216: End Insert---
      lwa_fieldcat-seltext_m     = lwa_fieldcat-seltext_l.
      lwa_fieldcat-seltext_s     = lwa_fieldcat-seltext_l.
      lwa_fieldcat-ddictxt       = 'L'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'RAST3'.
      lwa_fieldcat-ref_tabname   = 'BSAD'.
      lwa_fieldcat-ref_fieldname = 'DMBTR'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '17'.
    --WG1K903216: Start Delete-
    concatenate rastbis2
                 rastbis3
                 into lwa_fieldcat-seltext_l
                 separated by co_delim_dash.
    --WG1K903216: End Delete---
    --WG1K903216: Start Insert-
      clear: v_datum,
             v_datxt.
      v_noday = rastbis2.
      call function 'ZWAG_DATE_CALCULATOR'
        exporting  i_datum         = v_mdmth
                   i_noday         = v_noday
                   i_oprnd         = '-'
        importing  e_datum         = v_datum
        exceptions invalid_operand = 1.
      call function 'ZWAG_END_MONTH'
        exporting  i_datum         = v_datum
        importing  e_datum         = v_datum
                   e_datxt         = v_datxt
        exceptions invalid_date    = 1.
      concatenate 'Due' v_datxt into lwa_fieldcat-seltext_l
        separated by space.
    --WG1K903216: End Insert---
      lwa_fieldcat-seltext_m     = lwa_fieldcat-seltext_l.
      lwa_fieldcat-seltext_s     = lwa_fieldcat-seltext_l.
      lwa_fieldcat-ddictxt       = 'L'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'RAST4'.
      lwa_fieldcat-ref_tabname   = 'BSAD'.
      lwa_fieldcat-ref_fieldname = 'DMBTR'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '18'.
    --WG1K903216: Start Delete-
    concatenate rastbis3
                 rastbis4
                 into lwa_fieldcat-seltext_l
                 separated by co_delim_dash.
    --WG1K903216: End Delete---
    --WG1K903216: Start Insert-
      clear: v_datum,
             v_datxt.
      v_noday = rastbis3.
      call function 'ZWAG_DATE_CALCULATOR'
        exporting  i_datum         = v_mdmth
                   i_noday         = v_noday
                   i_oprnd         = '-'
        importing  e_datum         = v_datum
        exceptions invalid_operand = 1.
      call function 'ZWAG_END_MONTH'
        exporting  i_datum         = v_datum
        importing  e_datum         = v_datum
                   e_datxt         = v_datxt
        exceptions invalid_date    = 1.
      concatenate 'Due' v_datxt into lwa_fieldcat-seltext_l
        separated by space.
    --WG1K903216: End Insert---
      lwa_fieldcat-seltext_m     = lwa_fieldcat-seltext_l.
      lwa_fieldcat-seltext_s     = lwa_fieldcat-seltext_l.
      lwa_fieldcat-ddictxt       = 'L'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'RAST5'.
      lwa_fieldcat-ref_tabname   = 'BSAD'.
      lwa_fieldcat-ref_fieldname = 'DMBTR'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '19'.
    --WG1K903216: Start Delete-
    concatenate rastbis4
                 rastbis5
                 into lwa_fieldcat-seltext_l
                 separated by co_delim_dash.
    --WG1K903216: End Delete---
    --WG1K903216: Start Insert-
      clear: v_datum,
             v_datxt.
      v_noday = rastbis4.
      call function 'ZWAG_DATE_CALCULATOR'
        exporting  i_datum         = v_mdmth
                   i_noday         = v_noday
                   i_oprnd         = '-'
        importing  e_datum         = v_datum
        exceptions invalid_operand = 1.
      call function 'ZWAG_END_MONTH'
        exporting  i_datum         = v_datum
        importing  e_datum         = v_datum
                   e_datxt         = v_datxt
        exceptions invalid_date    = 1.
      concatenate 'Due' v_datxt into lwa_fieldcat-seltext_l
        separated by space.
    --WG1K903216: End Insert---
      lwa_fieldcat-seltext_m     = lwa_fieldcat-seltext_l.
      lwa_fieldcat-seltext_s     = lwa_fieldcat-seltext_l.
      lwa_fieldcat-ddictxt       = 'L'.
      append lwa_fieldcat to pa_it_fieldcat.
      clear lwa_fieldcat.
      lwa_fieldcat-tabname       = 'PA_IT_MERGED'.
      lwa_fieldcat-fieldname     = 'RAST6'.
      lwa_fieldcat-ref_tabname   = 'BSAD'.
      lwa_fieldcat-ref_fieldname = 'DMBTR'.
      lwa_fieldcat-row_pos       = '1'.
      lwa_fieldcat-col_pos       = '20'.
    --WG1K903216: Start Delete-
    concatenate '>'
                 rastbis5
                 into lwa_fieldcat-seltext_l
                 separated by space.
    --WG1K903216: End Delete---
    --WG1K903216: Start Insert-
      clear: v_datum,
             v_datxt.
      v_noday = rastbis5.
      call function 'ZWAG_DATE_CALCULATOR'
        exporting  i_datum         = v_mdmth
                   i_noday         = v_noday
                   i_oprnd         = '-'
        importing  e_datum         = v_datum
        exceptions invalid_operand = 1.
      call function 'ZWAG_END_MONTH'
        exporting  i_datum         = v_datum
        importing  e_datum         = v_datum
                   e_datxt         = v_datxt
        exceptions invalid_date    = 1.
      concatenate 'Due By' v_datxt into lwa_fieldcat-seltext_l
        separated by space.
    --WG1K903216: End Insert---
      lwa_fieldcat-seltext_m     = lwa_fieldcat-seltext_l.
      lwa_fieldcat-seltext_s     = lwa_fieldcat-seltext_l.
      lwa_fieldcat-ddictxt       = 'L'.
      append lwa_fieldcat to pa_it_fieldcat.
    endform.                    " build_field_catalog
    *&      Form  output_report_via_alv
          text
    form output_report_via_alv
                        tables pa_it_fieldcat type slis_t_fieldcat_alv
                               pa_it_merged   type ty_it_merged.
    Local variables
      data:
        lva_repid    like sy-repid,
        lva_formname type slis_formname.
      lva_repid = sy-repid.
      lva_formname = 'USER_COMMAND'.
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_callback_program      = lva_repid
          i_callback_user_command = lva_formname
          i_save                  = 'A'
          is_variant              = st_variant
          it_fieldcat             = pa_it_fieldcat[]
        tables
          t_outtab                = pa_it_merged
        exceptions
          program_error           = 1
          others                  = 2.
    endform.                    " output_report_via_alv

    Hi shiva
    Thanks for your help,
    Can you check this coding and revert me back ASAP Please.
    REPORT BDS_GOS_CONNECTION.
    DATA : logical_system LIKE BAPIBDS01-log_system.
           CLASSNAME LIKE BAPIBDS01-CLASSNAME
           OBJKEY LIKE SWOTOBJID-objkey.
    PARAMETERS: pa_lo_sys BAPIBDS01-log_system,
                pa_class like BPIBDS01-CLASSNAME,
                pa_objkey like swotobjidobjkey.
    AT SELECTION-SCREEN.
    CALL FUNCTION 'BDS_GOS_CONNECTIONS_GET'
             EXPORTING
                  bor_id             = bor_id
             IMPORTING
                  logical_sytem      = pa_lo_sys.
                  classname          = pa_class.
                  objkey            = pa_objkey.
             EXCEPTIONS
                  no_objects_found     = 1
                  internal_error       = 2
                  internal_gos_error   = 3.
       IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       ENDIF.
    clear v_attno1.
    i_object1-typeid = 'BUS2012'.
    i_object1-catid  = 'BO'.
    i_object1-instid = i_yItem-docno.
    call method cl_gos_attachment_query=>count_for_object
       exporting
        is_object = i_object1
        ip_arl    = space
       receiving
        rt_stat   = i_stat1.
    read table i_stat1 into wa_stat1 index 1.
    if sy-subrc eq c_0.
        move wa_stat1-counter to v_attno1.
    endif.             
    CALL METHOD cl_gos_attachment_query=>count_for_object
    EXPORTING
    is_object = object
    ip_arl =    space
    RECEIVING
    rt_stat = lt_stat.
    READ TABLE lt_stat INDEX 1 into ls_stat.
    count = ls_stat-counter.
    *The object has to be a concatenation of your document, like this:
    CONCATENATE object-instid tab-gjahr INTO object-instid.
    ELSE.
    CONCATENATE tab-bukrs tab-belnr tab-gjahr INTO
    object-instid.
    ENDIF.

  • Call RFC Function Module and return 1000 records at a time

    I would like to call a Remote Enabled Function Module from a non SAP system.  This function module will select data from the database and return it to the calling program.
    Suppose there are 100,000 records that need to be returned, but the calling module would like the data in chunks of 1000 records.  Therefore the calling program would call the FM 100 times. 
    How do I code the function module to know on each subsequent call to grab the next chunk of 1000 records? 
    Let me know if additional information is needed.
    Thanks,
    Aaron

    Hello,
    Here is how you can go for this issue:
    1. Create one RFC function module with following parameter. These parameters are with respective of chunking logic.
         Import: Package Size
         Export: Total number of records
         Changing: chunk count
    Implement following logic:
    1. First of you need to know how many chunks you need to fetch for that get the count of total number of records. This is one  
        time activity so you better maintain one flag import parameter will be set to 'X' only first call.
    2. Get the number of chunk using total number of records / chunk size for e.g. 1000 / 100 so chunk count = 10.
    3. Define internal chunk counter in function module which will be used to locate the correct chunk depending on the chunk
        counter value sent from calling program.
    4. Send first call with package size 100 and chunk count = 1, execute select statement and increment internal
        chunk count check if chunk count = internal chunk count in current case chunk count = 1 so exit select statement and return
        with first chunk.
    5. Send second call with package size 100 and chunk count = 2. Execute select statement and check chunk count with internal
        chunk counter, in current case it will be 1 so skip that data and go for next chunk of 100 records increment internal chunk  
        counter. In this case it will match with external chunk count = 2. load output table with that data and return to calling program.
    6. Repeat step 4 until you reach last chunk.
    You need to use SELECT...ENDSELECT with PACKAGE SIZE addition so for every loop it will return number of records mentioned in package size.
    Hope this helps.
    Thanks,
    Augustin.

  • Function Module RSDRI_DATA_WRAP_V

    BI Experts,
    As part of BI 7.0 SAP has delivered a Function Module 'RSDRI_DATA_WRAP_V' which is basically called by the Function Module 'RSDRI_INFOPROV_READ_RFC'. In our particular case we are exposing FM ' RSDRI_INFOPROV_READ_RFC' as a web service. Using this method we are extracting data in the form of a single array, Which mean to say that if we request for 20,000 rows and 4 fields from a info provider (DSO/Cube) the length of the array would be 20,000 X 4 = 80,000
    In the function module 'RSDRI_DATA_WRAP_V' there is a limit hard coded (Line 57) to 100,000. This is way to low for our application needs. We checked if there are any enhancement points in this FM so that if we change it, we are still within the enhancement  framework. Unfortunately that is not possible.
    We need to know from  why is there a limit of only 100,000 in this function module. However as a feedback, we changed this value to 4,000,000 in our Sandbox and and we did not see any performance impact.
    Has anyone encountered this yet. Any feedback will be very helpful. Thanks Community!
    Regards
    Yashu Raj

    Hi Yashu,
    There is a default SAP guideline that stipulates data packets should be no more than 100,000 lines.
    This should coincide with the internal table space memory that Basis sets. There is a rough calculation that SAP has published to work out the best data packet size optimized for loading.
    I would recommend that you play around with your data packet sizes, I would not recommend increasing the max lines as this will cause other issues. Your Basis contact should be able to provide more insight as to why this is. Below I have done a small outline of how this is done.
    You need to know the structure width (ABAP length) you can get this via SE11, view DataSource as a data type, not a data base table. Then under extras look at the Structure width/ABAP length.
    In our case say the width is 250
    Max lines at highest its setting is 100,000 lines (SAP recommended) this setting can be changed via the Scheduler menu DataS. Default Data Transfer max is 20,000 lines unless you maintain table ROOSPRMS
    Then you need an idea of the number of records to be transferred say 10,000,000
    The calculation of “Number of records per Data Packet” would be
    (Max Lines/Structure Width x 1,000)
    The calculation of “Total Number of Data Packets” would be
    (Number of Records/Number of records per Data Packet)
    So in my example the calc would be
    (100,000/250) x 1,000 = 400,000 records per data packet
    And the number of packets would be
    (10,000,000/400,000) = 25 data packets
    So in summary decrease your packet size and as a result the number of packets will increase but your information will pass through the function module
    Have a look at these links as well
    http://help.sap.com/saphelp_sem40bw/helpdata/EN/b8/5b723b9b4f8f7de10000000a114084/frameset.htm
    http://help.sap.com/saphelp_sem40bw/helpdata/EN/17/e0603801be792de10000009b38f842/content.htm
    Hope this helps, Good Luck
    Ben
    Please assign points if useful

  • How to pick the entries from a function  module fields values

    hi guys,
                i have a function module 'BP_JOBLOG_READ’.when i execute this for a particular jobname,i will get some entries.again if i click those entries,i will get some fields with values.in that one field 'text' contains total credit amount(purely numeric).how to fetch this value into internal tabel and update into my internal table.very urgent.plz provide some coding.rewards wil b there for helpful sggestion.

    Mahesh,
    Use the FM  BP_JOBLOG_SHOW  to display those job logs.
    Hope this is helpful.
    Thanks,
    Naren

  • Performance issue for this function-module(HR_TIM_REPORT_ABSENCE_DATA)

    Hi Friends
    I am having performance issue for this function-module(HR_TIM_REPORT_ABSENCE_DATA) and one my client got over 8 thousend employees . This function-module taking forever to read the data. is there any other function-module to read the absences data IT2001 .
    I did use like this .if i take out this F.M 'HR_TIM_REPORT_ABSENCE_DATA_INI' its not working other Function-module.please Suggest me .
    call function 'HR_TIM_REPORT_ABSENCE_DATA_INI'
    exporting "Publishing to global memory
    option_string = option_s "string of sel org fields
    trig_string = trig_s "string of req data
    alemp_flag = sw_alemp "all employee req
    infot_flag = space "split per IT neccessary
    sel_modus = sw_apa
    importing
    org_num = fdpos_lines "number of sel org fields
    tables
    fieldtab = fdtab "all org fields
    field_sel = fieldnametab_m. "sel org fields
    To Read all infotypes from Absences type.
    RP_READ_ALL_TIME_ITY PN-BEGDA PN-ENDDA.
    central function unit to provide internal tables: abse orgs empl
    call function 'HR_TIM_REPORT_ABSENCE_DATA'
    exporting
    pernr = pernr-pernr
    begda = pn-begda
    endda = pn-endda
    IMPORTING
    SUBRC = SUBRC_RTA
    tables
    absences = absences_01
    org_fields = orgs
    emp_fields = empl
    REFTAB =
    APLTAB =
    awart_sel_p = awart_s[]
    awart_sel_a = awart_s[]
    abstp_sel = abstp_s[]
    i0000 = p0000
    i0001 = p0001
    i0002 = p0002
    i0007 = p0007
    i2001 = p2001
    i2002 = p2002
    i2003 = p2003.
    Thanks & Regards
    Reddy

    guessing will not help you much, check with SE30 to get a better insight
    SE30
    The ABAP Runtime Trace (SE30) -  Quick and Easy
    what is the total time, what are the Top 10 in the hitlist.
    Siegfried

Maybe you are looking for