Create delivery from a PO

Hi,
I need to create a new Z transaction that creates a delivery from a purchase order.
So far I found two FM's (GN_DELIVERY_CREATE and RV_DELIVERY_CREATE) but they only seem to work with sales orders.
There also BAPI's to change deliveries but none to create deliveries.
Is there a way to automatically create a new delivery from a PO? FM, BAPI, ...
If possible I would like to do in in foreground
Thanks in advance!
Bert

Hi Bert,
Use code similar to the below to create delivery from PO.
  data:lt_request      like bapideliciousrequest
           occurs 0 with header line,
       lt_createditems like bapideliciouscreateditems
           occurs 0 with header line,
       lt_return       like bapiret2
           occurs 0 with header line.
  if px_infile-type = 'PO' . "If Purchase order
    lt_request-document_type      = 'B'.
    lt_request-document_numb      = lv_ebeln.
    lt_request-document_item      = lv_posnr.
  else.                      "If Sales Order
    lt_request-document_type      = 'A'.
    lt_request-document_numb      = lv_vbeln.
    lt_request-document_item      = lv_posnr.
  endif.
  lt_request-material           = lv_matnr.
  lt_request-plant              = lv_werks.
  lt_request-stge_loc           = lv_lgort.
  lt_request-quantity_base__uom = lv_base_uom_qty.
  lt_request-delivery_date      = sy-datum.
  append lt_request.
  call function 'BAPI_DELIVERYPROCESSING_EXEC'
  EXPORTING
    DELIVERY_EXTEND       =
    TECHN_CONTROL         =
    tables
      request               = lt_request
      createditems          = lt_createditems
      return                = lt_return.
  loop at lt_return where type = 'A'
                      or  type = 'E'.
    call function 'BAPI_TRANSACTION_ROLLBACK'.
    exit.
  endloop.
  if sy-subrc <> 0.
Use the BAPI for Commit
    call function 'BAPI_TRANSACTION_COMMIT'
         exporting
              wait = 'H'.
  endif.
Hope this helps.
Thanks,
Ramakrishna

Similar Messages

  • PS: WBS is not flowing for a Material, while creating delivery from Project

    Hi,
    While creating delivery from Project thro CNS0, WBS is not flowing for a Material in delivery, in turn WBS is not flowing in Billing document for same material, in turn not allowing to Post the Billing document to Accounting.
    Error while releasing Billing to the Accounting: Accounting Entry is not generated. Error Message:Assign Condition type
    YMRG in COPA.
    Pls let me know, what can be the reason ?
    Thanks.
    Amit.

    Hi Kuldeep,
    Check this note,
    Note 159387 - Message BP603: incorrect line item is displayed
    Its valid only till 4.6. Might give you some idea but.
    Regards,
    Gokul

  • Budget error while creating delivery from sales order

    hi Gurus,
    System is throwing error PB603 "Item 004 WBS element ABC-XXX budget exceeded" while creating delivery from sales order.
    I am picking material from unrestricted plant stock (not in project stock).
    I am also confused as sales order has 3 line items & error shows Item 004 !

    Hi Kuldeep,
    Check this note,
    Note 159387 - Message BP603: incorrect line item is displayed
    Its valid only till 4.6. Might give you some idea but.
    Regards,
    Gokul

  • BAPI Create delivery from scheduling agreement

    Hello,
    Does anyone have code to create a delivery referencing a scheduling agreement?  
    Thanks,
    Evan

    I dont think there is a BAPI to create delivery from the schedule lines .
    You can get the details of schedule lines from the VBEP  table and use the FM BAPI_OUTB_DELIVERY_CREATE_SLS.
    This becomes very cumbersome in case there are partial deliveries per schedule line.

  • Create delivery from Purchase order

    Hi all,
    I want to know the TCode to create a delivery from a Purchase Order
    Harini

    HI HARINI KESANI,
                                 IN ORDER TO CREATE DELIVERY FROM PO CAN DO THRU THE T.CODE
    VL10B( BATCHES). ENTER THE PURCHASE DOCUMENT IN THE PURCHASE ORDERS TAB PAGE, CLICK ON EXECUTE
    YOU WILL ENTER INTO ANOTHER SCREEN , SELECT THE LINE ITEM AND CLICK ON EXECUTE BACKGROUND.
    YOU WILL GET THE DELIVERY NO., GO TO VL02N AND DO THE POST GOODS ISSUE.
      YOUR CAN ALSO CHECK THE DELIVERY NO. IN THE P.O , PURCHASSE ORDER HISTORY TAB PAGE, THERE U CAN SEE THE STATUS OF THE GOODS ALSO , WHETHER MATERIAL DELIVERED ,ISSUED AND GR.
    REGARDS,
    RAM

  • How to create delivery from a sales order?

    Hi friends,
    Can you tell me how to crete a delivery from a sales order?
    First, I would like to know which transaction we use to create and how?
    Appreciate your input.
    Thanks,
    Krishen
    P.S. Points assured for helpful answers and thanks in advance for your time.

    VL01 is the transaction for the creation of Delivery
    VL01   SAPMV50A       Create Delivery
    VL01N  SAPMV50A       Create Outbound Dlv. with Order Ref
    VL01NO SAPMV50A       Create Outbound Dlv. w/o Order Ref.
    Message was edited by: Gopi Narendra

  • Create Delivery from Sales Order Document

    Hello all,
    I have a business requirement to create deliveries from sales orders in the most effcient way possible.  Our current program uses BDC and calls transaction VL01N, however this has been found to dramatically increase the run-time of this program.  I have been searching for a BAPI to essentially do the same thing. 
      I came across one BAPI, BAPI_DELIVERYPROCESSING_EXEC, but have been getting inconsistent results.  It will create deliveries for some line items and not others with little rhyme or reason.  The return table is not being populated unless it is a high level error, such as the quantity passed being 0.
    To the BAPI, I am passing: Sales Doc Number, Line Item, Quantity, and Document Category.  This is done through an internal table.  I also pass internal tables to receive the return messages and the created documents. 
    Has anyone seen the same thing with this BAPI? Is there a better BAPI to use for such a purpose?
    many thanks for any help,
    brian

    Hi!
    For delivery creation you can use FM SHP_VL10_DELIVERY_CREATE:
        DATA:
          if_ledat TYPE lfdat_a,
          if_nur_vorgabe_pos TYPE xfeld,
          it_key_to_enque_t TYPE shp_vl10_package_t,
          it_key_to_enque LIKE LINE OF it_key_to_enque_t,
          it_komdlgn_t TYPE shp_komdlgn_t,
          cx_sd_order TYPE shp_vl10_sd_order,
          ct_vbsk_all_t TYPE shp_vbsk_t,
          ct_vbls_t TYPE shp_vbls_t,
          ct_key_late TYPE shp_vl10_package_t,
          ct_vorgabe_daten_t TYPE shp_vorgabe_daten_t,
          ct_vorgabe_daten LIKE LINE OF ct_vorgabe_daten_t,
          wa_dlvsrc LIKE LINE OF m_it_dlvsrc,
          msg TYPE string.
        LOOP AT m_it_dlvsrc
          INTO wa_dlvsrc.
          CLEAR it_key_to_enque.
          it_key_to_enque-panum = '1'.
          it_key_to_enque-vbobj = 'A'.
          it_key_to_enque-vbtyp = 'C'.
          it_key_to_enque-vbeln = wa_dlvsrc-vbeln.
          it_key_to_enque-posnr = wa_dlvsrc-posnr.
          it_key_to_enque-id = '1'.
          it_key_to_enque-tabix = '1'.
          it_key_to_enque-vstel = wa_dlvsrc-vstel.
          APPEND it_key_to_enque TO it_key_to_enque_t.
          CLEAR ct_vorgabe_daten.
          ct_vorgabe_daten-vgbel = it_key_to_enque-vbeln.
          ct_vorgabe_daten-vgpos = it_key_to_enque-posnr.
          ct_vorgabe_daten-lfimg = wa_dlvsrc-lfimg.
          ct_vorgabe_daten-akmng = 'B'.
          ct_vorgabe_daten-postab_tabix = it_key_to_enque-tabix.
          ct_vorgabe_daten-panum = it_key_to_enque-panum.
          ct_vorgabe_daten-id = it_key_to_enque-id.
          APPEND ct_vorgabe_daten TO ct_vorgabe_daten_t.
        ENDLOOP.
        if_ledat = sy-datum.
        if_nur_vorgabe_pos = 'X'.
        CALL FUNCTION 'SHP_VL10_DELIVERY_CREATE'
             EXPORTING
                  if_ledat           = if_ledat
                  if_nur_vorgabe_pos = if_nur_vorgabe_pos
                  it_key_to_enque    = it_key_to_enque_t
                  it_komdlgn         = it_komdlgn_t
             CHANGING
                  cx_sd_order        = cx_sd_order
                  ct_vbsk_all        = ct_vbsk_all_t
                  ct_vbls            = ct_vbls_t
                  ct_key_late        = ct_key_late
                  ct_vorgabe_daten   = ct_vorgabe_daten_t.
        COMMIT WORK AND WAIT.
    All created deliveries numbers:
    SELECT vbeln
          INTO TABLE m_it_vbeln
          FROM vbss
          FOR ALL ENTRIES IN ct_vbsk_all_t
          WHERE sammg = ct_vbsk_all_t-sammg.
    All errors during processing:
          SELECT msgid msgno msgv1 msgv2 msgv3 msgv4
            INTO TABLE it_msg
            FROM vbfs
          FOR ALL ENTRIES IN ct_vbsk_all_t
          WHERE sammg = ct_vbsk_all_t-sammg.
    Regards,
    Maxim.

  • Creating Delivery from Sales Document

    Hi,
    When I try to create a automatic delivery from the sales document I am getting an error as :
    Delivery duplication only possible for one ship-to party.
    I am trying to create Sales order through IDOC, still I find the same issue.
    The message raised is VLBAPI - 001.
    Is there any thing to do with partner profiles or the distribution model.
    Thanks.

    Hi,
    You can find the duplicate entry in TBD06. Searching by FOBJVALUE for example may show where you have a duplicate RCVSYSTEM.
    Regards,

  • Problem during creating delivery from PO in intra-co stock transport

    Hi All,
    during the intra co stock transport process between 2 company codes after the PO is saved as the 1st step of the process,im trying to create a delivery wrt the PO in the transaction code VL10B.
    this is giving the following errors
    1.documet is incomplete:u cannot save the delivery
    2.serial number reqt.not satisfied (V50UC-SERIAL),error group:L1
    immediate help on this issues will be appreciable.
    thanx
    vishal degaonkar

    to add more information bout the problem.....
    we've assigned serial no's during delivery creation which is done manually.as the delivery creation process in VL10B is in the background it is not picking up the serial no's and hence the incompletion error.
    is there any other method to create deliveries from purchase orders???

  • Create Delivery from a Sales Order adding a new position

    Hi experts!
    I need to create a delivery from an existing Sales Order (with just 1 position), and add a new position to this Delivery so it creates with two positions, the one from the SO and the added one.
    I'm using FM RV_DELIVERY_CREATE. Is it possible to do this?
    Thanks!!
    Carles

    Hi Carles,
    I would prefer BAPI_OUTB_DELIVERY_CREATE_SLS. At least the delivery creation will be fine, your second position might be more complicated. But there are exits in the Bapi and you might go for an exit of the delivery creation itself -> then also manual triggered creation of a delivery will be correct.
    BR, Christian

  • BAPI to create Delivery from Sales Order posting EIKP data

    Hi All,
    I'm searching for BAPIs to create a Delivery from Sales Order which I can update/insert data into EIKP table because I am receiving data that it must be saved into ZOLLA and ZOLLB fields (Customs Office: Office of Exit/Entry and Destination for Foreign Trade).
    I tried with BAPI_OUTB_DELIVERY_SAVEREPLICA, BAPI_OUTB_DELIVERY_CREATE_SLS and BAPI_DELIVERYPROCESSING_EXEC but I didn't find structures with these fields.
    Please, I need some help to resolve this issue.
    Thanks in advance.

    Hello Manoj what you have to do to create PO from PR is that
    1) Use   BAPISDORDER_GETDETAILEDLIST (pass sales order number in sales_document table) and then get PR (Purchase requisition number from this BAPI.
    2) Use  BAPI_REQUISITION_GETDETAIL to get PR items
    3) Use BAPI_PO_CREATE1 to craete PO from PR then.
    to create goods movement you can use
    BAPI_GOODSMVT_CREATE
    REWARDS IF USEFUL.

  • User exit while creating delivery from sales order

    Hi Guys ,
    Is there any user exit in sales order which triggers when we try to DELIVER(from the menu bar) .
    My requirement is to not include some line items(base on some condition) before they are included in the delivery .
    Thnx in advance .
    Anil

    Hi Naimesh ,
    Thnx for your reply.
    I'm not sure of the functionality in VOFM .Can u please tell me how can i acheive my current functionality as explained above in my question .
    I'll tell u my requirement .
    When creating delivery , I have to check for some condition and depending upon this condition , the line items must not be included in the delivery .
    I have acheived this by BADI  LE_SHLP_DELIVERY~SAVE_DOCUMENT_PREPARE.
    if suppose any line items gets deleted in the delivery(based upon my condition) , and then if I look at the status of the slaes order(VA03) , it shows partially confirmed at the header level and the item which is rejected(in delivery) shows OPEN .
    Can u tell me how to update the status of the sales order header and item level (if any item is deleted) during creation of delivery .
    Thnx .
    Anil

  • How to create Delivery from VA01 wich split on the basis of line item count

    Hi Frnds,
    I have this requirement where I have to split a single sales order into multiple deliveries whenever the line items count exceeds 10.
    Kindly advice if there is any routine/ any exit for this OR any other soln to this...
    Note : Splitting only takes place when the Line items count exceeds 10.
    for eg : In VA01, for a sales order having line items
                 01, 02, 03, 04, 05, 06, 07, 08, 09, & 10 ---> One delivery
                 11, 12, 13, 14, 15............................ 20 ---> second delivery
    Your help will be truely appreciated..
    Thanks,
    Kamal Sehrawat

    These are called copying requirements. If you open VOFM, you will understand better.
    The routine is a 3 digit number which corresponds to one particular scenario. There are many standard routines for each scenario. Ex : sales orders, deliveries, partners etc.
    There are 2 cases:
    1. copying the data from one scenario to other. Ex: orders to delivery, delivery to billing etc
    2. Moving the data while creation.
    You can choose anything which depends on your scenario.
    To code, copy the routine and create a custom routine. Select the routine and Press F5 (Second Icon to see the source text) to write the code. You can write/modify the code in the copied standard include it takes.
    If the standard routine is not suffice, you can also create a new custom routine which starts with 9XX.
    You need to explore more to understand better.
    Thanks,
    Vinod

  • Wrong VL-367 error while creating delivery from multiple sales orders

    Hi,
    We have a Z program* that runs BAPI_OUTB_DELIVERY_CREATE_SLS with multiple sales order items to create one delivery.
    The program runs as a job. The problem is sometimes Bupi turns "VL367 - an item with no delivery quantity..." error for some of the items. But actually we have no availability problem, after a minute in the next job the delivery is being created for those items.
    We couldnt find the the state that causes this wrong error. Have any ideas, is there any problem with the bapi ?

    Hi,
    You should check if you got other Sales Order that might be have items with quantities confirmed. Quantities confirmed in a sales order will be appear as unrestricted stock, although is reserved, and therefore for example:
    Sales Order A: item 10, quantity 10
    Unrestricted stock: 10
    Sales Order B: item 10 (Same material as Sales Order A), quantity 2
    Creating outbound delivery for Sales Order B will generate the message, because that stock is being taken for the Sales Order A already.
    Hope it helps.

  • Help! how to create an outbound delivery from a project using a FM/BAPI?

    Hi,
    I need help to find a BAPI or FM which can be used to create an outbound delivery from a project similar to tcode CNS0?
    The following data will be used in creating the outbound delivery from a project:
      Project definition
      WBS Element
      Network
      Shipping Point
      Ship_To_Party
      Plant
      Storage Location
      Planned Goods Movement Date
      Delivery Type  : LP
      Sales Organization
      Distribution Channel
      Division
      Item Number
    Please help me find the appropriate BAPI or FM to create the delivery from project.
    Any help on this would be greatly appreciated.
    Thank you.
    with regards,
    Muthu Ganapathy.

    Hi Ferry Lianto,
    Thank you for your response.  Do you have a sample code to call this FM? Or can you please provide me what all parameters I need to pass to create delivery from project?    My input parameters are as given below:
    Project definition
    WBS Element
    Network
    Shipping Point
    Ship_To_Party
    Plant
    Storage Location
    Planned Goods Movement Date
    Delivery Type : LP
    Sales Organization
    Distribution Channel
    Division
    Item Number
    Please help me on this.
    Thank you.
    with regards,
    Muthu Ganapathy.

Maybe you are looking for

  • How to delete time machine files from external back up drive?

    When connected to my Macbook I deleted some old backups to the trash.  When I try to empty trash, a message comes back saying there are locked files and files cannot be deleted.  I have turned off time machine, and tried to delete files but get the s

  • Need some help killing threads (not in the way already mentioned..)

    I have read the ways in which we should safely kill a thread - and for the most part i understand that. But my question is HOW to implement it in the way that I need. Basically I have a multithreaded (ewww) app that really is a large job scheduler ru

  • HttpsURLConnection class cast exception problem

    Hy everyone, I have next java code to send xml file over https. //          Create a trust manager that does not validate certificate chains           TrustManager[] trustAllCerts = new TrustManager[] {                     new X509TrustManager() {   

  • Incorrect Auto Fill for mail recipient

    My gran is mastering her Mac well, but she has a recurring problem with mail. When she's trying to email me, she types in the beginning of my name, and Mail does the rest, but occasionally it fills in the address as "@unspecified domain". Is there so

  • No effect

    I have come across two edit right next to each other that won't accept an effect like a cross dissolve or sound dissolve. I tried even snipping off a little and that did not help. How can I fix this? BF