<?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 Re: Error BAPI_SALESORDER_CREATEFROMDAT2 - quantity of position at zero in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-bapi-salesorder-createfromdat2-quantity-of-position-at-zero/m-p/4204123#M1004799</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Google Translator&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have implemented other program with the BAPI_SALESORDER_CREATEFROMDAT1, with same data and works perfectly, but tyhis BAPI is obsolete. What is the problem with the BAPI_SALESORDER_CREATEFROMDAT2???... &lt;/P&gt;&lt;P&gt;Sending the code of the test program.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jhonny&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  zpruebajm09.
*-------------------------Data Declaration-----------------------------*
DATA: st_bapisdhead LIKE bapisdhead, " Sales Order Header Data
      ta_bapiitemin LIKE bapiitemin OCCURS 0 WITH HEADER LINE, " Ln item
      ta_bapipartnr LIKE bapipartnr OCCURS 0 WITH HEADER LINE, " Partner
      d_bapireturn1 LIKE bapireturn1, " Bapi return msg
      d_vbeln LIKE bapivbeln-vbeln. " Sales Order Number

* Move the data to create sales order in the repective parameters------*
MOVE: 'TA' TO st_bapisdhead-doc_type,
      '1000' TO st_bapisdhead-sales_org,
      '10' TO st_bapisdhead-distr_chan,
      '00' TO st_bapisdhead-division,

'00010' TO ta_bapiitemin-itm_number,
'GTS-14001' TO ta_bapiitemin-material,
'1000' TO ta_bapiitemin-plant,
'1.000' TO ta_bapiitemin-req_qty,

'AG' TO ta_bapipartnr-partn_role, " Sold to Party
'0000001000' TO ta_bapipartnr-partn_numb.

* Append the internal tables-------------------------------------------*
APPEND ta_bapipartnr.
CLEAR ta_bapipartnr.
APPEND ta_bapiitemin.
CLEAR ta_bapiitemin.

* Move ship to party---------------------------------------------------*
MOVE: 'RG' TO ta_bapipartnr-partn_role, " Ship to party
'0000001000' TO ta_bapipartnr-partn_numb.

* Append the internal tables-------------------------------------------*
APPEND ta_bapipartnr.
CLEAR ta_bapipartnr.


* Call the Bapi to create the sales order
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
EXPORTING
  order_header_in = st_bapisdhead
* WITHOUT_COMMIT = ' '
* CONVERT_PARVW_AUART = ' '
IMPORTING
  salesdocument = d_vbeln
* SOLD_TO_PARTY =
* SHIP_TO_PARTY =
* BILLING_PARTY =
  return = d_bapireturn1
TABLES
  order_items_in = ta_bapiitemin
  order_partners = ta_bapipartnr
* ORDER_ITEMS_OUT =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CCARD =
* ORDER_CFGS_BLOB =
* ORDER_SCHEDULE_EX =
  .

IF d_vbeln &amp;lt;&amp;gt; SPACE.
  WRITE: 'Sales order No. ', d_vbeln.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    WAIT = 'X'.
ELSE.
  WRITE: 'No data'.
  WRITE: / d_bapireturn1-MESSAGE.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Jul 2008 03:29:30 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-22T03:29:30Z</dc:date>
    <item>
      <title>Error BAPI_SALESORDER_CREATEFROMDAT2 - quantity of position at zero</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-bapi-salesorder-createfromdat2-quantity-of-position-at-zero/m-p/4204122#M1004798</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Google Translator&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have implemented a program with the BAPI_SALESORDER_CREATEFROMDAT2, and although properly filled all the required fields, including the field of quantity with the value 1, the document is created correctly but the position appears 0 and therefore the document does not calculate the value field overall.&lt;/P&gt;&lt;P&gt;He sought any notes or other OSS thread describing the problem and nothing found.&lt;/P&gt;&lt;P&gt;Sending the code of the test program.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jhonny&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  zpruebajm08.

DATA:
* Order partners
      li_order_partners    TYPE STANDARD TABLE OF bapiparnr,
      l_order_partners     LIKE bapiparnr,

* Structures for order header
      l_order_header_in    LIKE bapisdhd1,
      l_order_header_inx   LIKE bapisdhd1x,

* Tables for order items
      li_order_items_in    TYPE STANDARD TABLE OF bapisditm,
      l_order_items_in     LIKE bapisditm,

      li_order_items_inx   TYPE STANDARD TABLE OF bapisditmx,
      l_order_items_inx    LIKE bapisditmx,

* Return table from bapi call
      li_return TYPE STANDARD TABLE OF bapiret2,
      l_return  TYPE bapiret2,

* Sales document number
      l_vbeln LIKE bapivbeln-vbeln,

* Error flag
      l_errflag(1) TYPE c.
*------------------------------------------------------------------
* Build partner information
*------------------------------------------------------------------
  CLEAR l_order_partners.
  l_order_partners-partn_role = 'AG'.
  l_order_partners-partn_numb = '0000001000'.
  APPEND l_order_partners TO li_order_partners.

*------------------------------------------------------------------
* Build order header
*------------------------------------------------------------------

* Update flag
  l_order_header_inx-updateflag = 'I'.

* Sales document type
  l_order_header_in-doc_type    = 'TA'.
  l_order_header_inx-doc_type   = 'X'.

* Sales organization
  l_order_header_in-sales_org  = '1000'.
  l_order_header_inx-sales_org  = 'X'.

* Distribution channel
  l_order_header_in-distr_chan = '10'.
  l_order_header_inx-distr_chan = 'X'.

* Division
  l_order_header_in-division = '00'.
  l_order_header_inx-division = 'X'.

*------------------------------------------------------------------
* Build order item(s) - Only 1 is used in this example
*------------------------------------------------------------------

  l_order_items_in-itm_number = '10'.
  l_order_items_inx-itm_number = '10'.

  l_order_items_in-material = 'GTS-14001'.
  l_order_items_inx-material = 'X'.

  l_order_items_in-target_qty = '1.000'.
  l_order_items_inx-target_qty = 'X'.

  APPEND l_order_items_in TO li_order_items_in.

  l_order_items_inx-updateflag = 'I'.
  APPEND l_order_items_inx TO li_order_items_inx.


*------------------------------------------------------------------
* CALL Bapi
*------------------------------------------------------------------

  CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
  EXPORTING
    order_header_in  = l_order_header_in
    order_header_inx = l_order_header_inx
*      testrun          = 'X'
  IMPORTING
    salesdocument    = l_vbeln
  TABLES
    return           = li_return
    order_items_in   = li_order_items_in
    order_items_inx  = li_order_items_inx
    order_partners   = li_order_partners.

*------------------------------------------------------------------
* Check and write Return table
*------------------------------------------------------------------

  CLEAR l_errflag.

  WRITE: / 'Sales document: ', l_vbeln.

  LOOP AT li_return INTO l_return.
    WRITE: / l_return-type, l_return-message.
    IF l_return-type = 'E'.
      l_errflag = 'X'.
    ENDIF.
  ENDLOOP.

*------------------------------------------------------------------
* No errors - Commit
*------------------------------------------------------------------

IF l_errflag  IS INITIAL.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
   EXPORTING
     wait = 'X'
     .
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 02:58:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-bapi-salesorder-createfromdat2-quantity-of-position-at-zero/m-p/4204122#M1004798</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-22T02:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Error BAPI_SALESORDER_CREATEFROMDAT2 - quantity of position at zero</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-bapi-salesorder-createfromdat2-quantity-of-position-at-zero/m-p/4204123#M1004799</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;Google Translator&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have implemented other program with the BAPI_SALESORDER_CREATEFROMDAT1, with same data and works perfectly, but tyhis BAPI is obsolete. What is the problem with the BAPI_SALESORDER_CREATEFROMDAT2???... &lt;/P&gt;&lt;P&gt;Sending the code of the test program.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jhonny&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  zpruebajm09.
*-------------------------Data Declaration-----------------------------*
DATA: st_bapisdhead LIKE bapisdhead, " Sales Order Header Data
      ta_bapiitemin LIKE bapiitemin OCCURS 0 WITH HEADER LINE, " Ln item
      ta_bapipartnr LIKE bapipartnr OCCURS 0 WITH HEADER LINE, " Partner
      d_bapireturn1 LIKE bapireturn1, " Bapi return msg
      d_vbeln LIKE bapivbeln-vbeln. " Sales Order Number

* Move the data to create sales order in the repective parameters------*
MOVE: 'TA' TO st_bapisdhead-doc_type,
      '1000' TO st_bapisdhead-sales_org,
      '10' TO st_bapisdhead-distr_chan,
      '00' TO st_bapisdhead-division,

'00010' TO ta_bapiitemin-itm_number,
'GTS-14001' TO ta_bapiitemin-material,
'1000' TO ta_bapiitemin-plant,
'1.000' TO ta_bapiitemin-req_qty,

'AG' TO ta_bapipartnr-partn_role, " Sold to Party
'0000001000' TO ta_bapipartnr-partn_numb.

* Append the internal tables-------------------------------------------*
APPEND ta_bapipartnr.
CLEAR ta_bapipartnr.
APPEND ta_bapiitemin.
CLEAR ta_bapiitemin.

* Move ship to party---------------------------------------------------*
MOVE: 'RG' TO ta_bapipartnr-partn_role, " Ship to party
'0000001000' TO ta_bapipartnr-partn_numb.

* Append the internal tables-------------------------------------------*
APPEND ta_bapipartnr.
CLEAR ta_bapipartnr.


* Call the Bapi to create the sales order
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
EXPORTING
  order_header_in = st_bapisdhead
* WITHOUT_COMMIT = ' '
* CONVERT_PARVW_AUART = ' '
IMPORTING
  salesdocument = d_vbeln
* SOLD_TO_PARTY =
* SHIP_TO_PARTY =
* BILLING_PARTY =
  return = d_bapireturn1
TABLES
  order_items_in = ta_bapiitemin
  order_partners = ta_bapipartnr
* ORDER_ITEMS_OUT =
* ORDER_CFGS_REF =
* ORDER_CFGS_INST =
* ORDER_CFGS_PART_OF =
* ORDER_CFGS_VALUE =
* ORDER_CCARD =
* ORDER_CFGS_BLOB =
* ORDER_SCHEDULE_EX =
  .

IF d_vbeln &amp;lt;&amp;gt; SPACE.
  WRITE: 'Sales order No. ', d_vbeln.

  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    WAIT = 'X'.
ELSE.
  WRITE: 'No data'.
  WRITE: / d_bapireturn1-MESSAGE.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Jul 2008 03:29:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-bapi-salesorder-createfromdat2-quantity-of-position-at-zero/m-p/4204123#M1004799</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-22T03:29:30Z</dc:date>
    </item>
  </channel>
</rss>

