Reg BAPI_PO_CREATE1

Hi guys,
Im using the above said BAPI for PO Creation. Im getting errors in the return table sayinh "Net price should be greater than Zero". I tried testing the BAPI thro se37, where it doesnot give me any errors in the return table and automatically picks the net_price. The same BAPI is not picking net_price in my program.
Any suggestions.
Thanks,
S S K

** Program ID              :
** Program Desc            :              PO Creation Using BAPI
** Process Overview        :
** Created By              :              P.KARTHIKEYAN
** Created Date            :              25/10/2006
** Company Name            :              Infoview Technologies Limited
*& Report  ZBAPI_CREATE_PO                                             *
REPORT  ZBAPI_CREATE_PO                         .
*DATA DECLARATION
CONSTANTS : C_X VALUE 'X'.
*Structures to hold PO header data
DATA : HEADER LIKE  BAPIMEPOHEADER   ,
       HEADERX LIKE  BAPIMEPOHEADERX .
*Internal Tables to hold PO ITEM DATA
DATA : ITEM   LIKE BAPIMEPOITEM  OCCURS 0 WITH HEADER LINE,
       ITEMX  LIKE BAPIMEPOITEMX OCCURS 0 WITH HEADER LINE,
**Internal table to hold messages from BAPI call
       RETURN LIKE BAPIRET2 OCCURS 0 WITH HEADER LINE.
data : w_header(40) value 'PO Header'.
data : ws_langu like sy-langu.
data:  V_EXPPURCHASEORDER  like BAPIMEPOHEADER-PO_NUMBER.
*text-001 = 'PO Header' - define as text element
selection-screen begin of block b1 with frame title text-001.
parameters : company like header-comp_code  default '1000'      ,
             doctyp  like HEADER-DOC_TYPE   default 'NB'        ,
             cdate   like HEADER-CREAT_DATE default sy-datum    ,
             vendor  like HEADER-VENDOR     default 'RAJ',
             pur_org like HEADER-PURCH_ORG  default '0001'      ,
             pur_grp like HEADER-PUR_GROUP  default '001'       .
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-002.
parameters : item_num like ITEM-PO_ITEM  default '00020',
             material like ITEM-MATERIAL default 'M-127'   ,
             plant    like ITEM-PLANT    default '0001' ,
             quantity like ITEM-QUANTITY default 200.
selection-screen end of block b2.
**START-OF-SELECTION.
**DATA POPULATION
ws_langu = sy-langu.   "Language variable
*POPULATE HEADER DATA FOR PO
HEADER-COMP_CODE  = company    .
HEADER-DOC_TYPE   = doctyp     .
HEADER-CREAT_DATE = cdate      .
HEADER-VENDOR     = vendor     .
HEADER-LANGU      = ws_langu   .
HEADER-PURCH_ORG  = pur_org    .
HEADER-PUR_GROUP  = pur_grp    .
*POPULATE HEADER FLAG.
HEADERX-comp_code  = c_x.
HEADERX-doc_type   = c_x.
HEADERX-creat_date = c_x.
HEADERX-vendor     = c_x.
HEADERX-langu      = c_x.
HEADERX-purch_org  = c_x.
HEADERX-pur_group  = c_x.
*HEADERX-doc_date   = c_x.
*POPULATE ITEM DATA.
ITEM-PO_ITEM  = item_num.
ITEM-MATERIAL = material.
ITEM-PLANT    = plant.
ITEM-QUANTITY = quantity.
APPEND ITEM.
*POPULATE ITEM FLAG TABLE
ITEMX-PO_ITEM    = item_num.
ITEMX-MATERIAL   = C_X.
ITEMX-PLANT      = C_X .
*ITEMX-STGE_LOC   = C_X .
ITEMX-QUANTITY   = C_X .
*ITEMX-TAX_CODE   = C_X .
*ITEMX-ITEM_CAT   = C_X .
*ITEMX-ACCTASSCAT = C_X .
APPEND ITEMX.
*BAPI CALL
CALL FUNCTION 'BAPI_PO_CREATE1'
  EXPORTING
    POHEADER                     = HEADER
    POHEADERX                    = HEADERX
  POADDRVENDOR                 =
  TESTRUN                      =
IMPORTING
   EXPPURCHASEORDER             =   V_EXPPURCHASEORDER
  EXPHEADER                    =
  EXPPOEXPIMPHEADER            =
TABLES
   RETURN                       = RETURN
   POITEM                       = ITEM
   POITEMX                      = ITEMX.
*Confirm the document creation by calling database COMMIT
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
   WAIT          = 'X'
IMPORTING
  RETURN        =
end-of-selection.
****Output the messages returned from BAPI call
*LOOP AT RETURN.
WRITE /  v_EXPPURCHASEORDER.
*ENDLOOP.

Similar Messages

  • Hi reg bapi_po_create1

    hi  while creating po  through standard bapi
    (through se37), it is saying that purchase order still contains fau;lty items. mm consultant asked me to debug the standard function module, but is not  understandable, suggest me a suitable solution,,,,FM  IS BAPI_PO_CREATE1
    VERSION IS 5.0

    this error may come for several reasons ... so you have to debug the fn module and check it .... Other wise you can try to create PO through ME21 with the same data which you have given in se37( not by ME21n because the net price is taking from info record in case of BAPI like me21).
    regards
    shiba dutta

  • BAPI or BDC  for PO Creation

    Hi All,
    I need the sample BDC or BAPI Program for Purchase Order Creations upload.
    Regards
    Mustafa

    Hi Mustafa,
                     The BAPI for PO creation is BAPI_PO_CREATE1.
    Have a look at this thread.Link : [Thread|Reg BAPI_PO_CREATE1;.
    Hope your query resolves quickly.
    Have a best day ahead.

  • Reg. creation of Blanket Order through BAPI_PO_CREATE1

    Hi All,
    I have a requirement of creating framework order of document type FO. When I fill bapi interface correctly, I am getting an error message as either error  SE-518 u201CNo account assignment exists for service lineu201D or error 06 436-In case of account assignment, please enter acc. assignment data for item". I even tried in reverse way of filling bapi interface of po create1 by seeing from BAPI_PO_GETDETAIL1 of already created PO.but still I face same error. I filled up POLIMTS,with dummy package value in POSERVICES,POITEM,POITEMX, and account assignment details in POACCOUNT,POACCOUNTX tables of BAPI_PO_CREATE1 inetrface.
    If any one of you has worked on this before, i request you to send the code or any suggestion on how to proceed.
    Srikanth.

    i have the same problem. Can you suggest me your solution.
    Thank in advance.

  • Reg: Issue in BAPI_PO_CREATE1

    hi,
    i created a screen and made it as mandatory in me21n and its working fine. My problem is, when i use BAPI_PO_CREATE1, those fields are not there and throwing error msg. Can i append those field in the BAPI? If i do so, will it required any coding to be written inside BAPI to update those values ?
    please help.
    Thanks in advance,
    aswin.

    hi,
    maybe try this:
    1. switch off mandatory z-field via BADI ME_PROCESS_PO_CUST during process your BAPI_PO_CREATE1
    2.after create PO via BAPI update "manually" by z-program
    your z-fields...
    best regards,darek

  • Error while Creating a PO using BAPI_PO_CREATE1

    Hi Friends,
         The following issue that I have observed and as explained below is one of the weirdest scenarios that I have seen while working with SAP. Hence, kindly help me with possible errors from my end. I am working on ECC 6.0.
    Requirement: To automatically create a PO.
    Option used: I have used a BAPI: u2018BAPI_PO_CREATE1u2019
    Scenario: When I execute the BAPI u2018BAPI_PO_CREATE1u2019 directly in sequence with u2018BAPI_TRANSACTION_COMMITu2019, the PO gets created successfully. The data entered as input is:
    POHEADER-COMP_CODE
    POHEADER-DOC_TYPE
    POHEADER-PMNTTRMS
    POITEM-PO_ITEM
    POITEM-QUANTITY
    POITEM-TAX_CODE
    POITEM-TAXJURCODE
    POITEM-RFQ_NO
    POITEM-RFQ_ITEM
    POITEM-PREQ_NO
    POITEM-PREQ_ITEM
    POITEM-PREQ_NAME
    POSCHEDULE-PO_ITEM
    POSCHEDULE-SCHED_LINE
    POSCHEDULE-QUANTITY
    POSCHEDULE-PREQ_NO
    POSCHEDULE-PREQ_ITEM
    Problem: I need to pass data to the BAPI through code, so I called the BAPI u2018BAPI_PO_CREATE1u2019 and u2018BAPI_TRANSACTION_COMMITu2019 in a test function module as well as report. I passed the same data as mentioned above i.e. while creating the PO by passing data to the BAPI directly.
    But the BAPI returns an error BAPI header data still faulty, enter plant, Pur. Org., Pur. Grp., etc.
    I tried by passing all the available data for the header and then for the items, but finally, I still get an error that the item is from a different order account and just cannot create a PO.
    The Test FM code is as shown below:
      DATA : PYMNT_TERMS    TYPE YOAF_SEC_MASTER-TER_PYMNT.
      DATA : ITEM_NO(4) .
      DATA : CURRENCY TYPE LFM1-WAERS.
      DATA : POHEAD         TYPE BAPIMEPOHEADER.
      DATA : POHEADX        TYPE BAPIMEPOHEADERX.
      DATA : EXP_HEAD       TYPE BAPIMEPOHEADER.
      DATA : POITEM         TYPE TABLE OF BAPIMEPOITEM WITH HEADER LINE.
      DATA : POITEMX        TYPE TABLE OF BAPIMEPOITEMX WITH HEADER LINE.
      DATA : POSCHED        TYPE TABLE OF BAPIMEPOSCHEDULE WITH HEADER LINE.
      DATA : POSCHEDX       TYPE TABLE OF BAPIMEPOSCHEDULX WITH HEADER LINE.
      DATA : EX_PO_NUMBER   TYPE BAPIMEPOHEADER-PO_NUMBER.
      CONSTANTS : C_X VALUE 'X'.
      POHEAD-COMP_CODE  = 'P110'.
      POHEAD-DOC_TYPE   = DOC_TYPE.
      POHEAD-PMNTTRMS   = 'P10'.
      POHEADX-COMP_CODE  = C_X.
      POHEADX-DOC_TYPE   = C_X.
      POHEADX-PMNTTRMS   = C_X.
      POITEM-PO_ITEM    = '00001'.
      POITEM-QUANTITY   = '1.000'.
      POITEM-TAX_CODE   = 'D2'.
      POITEM-TAXJURCODE = 'MH01'.
      POITEM-RFQ_NO     = '2300009491'.
      POITEM-RFQ_ITEM   = '00001'.
      POITEM-PREQ_NO    = '200003583'.
      POITEM-PREQ_ITEM   = '00001'.
      POITEM-PREQ_NAME  = 'SACHIN'.
      APPEND POITEM.
      POITEMX-PO_ITEM    = '00001'.
      POITEMX-PO_ITEMX   = C_X.
      POITEMX-QUANTITY   = C_X .
      POITEMX-TAX_CODE   = C_X .
      POITEMX-TAXJURCODE = C_X .
      POITEM-RFQ_NO      = C_X.
      POITEM-RFQ_ITEM    = C_X.
      POITEM-PREQ_NO     = C_X.
      POITEM-PREQ_ITEM   = C_X.
      POITEMX-PREQ_NAME  = C_X.
      APPEND POITEMX.
      POSCHED-PO_ITEM        = '00001'.
      POSCHED-SCHED_LINE     = '0001'.
      POSCHED-QUANTITY       = '1.000'.
      POSCHED-PREQ_NO        = '1200003583'.
      POSCHED-PREQ_ITEM      = '00001'.
      APPEND POSCHED.
      POSCHEDX-PO_ITEM        = '1'.
      POSCHEDX-SCHED_LINE     = '0001'.
      POSCHEDX-PO_ITEMX       = C_X.
      POSCHEDX-SCHED_LINEX    = C_X.
      POSCHEDX-QUANTITY       = C_X.
      POSCHEDX-PREQ_NO        = C_X.
      POSCHEDX-PREQ_ITEM      = C_X.
      APPEND POSCHEDX.
      CALL FUNCTION 'BAPI_PO_CREATE1'
          EXPORTING
            POHEADER                     = POHEAD
            POHEADERX                    = POHEADX
          IMPORTING
            EXPPURCHASEORDER             = EX_PO_NUMBER
            EXPHEADER                    = EXP_HEAD
               EXPPOEXPIMPHEADER             =
          TABLES
            RETURN                       = RETURN_ERROR
            POITEM                       = POITEM
            POITEMX                      = POITEMX
               POADDRDELIVERY               =
            POSCHEDULE                   = POSCHED
            POSCHEDULEX                  = POSCHEDX
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          WAIT   = 'X'
        IMPORTING
          RETURN = RETURN_ERROR.

    Hi,
    As mentioned that this error was one of the wierdest SAP issues I have faced, it was due to the silliest copy paste errors on my behalf. I completely overlooked the POITEMX naming.
    For 4 values of RFQ_NO, RFQ_ITEM, PREQ_NO, PREQ_ITEM, I didnt have the 'X' for POITEMX and kept on looking for errors for days.
    BAPI_PO_CREATE1 works with min. possible inputs successfully.
    Thanks to all!

  • Error  while creating a Service PO using BAPI_PO_CREATE1

    Hi,
    Im facing Error as "In case of account assignment, please enter acc. assignment data for item" while creating Service PO using BAPI_PO_CREATE1.
    Header Data
          w_poheader-comp_code = w_src-bukrs.  "Company Code
          w_poheader-doc_type = w_src-bsart.   "Document type
         w_poheader-delete_ind = w_src-vrtkz. "Deletion Indicator
          CLEAR: lv_date.
          CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
            EXPORTING
              date_external            = w_src-aedat
            IMPORTING
              date_internal            = lv_date
            EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
          w_poheader-creat_date = lv_date.    "Creation Date
          w_poheader-created_by = sy-uname.    "Creator Name
          w_poheader-vendor = w_src-lifnr.     "Vendor
          w_poheader-pmnttrms = w_src-zterm.   "Payment Terms
          w_poheader-purch_org = w_src-ekorg.  "Purchase Organization
          w_poheader-pur_group = w_src-ekgrp.  "Purchase Group
          w_poheader-ref_1    = w_src-ihrez.   "OLD PO
          w_poheaderx-comp_code = 'X'.  "Company Code
          w_poheaderx-doc_type = 'X'.   "Document type
         w_poheaderx-delete_ind = 'X'.      "Deletion Indicator
          w_poheaderx-creat_date = 'X'.    "Creation Date
          w_poheaderx-created_by = 'X'.
          w_poheaderx-vendor = 'X'.
          w_poheaderx-pmnttrms = 'X'.   "Payment Terms
          w_poheaderx-purch_org = 'X'.  "Purchase Organization
          w_poheaderx-pur_group = 'X'.  "Purchase Group
          w_poheaderx-ref_1 = 'X'.
    Item Data
          w_poitem-po_item = w_src-ebelp.
          IF NOT w_src-elikz IS INITIAL.
            w_poitem-delete_ind = w_src-elikz.
          ENDIF.
          IF NOT w_src-txz01 IS INITIAL.
            w_poitem-short_text = w_src-txz01.
          ENDIF.
          IF NOT w_src-werks IS INITIAL.
            w_poitem-plant = w_src-werks.
          ENDIF.
    Material group
          IF NOT w_src-matkl IS INITIAL.
            w_poitem-matl_group = w_src-matkl.
          ENDIF.
    Open or Partial Qty
          IF w_src-opqty IS  NOT INITIAL.
            w_poitem-quantity = w_src-opqty.
          ELSEIF NOT w_src-paqty IS INITIAL.
            w_poitem-quantity = w_src-paqty.
          ENDIF.
          IF NOT w_src-meins IS INITIAL.
            w_poitem-po_unit = w_src-meins. "Base Unit of Measure
          ENDIF.
          IF NOT w_src-netpr IS INITIAL.
            w_poitem-net_price = w_src-netpr.  "Net Price
          ENDIF.
          IF NOT w_src-mwskz IS INITIAL.
            w_poitem-tax_code = w_src-mwskz.
          ENDIF.
          IF NOT w_src-pstyp IS INITIAL.
            w_poitem-item_cat = w_src-pstyp.
          ENDIF.
          IF NOT w_src-knttp IS INITIAL.
            w_poitem-acctasscat = w_src-knttp.
          ENDIF.
          IF NOT w_src-vrtkz IS INITIAL.
            w_poitem-distrib = w_src-vrtkz.
          ENDIF.
    Package No
          IF NOT w_src-packno IS INITIAL.
            w_poitem-pckg_no = w_src-packno.  "Package no
          ENDIF.
          IF w_poitem-delete_ind IS INITIAL AND
             w_poitem-short_text IS INITIAL AND
             w_poitem-plant IS INITIAL AND
             w_poitem-matl_group IS INITIAL AND
             w_poitem-quantity IS INITIAL AND
             w_poitem-po_unit IS INITIAL AND
             w_poitem-net_price IS INITIAL AND
             w_poitem-tax_code IS INITIAL.
            CLEAR lv_item.
          ELSE.
            APPEND w_poitem TO i_poitem.
            CLEAR: w_poitem.
            lv_item = 'X'.
          ENDIF.
          w_poitemx-po_item = w_src-ebelp.
          w_poitemx-delete_ind = 'X'.
          w_poitemx-short_text = 'X'.
          w_poitemx-plant = 'X'.
          w_poitemx-matl_group = 'X'.
          w_poitemx-quantity = 'X'.
          w_poitemx-po_unit = 'X'.
          w_poitemx-net_price = 'X'.
          w_poitemx-tax_code = 'X'.
          w_poitemx-item_cat = 'X'.
          w_poitemx-acctasscat = 'X'.
          w_poitemx-distrib = 'X'.
          IF NOT w_src-packno IS INITIAL.
            w_poitemx-pckg_no = 'X'.
          ENDIF.
          IF lv_item = 'X'.
            APPEND w_poitemx TO i_poitemx.
            CLEAR: w_poitemx,
                   lv_item.
          ENDIF.
    PO Deliery Address
          w_poaddrdelivery-po_item = w_src-ebelp.
          IF NOT w_src-adrn2 IS INITIAL.
            w_poaddrdelivery-addr_no = w_src-adrn2.
            APPEND w_poaddrdelivery TO i_poaddrdelivery.
            CLEAR w_poaddrdelivery.
          ENDIF.
    POschedule
          w_poschedule-po_item = w_src-ebelp.
          CLEAR: lv_date.
          CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
            EXPORTING
              date_external            = w_src-eindt
            IMPORTING
              date_internal            = lv_date
            EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
          IF NOT lv_date IS INITIAL.
            w_poschedule-del_datcat_ext = 'D'. "Delivery Date in Day Format
            w_poschedule-delivery_date = lv_date.
            w_poschedule-quantity = w_src-menge.
            APPEND w_poschedule TO i_poschedule.
            CLEAR w_poschedule.
            lv_schd = 'X'.
          ENDIF.
          w_poschedulex-po_item = w_src-ebelp.
          w_poschedulex-del_datcat_ext = 'X'.
          w_poschedulex-delivery_date = 'X'.
          w_poschedulex-quantity = 'X'.
          IF lv_schd = 'X'.
            APPEND w_poschedulex TO i_poschedulex.
            CLEAR : w_poschedulex,
                    lv_schd.
          ENDIF.
    PO Account Assignment
          w_poaccount-po_item = w_src-ebelp.
          w_poaccount-serial_no = w_src-zekkn.
    Distribution Indicator is 1
          IF w_src-vrtkz EQ '1'.
            w_poaccount-distr_perc = w_src-vproz.
            IF NOT w_src-menge IS INITIAL.
              CLEAR lv_menge.
              lv_menge = w_src-menge.
            ENDIF.
            lv_acct_qty = lv_menge * w_src-vproz / 100.
    Get Round value of Quanity
            frac = FRAC( lv_acct_qty ).
            IF frac EQ 0.
              lv_acct_qty = FLOOR( lv_acct_qty ).
            ELSE.
              lv_acct_qty = CEIL( lv_acct_qty ).
            ENDIF.
            w_poaccount-quantity = lv_acct_qty.
          ELSEIF w_src-vrtkz IS INITIAL.
            w_poaccount-quantity = w_src-menge.
          ENDIF.
          w_poaccount-gl_account = w_src-saknr.
          w_poaccount-costcenter = w_src-kostl.
          w_poaccount-asset_no = w_src-anln1.
          w_poaccount-wbs_element = w_src-wbs.
          w_poaccount-network = w_src-nplnr.
          w_poaccount-tax_code = w_src-mwskz.
          w_poaccount-activity = w_src-vornr.
          APPEND w_poaccount TO i_poaccount.
          CLEAR w_poaccount.
          w_poaccountx-po_item = w_src-ebelp.
          w_poaccountx-serial_no = w_src-zekkn.
          IF w_src-vrtkz EQ '1'.
            w_poaccountx-distr_perc =  'X'.
          ENDIF.
          w_poaccountx-quantity = 'X'.
          w_poaccountx-gl_account = 'X'.
          w_poaccountx-costcenter = 'X'.
          w_poaccountx-wbs_element = 'X'.
          w_poaccountx-network = 'X'.
          w_poaccountx-tax_code = 'X'.
          w_poaccountx-activity = 'X'.
          APPEND w_poaccountx TO i_poaccountx.
          CLEAR w_poaccountx.
    PO Services
          w_poservices-pckg_no = w_src-packno.  "Package no
          w_poservices-line_no = w_src-srv_line_no.    "Line item
          w_poservices-ext_line = w_src-extrow.    "External line
         w_poservices-outl_level = 0.
         w_poservices-outl_ind = 'X'.
          w_poservices-subpckg_no = w_src-sub_packno.  "Sub package no
          w_poservices-quantity = w_src-srqty.  "Service Quantity
          w_poservices-base_uom = w_src-srmeins.  "Service Basic unit of Measure
          w_poservices-price_unit = '1'.
         w_poservices-from_line = '1'.
          w_poservices-gr_price  = w_src-brtwr.  "GR Price
          w_poservices-short_text = w_src-sh_text1.    "Service Short Text
         w_poservices-matl_group = w_src-matkl.  "Material Group
          APPEND w_poservices TO i_poservices.
          CLEAR w_poservices.
    PO Service Access values
          w_posrvacc-pckg_no = w_src-packno.  "Package no
          w_posrvacc-line_no = w_src-srv_line_no. "Line item
          w_posrvacc-serno_line = w_src-zekkn.                  "'01'..
          IF w_src-vproz IS INITIAL.
            w_posrvacc-percentage = '100.0'.
          ENDIF.
          w_posrvacc-serial_no = w_src-zekkn.                   "'01'.
          w_posrvacc-quantity = w_src-srqty.  "Service Quantity
          w_posrvacc-net_value = w_src-srqty.  "Net value
          APPEND w_posrvacc TO i_posrvacc.
          CLEAR w_posrvacc.
        ENDIF.
    ***Create a NEW PO
        AT END OF ihrez.
    Call BAPI
          CALL FUNCTION 'BAPI_PO_CREATE1'
            EXPORTING
              poheader          = w_poheader
              poheaderx         = w_poheaderx
            IMPORTING
              exppurchaseorder  = gv_ebeln
            TABLES
              return            = i_return
              poitem            = i_poitem[]
              poitemx           = i_poitemx[]
              poaddrdelivery    = i_poaddrdelivery[]
              poschedule        = i_poschedule[]
              poschedulex       = i_poschedulex[]
              poaccount         = i_poaccount[]
              poaccountx        = i_poaccountx[]
              poservices        = i_poservices[]
              posrvaccessvalues = i_posrvacc[]
              extensionin       = i_extensionin[].
    Commit the Transaction
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
           EXPORTING
             WAIT          = 'X'.
    Regards,
    Deepthi.

    1. If we get error as  "In case of account assignment, please enter acc. assignment data for item" than First cehck whetaher u have authorization to Tcode ME23n or not. In my case, I din't had authorization to Me23n tcode.
    2. If we get Error as "Please Mainatain Services or Limits". Please create a Service PO in the following Order.
    *& Internal Table Declaration
    DATA : i_intern         TYPE STANDARD TABLE OF alsmex_tabline WITH HEADER LINE,
           i_poitem         TYPE STANDARD TABLE OF bapimepoitem,
           i_poitemx        TYPE STANDARD TABLE OF bapimepoitemx,
           i_poaddrdelivery TYPE STANDARD TABLE OF bapimepoaddrdelivery,
           i_poschedule     TYPE STANDARD TABLE OF bapimeposchedule,
           i_poschedulex    TYPE STANDARD TABLE OF bapimeposchedulx,
           i_poaccount      TYPE STANDARD TABLE OF bapimepoaccount,
           i_poaccountx     TYPE STANDARD TABLE OF bapimepoaccountx,
           i_poservices     TYPE STANDARD TABLE OF bapiesllc,
           i_posrvacc       TYPE STANDARD TABLE OF bapiesklc,
           i_extensionin    TYPE STANDARD TABLE OF bapiparex,
           i_return         TYPE STANDARD TABLE OF bapiret2.
    *& Work Area Declaration
    DATA:
          w_poheader       TYPE bapimepoheader,
          w_poheaderx      TYPE bapimepoheaderx,
          w_poitem         TYPE bapimepoitem,
          w_poitemx        TYPE bapimepoitemx,
          w_poaddrdelivery TYPE bapimepoaddrdelivery,
          w_poschedule     TYPE bapimeposchedule,
          w_poschedulex    TYPE bapimeposchedulx,
          w_poaccount      TYPE bapimepoaccount,
          w_poaccountx     TYPE bapimepoaccountx,
          w_poservices     TYPE bapiesllc,
          w_posrvacc       TYPE bapiesklc,
          w_extensionin    TYPE bapiparex,
          w_return         TYPE bapiret2.
    START-OF-SELECTION.
    Header Data
      w_poheader-comp_code = '5791'.  "Company Code
      w_poheader-doc_type = 'Z0CM'.   "Document type
      w_poheader-creat_date = sy-datum.  "lv_date.    "Creation Date
      w_poheader-created_by = sy-uname.    "Creator Name
      w_poheader-vendor = '0005012343'.     "Vendor
      w_poheader-pmnttrms = 'Z004'.   "Payment Terms
      w_poheader-purch_org = 'P000'.  "Purchase Organization
      w_poheader-pur_group = '001'.  "Purchase Group
      w_poheader-ref_1    = '004500007671'.   "OLD PO
      w_poheaderx-comp_code = 'X'.  "Company Code
      w_poheaderx-doc_type = 'X'.   "Document type
      w_poheaderx-creat_date = 'X'.    "Creation Date
      w_poheaderx-created_by = 'X'.
      w_poheaderx-vendor = 'X'.
      w_poheaderx-pmnttrms = 'X'.   "Payment Terms
      w_poheaderx-purch_org = 'X'.  "Purchase Organization
      w_poheaderx-pur_group = 'X'.  "Purchase Group
      w_poheaderx-ref_1 = 'X'.
    Item Data
      w_poitem-po_item = '000010'.
      w_poitem-short_text = 'Z0CM - Default Appr. Test  '.
      w_poitem-plant = '5368'.
      Trackign no
      w_poitem-trackingno = ''.
    Material group
      w_poitem-matl_group = '119'.
      w_poitem-po_unit = 'EA'. "Base Unit of Measure
      w_poitem-net_price = '17500.00'.  "Net Price
      w_poitem-tax_code = 'I0'.
      w_poitem-item_cat = '9'.
      w_poitem-acctasscat = 'K'.
      w_poitem-distrib = space.
    Package must be given in item to create Service PO
      w_poitem-pckg_no = 0000000001.
      APPEND w_poitem TO i_poitem.
      CLEAR: w_poitem.
      w_poitemx-po_item = '000010'.
      w_poitemx-delete_ind = 'X'.
      w_poitemx-short_text = 'X'.
      w_poitemx-plant = 'X'.
      w_poitemx-trackingno = 'X'.
      w_poitemx-matl_group = 'X'.
      w_poitemx-quantity = 'X'.
      w_poitemx-po_unit = 'X'.
      w_poitemx-net_price = 'X'.
      w_poitemx-tax_code = 'X'.
      w_poitemx-item_cat = 'X'.
      w_poitemx-acctasscat = 'X'.
      w_poitemx-distrib = 'X'.
      w_poitemx-pckg_no = 'X'.
      APPEND w_poitemx TO i_poitemx.
      CLEAR: w_poitemx.
    PO Deliery Address
          w_poaddrdelivery-po_item = '000010'.
            w_poaddrdelivery-addr_no = '0000061208'.
            APPEND w_poaddrdelivery TO i_poaddrdelivery.
            CLEAR w_poaddrdelivery.
    POschedule
          w_poschedule-po_item = '000010'..
    DATA : LV_DATE TYPE SY-DATUM,
           lv_schd.
          CLEAR: lv_date.
          CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
            EXPORTING
              date_external            = '12/2/2009'
            IMPORTING
              date_internal            = lv_date
            EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
          IF NOT lv_date IS INITIAL.
            w_poschedule-del_datcat_ext = 'D'. "Delivery Date in Day Format
            w_poschedule-delivery_date = lv_date.
            w_poschedule-quantity = '1.000'.
            APPEND w_poschedule TO i_poschedule.
            CLEAR w_poschedule.
            lv_schd = 'X'.
          ENDIF.
          w_poschedulex-po_item = '000010'.
          w_poschedulex-del_datcat_ext = 'X'.
          w_poschedulex-delivery_date = 'X'.
          w_poschedulex-quantity = 'X'.
          IF lv_schd = 'X'.
            APPEND w_poschedulex TO i_poschedulex.
            CLEAR : w_poschedulex,
                    lv_schd.
          ENDIF.
    PO Account Assignment
      w_poaccount-po_item = '000010'.
      w_poaccount-serial_no = '01'.
      w_poaccount-distr_perc = ''.
      w_poaccount-quantity = '1.000'.
      w_poaccount-gl_account = '0000603064'.
      w_poaccount-costcenter = '0053680100'.
      w_poaccount-asset_no = ''.
      w_poaccount-wbs_element = ''.
      w_poaccount-network = ''.
      w_poaccount-tax_code = 'I0'.
      w_poaccount-activity = ''.
      APPEND w_poaccount TO i_poaccount.
      CLEAR w_poaccount.
      w_poaccountx-po_item = '000010'.
      w_poaccountx-serial_no = '01'.
      w_poaccountx-distr_perc =  'X'.
      w_poaccountx-quantity = 'X'.
      w_poaccountx-gl_account = 'X'.
      w_poaccountx-costcenter = 'X'.
      w_poaccountx-wbs_element = 'X'.
      w_poaccountx-network = 'X'.
      w_poaccountx-tax_code = 'X'.
      w_poaccountx-activity = 'X'.
      w_poaccountx-cmmt_item = 'X'.
      APPEND w_poaccountx TO i_poaccountx.
      CLEAR w_poaccountx.
    Extension for ZZSub
      w_extensionin-structure = 'BAPI_TE_MEPOACCOUNTING'.
      w_extensionin-valuepart1+0(5) = '00010'..
      w_extensionin-valuepart1+5(2) = '01'.
      w_extensionin-valuepart1+28(5) = ''.
      APPEND w_extensionin TO i_extensionin.
      CLEAR w_extensionin.
      w_extensionin-structure = 'BAPI_TE_MEPOACCOUNTINGX'.
      w_extensionin-valuepart1+0(5) = '00010'.
      w_extensionin-valuepart1+5(2) = '01'.
      w_extensionin-valuepart1+11(1) = 'X'.
      APPEND w_extensionin TO i_extensionin.
      CLEAR w_extensionin.
    Extension to add Expense Type only
      w_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
      w_extensionin-valuepart1+10(4) = '0131'.
      APPEND w_extensionin TO i_extensionin.
      CLEAR w_extensionin.
      w_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.
      w_extensionin-valuepart1+10(4) = 'X'.
      APPEND w_extensionin TO i_extensionin.
      CLEAR w_extensionin.
      EXPORT i_extensionin[] TO MEMORY ID 'SUB'.
    PO Services
    PO Services( One Line Iem)
    Assign the dummy no as Pacakage no
      w_poservices-pckg_no = 0000000001.  "(assign package no as a dummy number)
      w_poservices-line_no = 0000000001.      "Line item
      w_poservices-outl_ind = 'X'.
    Assign Dummy no as sub package no
      w_poservices-subpckg_no = 0000000003.   "(Dummy No.) "Sub package no
      w_poservices-from_line = '1'.
      APPEND w_poservices TO i_poservices.
      CLEAR w_poservices.
    PO Services(Second Line Item )
    Assign the same sub package dummy no which is mentioned above
      w_poservices-pckg_no = 0000000003.   "(Dummy No.) "Sub package no
      w_poservices-line_no = 0000000002.
      w_poservices-ext_line = '0000000010'.     "External line
      w_poservices-quantity = '17500.0'.    "Service Quantity
      w_poservices-base_uom = 'EA'.    "Service Basic unit of Measure
      w_poservices-price_unit = '1'.
      w_poservices-gr_price  = '1'.    "GR Price
      w_poservices-short_text = 'Z0CM - Default Appr. T'.      "Service Short Text
    w_poservices-matl_group = '119'.  "w_src-matkl.  "Material Group
      APPEND w_poservices TO i_poservices.
      CLEAR w_poservices.
    PO Service Access values
      w_posrvacc-pckg_no = 0000000003.  "w_src-sub_packno.  "Sub package no
      w_posrvacc-line_no = 0000000002.  "w_src-srv_line_no. "Line item
      w_posrvacc-serno_line = '01'.
      w_posrvacc-percentage = '100.0'.
      w_posrvacc-serial_no = '01'.
      w_posrvacc-quantity = '17500.0'.  "w_src-srqty.  "Service Quantity
      APPEND w_posrvacc TO i_posrvacc.
      CLEAR w_posrvacc.
      DATA : gv_ebeln TYPE ebeln.
    Call BAPI
      CALL FUNCTION 'BAPI_PO_CREATE1'
        EXPORTING
          poheader          = w_poheader
          poheaderx         = w_poheaderx
        IMPORTING
          exppurchaseorder  = gv_ebeln
        TABLES
          return            = i_return
          poitem            = i_poitem[]
          poitemx           = i_poitemx[]
          poaddrdelivery    = i_poaddrdelivery[]
          poschedule        = i_poschedule[]
          poschedulex       = i_poschedulex[]
          poaccount         = i_poaccount[]
          poaccountx        = i_poaccountx[]
          poservices        = i_poservices[]
          posrvaccessvalues = i_posrvacc[]
          extensionin       = i_extensionin[].
    Commit the Transaction
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = 'X'.
      WRITE:/5 gv_ebeln COLOR 5.
      SKIP 2.
      DATA : lv_msg TYPE string.
      LOOP AT i_return INTO w_return WHERE type = 'E'.
        CALL FUNCTION 'FORMAT_MESSAGE'
          EXPORTING
            id        = w_return-id
            lang      = 'EN'
            no        = w_return-number
            v1        = w_return-message_v1
            v2        = w_return-message_v2
            v3        = w_return-message_v3
            v4        = w_return-message_v4
          IMPORTING
            msg       = lv_msg
          EXCEPTIONS
            not_found = 1
            OTHERS    = 2.
        WRITE:/10 lv_msg.
      ENDLOOP.

  • Error in : Purchase order Creation using BAPI_PO_CREATE1

    Hell  guys,
    I am trying to create a PO using a BAPI - BAPI_PO_CREATE1
    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).
    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 ?
    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 <> 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 <> 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.

    Hi Shareen,
    I think in the following parts of the code,
              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[].
    Error in : Purchase order Creation using BAPI_PO_CREATE1
    Posted: Mar 20, 2006 7:39 PM      Reply      E-mail this post 
    Hell guys,
    I am trying to create a PO using a BAPI - BAPI_PO_CREATE1
    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).
    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 ?
    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 <> 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 <> 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      = <b>i_ekpa[].</b>
              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
                    <b>    poitem           = i_bpoi[]
                        poitemx          = i_bpoix[]
                        poschedule       = i_bpos[]
                        poschedulex      = i_bposx[].</b>
    it should be only i_bpoi, i_bpoix, i_bpos, i_bposx but not  i_bpoi[], i_bpoix[], i_bpos[], i_bposx[].
    CHange the code as follows:
    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 <> 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 <> 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.

  • Service PO for Multiple Acct Assig is not created using BAPI_PO_CREATE1

    Hi,
    Im unable to create the Service po with multiple acct assiignment using BAPI_PO_CREATE1
    Header Data
          w_poheader-comp_code = w_src-bukrs.  "Company Code
          w_poheader-doc_type = w_src-bsart.   "Document type
         w_poheader-delete_ind = w_src-vrtkz. "Deletion Indicator
          CLEAR: lv_date.
          CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
            EXPORTING
              date_external            = w_src-aedat
            IMPORTING
              date_internal            = lv_date
            EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
          w_poheader-creat_date = lv_date.    "Creation Date
          w_poheader-created_by = sy-uname.    "Creator Name
          w_poheader-vendor = w_src-lifnr.     "Vendor
          w_poheader-pmnttrms = w_src-zterm.   "Payment Terms
          w_poheader-purch_org = w_src-ekorg.  "Purchase Organization
          w_poheader-pur_group = w_src-ekgrp.  "Purchase Group
          w_poheader-ref_1    = w_src-ihrez.   "OLD PO
          w_poheaderx-comp_code = 'X'.  "Company Code
          w_poheaderx-doc_type = 'X'.   "Document type
         w_poheaderx-delete_ind = 'X'.      "Deletion Indicator
          w_poheaderx-creat_date = 'X'.    "Creation Date
          w_poheaderx-created_by = 'X'.
          w_poheaderx-vendor = 'X'.
          w_poheaderx-pmnttrms = 'X'.   "Payment Terms
          w_poheaderx-purch_org = 'X'.  "Purchase Organization
          w_poheaderx-pur_group = 'X'.  "Purchase Group
          w_poheaderx-ref_1 = 'X'.
    Item Data
          w_poitem-po_item = w_src-ebelp.
          IF NOT w_src-elikz IS INITIAL.
            w_poitem-delete_ind = w_src-elikz.
          ENDIF.
          IF NOT w_src-txz01 IS INITIAL.
            w_poitem-short_text = w_src-txz01.
          ENDIF.
          IF NOT w_src-werks IS INITIAL.
            w_poitem-plant = w_src-werks.
          ENDIF.
    Material group
          IF NOT w_src-matkl IS INITIAL.
            w_poitem-matl_group = w_src-matkl.
          ENDIF.
    Open or Partial Qty
          IF w_src-opqty IS  NOT INITIAL.
            w_poitem-quantity = w_src-opqty.
          ELSEIF NOT w_src-paqty IS INITIAL.
            w_poitem-quantity = w_src-paqty.
          ENDIF.
          IF NOT w_src-meins IS INITIAL.
            w_poitem-po_unit = w_src-meins. "Base Unit of Measure
          ENDIF.
          IF NOT w_src-netpr IS INITIAL.
            w_poitem-net_price = w_src-netpr.  "Net Price
          ENDIF.
          IF NOT w_src-mwskz IS INITIAL.
            w_poitem-tax_code = w_src-mwskz.
          ENDIF.
          IF NOT w_src-pstyp IS INITIAL.
            w_poitem-item_cat = w_src-pstyp.
          ENDIF.
          IF NOT w_src-knttp IS INITIAL.
            w_poitem-acctasscat = w_src-knttp.
          ENDIF.
          w_src-vrtkz = '2'.    "Added
          IF NOT w_src-vrtkz IS INITIAL.
            w_poitem-distrib = w_src-vrtkz.
          ENDIF.
    Package No
          IF w_src-srv_line_no EQ '2'.
            w_poitem-pckg_no = 0000000001. "Assign dummy package no "w_src-packno.  "Package no
          ELSEIF w_src-srv_line_no EQ '3'.
            w_poitem-pckg_no = 0000000004. "Assign dummy package no "w_src-packno.  "Package no
          ENDIF.
          IF w_poitem-delete_ind IS INITIAL AND
             w_poitem-short_text IS INITIAL AND
             w_poitem-plant IS INITIAL AND
             w_poitem-matl_group IS INITIAL AND
             w_poitem-quantity IS INITIAL AND
             w_poitem-po_unit IS INITIAL AND
             w_poitem-net_price IS INITIAL AND
             w_poitem-tax_code IS INITIAL.
            CLEAR lv_item.
          ELSE.
            APPEND w_poitem TO i_poitem.
            CLEAR: w_poitem.
            lv_item = 'X'.
          ENDIF.
          w_poitemx-po_item = w_src-ebelp.
          w_poitemx-delete_ind = 'X'.
          w_poitemx-short_text = 'X'.
          w_poitemx-plant = 'X'.
          w_poitemx-matl_group = 'X'.
          w_poitemx-quantity = 'X'.
          w_poitemx-po_unit = 'X'.
          w_poitemx-net_price = 'X'.
          w_poitemx-tax_code = 'X'.
          w_poitemx-item_cat = 'X'.
          w_poitemx-acctasscat = 'X'.
          w_poitemx-distrib = 'X'.
          w_poitemx-pckg_no = 'X'.
          IF lv_item = 'X'.
            APPEND w_poitemx TO i_poitemx.
            CLEAR: w_poitemx,
                   lv_item.
          ENDIF.
    PO Deliery Address
          w_poaddrdelivery-po_item = w_src-ebelp.
          IF NOT w_src-adrn2 IS INITIAL.
            w_poaddrdelivery-addr_no = w_src-adrn2.
            APPEND w_poaddrdelivery TO i_poaddrdelivery.
            CLEAR w_poaddrdelivery.
          ENDIF.
    POschedule
          w_poschedule-po_item = w_src-ebelp.
       w_poschedule-SCHED_LINE = w_src-
          CLEAR: lv_date.
          CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
            EXPORTING
              date_external            = w_src-eindt
            IMPORTING
              date_internal            = lv_date
            EXCEPTIONS
              date_external_is_invalid = 1
              OTHERS                   = 2.
          IF NOT lv_date IS INITIAL.
            w_poschedule-del_datcat_ext = 'D'. "Delivery Date in Day Format
            w_poschedule-delivery_date = lv_date.
            w_poschedule-quantity = w_src-menge.
            APPEND w_poschedule TO i_poschedule.
            CLEAR w_poschedule.
            lv_schd = 'X'.
          ENDIF.
          w_poschedulex-po_item = w_src-ebelp.
       w_poschedule-SCHED_LINE = 'X'.
          w_poschedulex-del_datcat_ext = 'X'.
          w_poschedulex-delivery_date = 'X'.
          w_poschedulex-quantity = 'X'.
          IF lv_schd = 'X'.
            APPEND w_poschedulex TO i_poschedulex.
            CLEAR : w_poschedulex,
                    lv_schd.
          ENDIF.
    PO Account Assignment
          w_poaccount-po_item = w_src-ebelp.
          w_poaccount-serial_no = w_src-zekkn.
    Distribution Indicator is 1
          IF w_src-vrtkz EQ '1'.
            w_poaccount-distr_perc = w_src-vproz.
            IF NOT w_src-menge IS INITIAL.
              CLEAR lv_menge.
              lv_menge = w_src-menge.
            ENDIF.
            lv_acct_qty = lv_menge * w_src-vproz / 100.
    Get Round value of Quanity
            frac = FRAC( lv_acct_qty ).
            IF frac EQ 0.
              lv_acct_qty = FLOOR( lv_acct_qty ).
            ELSE.
              lv_acct_qty = CEIL( lv_acct_qty ).
            ENDIF.
            w_poaccount-quantity = lv_acct_qty.
          ELSEIF w_src-vrtkz IS INITIAL.
            w_poaccount-quantity = w_src-menge.
          ENDIF.
      w_poaccount-quantity = w_src-menge.    "added
          w_poaccount-gl_account = w_src-saknr.
          w_poaccount-costcenter = w_src-kostl.
          w_poaccount-asset_no = w_src-anln1.
          w_poaccount-wbs_element = w_src-wbs.
          w_poaccount-network = w_src-nplnr.
          w_poaccount-tax_code = w_src-mwskz.
          w_poaccount-activity = w_src-vornr.
          APPEND w_poaccount TO i_poaccount.
          CLEAR w_poaccount.
          w_poaccountx-po_item = w_src-ebelp.
          w_poaccountx-serial_no = w_src-zekkn.
          IF w_src-vrtkz EQ '1'.
            w_poaccountx-distr_perc =  'X'.
          ENDIF.
          w_poaccountx-quantity = 'X'.
          w_poaccountx-gl_account = 'X'.
          w_poaccountx-costcenter = 'X'.
          w_poaccountx-wbs_element = 'X'.
          w_poaccountx-network = 'X'.
          w_poaccountx-tax_code = 'X'.
          w_poaccountx-activity = 'X'.
          w_poaccountx-cmmt_item = 'X'.
          APPEND w_poaccountx TO i_poaccountx.
          CLEAR w_poaccountx.
    Extension for ZZSub
          IF NOT w_src-zzsub IS INITIAL.
            w_extensionin-structure = 'BAPI_TE_MEPOACCOUNTING'.
            w_extensionin-valuepart1+0(5) = w_src-ebelp.
            w_extensionin-valuepart1+5(2) = '01'.
            w_extensionin-valuepart1+28(5) = w_src-zzsub.
            APPEND w_extensionin TO i_extensionin.
            CLEAR w_extensionin.
            w_extensionin-structure = 'BAPI_TE_MEPOACCOUNTINGX'.
            w_extensionin-valuepart1+0(5) = w_src-ebelp.
            w_extensionin-valuepart1+5(2) = '01'.
            w_extensionin-valuepart1+11(1) = 'X'.
            APPEND w_extensionin TO i_extensionin.
            CLEAR w_extensionin.
          ENDIF.
    Extension to add Expense Type only
          IF NOT  w_src-zzexptype IS INITIAL.
            w_extensionin-structure = 'BAPI_TE_MEPOHEADER'.
            w_extensionin-valuepart1+10(4) = w_src-zzexptype.
            APPEND w_extensionin TO i_extensionin.
            CLEAR w_extensionin.
            w_extensionin-structure = 'BAPI_TE_MEPOHEADERX'.
            w_extensionin-valuepart1+10(4) = 'X'.
            APPEND w_extensionin TO i_extensionin.
            CLEAR w_extensionin.
          ENDIF.
          EXPORT i_extensionin[] TO MEMORY ID 'SUB'.
    PO Services( One Line Iem)
          IF w_src-srv_line_no EQ '2'.
            w_poservices-pckg_no = 0000000001.  "w_src-packno. "(assign package no as a dummy number)
            w_poservices-line_no = 0000000001.  "w_src-srv_line_no.    "Line item
            w_poservices-outl_ind = 'X'.
            w_poservices-subpckg_no = 0000000003.  "w_src-sub_packno. "(Dummy No.) "Sub package no
         w_poservices-quantity = w_src-srqty.  "Service Quantity
         w_poservices-base_uom = w_src-srmeins.  "Service Basic unit of Measure
         w_poservices-price_unit = '1'.
            w_poservices-from_line = '1'.
         w_poservices-gr_price  = w_src-brtwr.  "GR Price
         w_poservices-short_text = w_src-sh_text1.    "Service Short Text
            APPEND w_poservices TO i_poservices.
            CLEAR w_poservices.
    PO Services(Second Line Item )
            w_poservices-pckg_no = 0000000003.  "w_src-sub_packno. "(Dummy No.) "Sub package no
            w_poservices-line_no = 0000000002.
            w_poservices-ext_line = w_src-extrow.    "External line
            w_poservices-quantity = w_src-srqty.  "Service Quantity
            w_poservices-base_uom = w_src-srmeins.  "Service Basic unit of Measure
            w_poservices-price_unit = '1'.
            w_poservices-gr_price  = w_src-brtwr.  "GR Price
            w_poservices-short_text = w_src-sh_text1.    "Service Short Text
            APPEND w_poservices TO i_poservices.
            CLEAR w_poservices.
    PO Service Access values
            w_posrvacc-pckg_no = 0000000003.  "w_src-sub_packno.  "Sub package no
            w_posrvacc-line_no = 0000000002.  "w_src-srv_line_no. "Line item
            w_posrvacc-serno_line = w_src-zekkn.                "'01'.
            IF w_src-vproz IS INITIAL.
              w_posrvacc-percentage = '100.0'.
            ENDIF.
            w_posrvacc-serial_no = '01'.
            w_posrvacc-quantity = w_src-srqty.  "Service Quantity
            APPEND w_posrvacc TO i_posrvacc.
            CLEAR w_posrvacc.
          ELSEIF w_src-srv_line_no EQ '3'.
    PO Services
            if w_src-srv_line_no EQ '2'.
            w_poservices-pckg_no = 0000000004.  "(assign package no as a dummy number)
            w_poservices-line_no = 0000000001.  "Line item
            w_poservices-outl_ind = 'X'.
            w_poservices-subpckg_no = 0000000005.  "(Dummy No.) "Sub package no
            w_poservices-from_line = '1'.
            APPEND w_poservices TO i_poservices.
            CLEAR w_poservices.
            w_poservices-pckg_no = 0000000005.  "w_src-sub_packno. "(Dummy No.) "Sub package no
            w_poservices-line_no = 0000000002.
            w_poservices-ext_line = w_src-extrow.    "External line
            w_poservices-quantity = w_src-srqty.  "Service Quantity
            w_poservices-base_uom = w_src-srmeins.  "Service Basic unit of Measure
            w_poservices-price_unit = '1'.
            w_poservices-gr_price  = w_src-brtwr.  "GR Price
            w_poservices-short_text = w_src-sh_text1.    "Service Short Text
            APPEND w_poservices TO i_poservices.
            CLEAR w_poservices.
            endif.
            if  w_src-srv_line_no EQ '3'.
            w_poservices-pckg_no = 0000000005.  "w_src-sub_packno. "(Dummy No.) "Sub package no
            w_poservices-line_no = 0000000003.
            w_poservices-ext_line = w_src-extrow.    "External line
            w_poservices-quantity = w_src-srqty.  "Service Quantity
            w_poservices-base_uom = w_src-srmeins.  "Service Basic unit of Measure
            w_poservices-price_unit = '1'.
            w_poservices-gr_price  = w_src-brtwr.  "GR Price
            w_poservices-short_text = w_src-sh_text1.    "Service Short Text
            APPEND w_poservices TO i_poservices.
            CLEAR w_poservices.
            endif.
    PO Service Access values
           if  w_src-srv_line_no EQ '2'.
            w_posrvacc-pckg_no = 0000000005.  "w_src-sub_packno.  "Sub package no
            w_posrvacc-line_no = 0000000002.  "w_src-srv_line_no. "Line item
            w_posrvacc-serno_line = '01'.
            w_posrvacc-percentage = '100.0'.
            w_posrvacc-serial_no = '01'.    "w_src-zekkn.
            w_posrvacc-quantity = w_src-srqty.  "Service Quantity
            APPEND w_posrvacc TO i_posrvacc.
            CLEAR w_posrvacc.
            endif.
            if  w_src-srv_line_no EQ '3'.
            w_posrvacc-pckg_no = 0000000005.  "w_src-sub_packno.  "Sub package no
            w_posrvacc-line_no = 0000000003.  "w_src-srv_line_no. "Line item
            w_posrvacc-serno_line = '01'.
            w_posrvacc-percentage = '100.0'.
            w_posrvacc-serial_no = '02'.  "w_src-zekkn.  "'01'.
            w_posrvacc-quantity = w_src-srqty.  "Service Quantity
            APPEND w_posrvacc TO i_posrvacc.
            CLEAR w_posrvacc.
            endif.
          ENDIF.
        ENDIF.
    ***Create a NEW PO
    Call BAPI
          CALL FUNCTION 'BAPI_PO_CREATE1'
            EXPORTING
              poheader          = w_poheader
              poheaderx         = w_poheaderx
              TESTRUN           = ' '
            IMPORTING
              exppurchaseorder  = gv_ebeln
            TABLES
              return            = i_return
              poitem            = i_poitem[]
              poitemx           = i_poitemx[]
              poaddrdelivery    = i_poaddrdelivery[]
              poschedule        = i_poschedule[]
              poschedulex       = i_poschedulex[]
              poaccount         = i_poaccount[]
              poaccountx        = i_poaccountx[]
              poservices        = i_poservices[]
              posrvaccessvalues = i_posrvacc[]
              extensionin       = i_extensionin[].
    Commit the Transaction
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
            EXPORTING
              wait = 'X'.
    Regards,
    Deepthi.

    it is solved

  • Criação de Pedidos de Compra via BAPI_PO_CREATE1 com Impostos

    Boa tarde pessoal.
    Estou atuando em um projeto onde precisamos migrar pedidos de compra em aberto entre ambientes SAP. Estamos trabalhando com esta migração através da utilização da BAPI_PO_CREATE1 para isso. Estamos vivenciando o seguinte problema neste processo:
    - Recebemos a mensagem de erro 06 218 - O preço líquido tem de ser maior do que 0. Acontece que estamos alimentando a estrutura POCOND com os valores das condições do pedido origem. Porém o pedido tem impostos e na composição de suas condições eu tenho os impostos ICMS/IPI  e estou passando seus valores também na composição da estrutura POCOND.
    Se alguém já utilizou esta BAPI neste contexto de pedidos de compra com impostos e puder dar alguma dica a respeito deste assunto, ficaremos gratos pelo apoio
    Alessandro Luiz
    Pontual Consultores Associados

    Olá Alepontual,
    Por favor verifique a nota SAP (Note 580225 - Purchasing BAPIs: Conditions and pricing)
    https://service.sap.com/sap/support/notes/580225
    Verifique se está sendo preenchido o campo CHANGE_ID.
    Att,
    Bruno Xavier.

  • Mail can't send email from 123-reg accounts

    Hi all,
    I've got an issue with Mac Mail can’t send email from 123-reg accounts.
    I know there is a lot of articles on simular matters and some I have tried out with no luck, others are just speaking a whole other language.
    Any help would be greatly recived, here's my situation below:
    Running a iMac 2.8GHz Intel Core i5 on OS X 10.8.3
    I’m using 3 accounts on Macs Mail client, one is my iCloud account that is working fine and the other two are my 123-reg accounts that I use for business purposes. I’ve been working like this for a couple of years now and about 6 months ago I upgrade my operating system from Snow Leopard to Mountain Lion.
    2 or 3 months ago I randomly got a problem where I was unable to send any emails from my 123-reg account, I could only receive emails. I checked my settings and they were all correct and unchanged so I attempted to delete them and recreate the account but with no such luck.
    I then decided to check if it was a problem at 123-regs end and attempted to log into web mail. This worked and was able to both send and receive emails so eliminated that possibility.
    I also have these accounts set up on my iPhone, so checked if there was any issues and everything was working fine. I then checked my iphone details and made sure the same was on my desktop and still no such luck.
    I’ve tried out some of the articles I’ve found on here (the ones written in plain English) still no results. I’m not very IT illiterate and just wondered if anyone else has got any ideas, whether there is something specific with 123-reg accounts and Mac Mail?
    Many thanks.

    Thanks
    I just had another hunt around looking at posts and discovered that it was because I recently changed to BT Infinity and they had a block on.
    I didn't even think to question the ISP.
    https://discussions.apple.com/message/21173608#21173608

  • BAPI_PO_CREATE1 missing GL a/c no. and cost center in every 100th PO line item

    We have a strange issue. We are creating Service Purchase Orders by using BAPI_PO_CREATE1 function module. The source for creating PO is a Z table wherein it contains approximately 1000 records. We create one PO per Vendor and all POs are creating successfully but strangely GL account number and cost centers are missing in every 100, 200, 300, 400, 500, etc. line items and have NO issue with other line items. Our purchase order line item interval is 1 which means at every 100th line item we have an issue in missing GL account number and cost centers. We also checked by changing line item interval to '10' and still we have issue at every 1000th line item.
    We searched for OSS notes but no luck. Did anyone come across this kind of issue ? Could you please advise.
    Regards,
    Krish

    you can either share your code and your source file to have the people check if the error is on your part or you can directly contact SAP if you are the opinion that it is an error in their BAPI code.
    But without looking at code and source file it is not possible to do any evaluation except you are looking for clairvoyants

  • Reg: Message and BPM

    Hi
    I'm having a scenario where i use a JDBC adapter to extract data from a DB. As a result of the query say, 10 rows are returned as message to XI server. I have a transformation (BPM) set and the receiver(target system) is a file. When i open the file to see its contents i can see only the first record been transfered. The mapping part used for the transformation node is having IF condition. But all the fetched records satisfies the conditions in the mapping.
    Pls let me know the corrective step.
    reg: Prabhu

    Hi,
    1)Check the input XML i.e all 10 records are coming into XI . This you can check in SXMB_MONI
    2) Then you can test the mapping in the integration Reposiotry .. So now you can get if any mapping problem. For this , check is the occurence of target strcuture is 1..n or 0.n
    /people/michal.krawczyk2/blog/2005/09/16/xi-how-to-test-your-mapping-in-real-life-scenarios
    3) If mapping is correct , then check the RWB->Message Monitoring->Message Display Tool and check the payload.
    4) If this is correct, then check the File COntent Conversion of the Receiver File Adapter.
    Hope this helps,
    Regards,
    Moorthy

  • Need Help ! PO using a BAPI -  BAPI_PO_CREATE1

    Hi friends,
    Need some help. I am trying to create a PO using a BAPI - BAPI_PO_CREATE1
    <i><b>I want the new PO to have all the characteristics of an existing PO. which 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.</b></i>
    Am i making any mistake while filling the header or item or schedule lines before BAPI_PO_CREATE1 ?
    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 <> 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 <> 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.

    Hi,
    Make the required settings to trigger an idoc during the creation of a PO in Me21N with multiple line items, check how the idoc is being created, This should be starting point to know how to create idoc with multiple line items.
    Hope this works for you.
    Rajeev

  • Bapi_po_create1 is giving same system messages  multiple time in the joblog

    Hi Experts,
    Bapi_po_create1 is giving same system messages multiple times in the job log when we ran the program in the background
    can u plz suggest how to prevent these multiple appearances of same messages.
    I am pasting the code below whn i ran this program in backgorund job log is having the messages.
    Date       Time     Message text                                                                 Message class Message no. Message type
    08/06/2009 08:11:53 Job started                                                                       00           516          S
    08/06/2009 08:11:53 Step 001 started (program ZZZTEST, variant &0000000000008, user ID BREDDY)        00           550          S
    08/06/2009 08:11:54 Commitment plan contains no account assignment data                              MECP          020          S
    08/06/2009 08:11:54 Commitment plan contains no account assignment data                              MECP          020          S
    08/06/2009 08:11:54 Status "Initial Block" of material 20111 does not allow external procurement      ME           053          E
    08/06/2009 08:11:54 Status "Initial Block" of material 20111 does not allow external procurement      ME           053          E
    08/06/2009 08:11:54 Source not included in list despite source list requirement                       06           722          E
    08/06/2009 08:11:55 Pricing/euro: Attention: Euro Customizing not maintained                          VH           777          S
    08/06/2009 08:11:55 Pricing/euro: Attention: Euro Customizing not maintained                          VH           777          S
    08/06/2009 08:11:55 Status "Initial Block" of material 20111 does not allow external procurement      ME           053          E
    08/06/2009 08:11:55 Purchase order still contains faulty items                                       MEPO          000          E
    08/06/2009 08:11:55 Job finished                                                                      00           517          S
    Edited by: bhavani prasad kotharu on Aug 6, 2009 3:09 PM

    HERE IS THE CODE OF THE PROGRAM, WE R JUST PASSING SOME PO DATA TO THE BAPI_PO_CREATE1,ON RUNNING THIS PROGRAM IN BACKGROUND SAME SYSTEM MESSAGES ARE APPEARED MULTIPLE TIMES,----
    REPORT zzztest.
    DATA :    lwa_bapimepoheader TYPE bapimepoheader
             ,lwa_bapimepoheaderx TYPE bapimepoheaderx
             ,li_bapimepoitem TYPE STANDARD TABLE OF bapimepoitem
             ,lwa_bapimepoitem TYPE  bapimepoitem
             ,li_bapimepoitemx TYPE STANDARD TABLE OF bapimepoitemx
             ,lwa_bapimepoitemx TYPE bapimepoitemx
             ,li_conditions TYPE STANDARD TABLE OF komv
             ,li_return TYPE STANDARD TABLE OF bapiret2
             , n TYPE c
    PARAMETERS: p1 TYPE c AS CHECKBOX.
    IF p1 = 'X'.
      lwa_bapimepoheader-doc_type = 'NB'.
      lwa_bapimepoheader-purch_org = 'NA00'.
      lwa_bapimepoheader-pur_group = 'C02'.
      lwa_bapimepoheaderx-doc_type = 'X'.
      lwa_bapimepoheaderx-purch_org = 'X'.
      lwa_bapimepoheaderx-pur_group = 'X'.
      lwa_bapimepoitem-po_item = '10'.
      lwa_bapimepoitem-material = '000000000000020111'.
      lwa_bapimepoitem-plant = 'CA01'.
      lwa_bapimepoitem-vend_mat = '1000'.
      lwa_bapimepoitem-quantity = '10'.
      lwa_bapimepoitem-orderpr_un = 'M'.
      lwa_bapimepoitem-no_more_gr = 'K'.
      lwa_bapimepoitem-agreement = '4600000095'.
      lwa_bapimepoitem-agmt_item = '10'.
      lwa_bapimepoitem-pricedate = 'X'.
      lwa_bapimepoitem-price_date = '20071030'.
      lwa_bapimepoitem-no_rounding = 'X'.
      APPEND lwa_bapimepoitem TO li_bapimepoitem.
      lwa_bapimepoitemx-po_item = '10'.
      lwa_bapimepoitemx-po_itemx = 'X'.
      lwa_bapimepoitemx-po_itemx = 'X'.
      lwa_bapimepoitemx-material = 'X'.
      lwa_bapimepoitemx-plant = 'X'.
      lwa_bapimepoitemx-quantity = 'X'.
      lwa_bapimepoitemx-po_unit = 'X'.
      lwa_bapimepoitemx-orderpr_un = 'X'.
      lwa_bapimepoitemx-acctasscat = 'X'.
      lwa_bapimepoitemx-agreement = 'X'.
      lwa_bapimepoitemx-agmt_item = 'X'.
      lwa_bapimepoitemx-pricedate = 'X'.
      lwa_bapimepoitemx-price_date = 'X'.
      lwa_bapimepoitemx-preq_no = 'X'.
      lwa_bapimepoitemx-preq_item = 'X'.
      lwa_bapimepoitemx-no_rounding = 'X'.
      APPEND lwa_bapimepoitemx TO li_bapimepoitemx.
    DATA: lo_msg_handler  TYPE REF TO cl_message_handler_mm.
      CALL METHOD cl_message_handler_mm=>get_handler
        IMPORTING
          ex_handler = lo_msg_handler.
      lo_msg_handler->remove_all( ).
      lo_msg_handler->cleanup( ).
      CALL FUNCTION 'BAPI_PO_CREATE1' "in background task
           EXPORTING
             poheader   = lwa_bapimepoheader
             poheaderx  = lwa_bapimepoheaderx
             testrun    = 'X'
           NO_MESSAGING = c_x
           NO_MESSAGE_REQ = c_x
             no_authority = 'X'
           IMPORTING
             expheader  = lwa_bapimepoheader
           TABLES
             return     = li_return
             poitem     = li_bapimepoitem
             poitemx    = li_bapimepoitemx
             conditions = li_conditions.
    ENDIF.
    Edited by: bhavani prasad kotharu on Aug 6, 2009 3:38 PM

Maybe you are looking for

  • EJB 3.0 integration in FDS, with Annotations

    We have been working with the EJB 3.0 implementations and see a lot of synergy between the new approach to enterprise Java with this new specification, and would love to see FDS add an adaptor to support it. Our new entity/session beans have annotate

  • Can't connect to Internet using airport

    I am trying to connect to internet wirelessly, using my Airport Extreme (802.11n), but it won't work. When I use the ethernet cable directly to my MacBook Pro (as I am now) internet comes fine. I have done many tests, change configuration, but nothin

  • JSSE Export Restriction Error

    I am moving a client application from Java SDK 1.3 to Java SDK 1.4. I was previously using version 1.0.3 of JSSE but am currently using the later version shipped with SDK 1.4. I get the following error when trying to connect. Export restriction: SunJ

  • NB550D - Upgrade from Windows 7 Starter to Professional

    Dear All, I recently bought a Toshiba NB550D and need to upgrade the pre-installed Windows 7 Starter to Windows 7 Pro. I tried the (preinstalled) Anytime Upgrade Wizard but this does not work. I get stuck in the wizard because - as he tells me - "You

  • Inter-org / subinventory transfer api

    Hello, I am looking for a real-time api that will conduct an inter-org or subinventory transfer. I know there is an option of using the open interface table/concurrent manager but I am looking for a real-time api. I thought process_move_order api wou