<?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 in : Purchase order Creation using BAPI_PO_CREATE1 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233997#M140143</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ravi Kath,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont see any difference with your above said modification. It still gives the same EXCEPTION RAISE dump. What BAPI_CREATE_PO1 is doing is , it is repeatedly reading a structure called POT . Sometimes, POT has some values and sometimes it doesnt. When it doesn't it raises an exception.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Mar 2006 01:35:32 GMT</pubDate>
    <dc:creator>former_member125661</dc:creator>
    <dc:date>2006-03-22T01:35:32Z</dc:date>
    <item>
      <title>Error in : Purchase order Creation using BAPI_PO_CREATE1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233991#M140137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hell  guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to create a PO using a BAPI - BAPI_PO_CREATE1 &lt;/P&gt;&lt;P&gt;I want the new PO to have all the characteristics of an existing PO. whose PO # is  stored in wa_order_split_create-docnr and for the new PO, i want the quantity from wa_order_split_create-qty_acptd and the delivery data to be wa_order_split_create-dly_date. But this process and code below gives a short dump in the std FM - MEPO_DOC_ITEM_GET . It raises an exception of failure. I am trying to create many new PO's in the loop below. If there is just one row, sometimes, it creates the PO even with the exception failure ( which is pretty weird).&lt;/P&gt;&lt;P&gt;Am i making any mistake while filling the header or item or schedule lines for the BAPI_PO_CREATE1 ? Any tips or clues why I am getting a dump ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: i_insert,
        i_create_order,
        i_cycle     TYPE cycle,
        i_qty_acpt  TYPE dzmeng,
        i_dly_date  TYPE vbak-vdatu,
        i_item      TYPE roijnomiio .

  DATA: i_order TYPE symsgv,
        i_return TYPE swd_return .

  DATA: i_vbak      TYPE vbak,
        i_vbap      TYPE vbap,
        i_ekko      TYPE ekko,
        i_ekpo      TYPE ekpo,
        i_bsoh      TYPE bapisdhd1,
        i_bsohx     TYPE bapisdhd1x,
        i_bpoh      TYPE bapimepoheader,
        i_bpohx     TYPE bapimepoheaderx,
        i_vbeln     TYPE vbeln_va,
        i_posnr     TYPE posnr_va,
        i_contr     TYPE vbeln_va,
        i_conit     TYPE posnr_va,
        i_ebeln     TYPE ebeln,
        i_ebelp     TYPE ebelp,
        i_pargr     TYPE pargr,
        i_thead     TYPE thead,
        i_line      TYPE tline,
        i_note      TYPE txw_note,
        i_new_vbeln TYPE vbeln_va,
        i_new_ebeln TYPE ebeln,
        i_wa_bsoi   TYPE bapisditm,
        i_wa_bsoix  TYPE bapisditmx,
        i_wa_bsop   TYPE bapiparnr,
        i_wa_bsos   TYPE bapischdl,
        i_wa_bsosx  TYPE bapischdlx,
        i_wa_vbpa   TYPE vbpa,
        i_wa_vbkd   TYPE vbkd,
        i_wa_bpoi   TYPE bapimepoitem,
        i_wa_bpoix  TYPE bapimepoitemx,
        i_wa_bpos   TYPE bapimeposchedule,
        i_wa_bposx  TYPE bapimeposchedulx,
        i_wa_bpop   TYPE bapiekkop,
        i_wa_ekpa   TYPE ekpa,
        i_message   TYPE char72,
        i_bapiretn  TYPE bapiret2,
        i_bapiret2  TYPE TABLE OF bapiret2 INITIAL SIZE 1,
        i_vbpa      TYPE TABLE OF vbpa INITIAL SIZE 1,
        i_vbkd      TYPE TABLE OF vbkd INITIAL SIZE 1,
        i_ekpa      TYPE TABLE OF ekpa INITIAL SIZE 1,
        i_bsoi      TYPE TABLE OF bapisditm INITIAL SIZE 1,
        i_bsoix     TYPE TABLE OF bapisditmx INITIAL SIZE 1,
        i_bsos      TYPE TABLE OF bapischdl INITIAL SIZE 1,
        i_bsosx     TYPE TABLE OF bapischdlx INITIAL SIZE 1,
        i_bsop      TYPE TABLE OF bapiparnr INITIAL SIZE 1,
        i_bpoi      TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
        i_bpoix     TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
        i_bpos      TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
        i_bposx     TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
        i_bpop      TYPE TABLE OF bapiekkop INITIAL SIZE 1,
        i_text_tab  TYPE TABLE OF tline INITIAL SIZE 1,
        i_line_tab  TYPE TABLE OF tline INITIAL SIZE 1,
        i_txw_note  TYPE TABLE OF txw_note INITIAL SIZE 1,
        i_oij_el_doc_mot TYPE oij_el_doc_mot .

  CONSTANTS: c_char_c VALUE 'C',
             c_char_e VALUE 'E',
             c_char_p VALUE 'P',
             c_char_g VALUE 'G',
             c_char_i VALUE 'I',
             c_char_s VALUE 'S',
             c_char_x VALUE 'X',
             c_zsw(3) VALUE 'ZSW',
             c_nomit_stat(4) VALUE 'ZDNY' .

  DATA : lv_nomtk_split        TYPE oij_nomtk.
  DATA : i_order_split_create  TYPE TABLE OF zsws_order_split.
  DATA : wa_order_split_create TYPE zsws_order_split.



  LOOP AT i_order_split_create INTO wa_order_split_create.

    IF NOT i_create_order IS INITIAL .

      CLEAR: i_create_order .

 
          MOVE: wa_order_split_create-docnr  TO i_ebeln,
                wa_order_split_create-docitm TO i_ebelp .

          CALL FUNCTION 'ME_EKKO_SINGLE_READ'
               EXPORTING
                    pi_ebeln         = i_ebeln
               IMPORTING
                    po_ekko          = i_ekko
               EXCEPTIONS
                    no_records_found = 1
                    OTHERS           = 2.

          IF sy-subrc &amp;lt;&amp;gt; 0 .

          ENDIF .

* Fill PO Header
          i_bpoh-comp_code   = i_ekko-bukrs .
          i_bpoh-doc_type    = i_ekko-bsart .
          i_bpoh-vendor      = i_ekko-lifnr .
          i_bpoh-langu       = i_ekko-spras .
          i_bpoh-pmnttrms    = i_ekko-zterm .
          i_bpoh-purch_org   = i_ekko-ekorg .
          i_bpoh-pur_group   = i_ekko-ekgrp .
          i_bpoh-currency    = i_ekko-waers .
          i_bpoh-agreement   = i_ekko-konnr .
          i_bpoh-incoterms1  = i_ekko-inco1 .
          i_bpoh-incoterms2  = i_ekko-inco2 .

* Fill PO update indicator 'X'
          i_bpohx-comp_code  = c_char_x .
          i_bpohx-doc_type   = c_char_x .
          i_bpohx-vendor     = c_char_x .
          i_bpohx-langu      = c_char_x .
          i_bpohx-pmnttrms   = c_char_x .
          i_bpohx-purch_org  = c_char_x .
          i_bpohx-pur_group  = c_char_x .
          i_bpohx-currency   = c_char_x .
          i_bpohx-agreement  = c_char_x .
          i_bpohx-incoterms1 = c_char_x .
          i_bpohx-incoterms2 = c_char_x .

          CALL FUNCTION 'ME_EKPO_SINGLE_READ'
               EXPORTING
                    pi_ebeln         = i_ebeln
                    pi_ebelp         = i_ebelp
               IMPORTING
                    po_ekpo          = i_ekpo
               EXCEPTIONS
                    no_records_found = 1
                    OTHERS           = 2.

          IF sy-subrc &amp;lt;&amp;gt; 0 .
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF .

* Fill PO Item
          i_wa_bpoi-po_item    = i_ekpo-ebelp .
          i_wa_bpoi-material   = i_ekpo-matnr .
          i_wa_bpoi-plant      = i_ekpo-werks .
          i_wa_bpoi-stge_loc   = i_ekpo-lgort .
          i_wa_bpoi-quantity   = wa_order_split_create-qty_acptd .
          i_wa_bpoi-po_unit    = i_ekpo-meins .
          i_wa_bpoi-tax_code   = i_ekpo-mwskz .
          i_wa_bpoi-val_type   = i_ekpo-bwtar .
          i_wa_bpoi-item_cat   = i_ekpo-pstyp .
          i_wa_bpoi-acctasscat = i_ekpo-knttp .
          i_wa_bpoi-agreement  = i_ekpo-konnr .
          i_wa_bpoi-agmt_item  = i_ekpo-ktpnr .

          APPEND i_wa_bpoi TO i_bpoi .

* Fill PO Item update indicator 'X'
          i_wa_bpoix-po_item    = i_ekpo-ebelp .
          i_wa_bpoix-po_itemx   = c_char_x .
          i_wa_bpoix-material   = c_char_x .
          i_wa_bpoix-plant      = c_char_x .
          i_wa_bpoix-stge_loc   = c_char_x .
          i_wa_bpoix-quantity   = c_char_x .
          i_wa_bpoix-po_unit    = c_char_x .
          i_wa_bpoix-tax_code   = c_char_x .
          i_wa_bpoix-val_type   = c_char_x .
          i_wa_bpoix-item_cat   = c_char_x .
          i_wa_bpoix-acctasscat = c_char_x .
          i_wa_bpoix-agreement  = c_char_x .
          i_wa_bpoix-agmt_item  = c_char_x .

          APPEND i_wa_bpoix TO i_bpoix .

* Fill PO Item Schedule
          i_wa_bpos-po_item       = i_ekpo-ebelp .
          i_wa_bpos-sched_line    = '0001' .
          i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
          i_wa_bpos-quantity      = wa_order_split_create-qty_acptd .

          APPEND i_wa_bpos TO i_bpos .

* Fill PO Item schedule update indicator 'X'
          i_wa_bposx-po_item       = i_ekpo-ebelp .
          i_wa_bposx-sched_line    = '0001' .
          i_wa_bposx-delivery_date = c_char_x .
          i_wa_bposx-quantity      = c_char_x .

          APPEND i_wa_bposx TO i_bposx .

          CLEAR: i_pargr .
          SELECT SINGLE pargr
            INTO i_pargr
            FROM t161
           WHERE bstyp = i_ekko-bstyp
             AND bsart = i_ekko-bsart .

          CLEAR i_ekpa[].

          CALL FUNCTION 'MM_READ_PARTNERS'
               EXPORTING
                    application = c_char_p
                    ebeln       = i_ebeln
                    bstyp       = i_ekko-bstyp
                    pargr       = i_pargr
               TABLES
                    x_ekpa      = i_ekpa[].


          LOOP AT i_ekpa INTO i_wa_ekpa .
            i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
            i_wa_bpop-langu = sy-langu .

            IF NOT i_wa_ekpa-lifn2 IS INITIAL .
              i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
            ELSE .
              i_wa_bpop-buspartno = i_wa_ekpa-parnr .
            ENDIF .

            APPEND i_wa_bpop TO i_bpop .
            CLEAR: i_wa_ekpa, i_wa_bpop .
          ENDLOOP .

          CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.

          CALL FUNCTION 'BAPI_PO_CREATE1'
               EXPORTING
                    poheader         = i_bpoh
                    poheaderx        = i_bpohx
               IMPORTING
                    exppurchaseorder = i_new_ebeln
               TABLES
                    return           = i_bapiret2
                    poitem           = i_bpoi[]
                    poitemx          = i_bpoix[]
                    poschedule       = i_bpos[]
                    poschedulex      = i_bposx[].

          i_order = i_new_ebeln .
          SHIFT i_order LEFT DELETING LEADING '0' .

          i_return-errortype = c_char_i .
          i_return-workarea  = c_zsw .
          i_return-message   = '064' .
          i_return-variable1 = i_order .

        loop at i_bapiret2 into i_bapiretn where type ca 'EAX' .
        append i_bapiretn to t_bapi_return .
      endloop .

      if t_bapi_return[] is initial .
         i_create_order = c_char_x .

           CALL FUNCTION 'SWD_POPUP_MESSAGE_SEND'
               EXPORTING
                    act_return = i_return. "Popup with new PO no.

       
        
      ENDCASE .                                     " Docind

    ENDIF .

  ENDLOOP.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Mar 2006 00:39:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233991#M140137</guid>
      <dc:creator>former_member125661</dc:creator>
      <dc:date>2006-03-21T00:39:14Z</dc:date>
    </item>
    <item>
      <title>Re: Error in : Purchase order Creation using BAPI_PO_CREATE1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233992#M140138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You are not filling the PO items in loop (EKPO).&lt;/P&gt;&lt;P&gt;Probably thats why it is creating PO with one item and otherwise giving the dump.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shashank&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Mar 2006 04:29:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233992#M140138</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-21T04:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: Error in : Purchase order Creation using BAPI_PO_CREATE1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233993#M140139</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No Shashank, there is only one line item all the time. I can go ahead and safely make the ebelp = 10 all the time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Mar 2006 12:25:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233993#M140139</guid>
      <dc:creator>former_member125661</dc:creator>
      <dc:date>2006-03-21T12:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: Error in : Purchase order Creation using BAPI_PO_CREATE1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233994#M140140</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Shareen,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What does the dump say... Did u try putting in Commit after ur call to BAPI?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Mar 2006 13:18:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233994#M140140</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-21T13:18:21Z</dc:date>
    </item>
    <item>
      <title>Re: Error in : Purchase order Creation using BAPI_PO_CREATE1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233995#M140141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shareen,&lt;/P&gt;&lt;P&gt; I think in the following parts of the code,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'MM_READ_PARTNERS'&lt;/P&gt;&lt;P&gt;               EXPORTING&lt;/P&gt;&lt;P&gt;                    application = c_char_p&lt;/P&gt;&lt;P&gt;                    ebeln       = i_ebeln&lt;/P&gt;&lt;P&gt;                    bstyp       = i_ekko-bstyp&lt;/P&gt;&lt;P&gt;                    pargr       = i_pargr&lt;/P&gt;&lt;P&gt;               TABLES&lt;/P&gt;&lt;P&gt;                    x_ekpa      = i_ekpa[].&lt;/P&gt;&lt;P&gt; Error in : Purchase order Creation using BAPI_PO_CREATE1 &lt;/P&gt;&lt;P&gt;Posted: Mar 20, 2006 7:39 PM      Reply      E-mail this post  &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hell guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to create a PO using a BAPI - BAPI_PO_CREATE1 &lt;/P&gt;&lt;P&gt;I want the new PO to have all the characteristics of an existing PO. whose PO # is stored in wa_order_split_create-docnr and for the new PO, i want the quantity from wa_order_split_create-qty_acptd and the delivery data to be wa_order_split_create-dly_date. But this process and code below gives a short dump in the std FM - MEPO_DOC_ITEM_GET . It raises an exception of failure. I am trying to create many new PO's in the loop below. If there is just one row, sometimes, it creates the PO even with the exception failure ( which is pretty weird).&lt;/P&gt;&lt;P&gt;Am i making any mistake while filling the header or item or schedule lines for the BAPI_PO_CREATE1 ? Any tips or clues why I am getting a dump ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: i_insert,&lt;/P&gt;&lt;P&gt;        i_create_order,&lt;/P&gt;&lt;P&gt;        i_cycle     TYPE cycle,&lt;/P&gt;&lt;P&gt;        i_qty_acpt  TYPE dzmeng,&lt;/P&gt;&lt;P&gt;        i_dly_date  TYPE vbak-vdatu,&lt;/P&gt;&lt;P&gt;        i_item      TYPE roijnomiio .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  DATA: i_order TYPE symsgv,&lt;/P&gt;&lt;P&gt;        i_return TYPE swd_return .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  DATA: i_vbak      TYPE vbak,&lt;/P&gt;&lt;P&gt;        i_vbap      TYPE vbap,&lt;/P&gt;&lt;P&gt;        i_ekko      TYPE ekko,&lt;/P&gt;&lt;P&gt;        i_ekpo      TYPE ekpo,&lt;/P&gt;&lt;P&gt;        i_bsoh      TYPE bapisdhd1,&lt;/P&gt;&lt;P&gt;        i_bsohx     TYPE bapisdhd1x,&lt;/P&gt;&lt;P&gt;        i_bpoh      TYPE bapimepoheader,&lt;/P&gt;&lt;P&gt;        i_bpohx     TYPE bapimepoheaderx,&lt;/P&gt;&lt;P&gt;        i_vbeln     TYPE vbeln_va,&lt;/P&gt;&lt;P&gt;        i_posnr     TYPE posnr_va,&lt;/P&gt;&lt;P&gt;        i_contr     TYPE vbeln_va,&lt;/P&gt;&lt;P&gt;        i_conit     TYPE posnr_va,&lt;/P&gt;&lt;P&gt;        i_ebeln     TYPE ebeln,&lt;/P&gt;&lt;P&gt;        i_ebelp     TYPE ebelp,&lt;/P&gt;&lt;P&gt;        i_pargr     TYPE pargr,&lt;/P&gt;&lt;P&gt;        i_thead     TYPE thead,&lt;/P&gt;&lt;P&gt;        i_line      TYPE tline,&lt;/P&gt;&lt;P&gt;        i_note      TYPE txw_note,&lt;/P&gt;&lt;P&gt;        i_new_vbeln TYPE vbeln_va,&lt;/P&gt;&lt;P&gt;        i_new_ebeln TYPE ebeln,&lt;/P&gt;&lt;P&gt;        i_wa_bsoi   TYPE bapisditm,&lt;/P&gt;&lt;P&gt;        i_wa_bsoix  TYPE bapisditmx,&lt;/P&gt;&lt;P&gt;        i_wa_bsop   TYPE bapiparnr,&lt;/P&gt;&lt;P&gt;        i_wa_bsos   TYPE bapischdl,&lt;/P&gt;&lt;P&gt;        i_wa_bsosx  TYPE bapischdlx,&lt;/P&gt;&lt;P&gt;        i_wa_vbpa   TYPE vbpa,&lt;/P&gt;&lt;P&gt;        i_wa_vbkd   TYPE vbkd,&lt;/P&gt;&lt;P&gt;        i_wa_bpoi   TYPE bapimepoitem,&lt;/P&gt;&lt;P&gt;        i_wa_bpoix  TYPE bapimepoitemx,&lt;/P&gt;&lt;P&gt;        i_wa_bpos   TYPE bapimeposchedule,&lt;/P&gt;&lt;P&gt;        i_wa_bposx  TYPE bapimeposchedulx,&lt;/P&gt;&lt;P&gt;        i_wa_bpop   TYPE bapiekkop,&lt;/P&gt;&lt;P&gt;        i_wa_ekpa   TYPE ekpa,&lt;/P&gt;&lt;P&gt;        i_message   TYPE char72,&lt;/P&gt;&lt;P&gt;        i_bapiretn  TYPE bapiret2,&lt;/P&gt;&lt;P&gt;        i_bapiret2  TYPE TABLE OF bapiret2 INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_vbpa      TYPE TABLE OF vbpa INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_vbkd      TYPE TABLE OF vbkd INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_ekpa      TYPE TABLE OF ekpa INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bsoi      TYPE TABLE OF bapisditm INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bsoix     TYPE TABLE OF bapisditmx INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bsos      TYPE TABLE OF bapischdl INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bsosx     TYPE TABLE OF bapischdlx INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bsop      TYPE TABLE OF bapiparnr INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bpoi      TYPE TABLE OF bapimepoitem INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bpoix     TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bpos      TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bposx     TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bpop      TYPE TABLE OF bapiekkop INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_text_tab  TYPE TABLE OF tline INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_line_tab  TYPE TABLE OF tline INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_txw_note  TYPE TABLE OF txw_note INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_oij_el_doc_mot TYPE oij_el_doc_mot .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  CONSTANTS: c_char_c VALUE 'C',&lt;/P&gt;&lt;P&gt;             c_char_e VALUE 'E',&lt;/P&gt;&lt;P&gt;             c_char_p VALUE 'P',&lt;/P&gt;&lt;P&gt;             c_char_g VALUE 'G',&lt;/P&gt;&lt;P&gt;             c_char_i VALUE 'I',&lt;/P&gt;&lt;P&gt;             c_char_s VALUE 'S',&lt;/P&gt;&lt;P&gt;             c_char_x VALUE 'X',&lt;/P&gt;&lt;P&gt;             c_zsw(3) VALUE 'ZSW',&lt;/P&gt;&lt;P&gt;             c_nomit_stat(4) VALUE 'ZDNY' .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  DATA : lv_nomtk_split        TYPE oij_nomtk.&lt;/P&gt;&lt;P&gt;  DATA : i_order_split_create  TYPE TABLE OF zsws_order_split.&lt;/P&gt;&lt;P&gt;  DATA : wa_order_split_create TYPE zsws_order_split.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  LOOP AT i_order_split_create INTO wa_order_split_create.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    IF NOT i_create_order IS INITIAL .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      CLEAR: i_create_order .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          MOVE: wa_order_split_create-docnr  TO i_ebeln,&lt;/P&gt;&lt;P&gt;                wa_order_split_create-docitm TO i_ebelp .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'ME_EKKO_SINGLE_READ'&lt;/P&gt;&lt;P&gt;               EXPORTING&lt;/P&gt;&lt;P&gt;                    pi_ebeln         = i_ebeln&lt;/P&gt;&lt;P&gt;               IMPORTING&lt;/P&gt;&lt;P&gt;                    po_ekko          = i_ekko&lt;/P&gt;&lt;P&gt;               EXCEPTIONS&lt;/P&gt;&lt;P&gt;                    no_records_found = 1&lt;/P&gt;&lt;P&gt;                    OTHERS           = 2.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          IF sy-subrc &amp;lt;&amp;gt; 0 .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          ENDIF .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill PO Header&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          i_bpoh-comp_code   = i_ekko-bukrs .&lt;/P&gt;&lt;P&gt;          i_bpoh-doc_type    = i_ekko-bsart .&lt;/P&gt;&lt;P&gt;          i_bpoh-vendor      = i_ekko-lifnr .&lt;/P&gt;&lt;P&gt;          i_bpoh-langu       = i_ekko-spras .&lt;/P&gt;&lt;P&gt;          i_bpoh-pmnttrms    = i_ekko-zterm .&lt;/P&gt;&lt;P&gt;          i_bpoh-purch_org   = i_ekko-ekorg .&lt;/P&gt;&lt;P&gt;          i_bpoh-pur_group   = i_ekko-ekgrp .&lt;/P&gt;&lt;P&gt;          i_bpoh-currency    = i_ekko-waers .&lt;/P&gt;&lt;P&gt;          i_bpoh-agreement   = i_ekko-konnr .&lt;/P&gt;&lt;P&gt;          i_bpoh-incoterms1  = i_ekko-inco1 .&lt;/P&gt;&lt;P&gt;          i_bpoh-incoterms2  = i_ekko-inco2 .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill PO update indicator 'X'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          i_bpohx-comp_code  = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-doc_type   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-vendor     = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-langu      = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-pmnttrms   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-purch_org  = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-pur_group  = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-currency   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-agreement  = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-incoterms1 = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-incoterms2 = c_char_x .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'ME_EKPO_SINGLE_READ'&lt;/P&gt;&lt;P&gt;               EXPORTING&lt;/P&gt;&lt;P&gt;                    pi_ebeln         = i_ebeln&lt;/P&gt;&lt;P&gt;                    pi_ebelp         = i_ebelp&lt;/P&gt;&lt;P&gt;               IMPORTING&lt;/P&gt;&lt;P&gt;                    po_ekpo          = i_ekpo&lt;/P&gt;&lt;P&gt;               EXCEPTIONS&lt;/P&gt;&lt;P&gt;                    no_records_found = 1&lt;/P&gt;&lt;P&gt;                    OTHERS           = 2.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          IF sy-subrc &amp;lt;&amp;gt; 0 .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          ENDIF .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill PO Item&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          i_wa_bpoi-po_item    = i_ekpo-ebelp .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-material   = i_ekpo-matnr .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-plant      = i_ekpo-werks .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-stge_loc   = i_ekpo-lgort .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-quantity   = wa_order_split_create-qty_acptd .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-po_unit    = i_ekpo-meins .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-tax_code   = i_ekpo-mwskz .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-val_type   = i_ekpo-bwtar .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-item_cat   = i_ekpo-pstyp .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-acctasscat = i_ekpo-knttp .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-agreement  = i_ekpo-konnr .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-agmt_item  = i_ekpo-ktpnr .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          APPEND i_wa_bpoi TO i_bpoi .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill PO Item update indicator 'X'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          i_wa_bpoix-po_item    = i_ekpo-ebelp .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-po_itemx   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-material   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-plant      = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-stge_loc   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-quantity   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-po_unit    = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-tax_code   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-val_type   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-item_cat   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-acctasscat = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-agreement  = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-agmt_item  = c_char_x .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          APPEND i_wa_bpoix TO i_bpoix .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill PO Item Schedule&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          i_wa_bpos-po_item       = i_ekpo-ebelp .&lt;/P&gt;&lt;P&gt;          i_wa_bpos-sched_line    = '0001' .&lt;/P&gt;&lt;P&gt;          i_wa_bpos-delivery_date = wa_order_split_create-dly_date .&lt;/P&gt;&lt;P&gt;          i_wa_bpos-quantity      = wa_order_split_create-qty_acptd .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          APPEND i_wa_bpos TO i_bpos .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill PO Item schedule update indicator 'X'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          i_wa_bposx-po_item       = i_ekpo-ebelp .&lt;/P&gt;&lt;P&gt;          i_wa_bposx-sched_line    = '0001' .&lt;/P&gt;&lt;P&gt;          i_wa_bposx-delivery_date = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bposx-quantity      = c_char_x .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          APPEND i_wa_bposx TO i_bposx .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          CLEAR: i_pargr .&lt;/P&gt;&lt;P&gt;          SELECT SINGLE pargr&lt;/P&gt;&lt;P&gt;            INTO i_pargr&lt;/P&gt;&lt;P&gt;            FROM t161&lt;/P&gt;&lt;P&gt;           WHERE bstyp = i_ekko-bstyp&lt;/P&gt;&lt;P&gt;             AND bsart = i_ekko-bsart .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          CLEAR i_ekpa[].&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'MM_READ_PARTNERS'&lt;/P&gt;&lt;P&gt;               EXPORTING&lt;/P&gt;&lt;P&gt;                    application = c_char_p&lt;/P&gt;&lt;P&gt;                    ebeln       = i_ebeln&lt;/P&gt;&lt;P&gt;                    bstyp       = i_ekko-bstyp&lt;/P&gt;&lt;P&gt;                    pargr       = i_pargr&lt;/P&gt;&lt;P&gt;               TABLES&lt;/P&gt;&lt;P&gt;                    x_ekpa      = &amp;lt;b&amp;gt;i_ekpa[].&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          LOOP AT i_ekpa INTO i_wa_ekpa .&lt;/P&gt;&lt;P&gt;            i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .&lt;/P&gt;&lt;P&gt;            i_wa_bpop-langu = sy-langu .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;            IF NOT i_wa_ekpa-lifn2 IS INITIAL .&lt;/P&gt;&lt;P&gt;              i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .&lt;/P&gt;&lt;P&gt;            ELSE .&lt;/P&gt;&lt;P&gt;              i_wa_bpop-buspartno = i_wa_ekpa-parnr .&lt;/P&gt;&lt;P&gt;            ENDIF .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;            APPEND i_wa_bpop TO i_bpop .&lt;/P&gt;&lt;P&gt;            CLEAR: i_wa_ekpa, i_wa_bpop .&lt;/P&gt;&lt;P&gt;          ENDLOOP .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'BAPI_PO_CREATE1'&lt;/P&gt;&lt;P&gt;               EXPORTING&lt;/P&gt;&lt;P&gt;                    poheader         = i_bpoh&lt;/P&gt;&lt;P&gt;                    poheaderx        = i_bpohx&lt;/P&gt;&lt;P&gt;               IMPORTING&lt;/P&gt;&lt;P&gt;                    exppurchaseorder = i_new_ebeln&lt;/P&gt;&lt;P&gt;               TABLES&lt;/P&gt;&lt;P&gt;                    return           = i_bapiret2&lt;/P&gt;&lt;P&gt;                &amp;lt;b&amp;gt;    poitem           = i_bpoi[]&lt;/P&gt;&lt;P&gt;                    poitemx          = i_bpoix[]&lt;/P&gt;&lt;P&gt;                    poschedule       = i_bpos[]&lt;/P&gt;&lt;P&gt;                    poschedulex      = i_bposx[].&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;,&lt;/P&gt;&lt;P&gt;it should be only i_bpoi, i_bpoix, i_bpos, i_bposx but not  i_bpoi[], i_bpoix[], i_bpos[], i_bposx[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CHange the code as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: i_insert,&lt;/P&gt;&lt;P&gt;        i_create_order,&lt;/P&gt;&lt;P&gt;        i_cycle     TYPE cycle,&lt;/P&gt;&lt;P&gt;        i_qty_acpt  TYPE dzmeng,&lt;/P&gt;&lt;P&gt;        i_dly_date  TYPE vbak-vdatu,&lt;/P&gt;&lt;P&gt;        i_item      TYPE roijnomiio .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  DATA: i_order TYPE symsgv,&lt;/P&gt;&lt;P&gt;        i_return TYPE swd_return .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  DATA: i_vbak      TYPE vbak,&lt;/P&gt;&lt;P&gt;        i_vbap      TYPE vbap,&lt;/P&gt;&lt;P&gt;        i_ekko      TYPE ekko,&lt;/P&gt;&lt;P&gt;        i_ekpo      TYPE ekpo,&lt;/P&gt;&lt;P&gt;        i_bsoh      TYPE bapisdhd1,&lt;/P&gt;&lt;P&gt;        i_bsohx     TYPE bapisdhd1x,&lt;/P&gt;&lt;P&gt;        i_bpoh      TYPE bapimepoheader,&lt;/P&gt;&lt;P&gt;        i_bpohx     TYPE bapimepoheaderx,&lt;/P&gt;&lt;P&gt;        i_vbeln     TYPE vbeln_va,&lt;/P&gt;&lt;P&gt;        i_posnr     TYPE posnr_va,&lt;/P&gt;&lt;P&gt;        i_contr     TYPE vbeln_va,&lt;/P&gt;&lt;P&gt;        i_conit     TYPE posnr_va,&lt;/P&gt;&lt;P&gt;        i_ebeln     TYPE ebeln,&lt;/P&gt;&lt;P&gt;        i_ebelp     TYPE ebelp,&lt;/P&gt;&lt;P&gt;        i_pargr     TYPE pargr,&lt;/P&gt;&lt;P&gt;        i_thead     TYPE thead,&lt;/P&gt;&lt;P&gt;        i_line      TYPE tline,&lt;/P&gt;&lt;P&gt;        i_note      TYPE txw_note,&lt;/P&gt;&lt;P&gt;        i_new_vbeln TYPE vbeln_va,&lt;/P&gt;&lt;P&gt;        i_new_ebeln TYPE ebeln,&lt;/P&gt;&lt;P&gt;        i_wa_bsoi   TYPE bapisditm,&lt;/P&gt;&lt;P&gt;        i_wa_bsoix  TYPE bapisditmx,&lt;/P&gt;&lt;P&gt;        i_wa_bsop   TYPE bapiparnr,&lt;/P&gt;&lt;P&gt;        i_wa_bsos   TYPE bapischdl,&lt;/P&gt;&lt;P&gt;        i_wa_bsosx  TYPE bapischdlx,&lt;/P&gt;&lt;P&gt;        i_wa_vbpa   TYPE vbpa,&lt;/P&gt;&lt;P&gt;        i_wa_vbkd   TYPE vbkd,&lt;/P&gt;&lt;P&gt;        i_wa_bpoi   TYPE bapimepoitem,&lt;/P&gt;&lt;P&gt;        i_wa_bpoix  TYPE bapimepoitemx,&lt;/P&gt;&lt;P&gt;        i_wa_bpos   TYPE bapimeposchedule,&lt;/P&gt;&lt;P&gt;        i_wa_bposx  TYPE bapimeposchedulx,&lt;/P&gt;&lt;P&gt;        i_wa_bpop   TYPE bapiekkop,&lt;/P&gt;&lt;P&gt;        i_wa_ekpa   TYPE ekpa,&lt;/P&gt;&lt;P&gt;        i_message   TYPE char72,&lt;/P&gt;&lt;P&gt;        i_bapiretn  TYPE bapiret2,&lt;/P&gt;&lt;P&gt;        i_bapiret2  TYPE TABLE OF bapiret2 INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_vbpa      TYPE TABLE OF vbpa INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_vbkd      TYPE TABLE OF vbkd INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_ekpa      TYPE TABLE OF ekpa INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bsoi      TYPE TABLE OF bapisditm INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bsoix     TYPE TABLE OF bapisditmx INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bsos      TYPE TABLE OF bapischdl INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bsosx     TYPE TABLE OF bapischdlx INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bsop      TYPE TABLE OF bapiparnr INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bpoi      TYPE TABLE OF bapimepoitem INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bpoix     TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bpos      TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bposx     TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_bpop      TYPE TABLE OF bapiekkop INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_text_tab  TYPE TABLE OF tline INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_line_tab  TYPE TABLE OF tline INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_txw_note  TYPE TABLE OF txw_note INITIAL SIZE 1,&lt;/P&gt;&lt;P&gt;        i_oij_el_doc_mot TYPE oij_el_doc_mot .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  CONSTANTS: c_char_c VALUE 'C',&lt;/P&gt;&lt;P&gt;             c_char_e VALUE 'E',&lt;/P&gt;&lt;P&gt;             c_char_p VALUE 'P',&lt;/P&gt;&lt;P&gt;             c_char_g VALUE 'G',&lt;/P&gt;&lt;P&gt;             c_char_i VALUE 'I',&lt;/P&gt;&lt;P&gt;             c_char_s VALUE 'S',&lt;/P&gt;&lt;P&gt;             c_char_x VALUE 'X',&lt;/P&gt;&lt;P&gt;             c_zsw(3) VALUE 'ZSW',&lt;/P&gt;&lt;P&gt;             c_nomit_stat(4) VALUE 'ZDNY' .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  DATA : lv_nomtk_split        TYPE oij_nomtk.&lt;/P&gt;&lt;P&gt;  DATA : i_order_split_create  TYPE TABLE OF zsws_order_split.&lt;/P&gt;&lt;P&gt;  DATA : wa_order_split_create TYPE zsws_order_split.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  LOOP AT i_order_split_create INTO wa_order_split_create.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    IF NOT i_create_order IS INITIAL .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      CLEAR: i_create_order .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          MOVE: wa_order_split_create-docnr  TO i_ebeln,&lt;/P&gt;&lt;P&gt;                wa_order_split_create-docitm TO i_ebelp .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'ME_EKKO_SINGLE_READ'&lt;/P&gt;&lt;P&gt;               EXPORTING&lt;/P&gt;&lt;P&gt;                    pi_ebeln         = i_ebeln&lt;/P&gt;&lt;P&gt;               IMPORTING&lt;/P&gt;&lt;P&gt;                    po_ekko          = i_ekko&lt;/P&gt;&lt;P&gt;               EXCEPTIONS&lt;/P&gt;&lt;P&gt;                    no_records_found = 1&lt;/P&gt;&lt;P&gt;                    OTHERS           = 2.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          IF sy-subrc &amp;lt;&amp;gt; 0 .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          ENDIF .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill PO Header&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          i_bpoh-comp_code   = i_ekko-bukrs .&lt;/P&gt;&lt;P&gt;          i_bpoh-doc_type    = i_ekko-bsart .&lt;/P&gt;&lt;P&gt;          i_bpoh-vendor      = i_ekko-lifnr .&lt;/P&gt;&lt;P&gt;          i_bpoh-langu       = i_ekko-spras .&lt;/P&gt;&lt;P&gt;          i_bpoh-pmnttrms    = i_ekko-zterm .&lt;/P&gt;&lt;P&gt;          i_bpoh-purch_org   = i_ekko-ekorg .&lt;/P&gt;&lt;P&gt;          i_bpoh-pur_group   = i_ekko-ekgrp .&lt;/P&gt;&lt;P&gt;          i_bpoh-currency    = i_ekko-waers .&lt;/P&gt;&lt;P&gt;          i_bpoh-agreement   = i_ekko-konnr .&lt;/P&gt;&lt;P&gt;          i_bpoh-incoterms1  = i_ekko-inco1 .&lt;/P&gt;&lt;P&gt;          i_bpoh-incoterms2  = i_ekko-inco2 .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill PO update indicator 'X'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          i_bpohx-comp_code  = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-doc_type   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-vendor     = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-langu      = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-pmnttrms   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-purch_org  = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-pur_group  = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-currency   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-agreement  = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-incoterms1 = c_char_x .&lt;/P&gt;&lt;P&gt;          i_bpohx-incoterms2 = c_char_x .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'ME_EKPO_SINGLE_READ'&lt;/P&gt;&lt;P&gt;               EXPORTING&lt;/P&gt;&lt;P&gt;                    pi_ebeln         = i_ebeln&lt;/P&gt;&lt;P&gt;                    pi_ebelp         = i_ebelp&lt;/P&gt;&lt;P&gt;               IMPORTING&lt;/P&gt;&lt;P&gt;                    po_ekpo          = i_ekpo&lt;/P&gt;&lt;P&gt;               EXCEPTIONS&lt;/P&gt;&lt;P&gt;                    no_records_found = 1&lt;/P&gt;&lt;P&gt;                    OTHERS           = 2.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          IF sy-subrc &amp;lt;&amp;gt; 0 .&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          ENDIF .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill PO Item&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          i_wa_bpoi-po_item    = i_ekpo-ebelp .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-material   = i_ekpo-matnr .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-plant      = i_ekpo-werks .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-stge_loc   = i_ekpo-lgort .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-quantity   = wa_order_split_create-qty_acptd .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-po_unit    = i_ekpo-meins .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-tax_code   = i_ekpo-mwskz .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-val_type   = i_ekpo-bwtar .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-item_cat   = i_ekpo-pstyp .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-acctasscat = i_ekpo-knttp .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-agreement  = i_ekpo-konnr .&lt;/P&gt;&lt;P&gt;          i_wa_bpoi-agmt_item  = i_ekpo-ktpnr .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          APPEND i_wa_bpoi TO i_bpoi .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill PO Item update indicator 'X'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          i_wa_bpoix-po_item    = i_ekpo-ebelp .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-po_itemx   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-material   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-plant      = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-stge_loc   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-quantity   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-po_unit    = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-tax_code   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-val_type   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-item_cat   = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-acctasscat = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-agreement  = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bpoix-agmt_item  = c_char_x .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          APPEND i_wa_bpoix TO i_bpoix .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill PO Item Schedule&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          i_wa_bpos-po_item       = i_ekpo-ebelp .&lt;/P&gt;&lt;P&gt;          i_wa_bpos-sched_line    = '0001' .&lt;/P&gt;&lt;P&gt;          i_wa_bpos-delivery_date = wa_order_split_create-dly_date .&lt;/P&gt;&lt;P&gt;          i_wa_bpos-quantity      = wa_order_split_create-qty_acptd .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          APPEND i_wa_bpos TO i_bpos .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill PO Item schedule update indicator 'X'&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          i_wa_bposx-po_item       = i_ekpo-ebelp .&lt;/P&gt;&lt;P&gt;          i_wa_bposx-sched_line    = '0001' .&lt;/P&gt;&lt;P&gt;          i_wa_bposx-delivery_date = c_char_x .&lt;/P&gt;&lt;P&gt;          i_wa_bposx-quantity      = c_char_x .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          APPEND i_wa_bposx TO i_bposx .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          CLEAR: i_pargr .&lt;/P&gt;&lt;P&gt;          SELECT SINGLE pargr&lt;/P&gt;&lt;P&gt;            INTO i_pargr&lt;/P&gt;&lt;P&gt;            FROM t161&lt;/P&gt;&lt;P&gt;           WHERE bstyp = i_ekko-bstyp&lt;/P&gt;&lt;P&gt;             AND bsart = i_ekko-bsart .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          CLEAR i_ekpa[].&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'MM_READ_PARTNERS'&lt;/P&gt;&lt;P&gt;               EXPORTING&lt;/P&gt;&lt;P&gt;                    application = c_char_p&lt;/P&gt;&lt;P&gt;                    ebeln       = i_ebeln&lt;/P&gt;&lt;P&gt;                    bstyp       = i_ekko-bstyp&lt;/P&gt;&lt;P&gt;                    pargr       = i_pargr&lt;/P&gt;&lt;P&gt;               TABLES&lt;/P&gt;&lt;P&gt;                    x_ekpa      = i_ekpa.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          LOOP AT i_ekpa INTO i_wa_ekpa .&lt;/P&gt;&lt;P&gt;            i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .&lt;/P&gt;&lt;P&gt;            i_wa_bpop-langu = sy-langu .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;            IF NOT i_wa_ekpa-lifn2 IS INITIAL .&lt;/P&gt;&lt;P&gt;              i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .&lt;/P&gt;&lt;P&gt;            ELSE .&lt;/P&gt;&lt;P&gt;              i_wa_bpop-buspartno = i_wa_ekpa-parnr .&lt;/P&gt;&lt;P&gt;            ENDIF .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;            APPEND i_wa_bpop TO i_bpop .&lt;/P&gt;&lt;P&gt;            CLEAR: i_wa_ekpa, i_wa_bpop .&lt;/P&gt;&lt;P&gt;          ENDLOOP .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          CALL FUNCTION 'BAPI_PO_CREATE1'&lt;/P&gt;&lt;P&gt;               EXPORTING&lt;/P&gt;&lt;P&gt;                    poheader         = i_bpoh&lt;/P&gt;&lt;P&gt;                    poheaderx        = i_bpohx&lt;/P&gt;&lt;P&gt;               IMPORTING&lt;/P&gt;&lt;P&gt;                    exppurchaseorder = i_new_ebeln&lt;/P&gt;&lt;P&gt;               TABLES&lt;/P&gt;&lt;P&gt;                    return           = i_bapiret2&lt;/P&gt;&lt;P&gt;                    poitem           = i_bpoi&lt;/P&gt;&lt;P&gt;                    poitemx          = i_bpoix&lt;/P&gt;&lt;P&gt;                    poschedule       = i_bpos&lt;/P&gt;&lt;P&gt;                    poschedulex      = i_bposx.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          i_order = i_new_ebeln .&lt;/P&gt;&lt;P&gt;          SHIFT i_order LEFT DELETING LEADING '0' .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;          i_return-errortype = c_char_i .&lt;/P&gt;&lt;P&gt;          i_return-workarea  = c_zsw .&lt;/P&gt;&lt;P&gt;          i_return-message   = '064' .&lt;/P&gt;&lt;P&gt;          i_return-variable1 = i_order .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;        loop at i_bapiret2 into i_bapiretn where type ca 'EAX' .&lt;/P&gt;&lt;P&gt;        append i_bapiretn to t_bapi_return .&lt;/P&gt;&lt;P&gt;      endloop .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;      if t_bapi_return[] is initial .&lt;/P&gt;&lt;P&gt;         i_create_order = c_char_x .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;           CALL FUNCTION 'SWD_POPUP_MESSAGE_SEND'&lt;/P&gt;&lt;P&gt;               EXPORTING&lt;/P&gt;&lt;P&gt;                    act_return = i_return. "Popup with new PO no.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;       &lt;/P&gt;&lt;P&gt;        &lt;/P&gt;&lt;P&gt;      ENDCASE .                                     " Docind&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    ENDIF .&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Mar 2006 13:28:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233995#M140141</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-03-21T13:28:48Z</dc:date>
    </item>
    <item>
      <title>Re: Error in : Purchase order Creation using BAPI_PO_CREATE1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233996#M140142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried to call BAPI_TRANSACTION_COMMIT, it started to give another RAISE EXCEPTIOn, saying EBELN missing&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Mar 2006 01:33:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233996#M140142</guid>
      <dc:creator>former_member125661</dc:creator>
      <dc:date>2006-03-22T01:33:38Z</dc:date>
    </item>
    <item>
      <title>Re: Error in : Purchase order Creation using BAPI_PO_CREATE1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233997#M140143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ravi Kath,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I dont see any difference with your above said modification. It still gives the same EXCEPTION RAISE dump. What BAPI_CREATE_PO1 is doing is , it is repeatedly reading a structure called POT . Sometimes, POT has some values and sometimes it doesnt. When it doesn't it raises an exception.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Mar 2006 01:35:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233997#M140143</guid>
      <dc:creator>former_member125661</dc:creator>
      <dc:date>2006-03-22T01:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Error in : Purchase order Creation using BAPI_PO_CREATE1</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233998#M140144</link>
      <description>&lt;P&gt;Hi Shareen&lt;BR /&gt;I am using this BAPI and am experiencing the same issue. I cant find the solution anywhere.&lt;BR /&gt;Have you found the solution?  Please let me know if you have. Thanks!&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Dec 2020 10:59:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/error-in-purchase-order-creation-using-bapi-po-create1/m-p/1233998#M140144</guid>
      <dc:creator>former_member1136</dc:creator>
      <dc:date>2020-12-09T10:59:49Z</dc:date>
    </item>
  </channel>
</rss>

