BAPI_GOODSMVT_CREATE
时间: 2023-08-06 10:05:36 浏览: 245
BAPI_GOODSMVT_CREATE是一个用于生成物料凭证的BAPI。它有多个参数需要提供值,其中包括goodsmvt_header、goodsmvt_code和gt_good等。\[2\]在调用该BAPI时,需要将这些参数赋予相应的值。goodsmvt_header用于存储过账日期、操作者和抬头文本等抬头数据,goodsmvt_code用于指定使用的过账事务码。gt_good是一个重要的表,用于存储要进行货物移动的物料、数量等信息。调用BAPI后,可以通过返回参数goodsmvt_headret获取物料凭证编号和年份。\[2\]
以下是一个示例代码,展示了如何使用BAPI_GOODSMVT_CREATE进行物料凭证的生成:
```ABAP
DATA: goodsmvt_header TYPE bapi2017_gm_head_01,
goodsmvt_code TYPE bapi2017_gm_code,
gt_good TYPE TABLE OF bapi2017_gm_item_create,
gw_good TYPE bapi2017_gm_item_create,
goodsmvt_headret TYPE bapi2017_gm_head_ret,
return LIKE TABLE OF bapiret2 WITH HEADER LINE,
materialdocument TYPE bapi2017_gm_head_ret-mat_doc,
matdocumentyear TYPE bapi2017_gm_head_ret-doc_year,
ev_msgty TYPE BAPI_MTYPE,
ev_mestx TYPE BAPI_MSG.
"设置好goodsmvt_header、goodsmvt_code和gt_good的值
CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = goodsmvt_header
goodsmvt_code = goodsmvt_code
TABLES
goodsmvt_item = gt_good
IMPORTING
goodsmvt_headret = goodsmvt_headret
materialdocument = materialdocument
matdocumentyear = matdocumentyear
return = return.
"处理返回的日志消息
LOOP AT return WHERE type = 'A' OR type = 'E'.
ev_msgty = 'E'.
ev_mestx = return-message.
EXIT.
ENDLOOP.
```
以上是一个示例代码,展示了如何使用BAPI_GOODSMVT_CREATE进行物料凭证的生成。你可以根据自己的需求,设置相应的参数值,并根据返回的日志消息进行处理。\[2\]\[3\]
#### 引用[.reference_title]
- *1* *2* *3* [金色传说:SAP-BAPI-BAPI_GOODSMVT_CREATE创建物料凭证bapi的使用及参数值讲解](https://blog.csdn.net/weixin_43675474/article/details/122258115)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文