Enquiry in VBFA table

Hi all,
How can I genarate a report of finding Net value of Return and Cancelled invoices by Querying VBFA table ?
Regards,
Pooja

hi,
Check these FM.
READ_VBFA
WB2_READ_VBFA_BACK_TO_START
Use BKPF / VBRP table to fetch delivery details.
BKPF-AWKEY = VBRP-VBELN
You could try FM: RV_ORDER_FLOW_INFORMATION.
Check this thread..
How to read ducument flow (VBFA) using FM ?
Also some info which u can chk:
May be you can try the following FMs:
SD_VBFA_ARRAY_READ_VBELV
SD_VBFA_READ_WITH_VBELV
SD_VBFA_SELECT
SD_VBFA_SINGLE_READ
SD_VBFA_TRANSFER_TO_BUFFER.
regs,
hema.

Similar Messages

  • How to update the VBFA table without entries in VBRK and VBRP tables

    Hello,
    I have a requirement , where the sales order , delivery happens in one SAP system say X system and billing document wil happens in other sap system say Y.
    Now in this particular case , if the user want to know the billing document number in X system. what would be the solution.
    Is there any possibility to update the VBFA table with invoice number of Y system (without updating the VBRK and VBRP tables).
    User want to see the billing doc number from sales order in the form of document flow in X system
    Thanks in advance
    Pradeep

    Hii
    Without updating VBRK/VBRP table and updating VBFA is not possible, So you have to play with work arround to create one Z TABLE, so whenever system Y will create billing document with the reference of System X data you have to update Ztable with Invoice number created in System Y, The primary key will be in Z TABLE is Delivery document number to track one to one with billing doc.
    Thanks and Regards
    Shambhu Sarkar

  • Secondary index on vbfa table

    I have very expensive statement running against VBFA table. It comes from a customer report and doing SQL:
    SELECT /*+ FIRST_ROWS */ "VBELV"
    FROM "VBFA"
    WHERE "MANDT" = :A0 AND "VBELN" = :A1 AND ROWNUM <= :A2
    It has execution plan:
    SELECT STATEMENT ( Estimated Costs = 96.009 , Estimated #Rows = 41 )
    |
    --- COUNT STOPKEY
    |
    INDEX RANGE SCAN VBFA~0
    As you can see it is very expensive statement because VBFA is huge table and because I have only VBFA~0 index with columns:
    UNIQUE Index VBFA~0
    COLUMN DISTINCT VALUES
    MANDT      1
    VBELV       1.589.207
    POSNV      4.184
    VBELN       3.202.114
    POSNN       58.173
    VBTYP_N    18
    In order to improve performance of this report , would you recomend creating secondary index and would it be on columns: MANDT, VBELN, VBELV
    I have not seen this type of secondary index in SAP community (most of the time I see sec.index on mandt, vbeln and posnn columns) so that is why I want to double check it before I deploy it.
    Regards,
    Andrija

    Hi,
    Indexes speed up access to rows in a table. They can be created for a single column or for a series of columns.
    MANDT AND VBELN does not have index then create indexes on these columns.
    The explain statement can be used to check the effect of creating or deleting indexes (see index) on the choice of search strategy for the specified SQL statement. You can also estimate the time needed by the database system to process the specified SQL statement. The specified QUERY or SINGLE SELECT statement is not executed while the EXPLAIN statement is being executed.
    To be frank to analyze you shd generate trace file and you need to analyze.
    Oracle claims that <b>first_rows_n</b> optimization results in faster response time for certain queries, we must remember that the performance is achieved via a change to the costing.
    Use the FIRST_ROWS hint when you need only the first few hits of a query. When you need the entire result set, do not use this hint as it might result in poorer performance.
    So collect stats,Analyze table create index your query will execute faster.
    Analyze in trace file generated.Want to know indexes are used or not have a look on Explain Plan.
    Regards
    Vinod

  • How imrove the peformance of VBFA table in select statements.

    Hi,
    whenever execute program in production, program execution will taking long time due to below select statement.
    Please help me how we imrove performance?
    SELECT vbelv vbeln posnn vbtyp_v
    FROM vbfa
    INTO TABLE l_i_vbfa
    FOR ALL ENTRIES IN l_i_bill_cs
    WHERE vbeln EQ l_i_bill_cs-vbeln
    AND posnn EQ '000010'
    AND vbtyp_n IN ('K', 'H'). "MOD-024--
    AND vbtyp_v IN ('K', 'H'). "MOD-024++
    SORT l_i_vbfa BY vbeln vbtyp_n.
    Regards,
    Naidu
    Moderator message: third time I have to remind you: for performance problems with VBFA table please search for previous discussions of the same topic
    Edited by: Thomas Zloch on Nov 9, 2010 12:41 PM

    Hi Naidu,
    ranges: r_vbtypv type vbfa-r_vbtyp_v.
      CLEAR r_vbtypv.
      r_vbtypv-option = 'EQ'.
      r_vbtypv-sign   = 'I'.
      r_vbtypv-low    = 'K'.
      APPEND r_vbtypv.
      CLEAR r_vbtypv.
      r_vbtypvl-option = 'EQ'.
      r_vbtypv-sign   = 'I'.
      r_vbtypv-low    = 'H'.
      APPEND r_vbtypv.
    sort l_i_bill_cs by vbenl.
    if not l_i_bill_cs[] is initial.
    SELECT vbelv vbeln posnn vbtyp_v
    FROM vbfa
    INTO TABLE l_i_vbfa
    FOR ALL ENTRIES IN l_i_bill_cs
    WHERE vbeln EQ l_i_bill_cs-vbeln
    AND posnn EQ '000010'
    AND vbtyp_v IN r_anlkl.
    endif.
    SORT l_i_vbfa BY vbeln vbtyp_n.
    Thanks,
    Nelson

  • Extraction from VBFA table

    Hi All,
    How can I create extractor on the VBFA table supporting delta mode?
    Thanks in advance
    Regards

    To make data source which support just go in RSO2.
    Using Table you can make the data source now for on which filed you like to take Delta that you have to maintained in Tab Generic Delta in this select for ex AEDAT.
    and then after save both.
    But i suggest please make a view on this table and then after make the data source. It will be helpful in future.

  • 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.

  • Reading VBAK, VBAP and VBFA table during a process

    Hi friends,
    I have an execution DUMP in a Z report, so I would be very thankful if you can give me your expert opinion.
    I have a Z report which collects some information into an internal table. After that, I need to go over each record and read VABK, VBAP and VBFA tables and compute some quantities. It is not possible to do this in another way because I need to get some information first.
    Of course, each table is being read in the corresponding sequence (1st VBAK, then VBAP and then VBFA and at the end LIPS table) using the key or part of it. The problem is that if the user wants to execute the report online, it will be finish in a dump at this routine.
    My question is if it is possible to skip the dump getting VBAK and VBAP tables in memory and instead of reading directly, read them from memory. Notice that if I do this I need to put almost the entire table into memory. So, do you think that I will earn time or it will be the same or worse?
    Thanks in advance & kind regards,
    MMP.

    Hi everybody!
    We applied the note but it doesn't help. We realized that we have a problem with records quantity, so the key user is going to analyze which other parameter could be helpful.
    Thank everybody very much!
    Kind regards.

  • Field in vbfa table

    Hi friends,
    I am facing a problem in vbfa table.
    I have  a billing documnet number 1000 in l_value1
    now based  upon this billing document number i need to get the delivery number from vbfa table
    can any one tell which field should i use to retrive delivery number from vbfa table.
    and after the delivery number from vbfa table later i need to get the shipment number for that particular delivery number.
    can any one tell me which field should i use.
    Regards
    Priyanka.

    Hi,
    Use the logic in this way to get the delivery number...
    select vbelv                                                     " Preceding sales and distribution
             posnv                                                     " Preceding item of an SD document
             vbeln                                                      " Subsequent sales and distribution
             posnn                                                        " Subsequent item of an SD document
             vbtyp_n                                                    " Subsequent document document category
        from vbfa
        into table i_vbfa
        for all entries in i_value
        where vbeln = i_value-vbeln and
              vbtyp_v = 'J'. " Deliveryr
    Edited by: Subhankar Garani on Dec 12, 2008 11:42 AM

  • I NEED FIELDS FROM VBFA TABLE

    HI ALL,
    I NEED FIELDS FROM VBFA TABLE
    THE FIELDS I WANT IS :
    CUSTOMER-ID
    CUSTOMER NAME
    CONTACT NAME
    PROJECTID
    ORDER NO
    SALES MAN ID
    ORDER PROCESS DATE
    INVOICE DATE
    GROSS AMOUNT
    NET AMOUNT POSTAL CODE.
    THANKS & REGARDS,
    R.VINOD.

    Hi Vinod..
    Try this Code. I made all the modifications in your code .. It will solve ur issues..
    REPORT zsdr_omvsa40.
    TYPE-POOLS
    TYPE-POOLS: slis.
    TABLE DECLARATIONS
    TABLES : vbak, vbkd,
    zzvbak,
    kna1, vbrk, vbrp, knvp .
    INTERNALTABLE DECLARATION *
    DATA: BEGIN OF i_vbak OCCURS 0,
    vbelv LIKE vbfa-vbelv, " Sales Order no
    vbeln like vbfa-vbeln, "Invoice No
    erdat LIKE vbak-erdat, " Date on Which Record Was Created
    kunnr LIKE vbak-kunnr,
    ps_psp_pnr LIKE vbak-ps_psp_pnr, " Work Breakdown Structure Element
    END OF i_vbak.
    *DATA : BEGIN OF i_zzvbak OCCURS 0,
    *vbeln LIKE zzvbak-vbeln,
    *zssidc LIKE zzvbak-zssidc, "Salesman ID
    *END OF i_zzvbak.
    DATA : BEGIN OF i_vbrk OCCURS 0,
    vbeln LIKE vbrk-vbeln,
    fkdat LIKE vbrk-fkdat, "Invoice Date
    END OF i_vbrk.
    DATA : BEGIN OF i_kna1 OCCURS 0,
    kunnr LIKE kna1-kunnr , " Customer Number 1
    name1 LIKE kna1-name1, " Customer Name
    pstlz LIKE kna1-pstlz , " Postal Code
    END OF i_kna1.
    DATA : BEGIN OF i_vbrp OCCURS 0,
    vbeln LIKE vbrp-vbeln,
    aubel LIKE vbrp-aubel,
    netwr LIKE vbrp-netwr , " Net Value in Document Currency
    kzwi1 LIKE vbrp-kzwi1, " Subtotal 1 from pricing procedure for condition
    erdat LIKE vbrp-erdat, "Billing document.
    END OF i_vbrp.
    DATA : BEGIN OF i_knvp OCCURS 0,
    parvw LIKE knvp-parvw , " Partner Function
    kunnr LIKE knvp-kunnr ,
    parnr LIKE knvp-parnr , " Number of contact person
    END OF i_knvp .
    DATA : BEGIN OF i_data OCCURS 0,
    erdat LIKE vbak-erdat, " Date on Which Record Was Created
    vbeln LIKE vbak-vbeln, " Sales Order no
    fkdat LIKE vbrk-fkdat, " Invoice date.
    kunnr LIKE kna1-kunnr , " Customer Number
    ps_psp_pnr LIKE vbak-ps_psp_pnr, " Work Breakdown Structure Element
    name1 LIKE kna1-name1, " Customer Name
    netwr LIKE vbrp-netwr , " Net Value in Document Currency
    kzwi1 LIKE vbrp-kzwi1, " Subtotal 1 from pricing procedure for condition
    parvw LIKE knvp-parvw , " Partner Function
    parnr LIKE knvp-parnr , " Number of contact person
    *zssidc LIKE zzvbak-zssidc, "Salesman ID
    pstlz LIKE kna1-pstlz , " Postal Code
    END OF i_data.
    ALV Declaraton
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
    gd_tab_group TYPE slis_t_sp_group_alv,
    gd_layout TYPE slis_layout_alv,
    it_listheader TYPE slis_t_listheader,
    gd_repid LIKE sy-repid.
    Selection - Screen
    SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS creation FOR vbak-erdat . " Sales Order Date
    SELECT-OPTIONS period FOR vbrk-fkdat . " Invoice Date
    SELECT-OPTIONS order FOR vbak-vbeln . " Sales order no
    SELECT-OPTIONS name FOR kna1-name1 . " Customer Name
    SELECT-OPTIONS contact FOR knvp-parnr . " Contact Name.
    *SELECT-OPTIONS ssid FOR zzvbak-zssidc . " Salesman ID
    SELECT-OPTIONS project FOR vbak-ps_psp_pnr . " Work Breakdown Structure Element
    SELECTION-SCREEN : END OF BLOCK b1.
    START-OF-SELECTION
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM build_fieldcatalog.
    PERFORM BUILD_LAYOUT.
    PERFORM top_of_page.
      PERFORM fill_listheader USING it_listheader.
      PERFORM display_alv_report.
    END-OF-SELECTION.
    *TOP-OF-PAGE.
    TOP-OF-PAGE.
    END-OF-PAGE.
    *& Form BUILD_FIELDCATALOG
    text
    FORM build_fieldcatalog.
      fieldcatalog-fieldname = 'KUNNR'.
      fieldcatalog-seltext_m = 'Sold to Party'.
      fieldcatalog-col_pos = 0.
      fieldcatalog-outputlen = 10.
      fieldcatalog-emphasize = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'NAME1'.
      fieldcatalog-seltext_m = 'Hlev Customer'.
      fieldcatalog-col_pos = 1.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'PARNR'.
      fieldcatalog-seltext_m = 'Contact name'.
      fieldcatalog-col_pos = 2.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'PS_PSP_PNR'.
      fieldcatalog-seltext_m = 'Project ID'.
      fieldcatalog-col_pos = 3.
      fieldcatalog-do_sum = 'X'.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'VBELN'.
      fieldcatalog-seltext_m = 'Sales Document Type'.
      fieldcatalog-col_pos = 4.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'ZSSIDC'.
      fieldcatalog-seltext_m = 'SSID'.
      fieldcatalog-col_pos = 5.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'ERDAT'.
      fieldcatalog-seltext_m = 'so date'.
      fieldcatalog-col_pos = 6.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'FKDAT'.
      fieldcatalog-seltext_m = 'inv date'.
      fieldcatalog-col_pos = 7.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'KWZI1'.
      fieldcatalog-seltext_m = 'gross amt'.
      fieldcatalog-col_pos = 8.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'NETWR'.
      fieldcatalog-seltext_m = 'net amt'.
      fieldcatalog-col_pos = 9.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
      fieldcatalog-fieldname = 'PSTLZ'.
      fieldcatalog-seltext_m = 'Postal code'.
      fieldcatalog-col_pos = 10.
      APPEND fieldcatalog TO fieldcatalog.
      CLEAR fieldcatalog.
    ENDFORM. "BUILD_FIELDCATALOG
    *& Form DATA_RETRIEVAL
    text
    FORM data_retrieval.
      SELECT VBFAvbelv VBFAvbeln
             VBAKerdat VBAKkunnr VBAK~ps_psp_pnr
             INTO TABLE i_vbak
      FROM VBFA
      INNER JOIN vbak
      ON VBFAVBELV = VBAKVBELN
      WHERE VBAK~erdat IN creation
      AND VBFA~vbelV IN ORDER
      AND VBAK~ps_psp_pnr IN project
      AND VBFA~VBTYP_N = 'M'  "Subsequent doc is Invoice
      AND VBFA~VBTYP_V = 'C'  "Prec doc is Sales order
      IF NOT i_vbak[] IS INITIAL.
    **Change of ORDER in SELECTS HERE
        SELECT vbeln fkdat FROM vbrk INTO TABLE i_vbrk
        FOR ALL ENTRIES IN i_vbak
        WHERE vbeln = i_vbak-vbeln
        AND fkdat IN period.
        IF NOT i_vbrk[] IS INITIAL.
          SELECT vbeln aubel netwr kzwi1 FROM vbrp INTO TABLE i_vbrp
          FOR ALL ENTRIES IN i_vbrk
          WHERE VBELN = i_vbrk-vbeln.
        endif.
        SELECT kunnr name1  pstlz  FROM kna1 INTO TABLE i_kna1 FOR ALL ENTRIES IN i_vbak
        WHERE kunnr = i_vbak-kunnr
        AND name1 IN name.
    *SELECT vbeln zssidc FROM zzvbak INTO TABLE i_zzvbak FOR ALL ENTRIES IN i_vbak
    *WHERE vbeln = i_vbak-vbeln
    *AND zssidc IN ssid .
    select netwr kzwi1 erdat from vbrp into table i_vbrp for all entries in i_vbak
    where erdat = i_vbak-erdat.
        SELECT kunnr parnr parvw FROM knvp INTO CORRESPONDING FIELDS OF TABLE i_knvp FOR ALL ENTRIES IN i_vbak
        WHERE kunnr = i_vbak-kunnr
        AND parvw = 'AP'
        AND parnr IN contact.
      ENDIF .
      SORT I_VBAK BY VBELN .
      SORT I_VBRK BY VBELN .
      LOOP AT i_vbrp.  "Invoice Item data
        MOVE i_vbrp-netwr TO i_data-netwr .
        MOVE i_vbrp-kzwi1 TO i_data-kzwi1.
        READ table I_VBAK WITH KEY VBELN = I_VBRP-VBELN BINARY SEARCH.  "Sales Order info
        IF SY-SUBRC = 0.
          MOVE I_VBAK-VBELV TO I_DATA-VBELN.   "Sales Order no
          MOVE I_VBAK-erdat TO I_DATA-erdat.   " Date on Which Record Was Created
          MOVE I_VBAK-kunnr TO I_DATA-KUNNR.    "Customer No
          MOVE I_VBAK-ps_psp_pnr TO I_DATA-ps_psp_pnr. " Work Breakdown Structure Element
        endif.
        READ TABLE I_VBRK WITH KEY VBELN = I_VBRP-VBELN BINARY SEARCH.   "Invoice header info
        IF SY-SUBRC = 0.
          MOVE i_vbrk-fkdat TO i_data-fkdat.
        endif.
        READ TABLE I_KNA1 WITH KEY KUNNR = I_VBAK-KUNNR BINARY SEARCH.   "Customer info
        IF SY-SUBRC = 0.
          MOVE i_kna1-kunnr TO i_data-kunnr.
          MOVE i_kna1-name1 TO i_data-name1.
          MOVE i_kna1-pstlz TO i_data-pstlz .
        endif.
        READ TABLE I_KNvp WITH KEY KUNNR = I_VBAK-KUNNR BINARY SEARCH.   "Partner info
        IF SY-SUBRC = 0.
          MOVE i_knvp-parnr TO i_data-parnr.
        endif.
        APPEND i_data.
      ENDLOOP.
    ENDFORM. "DATA_RETRIEVAL
    *& Form DISPLAY_ALV_REPORT
    text
    FORM display_alv_report.
    GD_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER = ' '
    I_BUFFER_ACTIVE = ' '
      i_callback_program = sy-repid
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
      i_callback_top_of_page = 'TOP_OF_PAGE'
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = ' '
    I_GRID_TITLE =
    I_GRID_SETTINGS =
    IS_LAYOUT =
      it_fieldcat = fieldcatalog[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
    IT_EVENTS =
    IT_EVENT_EXIT =
    IS_PRINT =
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    I_HTML_HEIGHT_TOP = 0
    I_HTML_HEIGHT_END = 0
    IT_ALV_GRAPHICS =
    IT_HYPERLINK =
    IT_ADD_FIELDCAT =
    IT_EXCEPT_QINFO =
    IR_SALV_FULLSCREEN_ADAPTER =
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
      TABLES
      t_outtab = i_data.
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2 .
    *IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    ENDFORM. "DISPLAY_ALV_REPORT
    FORM FOR FILLING LISTHEADER *
    FORM fill_listheader USING it_listheader TYPE slis_t_listheader.
      DATA : wa_listheader TYPE slis_listheader.
      wa_listheader-typ = 'H'.
      wa_listheader-info = 'Noel Gifts International Limited '.
      APPEND wa_listheader TO it_listheader.
      wa_listheader-typ = 'S'.
      wa_listheader-info = 'CUSTOMER CREDIT EXCEPTION REPORT' .
      APPEND wa_listheader TO it_listheader.
      CLEAR wa_listheader.
    ENDFORM. "fill_listheader
    *& Form top_of_page
    text
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = it_listheader.
    ENDFORM. "top_of_page
    REWARD IF HELPFUL.

  • Performane issue in accesing VBFA table

    Hi frnds,
    I have requirement that get sales return value and flow is get delivery document and from delivery get sales detail data and further get return and sales value for particular sales order.
    Now when I am accessing VBFA table  for getting Sales order from delivery document number, it is taking more time to get sales order and it is performance issue.
    So any suggestions are welcome...
    Thanks
    Priyank

    Hi Priyank,
    To get a Sales Order Number for a Delivery Number you can go for the Delivery tables LIKP (Delivery Header) and LIPS (Delivery Item)
    In LIPS we have VGBEL field which is the Sales Order Number, and VGPOS is Sales Item.
    Regards,
    Chandra Sekhar

  • VBFA Table showing in EUR

    Dear All,
    I am facing a peculiar problem.
    We have both domestic and export sales.During domestic  sales the Sales Order and Invoice is displayed in INR,the customer master currency is INR,Company code currency -controlling area and profit center-everwhere the currency is displayed in INR but in VBFA Table the currency is showing as EUR.
    Someone please help me to resolve the issue.
    Regards.
    Saurav

    I would like to add to what my colleague Lakshmi has said.
    What empowers him to correct you when you break the Rules of Engagement, even inadvertently, is that he is a moderator of these forums. It is precisely his job to correct rule breaches, and to guide members in adhering to the rules.
    Regarding what you wrote, there are two points.
    1. This is a global forum. Customs of address and use of language vary tremendously. What is meant as a gentle reminder by one person, may be seen as a rebuke by another. What is considered hurtful by one, may be construed as just fair comment by another. It's a good idea to consider these things, before taking offence. Especially in an online environment where we have no facial expressions or body language to aid our understanding.
    2. Replying in CAPITALS is akin to shouting. In my view this is at least as bad as the alledged sarcasm. I have read Lakshmi's original post to you, and do not consider that he was being anything other than entirely proper in his posting.
    It seems to me that the correct response from you should have been:
    The problem was posted a second time inadvertently. My apologies for any inconvenience caused.
    Now, let's move on and continue to foster an environment of mutual respect.
    matt.

  • Re: vbfa table

    Hi gurus,
           can any one say the use of vbfa table in detail .
    with regards,
      aru.

    Hello Aravind,
    [code]Sales document flow(VBFA)
    genral senario:
    suppose you want to buy a computer
    1) You do Inquiry
    2) You get N number of Quotation for that inquiry
    3) you select 1 quotation for sales order or many for individual parts like CPU in
    one quotation, monitor from one quotation and so on....
    4) for all these sales order(s) you get delivery doc(s) and billing doc(s)
    using VBFA we can get all the doc numbers related to sales senarios
    If you take Inquiry doc all the Quotation doc(s),sales order doc(s) ........
    will be preceding documents.
    for sales order
    Quotation doc(s),Inquiry are subceding.
    billing docs(s) ,delivery doc(s) are preceding documents.
    This is the consept of VBFA table.
    VBFA is the table of the flow of sales document, so you can find all SD document in VBFA, so sales order.
    Now u ave to know the type of a sale document.
    You can find this information in field VBTYP:
    A Inquiry
    B Quotation
    C Order
    D Item proposal
    E Scheduling agreement
    F Scheduling agreement with external service agent
    G Contract
    H Returns
    I Order w/o charge
    J Delivery
    K Credit memo request
    L Debit memo request
    M Invoice
    N Invoice cancellation
    O Credit memo
    P Debit memo
    Q WMS transfer order
    R Goods movement
    S Credit memo cancellation
    T Returns delivery for order
    U Pro forma invoice
    V Purchase order
    W Independent reqts plan
    X Handling unit
    0 Master contract
    1 Sales activities (CAS)
    2 External transaction
    3 Invoice list
    4 Credit memo list
    5 Intercompany invoice
    6 Intercompany credit memo
    7 Delivery/shipping notification
    8 Shipment
    a Shipment costs
    e Allocation table
    g Rough Goods Receipt (only IS-Retail)
    h Cancel goods issue
    i Goods receipt
    j JIT call
    r TD Shipment (IS-Oil Only)
    s Loading Confirmation, Reposting (IS-Oil Only)
    t Gain/Loss (IS-Oil Only)
    u Placing Back in Stock (IS-Oil Only)
    v Two-Step Goods Receipt (IS-Oil Only)
    w Reservation (IS-Oil Only)
    x Loading Confirmation, Goods Receipt (IS-Oil Only)
    $ (AFS)
    So: if you need to find the order like preceding document:
    VBFA-VBELV = VBAK-VBELN.
    VBFA-VBTYP_V = VBAK-VBTYP.
    else:
    VBFA-VBELN = VBAK-VBELN.
    VBFA-VBTYP_N = VBAK-VBTYP.[/code]
    Regards,
    Deepu.K

  • Read data from VBFA table

    hi gurus;
         I want to read data from VBFA table nd pass its VBELV to VBAK table to get VBAK values, Iam using FM SD_DOCUMENT_FLOW_GET ND RV_ORDER_FLOW_INFORMATION, BUT i am not getting desire result. WHEN iam using FM SD_DOCUMENT_FLOW_GET, it will give result only for last row of data, its not considering body part, so tell me how to used this FM properly.
    data: l_docflow type tdt_docflow.
    data lw_docflow type tds_docflow OCCURS 1 WITH HEADER LINE .
    SELECT VBELN KNUMV BUKRS KUNRG REGIO NETWR FKSTO FKDAT FKART  INTO CORRESPONDING FIELDS OF TABLE T_VBRK
          FROM VBRK WHERE BUKRS IN P_BUKRS AND FKDAT IN P_FKDAT AND VKORG IN P_VKORG AND REGIO = '07'
        ORDER BY VBELN KNUMV.
      SORT T_VBRK BY vbeln.
      LOOP AT T_VBRK.
        IF  T_VBRK-FKART = 'F2' OR T_VBRK-FKART = 'YF2' OR T_VBRK-FKART = 'ZF2' OR
            T_VBRK-FKART = 'ZG2' OR T_VBRK-FKART = 'ZL2' OR T_VBRK-FKART = 'YG2' OR T_VBRK-FKART = 'YL2' .
          IF T_VBRK-FKSTO IS INITIAL.
        CALL FUNCTION 'SD_DOCUMENT_FLOW_GET'
      EXPORTING
        IV_DOCNUM              = T_VBRK-vbelN
      IV_ITEMNUM             =
      IV_ALL_ITEMS           =
      IV_SELF_IF_EMPTY       = ' '
    IMPORTING
       ET_DOCFLOW             = l_docflow
    LOOP AT l_docflow INTO lw_docflow   .
      IF  lw_docflow-vbtyp_V = 'C' OR lw_docflow-vbtyp_V = 'K' OR lw_docflow-vbtyp_V = 'L' OR lw_docflow-vbtyp_V = 'E'.
    T_VBFA-vbelv = lW_docflow-vbelv.
    T_VBFA-VBELN = lW_docflow-VBELN.
    T_VBFA-vbtyp_V = lW_docflow-vbtyp_V.
    APPEND t_vbfa.
    endif.
    endloop.
    ENDIF.
    endloop.
    loop at t_vbfa.
      if t_vbfa-vbtyp_V = 'C' OR t_vbfa-vbtyp_V = 'K' OR t_vbfa-vbtyp_V = 'L' OR t_vbfa-vbtyp_V = 'E' .
    SELECT VBELN BSTNK BSTDK FROM VBAK INTO CORRESPONDING FIELDS OF TABLE T_VBAK FOR ALL ENTRIES IN T_VBFA
              WHERE VBELN = T_VBFA-VBELV .
    endif.
      ENDLOOP.

    Hello
    Use the below function module
    RV_ORDER_FLOW_INFORMATION pass the type as C and pass the number.You will get all the flow.
    SELECT VBELN KNUMV BUKRS KUNRG REGIO NETWR FKSTO FKDAT FKART  INTO CORRESPONDING FIELDS OF TABLE T_VBRK  FROM VBRK WHERE BUKRS IN P_BUKRS AND FKDAT IN P_FKDAT AND VKORG IN P_VKORG AND REGIO = '07'
        ORDER BY VBELN KNUMV.
    SORT T_VBRK BY vbeln.
      LOOP AT T_VBRK.
        IF  T_VBRK-FKART = 'F2' OR T_VBRK-FKART = 'YF2' OR T_VBRK-FKART = 'ZF2' OR
            T_VBRK-FKART = 'ZG2' OR T_VBRK-FKART = 'ZL2' OR T_VBRK-FKART = 'YG2' OR T_VBRK-FKART = 'YL2' .
          IF T_VBRK-FKSTO IS INITIAL.
    i_vbco6-vbeln = t_vbrk-vbeln.
    CALL FUNCTION 'RV_ORDER_FLOW_INFORMATION'
      EXPORTING
      AUFBEREITUNG        = '2'
      BELEGTYP            = ' '
        COMWA               = i_vbco6
      NACHFOLGER          = 'X'
      N_STUFEN            = '50'
      VORGAENGER          = 'X'
      V_STUFEN            = '50'
    IMPORTING
      BELEGTYP_BACK       =
      TABLES
        VBFA_TAB            = t_vbfa
    EXCEPTIONS
       NO_VBFA             = 1
       NO_VBUK_FOUND       = 2
       OTHERS              = 3
    endif.
    ENDIF.
    endloop.
    loop at t_vbfa.
      if t_vbfa-vbtyp_V = 'C' OR t_vbfa-vbtyp_V = 'K' OR t_vbfa-vbtyp_V = 'L' OR t_vbfa-vbtyp_V = 'E' .
    *clear t_vbfa.
    SELECT VBELN BSTNK BSTDK FROM VBAK INTO CORRESPONDING FIELDS OF TABLE T_VBAK FOR ALL ENTRIES IN T_VBFA WHERE VBELN = T_VBFA-VBELV .
    endif.
      ENDLOOP.
    In case of any more help is required do let me know
    Regards,
    Nabheet Madan

  • VBFA Table Update for Credit Note

    Hi ,
    I have created a rebate credit memo advice and a credit memo billing docment for final settlement. Now the document category that is displayed in VBAK and VBRK document respectively indicate that the documents created are credit memo documents but when i check in the document flow in Table VBFA, i observed that the document category indicated against the credit note order and Billing document is P and L respectively which is the document category for Debit Memo. Need to know how this document category changed in VBFA from Credit memo to debit memo category.Further need to know how the document category in VBFA table is updated.
    To provide more inputs,when i create a normal credit note advice to billing process,VBFA takes the document category of credit memo.
    Regards,
    VEE KAY

    HI,
    this is not possible.
    Tips:
    1. Create a reserve invoice with negative amount with items copying the original invoice rows inside with custom code. (this will not thouch the stock).
    or
    2. Create a non inventory managed item (service type)  - code: DE (Discount/Exemptions)
    then you can use it:
    2.1. Create the credit memo
    2.2. Copy lines via custom code, but the itemcode will be always your itemcode, and every other can be copied from Invoice.
    each cases there will no connection between your Original Invoice and Created Credit Memo/Reserve Invoice. You should have to use custom code to copy lines from original items.
    In payment you can use the numatcard field for matching the documents together (numatcard: Vendor/Customer reference number)
    Regards,
    J:

  • Generic Data source on VBFA Table

    Dear Experts,
    I would liike beuild a generic data source on VBFA table. Here i want to have all the fields of the Table.
    Now my questions are.
    1.I want to a Delta Update to BW, on want fields I should choose Delta to get all the changed records as well as the newly created records.
    2. Do I need to build the Data source using a Function module.
    3.Along with this I have a requirement to get the Sales Org, Company Code, Maetrial group information. How can I achieve this ( from which all tables I can get this information).
    4. What is the frequncy of the table VBFA update.
    5. generally what would be the number of Records for a Delta Update to BW.
    Your suggestions are appreciated.
    Regards,
    Ganesh Thota.
    Moderator message: a topic for the BI forums, but please invest own research effort before asking there.
    Edited by: Thomas Zloch on Jul 15, 2010 12:56 PM

    Hi,
    you need to create fm for the extraction as you have 2 delta relevant fields erdat and aedat to get the new and the changed records.
    Siggi

Maybe you are looking for