<?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: order quantity in BAPI BAPI_SALESORDER_CREATEFROMDAT2 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-quantity-in-bapi-bapi-salesorder-createfromdat2/m-p/4203679#M1004671</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created SO using BAPI_SALESDOCU_CREATEFROMDATA1. while filling the header and item data, i used to do the following,&lt;/P&gt;&lt;P&gt;If you are passing some value to 'target_qty', make sure that you are filling the sales_items_inx-req_qty with 'X'. then pass them to the tables import parameters. Please refer the following code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  fs_sorder-doc_type  = w_auart.
  fs_sorderx-doc_type = c_flag.

  fs_sorder-sales_org  = w_vkorg.
  fs_sorderx-sales_org = c_flag.

  fs_sorder-distr_chan  = w_vtweg.
  fs_sorderx-distr_chan = c_flag.

  fs_sorder-division  = w_spart.
  fs_sorderx-division = c_flag.

  fs_sorderx-updateflag = c_flag.


  fs_partner-partn_role = c_pship.
  fs_partner-partn_numb = w_pship.
  APPEND fs_partner TO t_partner.

  fs_partner-partn_role = c_psold.
  fs_partner-partn_numb = w_psold.
  APPEND fs_partner TO t_partner.

  loop at t_mdata into fs_mdata.
    fs_item-itm_number  = fs_mdata-posnr.
    fs_itemx-itm_number = c_flag.
    fs_item-material    = fs_mdata-matnr.
    fs_itemx-material   = c_flag.
    fs_item-target_qty  = fs_mdata-kwmeng.
    fs_itemx-target_qty = c_flag.
    fs_item-item_categ  = fs_mdata-pstyv.
    fs_itemx-item_categ = c_flag.
    fs_itemx-updateflag = c_flag.
      APPEND fs_item TO t_item.
      APPEND fs_itemx TO t_itemx.

    fs_sline-ITM_NUMBER  = fs_mdata-posnr.
    fs_slinex-ITM_NUMBER = c_flag.
    fs_sline-SCHED_LINE  = c_sline.
    fs_slinex-SCHED_LINE = c_flag.
    fs_sline-REQ_QTY     = fs_mdata-kwmeng.
    fs_slinex-REQ_QTY    = c_flag.
      APPEND fs_sline TO t_sline.
      APPEND fs_slinex TO t_slinex.
  endloop.                             " Loop t_mdata

ENDFORM.                               " data_fill

*---------------------------------------------------------------------*
*  FORM CREATE_SO                                                     *
*---------------------------------------------------------------------*
*  This subroutine calls a BAPI BAPI_SALESDOCU_CREATEFROMDATA1 for    *
*  creating a sales document.                                         *
*---------------------------------------------------------------------*
*  There are no interface parameters to be passed to this subroutine. *
*---------------------------------------------------------------------*
FORM create_so .

  CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
    EXPORTING
      sales_header_in     = fs_sorder
      sales_header_inx    = fs_sorderx
    IMPORTING
      salesdocument_ex    = w_sonum
    TABLES
      return              = t_return
      sales_items_in      = t_item
      sales_items_inx     = t_itemx
      sales_partners      = t_partner
      sales_schedules_in  = t_sline
      sales_schedules_inx = t_slinex.

ENDFORM.                               " create_SO

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Jul 2008 07:45:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-24T07:45:14Z</dc:date>
    <item>
      <title>order quantity in BAPI BAPI_SALESORDER_CREATEFROMDAT2</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-quantity-in-bapi-bapi-salesorder-createfromdat2/m-p/4203678#M1004670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm using BAPI 'BAPI_SALESORDER_CREATEFROMDAT2' to create a sale order.&lt;/P&gt;&lt;P&gt;But the order quantity isn't upadate when I check the sales order number.&lt;/P&gt;&lt;P&gt;The field I used is target_qty in BAPISDITM.&lt;/P&gt;&lt;P&gt;Is the field wrong or some other problems?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Rachel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2008 07:37:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-quantity-in-bapi-bapi-salesorder-createfromdat2/m-p/4203678#M1004670</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-24T07:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: order quantity in BAPI BAPI_SALESORDER_CREATEFROMDAT2</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-quantity-in-bapi-bapi-salesorder-createfromdat2/m-p/4203679#M1004671</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created SO using BAPI_SALESDOCU_CREATEFROMDATA1. while filling the header and item data, i used to do the following,&lt;/P&gt;&lt;P&gt;If you are passing some value to 'target_qty', make sure that you are filling the sales_items_inx-req_qty with 'X'. then pass them to the tables import parameters. Please refer the following code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  fs_sorder-doc_type  = w_auart.
  fs_sorderx-doc_type = c_flag.

  fs_sorder-sales_org  = w_vkorg.
  fs_sorderx-sales_org = c_flag.

  fs_sorder-distr_chan  = w_vtweg.
  fs_sorderx-distr_chan = c_flag.

  fs_sorder-division  = w_spart.
  fs_sorderx-division = c_flag.

  fs_sorderx-updateflag = c_flag.


  fs_partner-partn_role = c_pship.
  fs_partner-partn_numb = w_pship.
  APPEND fs_partner TO t_partner.

  fs_partner-partn_role = c_psold.
  fs_partner-partn_numb = w_psold.
  APPEND fs_partner TO t_partner.

  loop at t_mdata into fs_mdata.
    fs_item-itm_number  = fs_mdata-posnr.
    fs_itemx-itm_number = c_flag.
    fs_item-material    = fs_mdata-matnr.
    fs_itemx-material   = c_flag.
    fs_item-target_qty  = fs_mdata-kwmeng.
    fs_itemx-target_qty = c_flag.
    fs_item-item_categ  = fs_mdata-pstyv.
    fs_itemx-item_categ = c_flag.
    fs_itemx-updateflag = c_flag.
      APPEND fs_item TO t_item.
      APPEND fs_itemx TO t_itemx.

    fs_sline-ITM_NUMBER  = fs_mdata-posnr.
    fs_slinex-ITM_NUMBER = c_flag.
    fs_sline-SCHED_LINE  = c_sline.
    fs_slinex-SCHED_LINE = c_flag.
    fs_sline-REQ_QTY     = fs_mdata-kwmeng.
    fs_slinex-REQ_QTY    = c_flag.
      APPEND fs_sline TO t_sline.
      APPEND fs_slinex TO t_slinex.
  endloop.                             " Loop t_mdata

ENDFORM.                               " data_fill

*---------------------------------------------------------------------*
*  FORM CREATE_SO                                                     *
*---------------------------------------------------------------------*
*  This subroutine calls a BAPI BAPI_SALESDOCU_CREATEFROMDATA1 for    *
*  creating a sales document.                                         *
*---------------------------------------------------------------------*
*  There are no interface parameters to be passed to this subroutine. *
*---------------------------------------------------------------------*
FORM create_so .

  CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
    EXPORTING
      sales_header_in     = fs_sorder
      sales_header_inx    = fs_sorderx
    IMPORTING
      salesdocument_ex    = w_sonum
    TABLES
      return              = t_return
      sales_items_in      = t_item
      sales_items_inx     = t_itemx
      sales_partners      = t_partner
      sales_schedules_in  = t_sline
      sales_schedules_inx = t_slinex.

ENDFORM.                               " create_SO

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2008 07:45:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-quantity-in-bapi-bapi-salesorder-createfromdat2/m-p/4203679#M1004671</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-24T07:45:14Z</dc:date>
    </item>
    <item>
      <title>Re: order quantity in BAPI BAPI_SALESORDER_CREATEFROMDAT2</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-quantity-in-bapi-bapi-salesorder-createfromdat2/m-p/4203680#M1004672</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; Do you mean your sales order is missing only qty which was posted with the said BAPI ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Sudharshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2008 07:46:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-quantity-in-bapi-bapi-salesorder-createfromdat2/m-p/4203680#M1004672</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-24T07:46:34Z</dc:date>
    </item>
    <item>
      <title>Re: order quantity in BAPI BAPI_SALESORDER_CREATEFROMDAT2</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-quantity-in-bapi-bapi-salesorder-createfromdat2/m-p/4203681#M1004673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;only qty is missing.&lt;/P&gt;&lt;P&gt;And in 'BAPI_SALESORDER_CREATEFROMDAT1' , it seems that the quantity field is rec_qty.&lt;/P&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Rachel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jul 2008 08:03:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-quantity-in-bapi-bapi-salesorder-createfromdat2/m-p/4203681#M1004673</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-24T08:03:10Z</dc:date>
    </item>
    <item>
      <title>Re: order quantity in BAPI BAPI_SALESORDER_CREATEFROMDAT2</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/order-quantity-in-bapi-bapi-salesorder-createfromdat2/m-p/4203682#M1004674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In Order to add the quantity populate the schedule field which will automatically populate the quantity in the Line item of thr sales tab. I am using the same and its owrking perfect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    it_schedule_in-itm_number = posnr.&lt;/P&gt;&lt;P&gt;    it_schedule_in-req_qty    = quantity.&lt;/P&gt;&lt;P&gt;    APPEND it_schedule_in.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          order_header_in       = wa_bapisdhd1&lt;/P&gt;&lt;P&gt;          int_number_assignment = 'X'&lt;/P&gt;&lt;P&gt;          testrun               = p_tstrun&lt;/P&gt;&lt;P&gt;        IMPORTING&lt;/P&gt;&lt;P&gt;          salesdocument         = w_vbeln&lt;/P&gt;&lt;P&gt;        TABLES&lt;/P&gt;&lt;P&gt;          return                = it_return&lt;/P&gt;&lt;P&gt;          order_items_in        = it_orders_in&lt;/P&gt;&lt;P&gt;          order_schedules_in    = it_schedule_in&lt;/P&gt;&lt;P&gt;          order_partners        = it_partners.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Murali.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jul 2008 09:38:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/order-quantity-in-bapi-bapi-salesorder-createfromdat2/m-p/4203682#M1004674</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-30T09:38:14Z</dc:date>
    </item>
  </channel>
</rss>

