Function module for VBFA table

Hi Gurus,
Please Help me on this Issue..
I want to retrieve data from vbfa table..while making query to retrieve data from vbfa tabl,its making performance issue on production server.
    SELECT vbelv
           vbeln
                INTO TABLE i_ref_data
    FROM vbfa FOR ALL ENTRIES IN i_billing_main
    WHERE
         vbelv   EQ i_billing_main-vbeln AND
         vbtyp_n EQ c_vbtyp_n.
so i have tried to retrieve data using functiom module "RV_ORDER_FLOW_INFORMATION" .in this function i was not able to pass multiple document no to this function module so put this function module inside the loop but this option also making performance issue..
LOOP AT i_billing_main_temp INTO wa_billing_main.
    CLEAR : wa_comwa,wa_vbfa.
    REFRESH i_vbfa.
    wa_comwa-vbeln = wa_billing_main-vbeln.
This function module used for retrieving document flow data from VBFA
    CALL FUNCTION 'RV_ORDER_FLOW_INFORMATION'
      EXPORTING
        comwa    = wa_comwa
      TABLES
        vbfa_tab = i_vbfa.
    SORT i_vbfa BY vbelv vbeln vbtyp_n.
    DELETE ADJACENT DUPLICATES FROM i_vbfa COMPARING vbelv vbeln vbtyp_n.
    SORT i_vbfa BY vbtyp_n.
    READ TABLE i_vbfa
             INTO wa_vbfa
             WITH KEY vbtyp_n  =  c_vbtyp_n
    BINARY SEARCH.
    IF sy-subrc EQ 0.
      wa_ref_data-vbeln = wa_vbfa-vbeln.
      wa_ref_data-vbelv = wa_billing_main-vbeln.
      APPEND wa_ref_data TO i_ref_data.
    ENDIF.
  ENDLOOP.
so kindly give me the solution for improving performance of this issue.
Is it having any function module to pass multiple inputs to the function module.?
Regards
P.Senthil Kumar
Edited by: senthil kumar on Mar 23, 2009 12:23 PM

Please add  check condition to check  internal table is blank.
if not i_billing_main[] is initial.
SELECT vbelv
vbeln
INTO TABLE i_ref_data
FROM vbfa FOR ALL ENTRIES IN i_billing_main
WHERE
vbelv EQ i_billing_main-vbeln AND
vbtyp_n EQ c_vbtyp_n.
endif.
This is the best possible way to retrive data from VBFA table.
Other method you adopted will take more time since you are calling the FM in loop.
Please check ST05 trace for your above query to see if primary index is being used. Else contact Basis to help you out.

Similar Messages

  • How to create ENQUEUE function module for s567 table

    Hi Experts,
    Anyone Plz tell the steps how to create a ENQUEUE function module for the table s567.
    Its somewht urgent, plz help me.
    <REMOVED BY MODERATOR>
    Mohana
    Edited by: Alvaro Tejada Galindo on Mar 10, 2008 4:21 PM

    Hi,
    You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.
    Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.
    Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.
    Technicaly:
    When you create a lock object System automatically creat two function module.
    1. ENQUEUE_<Lockobject name>. to insert the object in a queue.
    2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.
    You have to use these function module in your program.
    Hope this will give a basic idea.
    Regards
    Sudheer

  • How to find the function module for standard tables.

    Hi
    Could any one please tell me how to find the standard function module to update the standard tables
    Thanks & Regards
    Sowmya

    Hi sowmya,
    To find the function modules for standard tables you go for a where used list of that particular table and check only function module interfaces checkbox...
    and more over you can go for DB_UPDATE_TABLE will be the function module for updating database table..
    Hope this information would help you
    Regards
    Narin Nandivada

  • Urgent: creation function module for chvw table

    hi,
    I want to make Function Module for the fields in which i have to display the production order and batch numbers.plzz tell me how to create for it.

    Hi Everybody,
    About how to use this function Does anyone have an idea?
    I've found it.
    call function 'FI_DOCUMENT_READ'
    exporting
       i_awtyp = 'VBRK'
       i_awref = vbfa_tab-vbeln
       i_awsys = vbrk-logsys
       i_bukrs = vbrk-bukrs
       i_gjahr = vbrk-gjahr
    tables
       t_bkpf = xbkpf
       t_bseg = xbseg
    exceptions
    wrong_input = 1
    not_found = 2.
    But this is not enough.
    Best Regards Rasim.

  • Function module for BSEG table

    Hi Guru's,
      SELECT bukrs
             belnr
             gjahr
             budat
             monat
             waers
             awkey
        FROM bkpf
        INTO TABLE i_bkpf_data
        WHERE  bukrs EQ pa_bukrs AND
               budat IN so_budat.
    SORT i_bkpf_data BY bukrs belnr gjahr.
        IF i_bkpf_data[] IS NOT INITIAL.
          SELECT bukrs belnr gjahr koart dmbtr wrbtr pswsl
                 kokrs kostl hkont aufnr lifnr ebeln buzei shkzg
            FROM bseg
            INTO TABLE i_bseg_data
            FOR ALL ENTRIES IN i_bkpf_data
            WHERE 
                    bukrs  EQ pa_bukrs AND
                   belnr    EQ i_bkpf_data-belnr AND
                   gjahr    EQ i_bkpf_data-gjahr AND
                   kostl    IN so_kostl AND
                   lifnr      IN so_lifnr AND
                   hkont   IN so_hkont.
       ENDIF.
    I got performance issue on this Query..while accessing the data from BSEG table,its makes performance issue in my program so i want to improve performance of the program.i was analysed that BSEG table makes performance issue..
    Hi..Anybody give the solution imporving this Query or give some function module for accessing BSEG table..
    Note..I want to pass my selection inputs also into function module..i was seen some function module for BSEG,those are not satisfying the my inputs so those also making performance issue..
    Regards
    P.Senthil Kumar

    Hi Everybody,
    About how to use this function Does anyone have an idea?
    I've found it.
    call function 'FI_DOCUMENT_READ'
    exporting
       i_awtyp = 'VBRK'
       i_awref = vbfa_tab-vbeln
       i_awsys = vbrk-logsys
       i_bukrs = vbrk-bukrs
       i_gjahr = vbrk-gjahr
    tables
       t_bkpf = xbkpf
       t_bseg = xbseg
    exceptions
    wrong_input = 1
    not_found = 2.
    But this is not enough.
    Best Regards Rasim.

  • SAP Functional Module for authorization tables

    I would like to know are there any standard SAP Functional Modules which could update the Authorization Tables, like AGR_1251.
    Thank you

    Hi Prabhu,
    Other than function modules with role, I had also tried to look for function modules with AuthObject*.
    Because, I would like to update remove one of the authorization object from the system. For example, remove all data which AUTHORIZATION OBJECT = S_SCD0 and ACTIVITY = 06 in the system.
    I got the list of functions from the search, but all of them are without proper documentations. So is very hard for me to understand their functionalities and purposes.
    Kindly advice.
    Thank you.

  • Is their any function module for deleting condition record i am trying

    Hi Experts,
    Is their any function module for deleting condition record i am trying  this way.......
    DATA: TABLE (4) TYPE C.
    DATA: KNUM LIKE KONH-KNUMH
    DATA: K_VEWE LIKE T681-KVEWE VALUE 'A'.
    DATA: T681_STR LIKE T681.
    DATA: LV_NUM TYPE I.
    GET PARAMETERS
    PARAMETERS: TABNO LIKE T681-KOTABNR.
    PARAMETERS: TESTMODE DEFAULT 'X' AS CHECKBOX.
    REFRESH INT_KNUMH.
    Select single * from T681 into T681_STR
    where kvewe = K_VEWE AND
    KOTABNR = TABNO.
    IF SY-SUBRC NE 0.
    WRITE: / 'No entry in T681 for number ', TABNO.
    WRITE: / 'Check whether corresponding condition table exists.'.
    EXIT.
    ENDIF.
    TABLE = T681_STR-KOTAB.
    SELECT KNUMH FROM (TABLE) INTO KNUM.
    SELECT SINGLE * FROM KONH WHERE KNUMH = KNUM.
    IF SY-SUBRC NE 0.
    INT_KNUMH-KNUMH = KNUM.
    COLLECT INT_KNUMH.
    ENDIF.
    ENDSELECT.
    DESCRIBE TABLE INT_KNUMH LINES LV_NUM.
    IF LV_NUM EQ 0.
    WRITE: / 'No inconsistent entries found.'.
    WRITE: / 'Each record in the condition table has a corresponding.'.
    WRITE: / 'entry in the KONH table.'.
    EXIT.
    ENDIF.
    LOOP AT INT_KNUMH.
    IF TESTMODE IS INITIAL.
    DELETE FROM (TABLE) WHERE
    KNUMH = INT_KNUMH-KNUMH.
    IF SY-SUBRC = 0.
    WRITE: / 'KNUMH =', INT_KNUMH-KNUMH(10), ' deleted from table ' ,TABLE.
    ELSE.
    WRITE: / 'DELETE: SY-SUBRC is', SY-SUBRC , ' FOR KNUMH = ' .
    WRITE: INT_KNUMH-KNUMH(10).
    ENDIF.
    ELSE.
    WRITE: / 'TESTRUN: KNUMH =', INT_KNUMH-KNUMH(10).
    ENDIF.
    ENDLOOP.
    is their any Standerd Function module  for comparing  tables if the condition record not exist in it has to exit if it is their then compare  those two tables if not exist in one table also that has  to be delete  the condition record
    Please let me know .....

    Hi,
       You can use Function module PRICING_CHECK to check condition record. Do a where-used list on it to see how to call it.
    Regards
    Kiran Sure

  • Function modules for Transaction SE16  for any table whole data

    Hi Experts,
    i need to pass report or function module input as table name:LFA1.
    I Need to get all the data with fileds for those table.
    say : i/p
    paramters: s_tabname  like (tabname).
    here s_tabname ='lfa1'.
    output :all the fileds details with  whole data like se16 or se11 transaction for table.
    is there any function module.
    Thanks
    nag

    Hi,
    you can create this easily using runtime creation of objects and SALV for display.
    Although I would never do something like this...
    REPORT  zzzz.
    DATA:
      gr_itab  TYPE REF TO data,
      gr_salv  TYPE REF TO cl_salv_table.
      PARAMETERS:
        p_table TYPE tabname.
      FIELD-SYMBOLS:
        <tab> TYPE table.
    START-OF-SELECTION.
      create data gr_itab type table of (p_table).
      ASSIGN gr_itab->* TO <tab>.
      select *
        from (p_table)
        into table <tab>.
      TRY.
          cl_salv_table=>factory(
            IMPORTING
              r_salv_table = gr_salv
            CHANGING
              t_table      = <tab> ).
        CATCH cx_salv_msg.                                  "#EC NO_HANDLER
      ENDTRY.
      DATA:
        lr_functions TYPE REF TO cl_salv_functions_list.
      lr_functions = gr_salv->get_functions( ).
      lr_functions->set_all( abap_true ).
      gr_salv->display( ).
    You won't find anything simpler.
    Regards,
    Clemens

  • Function Module for .xlsx to Internal table

    Hi Gurus,
    Please let me know if there is any function module for .xlsx to internal table.
    Kind regards,
    Varun

    Hi,
    try the below FM's
    ALSM_EXCEL_TO_INTERNAL_TABLE
    TEXT_CONVERT_XLS_TO_SAP
    Thanks,
    Vinayaka

  • Rfc enabled function module for the updating the database table

    Hi,
            I need one rfc enabled function module for the updating the database table from the legacy system.currently i am using the rfc_read_table to read the database table.similarly i need for the update.

    Hi
    I believe you need to create one by yourself
    Max

  • Function module for table control

    Hi experts,
    I am creating the BDC program, In that I need to select the particular item from the table control say for example item 0010 or 0020 based on the input file and need to process from there.
    Is there any function module to select the particular item by passing item no say 0010 or 0020.
    Thanks in advance
    sai

    Hi
    I suppose there is no function module for table control.
    below solution might be useful to you.
    1) Do BDC recording for the table control with each condition you would like to incorporate in your program.
    2) copy the code of Table Control recording in your program and place the code in Loop of internal table.
    3) based on the condition  call the respective BDC recording of the table control
    4) By the above steps  you can manage the table control based on the condition.
    Regards
    Santosh Kumaar.M

  • How to create the INBOUND Function Module for INBOUND IDOCs

    Hi Friends,
    Can any Suggest me How to proceed to Create an INBOUND Function Module for Processing the INBOUND IDOCS
    which are recieved from XI Server ?
    I am working in SAP-ISU
    Here i will recieve the INBOUND IDOCs for the Meter Reading Orders.
    We have a Standard INBOUND FUNCTION MODULE
    IDOC_INPUT_ISU_MR_UPLOAD
    which Uploads the Meter Reading Results.
    I copied the Same function Module into ZIDOC_INPUT_
    and working on it.
    Can any one suggest me, whether i am going in correct way or not.
    In IDOC_INPUT_ISU_MR_UPLOAD Inbound fun module,
    BAPI_MTRREADDOC_UPLOAD is used to Update or Insert the Meter Reading Results,
    My requirment is to Insert and Update the Meter Reading Orders which are Inbounded from XI.
    Can I Use the Same BAPI
    BAPI_MTRREADDOC_UPLOAD
    to Update the below fields,
    EABL-SERNR
    EABL-ZWNUMMER
    EABLG-ABLESGR
    EABL-V_ZWSTAND
    EABL-N_ZWSTAND
    EABL-ABLHINW
    EABL-ZSKIPC
    EABL-ADAT
    EABL-ATIMTATS
    EABL-ADATTATS
    EABL-ATIM
    EABL-ZMESSAGE
    EABL-ABLESER(Meter reader number)
    Kindly Suggest me,
    Thanks in Advance,
    Ganesh

    Hello Ganesh
    I think you are going completely astray with you z-function module for IDoc processing.
    If you look at TABLES parameter METERREADINGRESULTS (type BAPIEABLU ) of BAPI_MTRREADDOC_UPLOAD you will find many of the requested fields already:
    EABL-SERNR => BAPIEABLU-SERIALNO
    EABL-ZWNUMMER =>REGISTER
    EABLG-ABLESGR
    EABL-V_ZWSTAND
    EABL-N_ZWSTAND
    EABL-ABLHINW
    EABL-ZSKIPC
    EABL-ADAT
    EABL-ATIMTATS => ACTUALMRTIME
    EABL-ADATTATS => ACTUALMRDATE
    EABL-ATIM
    EABL-ZMESSAGE
    EABL-ABLESER(Meter reader number)
    Field EABL-ZMESSAGE appears to be custom field (at least I cannot find it on ECC 6.0). If this field was added using include CI_EABL then you probably can get these values into the BAPI using the EXTENSIONIN parameter.
    Check routine CHECK_UPLOADRECORDS in the BAPI which allows two extension structures:
    - BAPI_TE_EABL
    - BAPI_TE_EOSB
    Not surprisingly BAPI_TE_EABL contains the include CI_EABL.
    Regards
      Uwe

  • Function Modules for uploading the file

    Hi experts ,
                      I have a requirement to download a file (csv) from my local sytem (say desktop) into an internal table first and then update the contents of the same internal table into the database table.
    Can anybody provide me with a sample program for doing the same or at least the name of function modules for the same.
    Prompt replies will be rewarded.
    TIA
    Abhishek

    Hi Abhishek,
    How to use INSERT Statement..
    Check this Sample Program..
    TABLES:MARA.
    DATA:ITAB LIKE MARA OCCURS 0 WITH HEADER LINE.
    START-OF-SELECTION.
    ITAB-MATNR = '123ABCDA'. .
    ITAB-MBRSH = 'C'.
    ITAB-MTART = 'FERT' .
    ITAB-MEINS = 'KG' .
    APPEND ITAB.
    ITAB-MATNR = '123ABCDB'. .
    ITAB-MBRSH = 'C'.
    ITAB-MTART = 'FERT' .
    ITAB-MEINS = 'KG' .
    APPEND ITAB.
    LOOP AT ITAB.
    INSERT MARA FROM ITAB.
    MODIFY MARA .
    ENDLOOP.

  • Function Module for open Purchase Order & Sales Order?

    Hi, commonly I read the data from tables and calculate the open quantity for sales order and purchase order, but I want to know, are there any standard function modules for getting the list of open "purchase order" and "sales order" respectively?
    Thanks and Regards.

    hi Ren,
    u can check all these bapi's related to salesorder
    BAPI_SALESORDER_CHANGE Sales order: Change Sales Order
    BAPI_SALESORDER_CONFIRMDELVRY Sales Order: Confirmation of Delivery; Document Flow Update
    BAPI_SALESORDER_CREATEFROMDAT1 Sales order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDAT2 Sales order: Create Sales Order
    BAPI_SALESORDER_CREATEFROMDATA Create Sales Order, No More Maintenance
    BAPI_SALESORDER_GETLIST Sales order: List of all Orders for Customer
    BAPI_SALESORDER_GETSTATUS Sales Order: Display Status
    BAPI_SALESORDER_SIMULATE Sales Order: Simulate Sales Order
    May be this FM can help you
    MB_ADD_PURCHASE_ORDER_QUANTITY (Reading and adding open purchase order quantities)
    Regards,
    Naveen

  • Error in XXL_FULL_API function module for download report to excel

    Hi all,
    I am using XXL_FULL_API function module for download report to excel, In this FM we have to fill a table called sema        = t_gxxlt_s. in this table we have a fields called
    i_sema-col_no  = 19.
      i_sema-col_src = 19.
      i_sema-col_typ = 'STR'.
      i_sema-col_ops = 'DFT'
    here in 'col_typ' if we put STR in excel it will come as a text but i wnat the time field what i have to pass ?
    and for filed 'col_ops' also ??
    Thaks,
    Sridhar

    Hi sridhar joshi,
    Please check this program
    REPORT Excel.
    TABLES:
      sflight.
    * header data................................
    DATA :
      header1 LIKE gxxlt_p-text VALUE 'Suresh',
      header2 LIKE gxxlt_p-text VALUE 'Excel sheet'.
    * Internal table for holding the SFLIGHT data
    DATA BEGIN OF t_sflight OCCURS 0.
            INCLUDE STRUCTURE sflight.
    DATA END   OF t_sflight.
    * Internal table for holding the horizontal key.
    DATA BEGIN OF  t_hkey OCCURS 0.
            INCLUDE STRUCTURE gxxlt_h.
    DATA END   OF t_hkey .
    * Internal table for holding the vertical key.
    DATA BEGIN OF t_vkey OCCURS 0.
            INCLUDE STRUCTURE gxxlt_v.
    DATA END   OF t_vkey .
    * Internal table for holding the online text....
    DATA BEGIN OF t_online OCCURS 0.
            INCLUDE STRUCTURE gxxlt_o.
    DATA END   OF t_online.
    * Internal table to hold print text.............
    DATA BEGIN OF t_print OCCURS 0.
            INCLUDE STRUCTURE gxxlt_p.
    DATA END   OF t_print.
    * Internal table to hold SEMA data..............
    DATA BEGIN OF t_sema OCCURS 0.
            INCLUDE STRUCTURE gxxlt_s.
    DATA END   OF t_sema.
    * Retreiving data from sflight.
    SELECT * FROM sflight
             INTO TABLE t_sflight.
    * Text which will be displayed online is declared here....
    t_online-line_no    = '1'.
    t_online-info_name  = 'Created by'.
    t_online-info_value = 'KODANDARAMI REDDY'.
    APPEND t_online.
    * Text which will be printed out..........................
    t_print-hf     = 'H'.
    t_print-lcr    = 'L'.
    t_print-line_no = '1'.
    t_print-text   = 'This is the header'.
    APPEND t_print.
    t_print-hf     = 'F'.
    t_print-lcr    = 'C'.
    t_print-line_no = '1'.
    t_print-text   = 'This is the footer'.
    APPEND t_print.
    * Defining the vertical key columns.......
    t_vkey-col_no   = '1'.
    t_vkey-col_name = 'MANDT'.
    APPEND t_vkey.
    t_vkey-col_no   = '2'.
    t_vkey-col_name = 'CARRID'.
    APPEND t_vkey.
    t_vkey-col_no   = '3'.
    t_vkey-col_name = 'CONNID'.
    APPEND t_vkey.
    t_vkey-col_no   = '4'.
    t_vkey-col_name = 'FLDATE'.
    APPEND t_vkey.
    * Header text for the data columns................
    t_hkey-row_no = '1'.
    t_hkey-col_no = 1.
    t_hkey-col_name = 'PRICE'.
    APPEND t_hkey.
    t_hkey-col_no = 2.
    t_hkey-col_name = 'CURRENCY'.
    APPEND t_hkey.
    t_hkey-col_no = 3.
    t_hkey-col_name = 'PLANETYPE'.
    APPEND t_hkey.
    t_hkey-col_no = 4.
    t_hkey-col_name = 'SEATSMAX'.
    APPEND t_hkey.
    t_hkey-col_no = 5.
    t_hkey-col_name = 'SEATSOCC'.
    APPEND t_hkey.
    t_hkey-col_no = 6.
    t_hkey-col_name = 'PAYMENTSUM'.
    APPEND t_hkey.
    * populating the SEMA data..........................
    t_sema-col_no  = 1.
    t_sema-col_typ = 'STR'.
    t_sema-col_ops = 'DFT'.
    APPEND t_sema.
    t_sema-col_no = 2.
    APPEND t_sema.
    t_sema-col_no = 3.
    APPEND t_sema.
    t_sema-col_no = 4.
    APPEND t_sema.
    t_sema-col_no = 5.
    APPEND t_sema.
    t_sema-col_no = 6.
    APPEND t_sema.
    t_sema-col_no = 7.
    APPEND t_sema.
    t_sema-col_no = 8.
    APPEND t_sema.
    t_sema-col_no = 9.
    APPEND t_sema.
    t_sema-col_no = 10.
    t_sema-col_typ = 'NUM'.
    t_sema-col_ops = 'ADD'.
    APPEND t_sema.
    CALL FUNCTION 'XXL_FULL_API'
      EXPORTING
    *   DATA_ENDING_AT          = 54
    *   DATA_STARTING_AT        = 5
       filename                = 'TESTFILE'
       header_1                = header1
       header_2                = header2
       no_dialog               = 'X'
       no_start                = ' '
        n_att_cols              = 6
        n_hrz_keys              = 1
        n_vrt_keys              = 4
       sema_type               = 'X'
    *   SO_TITLE                = ' '
      TABLES
        data                    = t_sflight
        hkey                    = t_hkey
        online_text             = t_online
        print_text              = t_print
        sema                    = t_sema
        vkey                    = t_vkey
    EXCEPTIONS
       cancelled_by_user       = 1
       data_too_big            = 2
       dim_mismatch_data       = 3
       dim_mismatch_sema       = 4
       dim_mismatch_vkey       = 5
       error_in_hkey           = 6
       error_in_sema           = 7
       file_open_error         = 8
       file_write_error        = 9
       inv_data_range          = 10
       inv_winsys              = 11
       inv_xxl                 = 12
       OTHERS                  = 13
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    please refer this link
    http://www.thespot4sap.com/Articles/Download_to_excel.asp
    Best regards,
    raam

Maybe you are looking for