<?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: difficuilty in creating po using bapi in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032162#M1349548</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;Check the sample code for your reference&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: t_salesorder TYPE STANDARD TABLE OF x_salesorder
      WITH HEADER LINE,
      t_header TYPE bapisdhd1 OCCURS 0 WITH HEADER LINE,
      t_headerx TYPE bapisdhd1x OCCURS 0 WITH HEADER LINE,
      t_partner TYPE bapiparnr OCCURS 0 WITH HEADER LINE,
      t_item TYPE bapisditm OCCURS 0 WITH HEADER LINE,
      t_itemx TYPE bapisditmx OCCURS 0 WITH HEADER LINE,
      t_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
      gv_doc_no LIKE bapivbeln-vbeln,
      wa_salesorder LIKE LINE OF t_salesorder,
      wa_partner TYPE bapiparnr,
      wa_item TYPE bapisditm,
      wa_alpha LIKE LINE OF t_salesorder.
LOOP AT t_salesorder INTO wa_salesorder.
  t_header-sales_org = wa_salesorder-vkorg.
  t_header-distr_chan = wa_salesorder-vtweg.
  t_header-division = wa_salesorder-spart.
  t_header-doc_type = wa_salesorder-auart.
  APPEND t_header.
  t_headerx-sales_org = 'X'.
  t_headerx-distr_chan = 'X'.
  t_headerx-division = 'X'.
  t_headerx-doc_type = 'X'.
  APPEND t_headerx.
  t_itemx-material = 'X'.
  t_itemx-target_qty = 'X'.
  APPEND t_itemx.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = wa_salesorder-kunnr
    IMPORTING
      output = wa_alpha-kunnr.
  wa_partner-partn_role = 'AG'.
  wa_partner-partn_numb = wa_alpha-kunnr.
  APPEND wa_partner TO t_partner.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = wa_salesorder-kunnr1
    IMPORTING
      output = wa_alpha-kunnr1.
  wa_partner-partn_role = 'WE'.
  wa_partner-partn_numb = wa_alpha-kunnr1.
  APPEND wa_partner TO t_partner.
  wa_item-po_itm_no = wa_salesorder-bstnk.
  wa_item-itm_number = wa_salesorder-posnr.
  wa_item-material = wa_salesorder-matnr.
  wa_item-target_qty = wa_salesorder-kwmeng.
  APPEND wa_item TO t_item.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
        order_header_in  = t_header
        order_header_inx = t_headerx
      IMPORTING
        salesdocument    = gv_doc_no
      TABLES
        return           = t_return
        order_items_in   = t_item[]
        order_items_inx  = t_itemx
        order_partners   = t_partner[].
  WRITE:/ 'Type:', t_return-type.
  WRITE:/ 'Message:', t_return-message.
  WRITE:/ 'Sales Order No:', gv_doc_no.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait   = 'X'
    IMPORTING
      return = t_return.
ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Aug 2009 08:48:52 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-08-04T08:48:52Z</dc:date>
    <item>
      <title>difficuilty in creating po using bapi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032157#M1349543</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi , im finding difficulty in creating a po. using a sample code given below .The po is not getting created . plz suggest whether i need to provide more internal tables to bapi function module in order to create that po . or plz send a sample code for it .&lt;/P&gt;&lt;P&gt; thanks !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  Z_PO_CREATE_BAPI
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

REPORT  Z_PO_CREATE_BAPI.

&amp;lt;/&amp;gt;data:header like BAPIMEPOHEADER,&amp;lt;/&amp;gt;
headerx like BAPIMEPOHEADERX,
it_item like standard table of BAPIMEPOITEM,
it_itemx like standard table of BAPIMEPOITEMX,
return like standard table of BAPIRET2,
wa_item like BAPIMEPOITEM,
wa_itemx like BAPIMEPOITEMX,
p_int type i,
p_matnr like mara-matnr,
p_pono like ekko-ebeln.

DATA: BEGIN OF BAPIRETURN OCCURS 0.
INCLUDE STRUCTURE BAPIRET2.
DATA: END OF BAPIRETURN.

constants:
c_x type c value 'X'.
header-comp_code = 'SILS'.
header-doc_type = 'DP25'.
header-creat_date = sy-datum.
header-item_intvl = '10'.
header-vendor = '0000700001'.
header-langu = sy-langu.
header-pmnttrms = '0001'.
header-purch_org = 'RUDP'.
header-pur_group = 'S02'.
header-currency = 'INR'.

headerx-comp_code = c_x.
headerx-doc_type = c_x.
headerx-creat_date = c_x.
headerx-item_intvl = c_x .
headerx-vendor = c_x.
headerx-langu = c_x.
headerx-pmnttrms = c_x .
headerx-purch_org = c_x.
headerx-pur_group = c_x.

*LOOP AT it_final2 INTO wa_final2.

p_int = p_int + 10.
wa_item-po_item = p_int.

p_matnr = 'BKT CHAWA BB'.


CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = p_matnr
IMPORTING
output = p_matnr
EXCEPTIONS
length_error = 1
OTHERS = 2.
*IF sy-subrc = 0.
*MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
*WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
*ENDIF.
wa_item-material = p_matnr.
wa_item-plant = 'TRAD'.
wa_item-quantity = 20.
wa_item-conf_ctrl = 'Z01'.
wa_item-ACKN_REQD = 'X'.
WA_ITEM-ERS = ''.

APPEND wa_item TO it_item.
wa_itemx-po_item = p_int.
wa_itemx-material = c_x.
wa_itemx-plant = c_x .
wa_itemx-stge_loc = c_x .
wa_itemx-quantity = c_x .
wa_itemx-item_cat = c_x .
wa_itemx-acctasscat = c_x .
wa_itemx-conf_ctrl = 'X'.
wa_itemx-ACKN_REQD = 'X'.
WA_ITEMX-ERS = 'X'.
APPEND wa_itemx TO it_itemx.
*ENDLOOP.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = header
poheaderx = headerx
IMPORTING
exppurchaseorder = p_pono
TABLES
return = return
poitem = it_item
poitemx = it_itemx.


CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = BAPIRETURN.


write:/ p_pono.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 08:31:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032157#M1349543</guid>
      <dc:creator>former_member242512</dc:creator>
      <dc:date>2009-08-04T08:31:53Z</dc:date>
    </item>
    <item>
      <title>Re: difficuilty in creating po using bapi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032158#M1349544</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;Please search in SCN you can find lot of posts on this bapi..You will get useful information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Nagaraj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 08:38:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032158#M1349544</guid>
      <dc:creator>former_member404244</dc:creator>
      <dc:date>2009-08-04T08:38:31Z</dc:date>
    </item>
    <item>
      <title>Re: difficuilty in creating po using bapi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032159#M1349545</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;Try single testing the function module by giving to what all you want to pass like t_header,t_item etc&lt;/P&gt;&lt;P&gt;and then execute with that test data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the return table t_return and change accordingly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subhashini&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 08:39:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032159#M1349545</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T08:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: difficuilty in creating po using bapi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032160#M1349546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ujjwal,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Please find the WIKI SAMPLE Code in the following link.&lt;/P&gt;&lt;P&gt;  [LINK|https://wiki.sdn.sap.com/wiki/display/ABAP/Function&lt;EM&gt;Module&lt;/EM&gt;to&lt;EM&gt;create&lt;/EM&gt;PO&lt;EM&gt;using&lt;/EM&gt;BAPI]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vimal.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 08:42:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032160#M1349546</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T08:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: difficuilty in creating po using bapi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032161#M1349547</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;[PO Creation Code|http://wiki.sdn.sap.com/wiki/display/ABAP/Function&lt;EM&gt;Module&lt;/EM&gt;to&lt;EM&gt;create&lt;/EM&gt;PO&lt;EM&gt;using&lt;/EM&gt;BAPI]&lt;/P&gt;&lt;P&gt;[Link|http://wiki.sdn.sap.com/wiki/display/SCM/Function&lt;EM&gt;Module&lt;/EM&gt;to&lt;EM&gt;create&lt;/EM&gt;PO&lt;EM&gt;using&lt;/EM&gt;BAPI]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 08:46:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032161#M1349547</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T08:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: difficuilty in creating po using bapi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032162#M1349548</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;Check the sample code for your reference&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: t_salesorder TYPE STANDARD TABLE OF x_salesorder
      WITH HEADER LINE,
      t_header TYPE bapisdhd1 OCCURS 0 WITH HEADER LINE,
      t_headerx TYPE bapisdhd1x OCCURS 0 WITH HEADER LINE,
      t_partner TYPE bapiparnr OCCURS 0 WITH HEADER LINE,
      t_item TYPE bapisditm OCCURS 0 WITH HEADER LINE,
      t_itemx TYPE bapisditmx OCCURS 0 WITH HEADER LINE,
      t_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
      gv_doc_no LIKE bapivbeln-vbeln,
      wa_salesorder LIKE LINE OF t_salesorder,
      wa_partner TYPE bapiparnr,
      wa_item TYPE bapisditm,
      wa_alpha LIKE LINE OF t_salesorder.
LOOP AT t_salesorder INTO wa_salesorder.
  t_header-sales_org = wa_salesorder-vkorg.
  t_header-distr_chan = wa_salesorder-vtweg.
  t_header-division = wa_salesorder-spart.
  t_header-doc_type = wa_salesorder-auart.
  APPEND t_header.
  t_headerx-sales_org = 'X'.
  t_headerx-distr_chan = 'X'.
  t_headerx-division = 'X'.
  t_headerx-doc_type = 'X'.
  APPEND t_headerx.
  t_itemx-material = 'X'.
  t_itemx-target_qty = 'X'.
  APPEND t_itemx.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = wa_salesorder-kunnr
    IMPORTING
      output = wa_alpha-kunnr.
  wa_partner-partn_role = 'AG'.
  wa_partner-partn_numb = wa_alpha-kunnr.
  APPEND wa_partner TO t_partner.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
    EXPORTING
      input  = wa_salesorder-kunnr1
    IMPORTING
      output = wa_alpha-kunnr1.
  wa_partner-partn_role = 'WE'.
  wa_partner-partn_numb = wa_alpha-kunnr1.
  APPEND wa_partner TO t_partner.
  wa_item-po_itm_no = wa_salesorder-bstnk.
  wa_item-itm_number = wa_salesorder-posnr.
  wa_item-material = wa_salesorder-matnr.
  wa_item-target_qty = wa_salesorder-kwmeng.
  APPEND wa_item TO t_item.
    CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
      EXPORTING
        order_header_in  = t_header
        order_header_inx = t_headerx
      IMPORTING
        salesdocument    = gv_doc_no
      TABLES
        return           = t_return
        order_items_in   = t_item[]
        order_items_inx  = t_itemx
        order_partners   = t_partner[].
  WRITE:/ 'Type:', t_return-type.
  WRITE:/ 'Message:', t_return-message.
  WRITE:/ 'Sales Order No:', gv_doc_no.
  CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
    EXPORTING
      wait   = 'X'
    IMPORTING
      return = t_return.
ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 08:48:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032162#M1349548</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T08:48:52Z</dc:date>
    </item>
    <item>
      <title>Re: difficuilty in creating po using bapi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032163#M1349549</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 have checked your code and I feel its a problem in the data your passing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the purchase org and group once again.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also your not passing same parameters in ITEM and ITEMX table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check your data and I think probelm will be solved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Subhashini&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Aug 2009 10:37:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032163#M1349549</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-04T10:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: difficuilty in creating po using bapi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032164#M1349550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks every one i got it .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Aug 2009 13:57:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032164#M1349550</guid>
      <dc:creator>former_member242512</dc:creator>
      <dc:date>2009-08-05T13:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: difficuilty in creating po using bapi</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032165#M1349551</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;Can I know what all changes you made in the code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;SUbhashini&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Aug 2009 05:36:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/difficuilty-in-creating-po-using-bapi/m-p/6032165#M1349551</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-08-06T05:36:39Z</dc:date>
    </item>
  </channel>
</rss>

