How to get master sales order number from delivery number

Hi All,
I need logic for getting master sales order number from available Delivery number.
Note: There can be many SO's in diffrent levels.
Finally i need to pick up master sales order no.
Thanks in advance.
Thanks,
Deep.

Hi,
I have a outbound delivery[VL03N] 'X' in my system .
Then for getting sales order no i am writing below code:
  SELECT single vbelv vbeln
         from vbfa
         INTO (vbelv, vbeln)
         where vbeln   EQ p_vbeln AND
               vbtyp_n EQ 'J'.
Then vbelv i need to pick up master sales order no.
    SELECT vbelv vbeln
           from vbfa
           INTO TABLE i_so
           where vbeln   EQ l_vbelv AND
                 vbtyp_n EQ 'C'.
If i write code as above it is giving four sales orders which one of them is master sales order no!
Thanks,
Deep.

Similar Messages

  • Which table I can get sales order no from delivery numbar.

    Hi,
    I want sales order no from delivery no. right now I am using table VBFA where I am passing VBELN and POSNN and geting sales order no. but performance of select query is very poor bcouse I am not passing first two key fields in the select query.
    Is there any other tablefrom where we can get sales order no. from delivery no. so that performance of report can be improved.
    Thanks,

    hi,
    sales doc header ( table VBAK ) copy to Delivery header table( LIKP)
    sales doc item table ( VBAP) copy to Delivery item table( LIPS)
    you can see this in copy control VTLA ,
    now u want slaes doc no. from dilv doc. no.
    so go to t-code se11.....
    fill table LIKP u will get VBELN field for deliv doc no, & TERNR field for sales doc. no.
    so if u want to call sales doc no from dilv doc no.. u can use table LIKP in ur report.
    i hope it will help u.

  • Calling VA01 from Report,how to get the Sales Order  No when Back.

    Hi all,
    I have a requirement of calling va01 from the report and have done that using
    did recording ...&
    call transaction va01 using bdcdata.
    but my problem is when back from that trasaction i have to get the sales order that is created . Is it possible to retrieve that value from va01 .i am unable to get . anyone pls share

    Use the addition MESSAGES INTO itab with call transaction va01 using bdcdata.
    Effect of MESSAGES INTO itab:
    Using this addition, all the messages sent during batch input processing are stored in an internal table itab of the type BDCMSGCOLL from the ABAP Dictionary.
    If the call transaction is successful then retrieve the last message from itab and then in any field among MSGV1,MSGV2,MSGV3,MSGV4 of itab u will get the document no.
    And when doing the call transaction pl. choose update mode as 'S' or 'L'.
    Regards,
    Joy.

  • How to get display sale order in MB51

    Hi,
    How we can get display sale order in mb51 , at present only sale order with special stock "E" is been display .
    Thanks..

    HI,
    if you just want last / latest SALES ORDER for material then check table VBAP
    if last billing document then check table VBRP
    check MCBE
    Prese F6
    there you can select the columns
    Last consumptn.
    Last gds issue
    Last gds mvmt.
    Last Receipt
    VA05- Report for the sale with Material Vs Customer. or
    You can easily get that in VBAP by putting the material number for MATNR
    for more clarity please refer the below link...
    How to findout last sale transction date of perticular material
    Regards,
    Udaya.

  • Get a Sales order based on delivery

    Hi,
    Is this the way to get a Sales order based on a delivery ?
    if(Delivery.GetByKey(DeliveryDocEntry))
        Delivery.Lines.SetCurrentLine(1);
        if (SalesOrder.GetByKey(Delivery.Lines.BaseEntry))
            //TODO: Do your job here !

    If you want to see how the multiple so's connected to one DN works,  go into test and create 2 sales orders for the same customer.  Then go into Delivery notes, key in that customer code & hit copy from, then select sales order.  Both those orders will pop up in a matrix & you can select them both at once.  After that the line items from both orders will be in your dn.  If you select a line from the first order & hit the source document icon on the tool bar (even in add mode) it will take you to that order and selecting a line item from the second order & clicking the source button will take you to it's based-on document.
    If you're lucky, your organization never does that, (but "never say never", right?

  • How to trace sales order number from delivery number, when batch is split

    Hi All,
    I have created a Sales Order and a Outbound Delivery against the sales order.
    While creating the Outbound delivery, I have split the qty in two batches.
    Now when I go in table LIPS, and search on the basis of the Delivery number, I get two rows, one for each batch. But here the sales order LIPS-VGBEL, and Sales order item no (LIPS-VGPOS) is updated only for the 1st batch line item, but is not updated for the second batch line item.
    Please help me so that on the basis of the delivery number, i will be able to find record from tables for sales order for both the line items (i.e. for each batch).
    Immediate help would be appreciated.
    Thanks in Advance.
    Ankush

    Hi,
    I have created delivery against sales order.
    While picking (during delivery PGI), I selected two batches to suffice the delivery qty. Please refer the example quoted below.
    Sales order (SO1) - Material (Mat1) - qty (15 ea)
    Delivery against sales order (Del1) - batch split: batch1 - 10 ea
                                                                         batch2 - 5 ea
    In table LIPS: when I enter delivery number as "Del1" and execute, I get 2 records:
       del no.     Item No.      Material   Qty       Batch no       Sales Order no     Sales Order Item no
    1. DEL1       10              Mat1        10 ea    batch1          SO1                    10
    2. DEL1       20              Mat1         5 ea     batch2         ______                 ____
    Thus in the 2nd record, the Sales order no.(LIPS-VGBEL) and sales order item no. (LIPS-VGPOS) does not get updated.
    I have to develop a report to display the Sales Order number and sales order line item number for each batch of the Delivery for the same item number. Please guide me to know how I can get the same.
    Hope this clarifies the issue faced.
    Regards,
    Ankush

  • How to get purchase order number from delivery number?

    hi all,
    how to get purchase order number and item if i have only delivery.
    and in same way how to get po number and item if i know only batch number.
    kindly give me some solution i need this urgently.
    thanks in advance.

    Check the logic below:
    * Selecting the Sales Documents from VBFA for corresponding Invoice
        SELECT vbelv
                     posnv
          FROM vbfa
          INTO TABLE gt_itab3
         WHERE vbeln EQ gt_itab5-vbeln
           AND posnn EQ gt_itab5-posnr
           AND vbtyp_n EQ 'J'.
        IF sy-subrc EQ zero.
          SORT gt_itab3 BY vbelv posnv.
        ENDIF.
      ENDIF.
      IF NOT gt_itab3 IS INITIAL.
    * Selecting the Purchase Orders from VBFA for corresponding Sales Documents
        SELECT vbeln
               posnn
          FROM vbfa
          INTO TABLE gt_itab4
       FOR ALL ENTRIES IN gt_itab3
         WHERE vbelv EQ gt_itab3-vbelv
           AND posnv EQ gt_itab3-posnv
           AND vbtyp_n EQ 'V'.
        IF sy-subrc EQ 0.
          SORT gt_itab4 BY vbeln posnn.
        ENDIF.
      ENDIF.
    Batch number will be there in delivery item.
    Regards
    Kannaiah

  • How to get customer / sales order details for VBBS table?

    Hi Friends,
    I have a requirement to create a report that will give the details of sales order ( VBELN ) and customer ( KUNNR) details from the sales requirement totals record table ( VBBS )
    Currently we have a report that just gives out the VBBS table entries for plant and material combination. As you are aware, the VBBS table contains the sales / deliveries requirements as displayed in MD04 transaction.
    Now there is a requirement to have the customer ( KUNNR ) and sales order (VBELN )  detail for each individual requirement totals.
    I checked the VBBE table ( sales requrirement : individual records ) but I cannot find any relationship between VBBS and VBBE. If there is a material / plant in VBBS , the same entry does not exist in VBBE.
    Please suggest if there is any other table to get this detail.
    Thanks
    Satya

    Tables are related.
    MATNR
    WERKS
    MBDAT
    LGORT
    CHARG
    etc fields are common in both VBBS and VBBE.
    May be you can generate a condition a fetch data using this.
    I hope it helps.
    thanks

  • Get the sales order text from ITS and save it in SAP.

    Hi,
    I have created an application to create sales order from ITS. In this app i'm having a text field to fet the header text for the order. & after that I'm calling an RFC which has a BAPI to create the sales order.
    Now, when i enter the text for header texts in frontend (separated by ENTER), then it saves only the first line of the text.
    I've tried using :
    SPLIT ordernotes AT cl_abap_char_utilities=>cr_lf INTO TABLE t_ordnotes.
    and using FM: CREATE_TEXT,
    but still, it is saving only the first line.
    Can anyone please help me with this ?????
    Its urgent.
    Thanks in advance,
    Hemant.

    Hi
    See the sample BDC program that is used to upload the Material LONG Texts into SAP using MM01 Tcode
    check this may be helpful
    REPORT zmm_longtext
           NO STANDARD PAGE HEADING
           LINE-SIZE 255.
    Internal Table for Upload of Long Texts Data
    DATA: BEGIN OF itab1 OCCURS 0,
            matnr    LIKE mara-matnr,    " Material
            text     LIKE tline-tdline,  " Long Text
          END OF itab1.
    Internal Table for Upload of Long Texts Data
    DATA: BEGIN OF itab OCCURS 0,
            matnr LIKE mara-matnr,    " Material
            text  LIKE tline-tdline,  " Long Text
          END OF itab.
    To create Long Text lines for CREATE_TEXT function module
    DATA:BEGIN OF dt_lines OCCURS 0.
            INCLUDE STRUCTURE tline.   " Long Text
    DATA:END OF dt_lines.
    Variable declarations for CREATE_TEXT function module
    DATA : dl_name TYPE thead-tdname,   " Object Name
           dl_lan TYPE thead-tdspras,   " Language
           gv_matnr TYPE matnr.
    Constants
    CONSTANTS:
    Object ID for Long Text of Material Basic Data 1
      c_best     TYPE thead-tdid VALUE 'GRUN',
      c_material TYPE thead-tdobject VALUE 'MATERIAL'. " Object
    Parameters
    PARAMETERS p_file LIKE rlgrap-filename.
    At selection-screen on Value Request for file Name
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
    Get the F4 Values for the File
      CALL FUNCTION 'F4_FILENAME'
        EXPORTING
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
        IMPORTING
          file_name     = p_file.
    Start Of Selection
    START-OF-SELECTION.
    *To Upload Flat file
      CALL FUNCTION 'UPLOAD'
        EXPORTING
          filename                = p_file
          filetype                = 'DAT'
        TABLES
          data_tab                = itab1
        EXCEPTIONS
          conversion_error        = 1
          invalid_table_width     = 2
          invalid_type            = 3
          no_batch                = 4
          unknown_error           = 5
          gui_refuse_filetransfer = 6
          OTHERS                  = 7.
      SORT itab1 BY matnr.
      LOOP AT itab1.
        CLEAR gv_matnr.
        SELECT SINGLE matnr INTO gv_matnr
           FROM mara WHERE bismt = itab1-matnr.
        IF itab1-text NE ' '.
          itab-matnr = gv_matnr.
          itab-text  = itab1-text.
          APPEND itab.
        ENDIF.
        CLEAR itab.
      ENDLOOP.
      DELETE itab WHERE matnr EQ ' '.
    Upload the Texts
      SORT itab BY matnr.
      LOOP AT itab.
        dt_lines-tdformat = 'ST'.
        dt_lines-tdline = itab-text.
        APPEND dt_lines.
        dl_lan = sy-langu.
        dl_name = itab-matnr.
    Call the Function Module to Create Text
        CALL FUNCTION 'CREATE_TEXT'
          EXPORTING
            fid         = c_best
            flanguage   = dl_lan
            fname       = dl_name
            fobject     = c_material
            save_direct = 'X'
            fformat     = '*'
          TABLES
            flines      = dt_lines
          EXCEPTIONS
            no_init     = 1
            no_save     = 2
            OTHERS      = 3.
        IF sy-subrc <> 0.
          WRITE:/ 'Long Text Creation failed for Material'(001),
                 itab-matnr.
        ELSE.
          WRITE:/ 'Long Text Created Successfully for Material'(002),
                 itab-matnr.
        ENDIF.
        AT END OF matnr.
          REFRESH dt_lines.
        ENDAT.
      ENDLOOP.
    <b>Reward points for useful Answers</b>
    Regards
    Anji

  • Get Sales Order price from delivery

    Hi Folks, I need your help.
    I have a smart form to print a ticket that shows the total amount to be paid. Iu2019m using the FM GN_INVOICE_CREATE to simulate the prices and sum the items (Table xvbrp), passing the material and quantity.
    The problem here is when some conditions of discounts are included manually as price conditions in the sales order this function has no considerer those and I get the wrong amount or the amount without those conditions.
    After this issue a decided to change the FM to RV_INVOICE_CREATE (Table xvbrp), which is the FM used by the transaction VF01, this function works perfect but a Post good issue is required to obtain the prices.
    I need a FM to get these prices from the delivery, taking in consideration sales order conditions automatic and manual for the delivery item and delivery quantity. The purpose of this is to print a ticket with the amount to be paid by the customer, before the invoice is created.
    Thank in advance.
    Alexis Ramirez

    I solved the issue using the FM RV_INVOICE_CREATE.
    CALL FUNCTION 'RV_INVOICE_CREATE'
      EXPORTING
        invoice_type   = rv60a-fkart
        invoice_date   = sy-datum
        pricing_date   = rv60a-prsdt
        delivery_date  = rv60a-fbuda
        select_date    = rv60a-seldat
        i_analyze_mode = 'X'
        vbsk_i         = vbsk
        id_no_enqueue  = 'X'
      IMPORTING
        vbsk_e         = vbsk
        od_bad_data    = lv_bad_data
        det_rebate     = rebate_determined
      TABLES
        xkomfk         = w_xkomfk
        xthead         = w_xthead
        xvbfs          = w_xvbfs
        xvbss          = w_xvbss
        xvbrk          = w_xvbrk
        xvbrp          = w_xvbrp
        xvbpa          = w_xvbpa
        xkomv          = w_xkomv.
    I get the price from the table xvbrp.
    Thanks,
    Alexis

  • HT1051 How to get iPhoto print order to recognise phone number?

    I am trying to order a print from print services via iPhoto 11.  The system does not recognise my phone number, which is the default number from my Apple store account.  Changing it does not help and I cannot get beyond this to place me order.  Can anyone help?
    Caroline

    Search the forums. Someone found a solution to this by moving a digit from one field to another
    LN

  • How to Avoid Open Sales Order Value from Credit Check

    Hello Everyone,
    We have a problem with Credit Management, When my user run the execute credit master sheet, system is considering open sales order value under Credit limit used. My user do not want consider open sales order value, they want only Open delivery and Open Billing value need to appear in Credit limit used.
    Is it possible to avoid open sales order values, if yes what setting i need to do....please help me.
    Thanks
    Sudheer

    Sudheer,
    You need to check the update rule given in the definition of the Credit control Area which you are using for credit management. If you want only the open deliveries then you need to have update rule 15 in the credit control area.
    In the credit controal settings, you need to have settings for the credit check at the delivery level.
    Hope this will solve your issue.
    Regards,
    Chetan
    Edited by: Chetan Gupte on Jul 15, 2010 8:56 PM

  • CIF: how to "push" a Sales Order item from ERP to SCM via FunctionModule ?

    Hello experts,
    we are implementing a process in ERP (ECC6.0) where we change a sales order item (VBAP- VPZUO) in order to stop SNP (LiveCache) performing the "fcst consumption" for this specific sales order since it is a spezial promotion / trade fair order which does not justify to change the fcst consumption for the entire product.
    We are searching for a function module or any ABAP "handle" of telling the CIF in ERP to "push" a specific sales order item thru to SCM again. We started with an artificial batch input in VA02 / VA32 and changed a non-used text field field in the sales order position and the document save was doing it. I wonder if someone run over same topic and found a better way to get this done with a specific function module or setting a specific trigger in some other ways.
    I was not sure if this is the correct forum - in case someone knows a better match on SDN I'm happy to move it over to the right place.
    Regards
    Thomas

    Hello Thomas,
    You can't really push a Sales Order seperately, and not advisable also as you should not tamper with CIF interface. I can give you another approach.
    You have to identify during CIF that the Sales Order is a special Sales Order. Better have a separate Sales order type for such special Sales Orders. That being the case, I think you can handle your issue by changing the ATP category of the Sales Order during CIF. The standard Order category is BM. You could create a custom category in APO, and during the transfer, you could change the Sales order category to this custom category. APOCF010  EXIT_/SAPAPO/SAPLCIF_SLS_001 exit (Inbound Sales Order in APO) should be helpful for this. You would need to change the ATP category field in IT_SL_REQ table.
    You could then display this "additional" Sales Order in a separate KF in SNP (if you need it) by assigning it a custom category group in SNP planning area which would have only this custom category. For normal SNP planning, normal SNP sales order of category BM would be relevant.
    Please be aware that when you try out things like this, you might need to tweak a lot of SAP standard behaviour at many other places. Things like CCR also need to be tweaked, and also whatever further planning you have to do for this particular Sales Order might also need to be tweaked.
    Thanks - Pawan

  • How to print one sales order output from two printers using single command.

    Dear all,
    Our requirement is to print single sales order from two different printers, where as one printout for sales order output and another for sales order cash receipt.
    We developed two smartforms for both outputs.
    But we are struggling to assign the smartforms to single document type, which has to result two printouts after saving the sales order.
    Please help us to solve the issue.
    Your suggestions will be highly appreciated.
    Best regards
    Raghu ram

    Hi,
    You should define two different output type for your requests, one is for SO output, the other is for SO cash receipt. That's okay!
    Good luck
    Z.T

  • How to get Picking List Output EK00 from delivery?

    Hi All...
    I have created a delivery..and picked completely.
    The shipping point is attached to the output type correctly..
    Still I am not getting Output Type EK00 in the Delivery-> Extras-> Picking Output
    And also how to get the print preview of picking list from the delivery?
    Thanks

    Hello my friend
    If the condtion record is not maintained in VV21 then the output type will not appear in the delivery output.
    If the record is maintained then check  the delivery in VL02N and then goto the delivery output  and then Goto--> Determination analysis to find out the issue

Maybe you are looking for

  • I was viewing a page online, and somehow it zoomed out so the page is tiny in the browser window. How do I zoom back in?

    I was viewing a page online, and somehow it zoomed out so that the page is now tiny in the browser window. I've shut down all my windows and rebooted my computer, but every time I return to that page, it is still tiny. I've looked for a button to con

  • There are no more endpoints available on Azure Website

    I am just trying to setup a simple web app that pings a IP address and host it on Azure Websites. I have a standard website (not the free tier) and I have web sockets turn ON. I am just sending a simple ping using the system.net.networkinformation.pi

  • Repairing HDD without loosing itunes library

    My HDD has been corrupted and I need reboot it and re-install all my software programs. If I save my itunes library on an external hard drive and I re-install itunes once the laptop drive is fixed, how will I ensure that the re-installed Itunes will

  • Unable to open JSP files using Workshop JSP Editor 3.0

    Every time I try to open a JSP file in Workshop JSP Editor 3.0, I get the following error: Unable to create this part due to an internal error. Reason for the failure: Cannot open the specified document: null org.eclipse.ui.PartInitException: Cannot

  • Export all tracks and bounce

    Hi,        Normally i work on my macbook pro and send the wav files to a engineer to be mixed in Protools. My query is that when iam doing this should i bounce all the tracks individually using the Bounce button or should i do it using the export all