How to fetch Billing Document Number

Hi All,
i have Sold to party (kunnr), from this i need to find Billing document number and the corresponding Ship to party.
i have used
      SELECT vbeln FROM vbpa INTO TABLE gt_vbeln
                              WHERE PARVW = 'WE' AND
                                    kunnr = p_kunnr.
      if gt_vbeln is NOT INITIAL.
        SELECT KUNNR FROM vbpa
                             INTO TABLE gt_kunnr
                             FOR ALL ENTRIES IN gt_vbeln
                             WHERE vbeln = gt_vbeln-vbeln AND
                                   PARVW = 'AG'.
        DELETE ADJACENT DUPLICATES FROM gt_kunnr COMPARING ALL FIELDS.
      ENDIF.
the first select query is taking long time n it is going for dump, please suggest me the solution.
Regards,
Kumar

Hi Kumar,
I will recommend with the below solution:
1. Select vbeln from vbrk...gt_vbeln
       where kunag = sold-to-party.
2. if gt_vbeln[] is not initial.
   Select from vbpa...
       for all entries in gt_vbeln
       where vbeln = gt_vbeln-vbeln
            and parvw = 'WE'.  "Ship to party
    endif.
If you have any qn / concern on the above soln, please let me know.
Regards,
Selva K.
Edited by: Selvakumar Krishnan on Jul 20, 2010 9:21 PM

Similar Messages

  • How to fetch accounting document number from known material document number

    Hi,
    Using MIGO transaction, by giving mblnr(material document number) as input, I get accounting document number by clicking FI document.I have to add this accounting document number in my report for corresponding known mblnr(material document number) values.
    My question is how to fetch the accounting document number present in MIGO to add in my report program.
    I used the xblnr(Reference Document Number) which is present both in mkpf and bkpf tables to fetch values.
    I extracted xblnr values with known mblnr values from mkpf (Header: Material Document table).
    and then extracted belnr(accounting document number) from bkpf (Accounting Document Header table) by using xblnr values.
    But the query is running for a long time.
    Is there any other method  to extract the values in a simpler way.
    Kindly advise.
    Thanks and Regards,
    Sanjeev

    I had the values of xblnr and some other fields such as mblnr, budat etc in wi_item table.
    I created a new internal table i_xblnr and got down those values.
    And then created a new internal table i_belnr and tried to get values of belnr in it.
    The code I wrote is given below:
    IF not wi_item[] is initial.
    loop at wi_item.
       at new xblnr.
        ws_xblnr-xblnr = wi_item-xblnr.
         append ws_xblnr to i_xblnr.
       endat.
    endloop.
      select belnr xblnr from bkpf into table i_belnr for all entries in i_xblnr where xblnr = i_xblnr-xblnr.
    ENDIF.
    Kindly look after it.Thank you.
    Regards,
    Sanjeev

  • How to get intercompany billing document number

    Hi,
    I have PO number , Delivery number  for a given shipping plant and receiving plant.I want to get the intercompany billing document number.Is there any method to fetch.Can anyone suggest me how to proceed with this.Intercompany billing document number can be obtained from VBRK-vbeln for type that is VBRK-fkart = iv .But how to relate PO number and delivery number with this.
    Regards,
    Sowmya.

    Hi Friend,
    Yes you can check though billing type IV.
    Gereally in inter company billing, we generally create a customer in the receiving company. Try to know the name of the customer (generally it is one and fixed) from functional consultant, and pass to bill to party, it will help to reduce lot data.
    I thnik delivery has been created through refrence of PO.
    You can get PO and delivery number if it is stored in the text of Billing doc.
    Consult with functional guys and tell them to store these numbers.
    Regards
    Krishnendu Laha

  • How to find sales document and billing document number of a accounting doc

    Hi,
    I have opened a accounting doc. using fb03. Now how to find the corresponding sales doc. and billing doc. no. of this accounting doc. no.

    Dear satyam
    Go to SE16 / BKPF, give the accounting document number reference in "Document number" and execute, so that you will get the respective billing document number.  Make a note of it.
    Now go to again SE16 and give table VBFA and give all the billing document references in "Follow-on doc" and maintain "C" in "Prec.doc.categ." and execute.
    Alternatively, you can try with table joining BKPF and VBFA in SQVI.
    thanks
    G. Lakshmipathi

  • How to get Accounting document number from billing document number

    Hi,
    How to get Accounting document number from billing document number i.e. from VBAK- VBELN.
    Cheta Pant

    Hi,
    VBAK is the Sale Order header table, Billing document table is VBRK.
    Sales tables (VBAK,VBAP,VBRP,VBRK) do not store accounting document numbers.
    You do other way around. Just go to SE16 and enter the Billing document number in field Billing document VBELN in BSEG or BSID or BSAD table and execute, you will find the accounting document number.
    If you just want collect this information once then you can use table BSEG, but if you think to develope a report then use table BSID and BSAD.
    Regards,
    Chintan Joshi

  • How to get po number based on billing document number

    Hi every body
          how to get a po number based on billing document number
    thanks in advance.
    sekhar.k

    Hi,
    Check this field VBRK-BSTNK_VF.
    Regards,
    Satish

  • How to syncronize billing document and accounting document numbers?

    Hello,
    In RV60AFZC USEREXIT_NUMBER_RANGE_INV_DATE I changed the number range for the billing document from what is configured for F2. I need for the accounting document number to be the same as the billiing document number. I have created an new external accounting document number range equal to the new biliing document number range, but the accounting document number is still being assigned from the number range that is configured for RV. How can I get it to pick up the new accounting doc number range?
    Thanks much,
    Joy

    Dear satyam
    Go to SE16 / BKPF, give the accounting document number reference in "Document number" and execute, so that you will get the respective billing document number.  Make a note of it.
    Now go to again SE16 and give table VBFA and give all the billing document references in "Follow-on doc" and maintain "C" in "Prec.doc.categ." and execute.
    Alternatively, you can try with table joining BKPF and VBFA in SQVI.
    thanks
    G. Lakshmipathi

  • Get Sales order from Billing document number

    Given Billing document number from VBRK-VBELN, how to get the Sales order number VBAK-VBELN?

    Please check table VBFA.
    Below code might give you some idea:
    PARAMETERS: P_VBELN TYPE VBELN OBLIGATORY.
    DATA: COMWA TYPE VBCO6.
    DATA: IT_VBFA TYPE TABLE OF VBFA,
          WA_VBFA TYPE VBFA.
    COMWA-VBELN = P_VBELN.
    CALL FUNCTION 'RV_ORDER_FLOW_INFORMATION'
      EXPORTING
       BELEGTYP            = 'M'
       COMWA               = COMWA
      TABLES
        VBFA_TAB            = IT_VBFA
    EXCEPTIONS
       NO_VBFA             = 1
       NO_VBUK_FOUND       = 2
       OTHERS              = 3.
    LOOP AT IT_VBFA INTO WA_VBFA WHERE VBTYP_N = 'C'.
       WRITE:/ WA_VBFA-VBELN.
    ENDLOOP.
    Kind Regards
    Eswar

  • To know Customer from Billing Document number

    Hi,
    In VF03 IN we enter BILLING DOCUMENT NUMBER then we get detail of that. How can we find Customer(KUNNR from KNA1) from this BILLING DOCUMENT NUMBER. Please help me in this.
    Thanks in advance.

    Hi  Suresh..
    Table: VBFA (sales doc flow)
    From Billing Document No  find the Sales order no.
    Table VBAK - From sales order No find the Customer No.
    reward if Helpful.

  • Sales Order and Billing Document Number

    Hi All,
    I have  Billing document Number (LIKP-VBELN).
    Based on Billing document number, how to find out the corresponding Sales Order....????
    Is there any logic to find out this...??????
    Regards
    Pavan

    Hi,
    Go to VF02 and enter your Billing Document Number and "Enter".
    Environment -> Display Document Flow.
    Select standard order ->  Diplay Document.
    It will shows the sales order.
    Thanks,
    Reward If Helpful.

  • Billing document number based on plant

    Hi friends, I have new requirement from customer
    Billing document number should be based on plant
    Ex: Range start from 900000 u2013 for plant ABC1
          Range start from 800000 u2013 for plant  ABC2
    How to achive this
    regards
    Satish

    Create a zee table say ZV_NUMRANGE for the combination of plant, billing type & number range object.  There maintain some objects according to plant and save.
    Next go to VN01 and maintain number ranges according to requirement and save.
    Finally apply USEREXIT_NUMBER_RANGE (Module pool SAPLV60A, program RV60AFZZ) and trigger the above table as and when VF01 or VF04 is executed.
    thanks
    G. Lakshmipathi

  • P.O number for a billing document number

    Hi Experts,
    From  which table we can find a PO number for corresponding billing document number(VF03)?

    hi RAVI,
    Go to T.code SE16
      enter table name VBRK-->enter
       billing doc type,billing doc no,s.org,d.channel
      execute
    waiting for reward points
    mcm

  • Error while generatin the Billing document number in WPUK

    Dear Experts,
    My clien thaving ISRETAIL ECC6.0 version & we would like to implement Fund management. At the time of sales at stores below mentioned error displaying.
    No commitment item entered in item 2700 2009 9000067
    In this my company code is 2700
    9000067 is billing document number (It is not yet created)
    Best Rgds
    Suma

    980273 NOTE HAS BEEN APPLIED TO ERROR FREE

  • Credit Memo request with reference to Billing Document number via IDoc

    Hi,
    I want to create credit memo request with reference to billing document number via IDocs.
    I have tried through ORDERS05, but when I process I saw that it is only processing with reference to contract  number or quotation.
    So is any other way of creating credit memo request creation with reference to Billing document number via IDocs?
    Thank you in advance.
    Regards,
    Santhi

    Please Help... it is Urgent...  Thank you

  • KE30 report - Unable to see billing document number

    Dear SAP community
    I have a requirement to be able to show the billing document number in a KE30 report.
    Background as follows:
    Sales order created, delivery is created, stock is picked and transferred and delivered, post goods isssue and invoice created to produce the accounting documents.
    The requirement is to show a report which is broken down by sales order and then further drilldown to things like cost centre and billing document numbers.. On running the report, no billing document number is shown.
    I have created a custom characteristic called WWINV in KEA5 using data element VBLEN_VF, Domain VBLEN, check table VBUK.
    WWINV is then assigned to the operating concern (op concern regenerated).
    Next step I created a lookup in KEDR
    Source fields:
    Origin        Field Name    Name                                    Assigned   Origin       Field Name     Name            
    VBRP        VBELN          Billing Document                    =                CO-PA    KAUFN            Sales Document
    VBRP         POSNR         Billing Item                             =                 CO-PA   KDPOS             item number
    Target Fields:
    VBRP        VBELV         Originating Document           =                  CO-PA   WWINV            Billing Doc

    Message" no. DS 016.
    For the above error, you can check note 312392
    thanks
    G. Lakshmipathi

Maybe you are looking for