BAPI_PO_CREATE1 of services

Hi,
While using this BAPI with the service option, i get the 3 following errors.
-No instance of object type PuchaseOrder has been created.
-Purchase order still contains faulty items.
-Please enter either material or short text.
The first two, i have no clue about them, but the third one is weird for me, because i've already filled the short text field and left the material filed in blank (cuz i'm working only with services).
I've already filled the item category field with a D, which is the service category en my configuration.
Does anyone knows how to fix it ????...
Help !!!

hi
go to ML90
here for field selecttion 04 and  PT9  check the field selection for material field it should be hidden or optional
regards
kunal

Similar Messages

  • Using BAPI_PO_CREATE1 : Linking service, and account assignment

    Hello,
    I have trouble when using BAPI_PO_CREATE1. When creating PO using BAPI_PO_CREATE1, I need to input service for each po item and the service itself need to have account assignment. I simplify the code below.
    **PO item
    t_poitem-po_item        = '10'. "for item 10
    t_poitem-PCKG_NO        = '20'. "link with service
    t_poitemx-po_item        = 'X'.
    t_poitemx-PCKG_NO       = 'X'.
    **Account Assignment
    t_poaccount-po_item    = '10'. "link with PO Item
    t_poaccount-SERIAL_NO  = '01'.
    t_poaccount-DISTR_PERC = 1.
    t_poaccountx-po_item    = '10'.
    t_poaccountx-SERIAL_NO  =  '01'.
    t_poaccountx-po_itemx    = 'X'.
    t_poaccountx-SERIAL_NOx  = 'X'.
    t_poaccountx-DISTR_PERC = 'X'.
    **PO Services
    **1st row
    t_poservices-PCKG_NO = '20'.
    t_poservices-LINE_NO = '0000000001'.
    t_poservices-SUBPCKG_NO  = '21'.
    APPEND t_poservices.
    clear t_poservices.
    **2nd row
    t_poservices-PCKG_NO = '21'.
    t_poservices-LINE_NO = '0000000002'.
    t_poservices-EXT_LINE = '0000000010'.
    **fill account assignment for services
    t_POSRVACCESSVALUES-pckg_no = '21'.
    t_POSRVACCESSVALUES-LINE_NO = '0000000002'.
    T_POSRVACCESSVALUES-SERNO_LINE = '01'.
    t_POSRVACCESSVALUES-SERIAL_NO = '01'. "acct. assign. link
    t_POSRVACCESSVALUES-PERCENTAGE = '100'.
    Every time i execute BAPI_PO_CREATE1 using entry similar like above, i always found error message in t_return like this:
    No account assignment exists for service line 0000000010
    I feel sure that i have fill every field needed to link services and account assignment which is using serial_no, but somehow it does not link correctly. Can anyone advise me if there is some thing missing or incorrect with my ABAP code above? Thank you in advance for your help. For sure, first helpful answer will receive my rewards point.
    Regards,
    Abraham

    Thank you for the code. Actually i have fill the required field as you told but i did not put it in my code here to focus the problem on service and account assignment. After checking out your code, i found that the different between your code and mine is in services table.
    <u><b>your code :</b></u>
    <b>POSERVICES:structure</b>
    PCKG_NO : 0000000001
    LINE_NO :0000000001
    SUBPCKG_NO : 0000000002
    SERVICE :3000000000017
    QUANTITY :5
    BASE_UOM :AU
    GR_PRICE :20000
    <b>POSRVACCESSVALUES: structure name</b>
    PCKG_NO :0000000002
    LINE_NO :0000000002
    <u><b>my code are:</b></u>
    <b>POSERVICES:structure</b>
    PCKG_NO : 0000000001
    LINE_NO :0000000001
    SUBPCKG_NO : 0000000002
    PCKG_NO : 0000000002
    LINE_NO :0000000002
    SERVICE :3000000000017
    QUANTITY :5
    BASE_UOM :AU
    GR_PRICE :20000
    <b>POSRVACCESSVALUES: structure name</b>
    PCKG_NO :0000000002
    LINE_NO :0000000002
    SERIAL_NO :0000000001
    The other difference are in account assignment table, you didn't fill SERIAL_NO field.
    my code will be like below:
    <b>POACCOUNT: structure name</b>
    PO_ITEM :10
    SERIAL_NO : 0000000001
    If using your version, the error message will be:
    <i>In case of account assignment, please enter acc. assignment data for item</i>
    If using my version, the error message will be:
    <i>No account assignment exists for service line 0000000010</i>
    Please advise what was wrong with my code. Thank you.
    Regards,
    Abraham

  • Bapi_po_create1 for service

    I am trying to create a PO with reference to PR for service.
    Getting error saying “In case of account assignment, please enter acc. assignment data for item” at POITEM level
    Normal PO and PO with ref to PR are working fine.
    Any clue what might be wrong?
    CALL FUNCTION 'BAPI_PO_CREATE1'
        EXPORTING
         poheader                     = wa_header
       poheaderx                    = wa_headerx
       poaddrvendor                 = tb_address
         testrun                      = co_space
    *   MEMORY_UNCOMPLETE            =
    *   MEMORY_COMPLETE              =
    *   NO_MESSAGING                 =
    *   NO_MESSAGE_REQ               =
    *   NO_AUTHORITY                 =
       no_price_from_po             = 'X'
    * IMPORTING
    *   EXPPURCHASEORDER             =
    *   EXPHEADER                    =
    TABLES
       return                       = tb_return
       poitem                       = tb_item
       poitemx                      = tb_itemx
    *   POADDRDELIVERY               =
       poschedule                   = tb_sch
       poschedulex                  = tb_schx
       poaccount                    = tb_acc
    *   POACCOUNTPROFITSEGMENT       =
       poaccountx                   = tb_accx
    *   pocondheader                 = tb_condheader
    *   pocondheaderx                = tb_condheaderx
       pocond                       = tb_cond
       pocondx                      = tb_condx
       polimits                     = tb_e1bpesuhc
       pocontractlimits             = tb_e1bpesucc
       poservices                   = tb_service
       posrvaccessvalues            = tb_e1bpesklc
       poservicestext               = tb_e1bpeslltx
    *   EXTENSIONIN                  =
    *   EXTENSIONOUT                 =
       potextheader                 = tb_htext
       potextitem                   = tb_itext
       popartner                    = tb_e1bpekkop
    * Following line added for testing purpose
      READ TABLE tb_ze1bpekkotx INDEX 1.
      IF sy-subrc EQ 0.
        st_e1bpekkoc-po_number = tb_ze1bpekkotx-po_number.
      ENDIF.
    * End of Insertion.
    * Fill the PO Header
      wa_header-doc_date   = st_e1bpekkoc-doc_date.
      wa_header-doc_type   = st_e1bpekkoc-doc_type.
      wa_header-comp_code  = st_e1bpekkoc-co_code.
      wa_header-purch_org  = st_e1bpekkoc-purch_org.
      wa_header-pur_group  = st_e1bpekkoc-pur_group.
      wa_header-vendor     = st_e1bpekkoc-vendor.
      wa_header-po_number  = st_e1bpekkoc-po_number.
      wa_header-pmnttrms   = st_e1bpekkoa-pmnttrms.
      wa_header-dscnt1_to  = st_e1bpekkoa-dscnt1_to.
      wa_header-dscnt2_to  = st_e1bpekkoa-dscnt2_to.
      wa_header-dscnt3_to  = st_e1bpekkoa-dscnt3_to.
      wa_header-dsct_pct1  = st_e1bpekkoa-cash_disc1.
      wa_header-dsct_pct2  = st_e1bpekkoa-cash_disc2.
      wa_header-created_by = st_e1bpekkoa-created_by.
      wa_header-currency   = st_e1bpekkoa-currency.
      wa_header-exch_rate  = st_e1bpekkoa-exch_rate.
      wa_header-ex_rate_fx = st_e1bpekkoa-ex_rate_fx.
      wa_header-incoterms1 = st_e1bpekkoa-incoterms1.
      wa_header-incoterms2 = st_e1bpekkoa-incoterms2.
      wa_header-ref_1      = st_e1bpekkoa-ref_1.
      wa_header-sales_pers = st_e1bpekkoa-sales_pers.
      wa_header-telephone  = st_e1bpekkoa-telephone.
    * Fill the PO Header Change Toolbar
      wa_headerx-doc_date   = co_x.
      wa_headerx-doc_type   = co_x.
      wa_headerx-comp_code  = co_x.
      wa_headerx-purch_org  = co_x.
      wa_headerx-pur_group  = co_x.
      wa_headerx-vendor     = co_x.
      wa_headerx-po_number  = co_x.
      wa_headerx-pmnttrms   = co_x.
      wa_headerx-dscnt1_to  = co_x.
      wa_headerx-dscnt2_to  = co_x.
      wa_headerx-dscnt3_to  = co_x.
      wa_headerx-dsct_pct1  = co_x.
      wa_headerx-dsct_pct2  = co_x.
      wa_headerx-created_by = co_x.
      wa_headerx-currency   = co_x.
      wa_headerx-exch_rate  = co_x.
      wa_headerx-ex_rate_fx = co_x.
      wa_headerx-incoterms1 = co_x.
      wa_headerx-incoterms2 = co_x.
      wa_headerx-ref_1      = co_x.
      wa_headerx-sales_pers = co_x.
      wa_headerx-telephone  = co_x.
    * Fill the Address Table
      tb_address-po_number  = st_e1bpekkoc-po_number.
      tb_address-addr_no    = st_e1bpaddress-addrnumber.
      tb_address-name       = st_e1bpaddress-name1.
      tb_address-name_2     = st_e1bpaddress-name2.
      tb_address-name_3     = st_e1bpaddress-name3.
      tb_address-name_4     = st_e1bpaddress-name4.
      tb_address-city       = st_e1bpaddress-city1.
      tb_address-district   = st_e1bpaddress-city2.
      tb_address-city_no    = st_e1bpaddress-city_code.
      tb_address-postl_cod1 = st_e1bpaddress-post_code1.
      tb_address-postl_cod2 = st_e1bpaddress-post_code2.
      tb_address-postl_cod3 = st_e1bpaddress-post_code3.
      tb_address-po_box     = st_e1bpaddress-po_box.
      tb_address-po_box_cit = st_e1bpaddress-po_box_loc.
      tb_address-street     = st_e1bpaddress-street.
      APPEND tb_address.
    * Fill the POItem Table
      LOOP AT tb_e1bpekpoc.
        tb_item-po_item            = tb_e1bpekpoc-po_item.
    * Process the material based on the value.
        IF tb_e1bpekpoc-material+0(2) EQ co_b9.
          tb_item-material         = co_space.
        ELSE.
          tb_item-material         =  tb_e1bpekpoc-material.
        ENDIF.
        tb_item-item_cat           =  tb_e1bpekpoc-item_cat.
        tb_item-acctasscat         =  tb_e1bpekpoc-acctasscat.
        tb_item-agreement          =  tb_e1bpekpoc-agreement.
        tb_item-agmt_item          =  tb_e1bpekpoc-agmt_item.
        tb_item-matl_group         =  tb_e1bpekpoc-mat_grp.
        tb_item-short_text         =  tb_e1bpekpoc-short_text.
        tb_item-distrib            =  tb_e1bpekpoc-distrib.
        tb_item-part_inv           =  tb_e1bpekpoc-part_inv.
        tb_item-kanban_ind         =  tb_e1bpekpoc-kanban_ind.
        tb_item-plant              =  tb_e1bpekpoc-plant.
        tb_item-po_unit            =  tb_e1bpekpoc-unit.
        tb_item-po_unit_iso        =  tb_e1bpekpoc-po_unit_iso.
        tb_item-net_price          =  tb_e1bpekpoc-net_price.
        tb_item-conv_num1          =  tb_e1bpekpoc-conv_num1.
        tb_item-conv_den1          =  tb_e1bpekpoc-conv_den1.
        tb_item-orderpr_un         =  tb_e1bpekpoc-orderpr_un.
        tb_item-pckg_no            =  tb_e1bpekpoc-pckg_no.
        tb_item-trackingno         =  tb_e1bpekpoc-trackingno.
        tb_item-at_relev           =  tb_e1bpekpoc-at_relev.
        tb_item-po_price           =  tb_e1bpekpoc-po_price.
        tb_item-tax_code           =  tb_e1bpekpoc-tax_code.
        tb_item-preq_name          =  tb_e1bpekpoc-preq_name.
        tb_item-delete_ind         =  tb_e1bpekpoc-delete_ind.
        tb_item-free_item          =  co_space.
        tb_item-material_external  = tb_e1bpekpoc-material_external.
    *Populate the table from the other segments.
        READ TABLE tb_e1bpekpoa WITH KEY po_item = tb_e1bpekpoc-po_item.
        IF sy-subrc EQ 0.
          tb_item-info_upd         =  tb_e1bpekpoa-info_upd.
          tb_item-gr_ind           =  tb_e1bpekpoa-gr_ind.
          tb_item-ir_ind           =  tb_e1bpekpoa-ir_ind.
          wf_ind_check = co_x.
        ENDIF.
        READ TABLE tb_e1bpeket WITH KEY po_item = tb_e1bpeket.
        IF sy-subrc EQ 0.
          tb_item-preq_no          =  tb_e1bpeket-preq_no.
          tb_item-preq_item        =  tb_e1bpeket-preq_item.
    *      tb_item-ref_doc          =  tb_e1bpeket-preq_no.
          tb_item-quantity         =  tb_e1bpeket-quantity.
          wf_qty_check = co_x.
        ENDIF.
        APPEND tb_item.
    * Fill the POItemx Table
        tb_itemx-po_item           = tb_e1bpekpoc-po_item.
        tb_itemx-material          = co_x.
        tb_itemx-item_cat          = co_x.
        tb_itemx-acctasscat        = co_x.
        tb_itemx-agreement         = co_x.
        tb_itemx-agmt_item         = co_x.
        tb_itemx-matl_group        = co_x.
        tb_itemx-short_text        = co_x.
        tb_itemx-distrib           = co_x.
        tb_itemx-part_inv          = co_x.
        tb_itemx-kanban_ind        = co_x.
        tb_itemx-plant             = co_x.
        tb_itemx-po_unit           = co_x.
        tb_itemx-po_unit_iso       = co_x.
        tb_itemx-net_price         = co_x.
        tb_itemx-conv_num1         = co_x.
        tb_itemx-conv_den1         = co_x.
        tb_itemx-orderpr_un        = co_x.
        tb_itemx-pckg_no           = co_x.
        tb_itemx-trackingno        = co_x.
        tb_itemx-at_relev          = co_x.
        tb_itemx-po_price          = co_x.
        tb_itemx-tax_code          = co_x.
        tb_itemx-preq_name         = co_x.
        tb_itemx-delete_ind        = co_x.
        tb_itemx-free_item         = co_x.
        tb_itemx-material_external = co_x.
        IF NOT wf_ind_check IS INITIAL.
          tb_itemx-info_upd        = co_x.
          tb_itemx-gr_ind          = co_x.
          tb_itemx-ir_ind          = co_x.
        ENDIF.
        IF NOT wf_qty_check IS INITIAL.
          tb_itemx-preq_no         = co_x.
          tb_itemx-preq_item       = co_x.
    *      tb_itemx-ref_doc          = co_x.
          tb_itemx-quantity        = co_x.
        ENDIF.
        APPEND tb_itemx.
      ENDLOOP.
    * Fill the POSCHEDULE Table.
      LOOP AT tb_e1bpeket.
        tb_sch-po_item        = tb_e1bpeket-po_item.
        tb_sch-delivery_date  = tb_e1bpeket-deliv_date.
        tb_sch-quantity       = tb_e1bpeket-quantity.
        tb_sch-preq_no        = tb_e1bpeket-preq_no.
        tb_sch-preq_item      = tb_e1bpeket-preq_item.
        tb_sch-del_datcat_ext = tb_e1bpeket-del_datcat_ext.
        APPEND tb_sch.
    * Fill the POSCHEDULEX Table
        tb_schx-po_item       = tb_e1bpeket-po_item.
        tb_schx-delivery_date = co_x.
        tb_schx-quantity      = co_x.
        tb_schx-preq_no       = co_x.
        tb_schx-preq_item     = co_x.
        tb_sch-del_datcat_ext = co_x.
        APPEND tb_schx.
      ENDLOOP.
    * Fill the POTEXTITEM Table.
      LOOP AT tb_e1bpekpotx.
        tb_itext-po_number = tb_e1bpekpotx-po_number.
        tb_itext-po_item   = tb_e1bpekpotx-po_item.
        tb_itext-text_id   = tb_e1bpekpotx-text_id.
        tb_itext-text_form = tb_e1bpekpotx-text_form.
        tb_itext-text_line = tb_e1bpekpotx-text_line.
        APPEND tb_itext.
      ENDLOOP.
    * Fill the POTEXTHEADER Table.
      LOOP AT tb_ze1bpekkotx.
        tb_htext-po_number = tb_ze1bpekkotx-po_number.
        tb_htext-text_id   = tb_ze1bpekkotx-text_id.
        tb_htext-text_form = tb_ze1bpekkotx-text_form.
        tb_htext-text_line = tb_ze1bpekkotx-text_line.
        APPEND tb_htext.
      ENDLOOP.
      LOOP AT tb_item.
    * Fill the Condition Table.
        tb_cond-cond_value = tb_item-net_price.
        tb_cond-itm_number = 10. "tb_item-po_item.
        tb_cond-currency = st_e1bpekkoa-currency.
        tb_cond-change_id = 'I'.      "co_i.
        tb_cond-condchaman = co_x.
        APPEND tb_cond.
        tb_condheader-cond_value = tb_item-net_price.
        tb_condheader-cond_type = 'PB00'.
        tb_condheader-currency = st_e1bpekkoa-currency.
        tb_condheader-change_id = 'I'.
        tb_condheader-condchaman = co_x.
        APPEND tb_condheader.
    * Fill the Condition header Table
        tb_condx-itm_number = tb_item-po_item.
        tb_condx-cond_value = co_x.
        tb_condx-cond_type  = co_x.
        tb_condx-currency = co_x.
        tb_condx-change_id = co_x.
        tb_condx-condchaman = co_x.
        APPEND tb_condx.
        tb_condheaderx-cond_type = co_x.
        tb_condheaderx-cond_value = co_x.
        tb_condheaderx-currency = co_x.
        tb_condheaderx-change_id = co_x.
        tb_condheaderx-condchaman = co_x.
        APPEND tb_condheaderx.
      ENDLOOP.
    * Testing for PR and Services
      IF NOT wf_qty_check IS INITIAL.
        SELECT *
          FROM eban
        INTO TABLE tb_eban_po
        FOR ALL ENTRIES IN tb_item
        WHERE banfn = tb_item-preq_no
         AND  bnfpo = tb_item-preq_item.
        IF NOT tb_eban_po[] IS INITIAL.
          CLEAR lv_tabix.
          LOOP AT tb_item.
            lv_tabix = sy-tabix.
            READ TABLE tb_eban_po WITH KEY banfn = tb_item-preq_no
                                           bnfpo = tb_item-preq_item.
            IF sy-subrc EQ 0.
              tb_item-item_cat = tb_eban_po-pstyp.
              tb_item-acctasscat = tb_eban_po-knttp.
              tb_item-gr_basediv = co_x.
    * Populate the Service Table
              tb_service-pckg_no = tb_eban_po-packno.
              tb_service-matl_group = tb_eban_po-matkl.
              tb_service-quantity = tb_eban_po-menge.
              tb_service-base_uom = tb_eban_po-meins.
              tb_service-short_text = tb_eban_po-txz01.
              tb_service-base_uom   = tb_eban_po-meins.
              tb_service-ext_line   = '10'.
              tb_service-gr_price   = tb_eban_po-preis.
              APPEND tb_service.
              tb_srv_acc-pckg_no = tb_eban_po-packno.
              APPEND tb_srv_acc.
              READ TABLE tb_itemx INDEX lv_tabix.
              IF sy-subrc EQ 0.
                tb_itemx-item_cat = co_x.
                tb_itemx-acctasscat = co_x.
                tb_itemx-gr_basediv = co_x.
                MODIFY tb_item INDEX lv_tabix.
                MODIFY tb_itemx INDEX lv_tabix.
              ENDIF.
              tb_item-item_cat = tb_eban_po-pstyp.
              tb_item-acctasscat = tb_eban_po-knttp.
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDIF.
    * Fill the POACCOUNT Table.
      SELECT *
          FROM ebkn
      INTO TABLE tb_ebkn_po
      FOR ALL ENTRIES IN tb_sch
      WHERE banfn = tb_sch-preq_no.
      IF NOT tb_ebkn_po[] IS INITIAL.
        LOOP AT tb_ebkn_po.
          tb_acc-po_item     = tb_ebkn_po-bnfpo.
          tb_acc-serial_no   = tb_ebkn_po-zebkn.
          tb_acc-quantity    = tb_ebkn_po-menge.
          tb_acc-gl_account  = tb_ebkn_po-sakto.
          tb_acc-costcenter  = tb_ebkn_po-kostl.
          tb_acc-profit_ctr  = tb_ebkn_po-prctr.
          tb_acc-co_area     = tb_ebkn_po-kokrs.
          tb_acc-net_value   = tb_ebkn_po-netwr.
          APPEND tb_acc.
    * Fill the POACCOUNTX Table
          tb_accx-po_item    = tb_ebkn_po-bnfpo.
          tb_accx-po_itemx   = co_x.
          tb_accx-serial_no  = tb_ebkn_po-zebkn.
          tb_accx-serial_nox = co_x.
          tb_accx-quantity   = co_x.
          tb_accx-gl_account = co_x.
          tb_accx-costcenter = co_x.
          tb_accx-profit_ctr = co_x.
          tb_accx-co_area    = co_x.
          tb_accx-net_value  = co_x.
          APPEND tb_accx.
        ENDLOOP.
      ENDIF.
    ENDFORM.
    Edited by: Archish RS on Feb 7, 2008 9:34 AM

    Hello,
    The same problem is discussed before two days.
    Please have a look at this thread:
    https://www.sdn.sap.com/irj/sdn/profile?userid=3461421
    solved the issue by debugging.
    Don't get too worried, there is an easy way to solve this if you get issues like this. See I was able to create a service PO from ME21N transaction. As you know service PO needs Service lines to be created it's mandatory. Here were my error is.
    SAP from front end is using a hierarchical method of creating service lines. Not sure this is always like this!!!
    The way you can figure out is ..go and create a PO from front end. use that PO number in BAPI_PO_GETDETAIL.
    See the values it returns in the associated tables. Compare these values with your mapping in data load program. Then make the necessary changes. Of course there are things needs to be changed in Both Service line structure and Account structure. good luck
    Hope this will solve ur problem
    Cheers,
    Vasanth

  • BAPI_PO_CREATE1: For Service Items

    Dear All,
    I am trying to create an upload program for all the POs which include service items using BAPI_PO_CREATE1.
    However, i am facing problems: Systems throws up an error message
    <b>"In case of account assignment, please enter acc. assignment data for item"</b>
    i have provided all the relavent fields, still could not found the reasons. (we are using services (with service master data in SAP) as line items).
    Please find the code:
    Fill PO Header Data
      wa_poheader-ref_1      = '1'.
      wa_poheader-doc_date   = '20070730'.
      wa_poheader-doc_type   = 'ZMN'.
      wa_poheader-vendor     = '0000100001'.
      wa_poheader-purch_org  = 'CPO'.
      wa_poheader-pur_group  = 'P01'.
      wa_poheader-currency   = 'MYR'.
      wa_poheader-incoterms1 = 'CIF'.
      wa_poheader-incoterms2 = 'MITV'.
      wa_poheaderx-ref_1      = 'X'.
      wa_poheaderx-doc_date   = 'X'.
      wa_poheaderx-doc_type   = 'X'.
      wa_poheaderx-vendor     = 'X'.
      wa_poheaderx-purch_org  = 'X'.
      wa_poheaderx-pur_group  = 'X'.
      wa_poheaderx-currency   = 'X'.
      wa_poheaderx-incoterms1 = 'X'.
      wa_poheaderx-incoterms2 = 'X'.
    Fill PO Line Item Data
      wa_poitem-po_item    = '00010'.
      wa_poitem-quantity   = '1'.
      wa_poitem-short_text = 'service material'.
      wa_poitem-acctasscat = 'K'.
      wa_poitem-item_cat   = '9'.
      wa_poitem-matl_group = 'SERVICE'.
      wa_poitem-plant      = '1000'.
      wa_poitem-net_price  = '100'.
      wa_poitem-price_unit = '1'.
      wa_poitem-pckg_no    = '0000000001'.
      APPEND wa_poitem TO it_poitem.
    PO Line item values to be updated
      wa_poitemx-po_item    = '00010'.
      wa_poitemx-po_itemx   = 'X'.
      wa_poitemx-quantity   = 'X'.
      wa_poitemx-short_text = 'X'.
      wa_poitemx-acctasscat = 'X'.
      wa_poitemx-item_cat   = 'X'.
      wa_poitemx-matl_group  = 'X'.
      wa_poitemx-plant      = 'X'.
      wa_poitemx-net_price  = 'X'.
      APPEND wa_poitemx TO it_poitemx.
      CLEAR: wa_poitem,
             wa_poitemx.
    Fill Accounting Data
      wa_poaccount-po_item    = '00010'.
      wa_poaccount-serial_no  = '01'.
      wa_poaccount-creat_date = sy-datum.
      wa_poaccount-quantity   = '1'.
      wa_poaccount-net_value  = '100'.
      wa_poaccount-costcenter = 'MNCOE0201'.
      wa_poaccount-gl_account = '0000505203'.
      wa_poaccount-co_area    = 'MITV'.
      APPEND wa_poaccount TO it_poaccount.
    Accounting line item values to be updated
      wa_poaccountx-po_item    = '00010'.
      wa_poaccountx-po_itemx  = 'X'.
      wa_poaccountx-serial_no = '01'.
      wa_poaccountx-serial_no   = 'X'.
      wa_poaccountx-creat_date = 'X'.
      wa_poaccountx-quantity   = 'X'.
      wa_poaccountx-net_value  = 'X'.
      wa_poaccountx-costcenter = 'X'.
      wa_poaccountx-gl_account = 'X'.
      wa_poaccountx-co_area     = 'X'.
      APPEND wa_poaccountx TO it_poaccountx.
    Fill Service Details servicio 1
      wa_poservices-pckg_no = '0000000001'.
      wa_poservices-line_no = '00010' .
      wa_poservices-ext_line = '00010' .
      wa_poservices-outl_level = '0'.
      wa_poservices-subpckg_no = '0000000000'.
      wa_poservices-service = '000000000003000025'.
      wa_poservices-edition = '0000' .
      wa_poservices-base_uom = 'EA' .
    *SERVICES-UOM_ISO = 'C62' .
      wa_poservices-quantity = '1' .
      wa_poservices-price_unit = '1' .
      wa_poservices-ovf_tol = '0' .
    wa_poSERVICES-FROM_LINE = '1' .
      wa_poservices-short_text = 'Electrical System'.
      wa_poservices-pers_no = '00000000' .
      wa_poservices-pln_pckg = '0000000000' .
      wa_poservices-pln_line = '0000000000' .
      wa_poservices-con_pckg = '0000000000' .
      wa_poservices-con_line = '0000000000' .
      wa_poservices-tmp_pckg = '0000000000' .
      wa_poservices-tmp_line = '0000000000' .
      wa_poservices-limit_line = '0000000000' .
    *SERVICES-TAX_CODE = 'I2' .
      wa_poservices-gr_price = '100' .
      wa_poservices-matl_group = 'SERVICE'.
      APPEND wa_poservices TO it_poservices.
      CLEAR wa_poservices.
    FIRST ENTRY
      posrvaccessvalues-pckg_no = '0000000001'.
      posrvaccessvalues-serno_line = '00010'.
      posrvaccessvalues-percentage = '100'.
      posrvaccessvalues-serial_no = '01'.
      posrvaccessvalues-quantity = '1'.
      posrvaccessvalues-net_value = '100'.
      APPEND posrvaccessvalues .
      CLEAR posrvaccessvalues.
      CALL FUNCTION 'BAPI_PO_CREATE1'
        EXPORTING
          poheader          = wa_poheader
          poheaderx         = wa_poheaderx
        IMPORTING
          exppurchaseorder  = w_ponumber
        TABLES
          return            = it_return
          poitem            = it_poitem
          poitemx           = it_poitemx
          poaccount         = it_poaccount
          poaccountx        = it_poaccountx
          polimits          = po_limits
          poservices        = it_poservices
          posrvaccessvalues = posrvaccessvalues.
      IF NOT w_ponumber IS INITIAL.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
        WRITE:/ w_ponumber.
      ELSE.
        LOOP AT it_return INTO wa_return.
          WRITE:/ wa_return-message_v1, wa_return-message_v2, wa_return-message.
        ENDLOOP.
      ENDIF.
    Please suggest me where i am going wrong.

    Hi,
    To commit BAPI or to run it properly , you need to fulfill all required data for BAPI.
    You can go to BAPI documentation to check for mandetory parameters and also check with Function consultant for more data and confifuration/
    Reward if useful!

  • Multiple Account Assignment issue with BAPI_PO_CREATE1 for service POs

    Whle creating service PO through BAPI_PO_CREATE1, The account assignments at the service line items were not being added correctly at the item level, instead they are getting split further wrt tax jurisdiction. This is occuring when an item have multiple service line items with mutltiple account assignments.
    The sample code is below, and the all the internal tables and structure were related to BAPI_PO_CREATE1. Tried with BADI ME_TAX_FROM_ADDRESS and User Exit enhancement SAPL2012, which were not helpful for this particular scenario.
    Item Details
    W_BAPI_ITEM-PO_ITEM = 1.
    W_BAPI_ITEMX-PO_ITEM = 1.
    W_BAPI_ITEM-ITEM_CAT = D.
    W_BAPI_ITEMX-ITEM_CAT = 'X'.
    W_BAPI_ITEM-ACCTASSCAT = K.
    W_BAPI_ITEMX-ACCTASSCAT = 'X'.
    W_BAPI_ITEM-PLANT = USMP. Tax Jurisdiction code 3604931001
    W_BAPI_ITEMX-PLANT = 'X'.
    W_BAPI_ITEM-MATL_GROUP = IT37.
    W_BAPI_ITEMX-MATL_GROUP = 'X'.
    W_BAPI_ITEM-QUANTITY = 1.
    W_BAPI_ITEMX-QUANTITY = 'X'.
    W_BAPI_ITEM-PRICE_UNIT = 1.
    W_BAPI_ITEMX-PRICE_UNIT = 'X'.
    W_BAPI_ITEM-PO_UNIT = LE.
    W_BAPI_ITEMX-PO_UNIT = 'X'.
    W_BAPI_ITEM-NET_PRICE = 100.
    W_BAPI_ITEMX-NET_PRICE = 'X'.
    W_BAPI_ITEM-PCKG_NO = 3456.
    W_BAPI_ITEMX-PCKG_NO = 'X'.
    W_BAPI_ITEM-PREQ_NAME = RTPTS02.
    W_BAPI_ITEMX-PREQ_NAME = 'X'.
    APPEND W_BAPI_ITEM TO IT_BAPI_ITEM.
    APPEND W_BAPI_ITEMX TO IT_BAPI_ITEMX.
    Delivery address details - Tax Jurisdiction 3305923401
    W_BAPI_ADDRDEL-PO_ITEM = 1.
    W_BAPI_ADDRDEL-NAME = COR.
    W_BAPI_ADDRDEL-NAME_2 = Chairman.
    W_BAPI_ADDRDEL-BUILD_LONG = 1001R
    W_BAPI_ADDRDEL-CITY = plainview.
    W_BAPI_ADDRDEL-STREET = old country road.
    W_BAPI_ADDRDEL-POSTL_COD1 = 11803.
    W_BAPI_ADDRDEL-COUNTRY = US.
    W_BAPI_ADDRDEL-REGION = NY.
    APPEND W_BAPI_ADDRDEL TO IT_BAPI_ADDRDEL.
    First Account Assignment - 3310300441
    W_BAPI_POACNT-SERIAL_NO = 1.
    W_BAPI_POACNTX-SERIAL_NO = 1.
    W_BAPI_POACNTX-SERIAL_NOX = 'X'.
    W_BAPI_POACNT-CREAT_DATE  = 11/03/2010.
    W_BAPI_POACNTX-CREAT_DATE  = 'X'.
    W_BAPI_POACNT-QUANTITY = 0.75.
    W_BAPI_POACNTX-QUANTITY  = 'X'.
    W_BAPI_POACNT-DISTR_PERC = 75.
    W_BAPI_POACNTX-DISTR_PERC  = 'X'.
    W_BAPI_POACNT-NET_VALUE = 75 .
    W_BAPI_POACNTX-NET_VALUE  = 'X'.
    W_BAPI_POACNT-PO_ITEM = 1.
    W_BAPI_POACNTX-PO_ITEM = 1.
    W_BAPI_POACNTX-PO_ITEMX = 'X'.
    W_BAPI_POACNT-GL_ACCOUNT = 641099.
    W_BAPI_POACNTX-GL_ACCOUNT  = 'X'.
    W_BAPI_POACNT-COSTCENTER =  10010394.
    W_BAPI_POACNTX-COSTCENTER = 'X'.
    W_BAPI_POACNT-CO_AREA = 1234.
    W_BAPI_POACNTX-CO_AREA = 'X'.
    APPEND W_BAPI_POACNT TO IT_BAPI_POACNT.
    APPEND W_BAPI_POACNTX TO IT_BAPI_POACNTX.
    Second Account Assignment
    W_BAPI_POACNT-SERIAL_NO = 2.
    W_BAPI_POACNTX-SERIAL_NO = 2.
    W_BAPI_POACNTX-SERIAL_NOX = 'X'.
    W_BAPI_POACNT-CREAT_DATE  = 11/03/2010.
    W_BAPI_POACNTX-CREAT_DATE  = 'X'.
    W_BAPI_POACNT-QUANTITY = 0.25.
    W_BAPI_POACNTX-QUANTITY  = 'X'.
    W_BAPI_POACNT-DISTR_PERC = 25.
    W_BAPI_POACNTX-DISTR_PERC  = 'X'.
    W_BAPI_POACNT-NET_VALUE = 25 .
    W_BAPI_POACNTX-NET_VALUE  = 'X'.
    W_BAPI_POACNT-PO_ITEM = 1.
    W_BAPI_POACNTX-PO_ITEM = 1.
    W_BAPI_POACNTX-PO_ITEMX = 'X'.
    W_BAPI_POACNT-GL_ACCOUNT = 641099.
    W_BAPI_POACNTX-GL_ACCOUNT  = 'X'.
    W_BAPI_POACNT-COSTCENTER =  10010393.
    W_BAPI_POACNTX-COSTCENTER = 'X'.
    W_BAPI_POACNT-CO_AREA = 1234.
    W_BAPI_POACNTX-CO_AREA = 'X'.
    APPEND W_BAPI_POACNT TO IT_BAPI_POACNT.
    APPEND W_BAPI_POACNTX TO IT_BAPI_POACNTX.
    Service Item detials
    W_BAPI_SERVICE-OUTL_IND = 'X'.
    W_BAPI_SERVICE-SUBPCKG_NO =  3457.
    W_BAPI_SERVICE-LINE_NO = 1.
    W_BAPI_SERVICE-PCKG_NO = 3456.
    W_BAPI_SERVICE-EXT_LINE = 0000000000.
    W_BAPI_SERVICE-QUANTITY = 0.
    W_BAPI_SERVICE-BASE_UOM = 0.
    W_BAPI_SERVICE-PRICE_UNIT = 0.
    W_BAPI_SERVICE-GR_PRICE = 0.
    W_BAPI_SERVICE-SHORT_TEXT = 0.
    W_BAPI_SERVICE-MATL_GROUP = 0.
    W_BAPI_SERVICE-DISTRIB = 0.
    APPEND W_BAPI_SERVICE TO IT_BAPI_SERVICE.
    W_BAPI_SERVICE-OUTL_IND = 'X'.
    W_BAPI_SERVICE-LINE_NO = 2.
    W_BAPI_SERVICE-PCKG_NO = 3457.
    W_BAPI_SERVICE-EXT_LINE = 0000000010.
    W_BAPI_SERVICE-QUANTITY = 10.
    W_BAPI_SERVICE-BASE_UOM = STD.
    W_BAPI_SERVICE-PRICE_UNIT = 0.
    W_BAPI_SERVICE-GR_PRICE = 5.
    W_BAPI_SERVICE-SHORT_TEXT = Cabling Services1.
    W_BAPI_SERVICE-MATL_GROUP = IT37.
    W_BAPI_SERVICE-DISTRIB = 2.
    APPEND W_BAPI_SERVICE TO IT_BAPI_SERVICE.
    W_BAPI_SERVICE-OUTL_IND = 'X'.
    W_BAPI_SERVICE-LINE_NO = 3.
    W_BAPI_SERVICE-PCKG_NO = 3457.
    W_BAPI_SERVICE-EXT_LINE = 0000000020.
    W_BAPI_SERVICE-QUANTITY = 10.
    W_BAPI_SERVICE-BASE_UOM = STD.
    W_BAPI_SERVICE-PRICE_UNIT = 0.
    W_BAPI_SERVICE-GR_PRICE = 5.
    W_BAPI_SERVICE-SHORT_TEXT = Cabling Services2.
    W_BAPI_SERVICE-MATL_GROUP = IT37.
    W_BAPI_SERVICE-DISTRIB = 2.
    APPEND W_BAPI_SERVICE TO IT_BAPI_SERVICE.
    Service Account assignment details
    W_ACC_SERVICE-PCKG_NO = 3457.
    W_ACC_SERVICE-LINE_NO = 2.
    W_ACC_SERVICE-SERNO_LINE = 1.
    W_ACC_SERVICE-SERIAL_NO = 1.   "Account Assignment Link
    W_ACC_SERVICE-NET_VALUE = .
    W_ACC_SERVICE-QUANTITY = 50 .
    W_ACC_SERVICE-PERCENTAGE = 100 .
    APPEND W_ACC_SERVICE TO IT_ACC_SERVICE.
    W_ACC_SERVICE-PCKG_NO = 3457.
    W_ACC_SERVICE-LINE_NO = 3.
    W_ACC_SERVICE-SERNO_LINE = 1.
    W_ACC_SERVICE-SERIAL_NO = 1.   "Account Assignment Link
    W_ACC_SERVICE-NET_VALUE = .
    W_ACC_SERVICE-QUANTITY = 50 .
    W_ACC_SERVICE-PERCENTAGE = 50 .
    APPEND W_ACC_SERVICE TO IT_ACC_SERVICE.
    W_ACC_SERVICE-PCKG_NO = 3457.
    W_ACC_SERVICE-LINE_NO = 3.
    W_ACC_SERVICE-SERNO_LINE = 1.
    W_ACC_SERVICE-SERIAL_NO = 2.   "Account Assignment Link
    W_ACC_SERVICE-NET_VALUE = .
    W_ACC_SERVICE-QUANTITY = 50 .
    W_ACC_SERVICE-PERCENTAGE = 50 .
    APPEND W_ACC_SERVICE TO IT_ACC_SERVICE.
    EKKN table entries:
    When created thru ME21N with the same set of data,which is expected
    ZEKKN            MENGE            NETWR  SAKTO        KOSTL
    01               0.750            75.00  0000641099   0010010394
    02               0.250            25.00  0000641099   0010010393
    But through BAPI_PO_CREATE1, the below split is being done with respect to Tax Jurisdiction code.
    01               0.500            50.00  0000641099   0010010394
    02               0.250            25.00  0000641099   0010010394
    03               0.250            25.00  0000641099   0010010393
    Please advice the solution.
    PS: there were different tax jurisdiction codes were being determined.
    Plant, Cost Center and Delivery Address.

    Hi,
    To commit BAPI or to run it properly , you need to fulfill all required data for BAPI.
    You can go to BAPI documentation to check for mandetory parameters and also check with Function consultant for more data and confifuration/
    Reward if useful!

  • Bapi_po_create1  error--service PO

    We are upgradeing to ECC6 and we have a program that is currently working in our old system using bapi_po_create1 to create service PO's.
    We are getting an account assignment error in the ECC6system, "In case of account assignment, please enter acc. assignment data for item"
    Entering manually works but I can't find out what has changed to correct the bapi.
    Any ideas or does someone have an example of a service entry.
    Thanks
    Julie

    Hi Julie,
    please check the following:
    The package number should be set according to FAQ note 499626,    
    question 8.                                                       
    POITEMX: if there are also fields filled with an X, which were NOT                
    filled in the POITEM structure, please remove those X entries.                                                                               
    If a field in POITEMX is marked 'X', it means that the corresponding           
    field in POITEM has a value.                                                   
    Similar is the case for POACCOUNT and POACCOUNTX.  
    Please check the FAQ note 420332 about how to fill the data structure correctly for service POs. In most of the cases the error message 06 436 disappeared after the data structures were set up correctly.   
    Please check / and if needed implement also the note 1236355
    Regards,
    Edit

  • Bapi BAPI_PO_CREATE1 . Service po upload with contract reference.

    Hi Experts,
    I created an abap program for uploading service po using BAPI  'BAPI_PO_CREATE1'. Its working fine without Contract reference. But if I include contract reference in the item it will return error
    'Service SERVICE 1234: please enter a price'.
    the fields I use for entering contract reference are
    1) bapimepoitem-ref_doc and
    2) bapimepoitem-ref_item.
    Please help me out in this bcz its critical now.
    Edited by: arun.george on Sep 12, 2011 3:16 PM

    Hi Arun,
    Refer the posts mentioned below:
    Link: [BAPI_PO_CREATE1;
    Link: [BAPI_PO_CREATE1;
    Link: [Contract Number and Item not transferred to limits in SAP PO;
    Try these hints. If still you face any issues, post further.
    Regards,
    Pranav.

  • G/L Account & the Cost Center not updating in BAPI_PO_CREATE1

    Hi,
    We are using BAPI_PO_CREATE1 for Service PO Creation.
    The System is creating the Purchase Order, but it is not updating the G/L Account & the Cost Center.
    We are passing the following parameters:
                    wa_poaccount-PO_ITEM  = '00010'.
                    wa_poaccount-SERIAL_NO   = '01'.
                    wA_poaccount-quantity   = '100.000'.
                    wa_poaccount-GL_ACCOUNT  = '0058120000'.
                    wa_poaccount-COSTCENTER  = '1000-LSG'.
                    wa_poaccount-itm_number  = '000010'.
                    wa_poaccount-CO_AREA     = '1000'.
                    append wa_poaccount to it_poaccount.
                    clear wa_poaccount.
                    wa_poaccountx-PO_ITEM = '00010'.
                    wa_poaccountx-SERIAL_NO   = '01'.
                    wA_poaccountx-quantity   = 'X'.
                    wa_poaccountx-GL_ACCOUNT = 'X'.
                    wa_poaccountx-COSTCENTER = 'X'.
                    wa_poaccountx-CO_AREA     =  'X'.
                    wa_poaccountx-itm_number  = 'X'.
                    append wa_poaccountx to it_poaccountx.
                    clear wa_poaccountx.
    Please guide how to correct the error.
    Regards,
    PK

    Hi,
    Thanks for the reply.
    We are passing the following parameter in POITEM.
                      clear wa_poitem.
                      wa_POITEM-PO_ITEM = '00010'.
                      wa_POITEM-PLANT = '1003'.
                      wa_POITEM-TAX_CODE = 'S1'.
                      wa_poitem-MATL_GROUP = 'SER04'.
                      wa_POITEM-ACCTASSCAT = 'K'.
                      wa_poitem-ITEM_CAT   = 'D'.
                      wa_poitem-pckg_no    = '0000000001'.
                      wa_POITEM-SHORT_TEXT = 'Freight Service'.
                      append wa_POITEM to it_POITEM.
                      clear wa_poitemX.
                      wa_POITEMX-PO_ITEM = '00010'.
                      wa_POITEMX-PLANT = 'X'.
                      wa_POITEMX-TAX_CODE = 'X'.
                      wa_poitemx-MATL_GROUP = 'X'.
                      wa_poitemx-short_Text = 'X'.
                      wa_POITEMX-ACCTASSCAT = 'X'.
                      wa_poitemx-ITEM_CAT   = 'X'.
                      wa_poitemX-pckg_no    = 'X'.
                      append wa_POITEMX to it_POITEMX.
    Please guide.
    Regards,
    PK

  • Web Service ECC_PURCHASEORDERCRTRC

    Hello,
    We want to use ECC_PURCHASEORDERCRTRC for creating Service PO in SAP from a third party system. But in the ES Workplace, SAP has documented that Service and limit data cannot be transferred on creation. In fact, BAPI_PO_CREATE1 supports Service data. Is there any reason for not supporting Service data with this Web Service?
    Thanks a lot,
    Venu

    To use this the below details are required which is available in PI 7.0:
    The details which you mentioned say that the WSDL is available in IR of the PI7.0....it is present under the SWCV SAP APPL 6.04
    Name of the WSDL and the namespace under the above SWCV is also given.......now your task may be to create appropriate Message Interface (Inbound) and then develop the mapping between the source and this WSDL messages.
    I hope above understanding is according to your requirement!
    Regards,
    Abhishek.

  • Need BAPI program to upload PO creation with flatfile having HEADER N  ITEM

    Hi abap experts,
    I Need sample BAPI program to upload PO creation(ME21) with flatfile having HEADER AND   ITEM datas.
    arun

    Hi,
    Look at the below links
    Re: BAPI_PO_CREATE1 and net price
    Re: Using BAPI_PO_CREATE1 : Linking service, and account assignment
    Regards
    Sudheer

  • 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.

  • 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

  • Creating Service PO using BAPI_PO_CREATE1

    Hi gurus,
    I am trying to create a PO with service lines using BAPI_PO_CREATE1 but am getting the following errror even though i have passed values to the structures POSERVICES POSRVACCESSVALUES and POACCOUNT along with item and header details:
    Please maintain services or limits
    Please suggest what are the basic details that need to be passed to the structures for creating a PO with service lines.

    Hi,
    You need to use Package Number to link the services with the item. Check the tables like ESKN to know how the linking works with your existing data.
    There are lot of posts related to this. Please do a search to get detailed answers. Thanks for your patience!!
    Regards,
    Yogesh

  • Error while creating service PO by BAPI_PO_CREATE1

    Hi,
    I am trying to create a service PO using the BAPI_PO_CREATE1 with reference to service PR and I am getting an "In case of account assignment, please enter acc. assignment data for item" for which i found so many threads but none had resolved this error in my case eventhough i filled up all the required structure such as
      LOOP AT gt_esll INTO gs_esll.
          gs_services-pckg_no    = gs_esll-packno.
          gs_services-line_no    = gs_esll-introw.
          gs_services-subpckg_no = gs_esll-sub_packno.
          gs_services-quantity   = gs_esll-menge.
          gs_services-base_uom   = gs_esll-meins.
          gs_services-gr_price   = gs_esll-brtwr.
          gs_services-outl_ind   = 'X'.
          APPEND gs_services TO gt_services.
          CLEAR gs_services.
      ENDLOOP.
      LOOP AT gt_esll1 INTO gs_esll1.
        gs_services-pckg_no  = gs_esll1-packno.
        gs_services-line_no  = gs_esll1-introw.
        gs_services-ext_line = gs_esll1-extrow.
        gs_services-quantity = gs_esll1-menge.
        gs_services-base_uom = gs_esll1-meins.
        gs_services-gr_price   = gs_esll1-brtwr.
        APPEND gs_services TO gt_services.
        CLEAR gs_services.
        gs_servalues-pckg_no   = gs_esll1-packno.
        gs_servalues-line_no   = gs_esll1-introw.
        gs_servalues-serno_line = '01'.
        gs_servalues-quantity  = gs_esll1-menge.
        gs_servalues-net_value = gs_esll1-brtwr.
        APPEND gs_servalues TO gt_servalues.
        CLEAR:  gs_servalues, gs_esll1.
      ENDLOOP.
      gs_poacct-po_item = gv_poitm.
      gs_poacct-serial_no = gs_ebkn-zebkn.
      gs_poacct-quantity  = gs_ebkn-menge.
      gs_poacct-gl_account = gs_ebkn-sakto.
      gs_poacct-costcenter = gs_ebkn-kostl.
      gs_poacct-co_area = gs_ebkn-kokrs.
      APPEND gs_poacct TO gt_poacct.
      CLEAR gs_poacct.
      gs_poacctx-po_item = gv_poitm.
      gs_poacctx-serial_no = gs_ebkn-zebkn.
      gs_poacctx-po_itemx = 'X'.
      gs_poacctx-serial_nox = 'X'.
      gs_poacctx-quantity  = 'X'.
      gs_poacctx-gl_account = 'X'.
      gs_poacctx-costcenter = 'X'.
      gs_poacctx-co_area = 'X'.
      APPEND gs_poacctx TO gt_poacctx.
      CLEAR : gs_poacctx, gs_ebkn.
    LOOP AT gt_ppsitm INTO gs_ppsitm.
      CLEAR: gs_poitm. " gt_poitm.
      READ TABLE gt_matnr INTO gs_matnr WITH KEY banfn = gs_ppsitm-banfn bnfpo = gs_ppsitm-bnfpo.
      CLEAR: gs_poitm.
      gv_poitm = gv_poitm + 10.
      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          INPUT         = gv_poitm
       IMPORTING
          OUTPUT        = gv_poitm.
      gs_poitm-po_item    = gv_poitm.
      gs_poitm-quantity   = gs_ppsitm-menge.
      gs_poitm-po_unit    = gs_matnr-meins.
      gs_poitm-net_price  = gs_ppsitm-quote_price.
    *  gs_poitm-price_unit = '1'.
      gs_poitm-tax_code   = gs_ppsitm-mwskz.
      gs_poitm-preq_no    = gs_ppsitm-banfn.
      gs_poitm-preq_item  = gs_ppsitm-bnfpo.
      IF gs_matnr-packno IS NOT INITIAL.
        gs_poitm-pckg_no    = gs_matnr-packno.        " ADDED BY SKE FOR SERVICE PO
      ENDIF.
      gs_poitm-item_cat    = gs_matnr-pstyp.
      gs_poitm-acctasscat = gs_matnr-knttp.
      APPEND gs_poitm TO gt_poitm.
    ENDLOOP.
    aftrer executing this bapi, the accounts structure has been cleared whereas other sturcture has values.
    Please give me some hints to fix this.
    Thanks in Advance,
    Kalidass.

    Hi pranav,
    from EBAN table i got the package no for a PR and passing that package No into ESLL table i am getting the subpaack No.
       SELECT banfn bnfpo txz01 matnr bsart ekgrp meins pstyp knttp packno FROM eban
         INTO TABLE gt_matnr
          FOR ALL ENTRIES IN gt_ppsitm
        WHERE banfn = gt_ppsitm-banfn
          AND bnfpo = gt_ppsitm-bnfpo.
        SELECT packno introw package sub_packno FROM esll
               INTO CORRESPONDING FIELDS OF TABLE gt_esll
               FOR ALL ENTRIES IN gt_matnr
               WHERE packno = gt_matnr-packno.
    IF gt_esll IS NOT INITIAL.
        SELECT packno introw extrow package sub_packno menge meins brtwr ktext1 FROM ESLL
               INTO TABLE gt_esll1
               FOR ALL ENTRIES IN gt_esll
               WHERE packno = gt_esll-sub_packno.
    ENDIF.
      LOOP AT gt_esll INTO gs_esll.
          gs_services-pckg_no    = gs_esll-packno.
          gs_services-line_no    = gs_esll-introw.
          gs_services-subpckg_no = gs_esll-sub_packno.
          gs_services-quantity   = gs_esll-menge.
          gs_services-base_uom   = gs_esll-meins.
          gs_services-gr_price   = gs_esll-brtwr.
          gs_services-outl_ind   = 'X'.
          APPEND gs_services TO gt_services.
          CLEAR gs_services.
      ENDLOOP.
      LOOP AT gt_esll1 INTO gs_esll1.
        gs_services-pckg_no  = gs_esll1-packno.
        gs_services-line_no  = gs_esll1-introw.
        gs_services-ext_line = gs_esll1-extrow.
        gs_services-quantity = gs_esll1-menge.
        gs_services-base_uom = gs_esll1-meins.
        gs_services-gr_price   = gs_esll1-brtwr.
        APPEND gs_services TO gt_services.
        CLEAR gs_services.
        gs_servalues-pckg_no   = gs_esll1-packno.
        gs_servalues-line_no   = gs_esll1-introw.
        gs_servalues-serno_line = '01'.
        gs_servalues-quantity  = gs_esll1-menge.
        gs_servalues-net_value = gs_esll1-brtwr.
        APPEND gs_servalues TO gt_servalues.
        CLEAR:  gs_servalues, gs_esll1.
      ENDLOOP.
    Edited by: Kalidass Etienne.S on Jan 31, 2012 11:07 AM

  • [VERY LOW IMPORTANCE] Creation of a Service Po via BAPI_PO_CREATE1

    Hi guys.
    I need a complete or maybe a code solution to implement a Service PO creation using BAPI_PO_CREATE1. All the examples I see just only show at least 1 service item and trying to reply those examples was ùnsuccesful...
    Pease can anyone provide me a code using BAPI_PO_CREATE1, for a list of N service items.
    Thanks in advance.
    RR:
    Edited by: Julius Bussche on Feb 16, 2010 8:37 AM
    Importance "corrected" ...

    Hi guys...
    Finally I found the solution, in a quite clear ABAP code.
    As you mention Manesh, we have to increment by2 for each service Item in the package number. I mean: remember we have a service line in ME21N (showing this transaction code as an example) and for each service we can have N position items. In my case, only we need 1:1 relation (service and position).
    Considering we need a package number per each service (f.e. 0000013291), a subpackage number per each position (this is the package number incremented by one -0000013292- if there is another position then the subpackage number is 0000013293 and so on). After we've completed all the positions for the previous service wa have to increment by (N + 1) where N is the number of positions taken by the previous service. So if the previous have 3 positions (0000013292, 0000013293 and 0000013294) then the new package number is 0000013295. Don't forget that if we have a service with N positions then we need to complete the POSERVICES table 2XN times (for the N positions and repeat N times the main service declaration for which correspond all these positions:
        services-pckg_no    = pckg_nro.
        services-line_no    = gvc_no.
        services-subpckg_no = pckg_nro + 1.
    I hope you've understood clearly my explanation.
    Well here is the code.

Maybe you are looking for

  • TNT On Demand Unable to Sign In - Please somebody help me

    This is my third plea for help.  The only reason I went with FIOS was to get Showtime On Demand and TNT On Demand.  I don't have a TV.  I watch exclusively on line.   Showtime works great.  But I am unable to log into TNT On Demand.  It did work two

  • How to delete all history in the newest version of safari?

    how do you delete all history in the newest version of safari?

  • Image processor defaulting to camera raw settings

    I'm trying to process a folder of RAW files. I'm using image processor and selecting the "open first image to apply settings" button. It opens the first Raw file in the folder and I can apply the Raw settings I want. This creates an xmp file next to

  • User Exit M06B0001 for Purchase Requisition Releases WF

    Hi All, I'm having some trouble with the User Exit M06B0001.  I am trying to add logic in here to determine the correct agents based on release codes, cost centers etc. and send emails to the required agents. Some background info: we are using BUS210

  • Active Session Object

    Hi Everyone, Here is my situation.  I am using a third party application to grab information from SAP.  My issue is that I need to get the most recently used window.  I have tried to use the ActiveSession object, but have had no luck getting applicat