用最新的采购信息记录更新采购单的价格——BAPI_PO_CHANGE

2021-01-04 17:28

阅读:632

标签:spl   ima   load   价格   field   nbsp   tables   tab   批量   

当采购信息记录更新价格后,可以透过前台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(  ).

 

效果:

技术图片

 

用最新的采购信息记录更新采购单的价格——BAPI_PO_CHANGE

标签:spl   ima   load   价格   field   nbsp   tables   tab   批量   

原文地址:https://www.cnblogs.com/StephenAmell/p/14216213.html


评论


亲,登录后才可以留言!