<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic 'BAPI_SALESORDER_CREATEFROMDAT2' in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-salesorder-createfromdat2/m-p/3865674#M929043</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am trying to run bapi 'BAPI_SALESORDER_CREATEFROMDAT2'  in &lt;STRONG&gt;se37&lt;/STRONG&gt; by passing doc type in header structure  and  sold to party in 'ORDER_PARTNERS' structure but it is giving me errors saying&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E  VP                   112 Please enter sold-to party or ship-to party&lt;/P&gt;&lt;P&gt;E  V4                    219 Sales document  was not changed &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can anybody please help me out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 12 May 2008 13:23:18 GMT</pubDate>
    <dc:creator>Vijay</dc:creator>
    <dc:date>2008-05-12T13:23:18Z</dc:date>
    <item>
      <title>'BAPI_SALESORDER_CREATEFROMDAT2'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-salesorder-createfromdat2/m-p/3865674#M929043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am trying to run bapi 'BAPI_SALESORDER_CREATEFROMDAT2'  in &lt;STRONG&gt;se37&lt;/STRONG&gt; by passing doc type in header structure  and  sold to party in 'ORDER_PARTNERS' structure but it is giving me errors saying&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;E  VP                   112 Please enter sold-to party or ship-to party&lt;/P&gt;&lt;P&gt;E  V4                    219 Sales document  was not changed &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can anybody please help me out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2008 13:23:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-salesorder-createfromdat2/m-p/3865674#M929043</guid>
      <dc:creator>Vijay</dc:creator>
      <dc:date>2008-05-12T13:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: 'BAPI_SALESORDER_CREATEFROMDAT2'</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-salesorder-createfromdat2/m-p/3865675#M929044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi vijay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer this sample code:&lt;/P&gt;&lt;P&gt;check this sample code..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;code&lt;/P&gt;&lt;P&gt;PARAMETERS: p_auart TYPE auart OBLIGATORY.&lt;/P&gt;&lt;P&gt;PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.&lt;/P&gt;&lt;P&gt;PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.&lt;/P&gt;&lt;P&gt;PARAMETERS: p_spart TYPE vtweg OBLIGATORY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARAMETERS: p_sold TYPE kunnr OBLIGATORY.&lt;/P&gt;&lt;P&gt;PARAMETERS: p_ship TYPE kunnr OBLIGATORY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*ITEM&lt;/P&gt;&lt;P&gt;PARAMETERS: p_matnr TYPE matnr OBLIGATORY.&lt;/P&gt;&lt;P&gt;PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.&lt;/P&gt;&lt;P&gt;PARAMETERS: p_plant TYPE werks_d OBLIGATORY.&lt;/P&gt;&lt;P&gt;PARAMETERS: p_itcat TYPE pstyv OBLIGATORY.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA DECLARATIONS. &lt;/P&gt;&lt;P&gt;DATA: v_vbeln LIKE vbak-vbeln.&lt;/P&gt;&lt;P&gt;DATA: header LIKE bapisdhead1.&lt;/P&gt;&lt;P&gt;DATA: headerx LIKE bapisdhead1x.&lt;/P&gt;&lt;P&gt;DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx&lt;/P&gt;&lt;P&gt;WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl&lt;/P&gt;&lt;P&gt;WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HEADER DATA &lt;/P&gt;&lt;P&gt;header-doc_type = p_auart.&lt;/P&gt;&lt;P&gt;headerx-doc_type = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;header-sales_org = p_vkorg.&lt;/P&gt;&lt;P&gt;headerx-sales_org = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;header-distr_chan = p_vtweg.&lt;/P&gt;&lt;P&gt;headerx-distr_chan = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;header-division = p_spart.&lt;/P&gt;&lt;P&gt;headerx-division = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;headerx-updateflag = 'I'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PARTNER DATA &lt;/P&gt;&lt;P&gt;partner-partn_role = 'AG'.&lt;/P&gt;&lt;P&gt;partner-partn_numb = p_sold.&lt;/P&gt;&lt;P&gt;APPEND partner.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;partner-partn_role = 'WE'.&lt;/P&gt;&lt;P&gt;partner-partn_numb = p_ship.&lt;/P&gt;&lt;P&gt;APPEND partner.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ITEM DATA &lt;/P&gt;&lt;P&gt;itemx-updateflag = 'I'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;item-itm_number = '000010'.&lt;/P&gt;&lt;P&gt;itemx-itm_number = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;item-material = p_matnr.&lt;/P&gt;&lt;P&gt;itemx-material = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;item-plant = p_plant.&lt;/P&gt;&lt;P&gt;itemx-plant = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;item-target_qty = p_menge.&lt;/P&gt;&lt;P&gt;itemx-target_qty = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;item-target_qu = 'EA'.&lt;/P&gt;&lt;P&gt;itemx-target_qu = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;item-item_categ = p_itcat.&lt;/P&gt;&lt;P&gt;itemx-item_categ = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND item.&lt;/P&gt;&lt;P&gt;APPEND itemx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fill schedule lines &lt;/P&gt;&lt;P&gt;lt_schedules_in-itm_number = '000010'.&lt;/P&gt;&lt;P&gt;lt_schedules_in-sched_line = '0001'.&lt;/P&gt;&lt;P&gt;lt_schedules_in-req_qty = p_menge.&lt;/P&gt;&lt;P&gt;APPEND lt_schedules_in.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fill schedule line flags &lt;/P&gt;&lt;P&gt;lt_schedules_inx-itm_number = '000010'.&lt;/P&gt;&lt;P&gt;lt_schedules_inx-sched_line = '0001'.&lt;/P&gt;&lt;P&gt;lt_schedules_inx-updateflag = 'X'.&lt;/P&gt;&lt;P&gt;lt_schedules_inx-req_qty = 'X'.&lt;/P&gt;&lt;P&gt;APPEND lt_schedules_inx.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call the BAPI &lt;/P&gt;&lt;P&gt;CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;sales_header_in = header&lt;/P&gt;&lt;P&gt;sales_header_inx = headerx&lt;/P&gt;&lt;P&gt;IMPORTING&lt;/P&gt;&lt;P&gt;salesdocument_ex = v_vbeln&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;return = return&lt;/P&gt;&lt;P&gt;sales_items_in = item&lt;/P&gt;&lt;P&gt;sales_items_inx = itemx&lt;/P&gt;&lt;P&gt;sales_schedules_in = lt_schedules_in&lt;/P&gt;&lt;P&gt;sales_schedules_inx = lt_schedules_inx&lt;/P&gt;&lt;P&gt;sales_partners = partner.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the return table. &lt;/P&gt;&lt;P&gt;LOOP AT return WHERE type = 'E' OR type = 'A'.&lt;/P&gt;&lt;P&gt;EXIT.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE: / 'Error in creating document'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;COMMIT WORK AND WAIT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE: / 'Document ', v_vbeln, ' created'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;[/code]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for the purpose:&lt;/P&gt;&lt;P&gt;Sales order: Create Sales Order&lt;/P&gt;&lt;P&gt;FM - BAPI_SALESORDER_CREATEFROMDAT2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Functionality&lt;/P&gt;&lt;P&gt;You can use this method to create sales orders.You must enter at least sales order header data (via ORDER_HEADER_IN structure) and partner data (via the ORDER_PARTNERS table) as input parameters.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Enter the item data via the ORDER_ITEMS_IN table. You can allocate item numbers manually, by filling in the relevant fields, or the system does it, according to the settings for Customizing, by leaving the relevant fields blank.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you have configurable items, you must enter the configuration data in the ORDER_CFGS_REF, ORDER_CFGS_INST, ORDER_CFGS_PART_OF and ORDER_CFGS_VALUE tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Credit cards can be transferred via the BAPICCARD structure, on the one hand, data for card identification, on the other, data for a transaction which has taken place in an external system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once you have created the sales order successfully, you will receive the document number (SALESDOCUMENT field). Any errors that may occur will be announced via the RETURN parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If no sales area has been created in the sales order header, then the system creates the sales area from the sold-to party or ship-to party, who has been entered in the partner table. If a clear sales area cannot be created, you will receive a system message, and the sales order will not be created.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Notes&lt;/P&gt;&lt;P&gt;1. Mandatory entries:&lt;/P&gt;&lt;P&gt;ORDER_HEADER_IN : DOC_TYPE Sales document type&lt;/P&gt;&lt;P&gt;SALES_ORG Sales organization&lt;/P&gt;&lt;P&gt;DISTR_CHAN Distribution channel&lt;/P&gt;&lt;P&gt;DIVISION Division&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ORDER_PARTNERS..: PARTN_ROLE Partner role, SP sold-to party&lt;/P&gt;&lt;P&gt;PARTN_NUMB Customer number&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ORDER_ITEMS_IN..: MATERIAL Material number&lt;/P&gt;&lt;P&gt;2. Ship-to party:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If no ship-to party is entered, use the following: Ship-to party =&lt;/P&gt;&lt;P&gt;sold-to party.&lt;/P&gt;&lt;P&gt;3. Commit control:&lt;/P&gt;&lt;P&gt;The BAPI does not have a database commit. This means that the relevant application must leave the commit, in order that can be carried out on on the database. The BAPI BAPI_TRANSACTION_COMMIT is available for this.&lt;/P&gt;&lt;P&gt;4. German key words:&lt;/P&gt;&lt;P&gt;The following key words must be entered in German, independantly of&lt;/P&gt;&lt;P&gt;the logon language:&lt;/P&gt;&lt;P&gt;DOC_TYPE Sales document type, for example: TA for standard order&lt;/P&gt;&lt;P&gt;PARTN_ROLE Partner role, for example: WE for ship-to party.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2008 13:39:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bapi-salesorder-createfromdat2/m-p/3865675#M929044</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-05-12T13:39:12Z</dc:date>
    </item>
  </channel>
</rss>

