Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

bapi create po system give message no. bm035

Former Member
0 Kudos
763

Deal all,

  when i use bapi 'BAPI_PO_CREATE1' create po, system give me a error message no. bm035(Measurement unit & has no ISO code). I don't konw how to sorve it.  But when i use T-code ME21N to create po, it create suceeed. Is my code wrong?  This is my code, please anybody give me some advice, Thanks.

FORM generate_free_po .

    DATA: lv_ebeln LIKE ekko-ebeln ,        lv_adrnr LIKE t001w-adrnr.  .

  CLEAR:poheader,poheaderx.  .

    REFRESH:poitem,poitemx,pocondheader,pocondheaderx,      .

  

poschedule,poschedulex,poaddrdelivery,poreturn,pocomponents,pocomponentsx. .

  LOOP AT gt_freepo INTO gs_freepo.  .

        ON CHANGE OF gs_freepo-ebeln.  .

  

            IF poheader IS NOT INITIAL.    .

      

                PERFORM exec_bapi_po USING lv_ebeln ''.  .

      

            ENDIF. .

      

      CLEAR:poheader,poheaderx,lv_ebeln.  .

      

      REFRESH:poreturn,poitem,poitemx,pocondheader,pocondheaderx,poschedule,poschedulex.  .

    

      lv_ebeln = gs_freepo-ebeln.      ""po header      .

      poheader-po_number    = gs_freepo-ebeln .  "po number  .

      poheader-comp_code    = gs_freepo-bukrs.        "company code    .

      poheader-doc_type    = gs_freepo-bsart.        ""document type    .

      poheader-vendor      = gs_freepo-lifnr.        ""vendor *    .

      poheader-currency    = gs_freepo-waers.        "waers    .

      poheader-purch_org    = gs_freepo-ekorg.        ""pur_org  .

      poheader-pur_group    = gs_freepo-ekgrp.        ""pur_group  .

  

      poheader-creat_date  = sy-datum.    .

    poheader-created_by  = sy-uname .  .

  

    poheader-langu        = sy-langu.  .

  

  poheader-doc_date    = sy-datum.    .

      poheader-item_intvl  = '00010' .  .

      poheader-status      = 'I' .                  "PO FROM BAPI    .

    "" po header flag  .

      

        poheaderx-po_number  = 'X' .    .

        poheaderx-comp_code  = 'X' .  .

        poheaderx-doc_type    = 'X' .  .

        poheaderx-vendor      = 'X'.    .

      poheaderx-purch_org  = 'X' .  .

      poheaderx-pur_group  = 'X' .  .

        poheaderx-creat_date  = 'X'.    .

        poheaderx-created_by  = 'X'.  .

  

      poheaderx-langu      = 'X' .    .

  

      poheaderx-doc_date    = 'X'.    .

      poheaderx-item_intvl  = 'X'.  .

  

      poheaderx-status      = 'X' .    .

    

    poheaderx-vat_cntry  = 'X' . .

    ENDON.    .

""po item  .

    CLEAR:poitem.    .

    poitem-po_item    = gs_freepo-ebelp.  "EKPO 采购凭证的项目编号    .

    poitem-material    = gs_freepo-matnr .  " MATERIAL    .

    poitem-plant      = gs_freepo-werks.  "工厂    .

    poitem-stge_loc    = gs_freepo-lgort . "LOCATION    .

poitem-quantity    = gs_freepo-menge.  "采购订单数量    .

  SELECT SINGLE bstme INTO poitem-po_unit FROM mara WHERE matnr = gs_freepo-matnr..

*    poitem-po_unit    = gs_freepo-meins.  "PO_UNIT  .

  poitem-short_text  = gs_freepo-txz01.  "短文本    .

poitem-item_cat    = gs_freepo-pstyp.  "Item Catagory  .

  poitem-free_item  = 'X'.                              ""免费项目    .

""*---------------------------------------------------------------------  .

    poitem-net_price  = gs_freepo-kbetr.  "单价  .

    poitem-price_unit  = gs_freepo-kpein.  "单价单位 .

    poitem-plan_del    = 0 .  .

    poitem-preq_name  = sy-uname. .

    poitem-period_ind_expiration_date = sy-datum . .

*    poitem-po_price    = '2'.  .

APPEND poitem.  .

  ""po item flag  .

      CLEAR:poitemx.  .

      poitemx-po_item                  = gs_freepo-ebelp.    .

      poitemx-po_itemx                  = 'X'.    .

      poitemx-material                  = 'X'.  .

      poitemx-plant                      = 'X'.    .

      poitemx-stge_loc                  = 'X'.  .

      poitemx-quantity                  = 'X'.    .

    poitemx-po_unit                    = 'X'.  .

    poitemx-net_price                  = 'X'.    .

    poitemx-price_unit                = 'X'.    .

    poitemx-preq_name                  = 'X'.  .

    poitemx-period_ind_expiration_date = 'X'. .

    poitemx-item_cat                  = 'X'.  .

  poitemx-free_item                  = 'X'.      .

*    poitemx-po_price                  = 'X'.  .

  APPEND poitemx.  .

  ""schedule .

    CLEAR:poschedule.  .

        poschedule-po_item        =  gs_freepo-ebelp.  .

        poschedule-sched_line      =  gs_freepo-ebelp. .

      poschedule-del_datcat_ext  = 'D'.              "交货日期的类别    .

      poschedule-delivery_date  =  gs_freepo-eeind.    "EKPO 交货日期    .

      poschedule-quantity        =  gs_freepo-menge.    "采购订单数量    .

        APPEND poschedule.    .

"""schedule flag  .

      CLEAR:poschedulex.  .

      poschedulex-po_item        =  gs_freepo-ebelp.  .

      poschedulex-sched_line    =  gs_freepo-ebelp.  .

    poschedulex-del_datcat_ext = 'X'.      .

    poschedulex-delivery_date  = 'X'.  .

      poschedulex-quantity      = 'X'.    .

      APPEND poschedulex.    .

    ""pocondheader    .

        CLEAR:pocondheader.  .

        pocondheader-cond_type    = 'PBXX' .    .

        pocondheader-condition_no  = gs_freepo-ebeln.    .

        pocondheader-itm_number    = gs_freepo-ebelp.    .

      pocondheader-cond_value    = gs_freepo-kbetr.  .

      pocondheader-currency      = gs_freepo-koein.    .

      pocondheader-cond_p_unt    = gs_freepo-kpein.    .

      pocondheader-cond_unit    = gs_freepo-kmein.  .

        pocondheader-change_id    = 'U'.    .

        pocondheader-cond_st_no    = 1 .  .

    SELECT SINGLE umrez umren INTO (pocondheader-numconvert,pocondheader-denominato) FROM marm    WHERE matnr = gs_freepo-matnr AND meinh = gs_freepo-meins.    .

APPEND pocondheader .  .

  ""pocondheader flag    .

        CLEAR:pocondheaderx. .

        pocondheaderx-cond_type    = 'X' .  .

        pocondheaderx-condition_no = gs_freepo-ebeln.    .

        pocondheaderx-itm_number  = gs_freepo-ebelp. .

        pocondheaderx-cond_st_no  = 1 .    .

        pocondheaderx-cond_value  = 'X'.    .

        pocondheaderx-currency    = 'X'.    .

      pocondheaderx-cond_p_unt  = 'X'.    .

      pocondheaderx-cond_unit    = 'X'.    .

      pocondheaderx-change_id    = 'X'.  .

        pocondheaderx-numconvert  = 'X'.    .

        pocondheaderx-denominato  = 'X'.    .

        APPEND pocondheaderx .    .

    """address  .

  CLEAR: poaddrdelivery,lv_adrnr .    .

poaddrdelivery-po_item = gs_freepo-ebelp.    .

SELECT SINGLE adrnr INTO lv_adrnr FROM t001w WHERE werks = gs_freepo-werks.    .

poaddrdelivery-addr_no = lv_adrnr .  .

  APPEND poaddrdelivery.  .

ENDLOOP.  .

    IF poheader IS NOT INITIAL.    .

          PERFORM exec_bapi_po  USING lv_ebeln ''.  .

    ENDIF. ENDFORM.      .

    FORM exec_bapi_po  USING  l_ebeln LIKE ekko-ebeln l_flag TYPE c.  .

          DATA: no_price_from_po LIKE bapiflag-bapiflag.  .

            CALL FUNCTION 'BAPI_PO_CREATE1'      .

                EXPORTING      poheader        = poheader      .

  

                                          poheaderx        = poheaderx .

*      no_price_from_po = no_price_from_po    .

            TABLES      return        = poreturn  .

                                  poitem        = poitem  .

                                    poitemx      = poitemx      .

                                    pocondheader  = pocondheader    .

                                    pocondheaderx = pocondheaderx .

                                      poschedulex    = poschedulex  .

                                      poschedule    = poschedule    .

    pocomponents  = pocomponents      .

                pocomponentsx  = pocomponentsx    .

    poaddrdelivery = poaddrdelivery.  .

                  READ TABLE poreturn WITH KEY type = 'E'.  .

                          IF sy-subrc EQ 0.  .

                              CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.      .

              

                          ELSE.    .

        

                    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'        EXPORTING        wait = 'X'.  .

    

  ENDIF. .

    

ENDFORM.                    " EXEC_BAPI_PO

6 REPLIES 6

former_member185537
Participant
0 Kudos
149

Hi Blue,

This is a customization problem. Forward the problem to the functional team.

0 Kudos
149

Hi Pras,

You are right, When create po using RFC(bapi_po_create1), system consider it communicate with external systems, thanks .

0 Kudos
149

Hi Blue,


bluesky chen wrote:

 

But when i use T-code ME21N to create po, it create suceeed. Is my code wrong?

If PO is created in transaction ME21, then there is no configuration problem. We need to check the parameters which we are passing in BAPI_PO_CREATE1.


As per the thread


In Item table, can you check and fill the values of the following fields.

  • PO_UNIT
  • PO_UNIT_ISO
  • ORDERPR_UN
  • ORDERPR_UN_ISO

Regards

Rajkumar Narasimman

0 Kudos
149

Hi Rajkumar, I get it when i maintain ISO code in SPRO-->SAP NetWeaver-->General Settings-->Check Units of Measurement. if i don't maintain it, i don't konw what is "PO_UNIT_ISO", is it same as "PO_UNIT" ? please write more detail, Thanks a lot. Bluesky

0 Kudos
149

Hi Blue,

Pass the same value which is assigned for PO_UNIT to ISO Unit.

Regards

Rajkumar Narasimman

0 Kudos
149

Hi Rajkumar,

Thanks a lot, i will test it later