Automatic creation of Sales Order on Creation of Purchase Order

Hi,
We want to create a sales order automatically in SAP the moment a Purchase order is created in SAP. How do we go about doing this? Can this be achieved through EDI or ALE Idocs?
Would greatly appreciate if you could give step by step instructions as I am new to this area.
Thanks in advance.
Mick

just check below link..
http://www.sap-img.com/abap/bapi-conventions.htm

Similar Messages

  • How to block the creation of a Sales Orders without a linked Purchase Order

    Hi. I'm trying to block the creation of a Sales Order that doesn't have a linked Purchase Order. The first thing I did is using the SBO Transaction Notification as follows:
    IF  @transaction_type = 'A' AND @object_type='17'
    BEGIN
         IF (SELECT PoPrss FROM ORDR WHERE DocEntry = @list_of_cols_val_tab_del) = 'N'
         BEGIN
              SET @error = 1
              SET @error_message = 'Purchase Order Missing...'
         END
    END
    This works good. I create the Sales Order, I tick the purchase order field on the logistics tab, I click Add, and then the purchase order window appears...
    Then, the problem begins... If I click the Cancel button, the purchase order is obviously not created, but the Sales Order is created.
    Can someone tell me how to block the creation of the sales order If the user press the cancel button on the purchase order window (and the purchase order is not created)
    As far as I can see, after clicking the add button in the sales order document, the Sales Order is created on the DB. If there's no way of blocking the creation of the Sales Order, can I avoid closing the purchase order window by the SBO_TransactionNotification? (if the purchase order has not been created)
    Thanks...

    Hi Yail,
    I think you can't close the purchase order with the stored procedure.
    Try to catch the Event when the user click on Cancel button.
    So you can list the vents with event logger : https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ede3be37-0e01-0010-1883-cd1b5293473e
    You can block the cancel button and force the user to create the purchase order.
    Hope i help you
    Best regards
    Michael

  • Assigning a Sales Order Number to a Purchase Order

    My company has a requirement that for every purchase order we need to identify what sales order was created to generate the PR.
    I have found that by using the Account Assignment C - Sales Order, this opens the "Account Assignment" Tab and the fields for Sales order, item, and schedule Line.
    I have saved the PO and now am trying to receive the parts into inventory.  When doing so, the inventory needs to post to our inventory GL account, in our case is 135075.  By NOT assigning the GL with the sales order in the PO it doesn't post to this account it posts to a different GL account.
    How do I go about using the "Sales Order" field in the purchase order so I can record which sales order the line item of the PO corresponds to, and when receiving the inventory into stock have it post to the correct GL account?
    Thanks,
    Karen

    The company I work for is a distributor, and doing a Make to Order order type would not be in the best business practice for our company.  We tend to purchase stock for multiple orders and put them in inventory to be sold.  We are looking for a way to "document" what sales order the purchase order line item is being bought for, and sometimes their our multiple lines.
    I understand what you are saying regarding posting to an stock GL vs a consumption GL.
    I am going to research further and see how we can post to a consumption GL and then move the remaining stock over to a stock GL account after we have sold what we have purchased and received.
    I was able to get the receipt posted to the GL 135075 by taking off the "post automatically" indicator in the configuration of the GL account, but this then posed problems when doing other inventory postings such as cycle counting or moving inventory.
    Thank you,
    Karen

  • Create Sales order with reference to purchase order - Help needed

    Hi Gurus
    Purchase order is being created in Oracle system. SAP system will receive the purchase order and creates the sales order for the corresponding purchase order.
    Hoe to create sales order, Through BAPI or through IDOC. Please suggest and give some pointers of existing interface
    Thanks
    Andy.

    Hi,
        If you are working on ECC6.0 check for the BAPI BAPI_SALESORDER_CREATEFROMDAT1 .You can also pass the purchase order number .
    Check the sample code
    REPORT z_bapi_salesorder_create.
    Parameters
    Sales document type
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text FOR FIELD p_auart.
    PARAMETERS: p_auart TYPE auart OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Sales organization
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text1 FOR FIELD p_vkorg.
    PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Distribution channel
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text2 FOR FIELD p_vtweg.
    PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Division.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text3 FOR FIELD p_spart.
    PARAMETERS: p_spart TYPE spart OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SKIP 1.
    Sold-to
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text4 FOR FIELD p_sold.
    PARAMETERS: p_sold  TYPE kunnr OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Ship-to
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text5 FOR FIELD p_ship.
    PARAMETERS: p_ship  TYPE kunnr OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    SKIP 1.
    Material
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text6 FOR FIELD p_matnr.
    PARAMETERS: p_matnr TYPE matnr   OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Quantity.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text7 FOR FIELD p_menge.
    PARAMETERS: p_menge TYPE kwmeng  OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Plant
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) v_text9 FOR FIELD p_plant.
    PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
    SELECTION-SCREEN END OF LINE.
    Data declarations.
    DATA: v_vbeln            LIKE vbak-vbeln.
    DATA: header             LIKE bapisdhead1.
    DATA: headerx            LIKE bapisdhead1x.
    DATA: item               LIKE bapisditem  OCCURS 0 WITH HEADER LINE.
    DATA: itemx              LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
    DATA: partner            LIKE bapipartnr  OCCURS 0 WITH HEADER LINE.
    DATA: return             LIKE bapiret2    OCCURS 0 WITH HEADER LINE.
    DATA: lt_schedules_inx   TYPE STANDARD TABLE OF bapischdlx
                             WITH HEADER LINE.
    DATA: lt_schedules_in    TYPE STANDARD TABLE OF bapischdl
                             WITH HEADER LINE.
    Initialization.
    INITIALIZATION.
    v_text   = 'Order type'.
    v_text1  = 'Sales Org'.
    v_text2  = 'Distribution channel'.
    v_text3  = 'Division'.
    v_text4  = 'Sold-to'.
    v_text5  = 'Ship-to'.
    v_text6  = 'Material'.
    v_text7  = 'Quantity'.
    v_text9  = 'Plant'.
    Start-of-selection.
    START-OF-SELECTION.
    Header data
    Sales document type
      header-doc_type = p_auart.
      headerx-doc_type = 'X'.
    Sales organization
      header-sales_org = p_vkorg.
      headerx-sales_org = 'X'.
    Distribution channel
      header-distr_chan  = p_vtweg.
      headerx-distr_chan = 'X'.
    *Purchase order number
    header-PURCH_NO_C =  '4000006'.
    headerx-PURCH_NO_C = 'X'.
    Division
      header-division = p_spart.
      headerx-division = 'X'.
      headerx-updateflag = 'I'.
    Partner data
    Sold to
      partner-partn_role = 'AG'.
      partner-partn_numb = p_sold.
      APPEND partner.
    Ship to
      partner-partn_role = 'WE'.
      partner-partn_numb = p_ship.
      APPEND partner.
    ITEM DATA
      itemx-updateflag = 'I'.
    Line item number.
      item-itm_number = '000010'.
      itemx-itm_number = 'X'.
    Material
      item-material = p_matnr.
      itemx-material = 'X'.
    Plant
      item-plant    = p_plant.
      itemx-plant   = 'X'.
    Quantity
      item-target_qty = p_menge.
      itemx-target_qty = 'X'.
      APPEND item.
      APPEND itemx.
      Fill schedule lines
      lt_schedules_in-itm_number = '000010'.
      lt_schedules_in-sched_line = '0001'.
      lt_schedules_in-req_qty    = p_menge.
      APPEND lt_schedules_in.
      Fill schedule line flags
      lt_schedules_inx-itm_number  = '000010'.
      lt_schedules_inx-sched_line  = '0001'.
      lt_schedules_inx-updateflag  = 'X'.
      lt_schedules_inx-req_qty     = 'X'.
      APPEND lt_schedules_inx.
    Call the BAPI to create the sales order.
      CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
           EXPORTING
                sales_header_in     = header
                sales_header_inx    = headerx
           IMPORTING
                salesdocument_ex    = v_vbeln
           TABLES
                return              = return
                sales_items_in      = item
                sales_items_inx     = itemx
                sales_schedules_in  = lt_schedules_in
                sales_schedules_inx = lt_schedules_inx
                sales_partners      = partner.
    Check the return table.
      LOOP AT return WHERE type = 'E' OR type = 'A'.
        EXIT.
      ENDLOOP.
      IF sy-subrc = 0.
        WRITE: / 'Error in creating document'.
      ELSE.
    Commit the work.
        COMMIT WORK AND WAIT.
        WRITE: / 'Document ', v_vbeln, ' created'.
      ENDIF.
    Reward points if it worked.
    Regards,
    Abhishek
    Edited by: Abhishek Raj on May 14, 2008 9:57 AM

  • User Exit to Create Production Order when creating of Purchase Order

    Hi Guru's,
    I want to create the Production Order when creating the Purchase Order. i want to know is there any user exit exists for that??
    My scenario is as follows.
    we are converting the Purchase Requisition to the Purchase Order , while doing this we want to create the Production Order.. Is this possible??
    If possible how can we do that???Please suggest me the possible solution.
    Thanks in advance.
    Thank you,
    Adi.

    Teja,
    My Scenario is as follows.
    P1- Manufacturing Plant
    P2 - WareHouse Plant (Procures Material from P1 using STO)
    When we run the MRP in P2, it creates a Purchase Requisition, that Purc.Req is going to be convert as STO (Stock Transport Order) in P1 Plant.
    When converting the Purchase Req to STO, we need to create a Production Order in P1 Plant.
    we know that system will creae the Purchase Order only, is there any possibility that,For creating the Production Order is there any user Exit/BADI or any other procedure while creating the Purchase Order????
    Thanks,
    Adi.

  • Purchase Order with reference to Purchase Order

    Dear SAP Gurus,
    Can it be possible to have a purchase order with reference to purchase order.
    Regards
    Vinod Kakade

    Hi,
    there is an option to give document date in the Purchase order selection in Document overview, what you can do here is that you can get a TVARVC variable created with date range of today - Today - 179 Days, in the attributes of the variant enter the TVARVC variable so that when the user uses this variant, he will get PO's only for that date range, if you  have any confusion on this then please speak to your ABAP Consultant.
    Regards
    Chandra Shekhar

  • New order type for a purchase order similar tu UB.

    Hi,
    I would like to know if it is possible to create a new order type for a purchase order. This new order type should work as a UB order type but "plant" and "storage location" should be indicated by default and shouldn't be changed.
    How should I proceed?
    Thanks in advance.
    Luis.

    The problem is that If I specify default values for each user (plant and storage location) It will always propose these values when using different order types. This can't be.
    Isn't there any other solution in standard sap?
    Edited by: LUIS ÁLVAREZ on Apr 26, 2010 11:25 AM

  • Automatic creation of Sales Order with reference to Purchase Order

    Hi
    I want to create the sales order automatically when we are creating the purchase order.
    kindly guide me how to do it,
    Pramod

    Hi
    U can create BDC for Tcode VA01 in T code SHDB with the validation and ask the ABAPer to create one Y/Z Tcode. Then you input the PO no in the Tcode to create the SO in background.
    Or
    Create BDC for PO AND SO and give logic and validation with input field and ask the ABAPer to crate one Y/Z Tcode to create PO and SO in single execute.
    Thx.

  • Creating Sales order With Respect To Purchase Order

    Hi Friends,
         Requirement is that in source system for exp Company A
    creating Purchase order now with respect to this purchase order...
    In Target System.for Exp Company B Sales Order Should be created.................
    For this in Source system........i m using message type orders
    when i m creating Purchase Order Idoc Successfully send to reciever......but in reciever idoc coming with error(sales organization,dist channel not found for customer 1000).......
    sales order not getting created automatically..............
    and customer 1000 is automatically coming i dont know how....?
    pls tell me what is the necessary configuration required for vendor,customer.....in source and destination side.....?

    DIDC   1500000000000032795700 03        1A000000001KUS004
          E1EDK01                         INR   1.00000                                                               ZPOR0000600764
          E1EDK14                     0141000
          E1EDK14                     01410
          E1EDK14                     00900
          E1EDK14                     013ZPOR
          E1EDK14                     0111000
          E1EDK03                     01220080122
          E1EDK03                     01120080122
          E1EDKA1                     AG S004
          E1EDKA1                     LF 0006000023
          E1EDKA1                     WE                  D001             Food Park - Kalamboli
          E1EDK02                     0010000600764                               20080122190024
          E1EDP01                     00010 0010 50.000         EA 50.000         EA        5              1         250
              E1EDP20                     50.000         0.000          20080126
              E1EDP19                     001000000000006000006                 ,hjurv Godrej Eazy wash1(curt change)
              E1EDP19                     0031234567891012
          E1EDS01                     002250               INR
    this is my segment detail i u told i hv created see bold char

  • Sales Order to Drop Ship Purchase Order -- Carry Over Ship Method?

    Hi everyone,
         When I create a sales order in B1 using the 99 warehouse, it automatically generates the purchase order once the transaction is billed/invoiced.
    This purchase order does not have the same shipping method as the sales order. I have worked around this in Crystal Reports, but is there a way to have SAP carry over the ship method?
    Thanks,
    Chris

    Hi Chris,
    This may only be done through SDK. There is no standard function to achieve it.
    Thanks,
    Gordon

  • Sales Order Profitability segment to Purchase Order

    Dear Experts,
    kindly help me out for the below scenario...
    I am creating PO with ref to Sales order my requirement is, i am taking account assignment as sales order , system is asking for sales order that is fine but in Prifitability segment of PO system is not copying as such as Sales order i am unable to copy customer no in the profitability segment in POm . I had done the necessary setting in OME9 t code i had taken accout assignment as Profit Segment for reporting purpose. Data of profit segemnt is flowing from sales order to PO everything is flowing except Customer.
    i want customer to be flown to PO in Profit segment....
    kindly ket me know any setting needs to be done
    regards
    abhi

    Dear Edurado,
    My requirement is in the sales order account assignment tab there is Profitability segment which is done by CO PA , the same PA segm ent must be automatically flow to Purchase order while creating the Po with ref to a sales order. Profitabilty segment is flowing but the fields like customer , Material is not flowing user must have to enter manully which he does not want.... i want all the field is Profilabbility segemnet of SO must be flow to PO while doing Po with ref to SO.
    Regards
    Abhi

  • Queries for Open Sales Order Lines and Open Purchase Order Lines

    Experts,
    Forgive me if these have been addressed elsewhere but I can't find them.  I'd like to create two queries to use as Alerts as follows:
    1.  Query of open lines in Sales Orders that are more than two weeks old
    2.  Query of open lines in Purchase Orders that are more than 2 days old
    Thanks in advance for your help.
    Steve

    Hi Steve,
    A couple of query templates you can use for your alerts are as follows:
    Purchase Orders
    SELECT T0.\[DocNum\], T0.\[DocDate\], T0.\[DocDueDate\], T0.\[CardCode\], T0.\[CardName\], T1.\[ItemCode\], T1.\[Dscription\], T1.\[Quantity\], T1.\[OpenQty\], T1.\[Price\] FROM OPOR T0  INNER JOIN POR1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.\[DocDueDate\] < (getdate() -2) AND  T1.\[LineStatus\] = 'O'
    Sales Orders
    SELECT T0.\[DocNum\], T0.\[DocDate\], T0.\[DocDueDate\], T0.\[CardCode\], T0.\[CardName\], T1.\[ItemCode\], T1.\[Dscription\], T1.\[Quantity\], T1.\[OpenQty\], T1.\[Price\] FROM ORDR T0  INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.\[DocDueDate\] < (getdate() -14) AND  T1.\[LineStatus\] = 'O'
    You can change the SELECT section to remove some of the columns or add extra columns if need be.  Once your happy with the query you can attach it to an alert and set the frequency.
    Regards,
    Adrian

  • Sales order with reference to purchase order

    Hi
    I have a scenario where i need to create a sales order from PO raised in another company code
    My client has 4 company codes
    1000 company code
    2000 company code
    3000 company code
    4000 company code
    Now
    2000 company will raise a PO on company code 1000
    So in company code 2000 i need to create a sales order with reference to PO from compcode 1000
    where all the data has to copied from PO with schedules
    so when i create a order in VA31 i have to create scheduling agreements with refernce to PO all the schedule line items should be copied?
    Is there any standard process or do i need to go for development?
    Regards

    Hi,
       As per my Understanding,
    I guess, you can do this same as creating Purchase Order-NB ( In ordering Company code)-ME21N,
    Vendor- Plant of Supplying Comp code ( Create this Plant as Vendor in ORdering Comp code)
    Purchase org/Group-
    Comp Code - Ordering Comp Code
    Material-
    Plant - Receiving Plant.
    Try n Revert-
    No Need to go for Userexit,
    My Query is: -
    Why you want to create Scheduling agreement wrt "PO" of Diff Comp Code.
    We can use the PO from Ordering Comp Code is a ref for any dispatches ( To Pass the PO requirements to Production in Supp.Comp code, while creating PO by maintaining Checking rule )

  • How to get sales order number based on purchase order

    hi,
    what is the transaction code to find the sales order number based on the purchase order number
    Regards,
    Murali

    Hi,
    Go to Se16 (data browser), see the table VBKD, enter the PO number, if any, execute.
    Prase

  • How to print sales order acknowledgement while printing purchase order

    how to print sales order acknowledgement while printing corresponding purchase order
    in me22n

    in print program of Purchase order.. try to trigger output for Order Ack. as well...
    Order acknowledgement

  • Incorrect sort order of rows in Purchase Order based on Sales Order

    Hello Experts.
    I have this problem on SAP B1 8.81 PL 04:
    I create a Purchase Order based on a Sales Order with 10 item rows, ticking the purchase order box in the logistic tab.
    The sort order of rows is different between PO and SO.
    I need the same order of SO on PO.
    Is there something I can do or it's a problem of this patch?
    I saw the Sap Note nr. 824822 but it's related to SAP B1 version 2004 A...
    Regards
    Silvia Reggiani
    Edited by: Silvia Reggiani on Oct 11, 2011 12:26 PM

    Hi,
    Are you able to reproduce the issue in the DEMO Database on the 8.81 PL04?
    Also, have you checked the issue in the latest patch of the 8.81?
    Kind Regards,
    Jitin
    SAP Business One Forum Team

Maybe you are looking for

  • How to create a variant for a screen (not a selection screen)

    Hi I foud a function module RS_CREATE_VARIANT. Is this the correct fm for creating screen variant, if yes then pls provide me some help about how to pass values to this fm. if not then pls help me to find out new one. thnks satisfactory answer will b

  • Connecting You View & Apple TV

    Hi Just received my new You view box which doesn't have a phone connection socket like my BT vision box had. I used that socket to connect my Apple TV to the internet. How would you suggest I do this now - Split the ethernet connection on the comtren

  • Ipod just not working period.....

    I have a Ipod 120gig classic that i bought from amazon 4 months ago, i worked fine for a the 1st 2 months then one time when i was bike riding it locked up on me. I took it home & let the battery drain then plug it in to charge it & it was fine. Now

  • Finding days in a specific month

    Hi All, I need help in writing a query to retrieve all days in a specific month using sysdate. For eaxmple SELECT trunc(to_date(sysdate, 'DD-MONTH-RRRR') FROM DUAL WHERE sysdate between FIRST_DAY AND LAST_DAY;

  • How do I get this piece of crap bookmarks menu to work?????

    I try to bookmark a site and I only get about 4 or 5 folders to put it in... what happens to the rest of my folders?