当采购信息记录更新价格后,可以透过前台ME22N项目-->条件-->更新 来修改采购单的价格
批量执行改功能则使用函数BAPI_PO_CHANGE,代码如下:
REPORT ZMMRTEST. DATA: lv_ebeln TYPE ebeln, lt_item TYPE TABLE OF bapimepoitem, ls_item TYPE bapimepoitem, lt_itemx TYPE TABLE OF bapimepoitemx, ls_itemx TYPE bapimepoitemx, lt_return TYPE TABLE OF bapiret2. lv_ebeln = 'BAPI_PO_CHANGE'. ls_item-po_item = '00010'. ls_item-calctype ='B'. APPEND ls_item TO lt_item. ls_itemx-po_item = '00010'. ls_itemx-calctype ='X'. APPEND ls_itemx TO lt_itemx. CALL FUNCTION 'BAPI_PO_CHANGE' EXPORTING purchaseorder = lv_ebeln TABLES return = lt_return poitem = lt_item poitemx = lt_itemx. READ TABLE lt_return WITH KEY type = 'E' TRANSPORTING NO FIELDS. IF sy-subrc = 0. ROLLBACK WORK. ELSE. COMMIT WORK. ENDIF. cl_demo_output=>write( lt_return ). cl_demo_output=>display( ).
效果: