ABAP VL02N 过账BAPI修改
时间: 2023-10-09 10:09:04 浏览: 211
要使用ABAP修改VL02N过账的BAPI,您可以使用BAPI_GOODSMVT_CREATE BAPI。以下是一个示例代码片段,演示如何使用该BAPI来修改VL02N过账:
```abap
DATA: lt_item TYPE TABLE OF bapi2017_gm_item_create,
ls_item TYPE bapi2017_gm_item_create,
lt_return TYPE TABLE OF bapiret2,
lv_material TYPE matnr VALUE 'MATERIAL_NUMBER'.
* 填写需要更新的过账数据
ls_item-material = lv_material.
ls_item-plant = 'PLANT_CODE'.
ls_item-move_type = 'MOVEMENT_TYPE'.
ls_item-entry_qnt = 'QUANTITY'.
ls_item-entry_uom = 'UNIT_OF_MEASURE'.
ls_item-move_reas = 'MOVEMENT_REASON'.
* 将更新信息添加到表中
APPEND ls_item TO lt_item.
* 调用BAPI进行过账
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = ls_header
TABLES
goodsmvt_item = lt_item
return = lt_return.
* 检查过账结果
IF sy-subrc = 0.
WRITE 'Goods movement created successfully.'.
ELSE.
WRITE 'Failed to create goods movement.'.
ENDIF.
```
请将代码中的MATERIAL_NUMBER替换为实际的物料号码,PLANT_CODE替换为实际的工厂代码,MOVEMENT_TYPE替换为实际的过账类型,QUANTITY替换为实际的数量,UNIT_OF_MEASURE替换为实际的计量单位,MOVEMENT_REASON替换为实际的过账原因。请注意,您需要具有适当的权限才能调用和更新该BAPI。
阅读全文