首页 > 其他分享 >BAPI_GOODSMVT_CREATE 带序列号

BAPI_GOODSMVT_CREATE 带序列号

时间:2022-10-14 17:36:45浏览次数:68  
标签:BAPI return move GOODSMVT item ls 序列号 data goodsmvt

 

API_GOODSMVT_CREATE
物料移动,比如MB1B
'343' "unblock
'344' "block


参考代码

*&BAPI
DATA: goodsmvt_header LIKE bapi2017_gm_head_01,
goodsmvt_code LIKE bapi2017_gm_code.
DATA: goodsmvt_headret LIKE bapi2017_gm_head_ret,
materialdocument TYPE bapi2017_gm_head_ret-mat_doc,
matdocumentyear TYPE bapi2017_gm_head_ret-doc_year.

DATA:goodsmvt_item LIKE TABLE OF bapi2017_gm_item_create WITH HEADER LINE,
goodsmvt_serialnumber LIKE TABLE OF bapi2017_gm_serialnumber WITH HEADER LINE,
return LIKE TABLE OF bapiret2 WITH HEADER LINE.

FIELD-SYMBOLS LIKE LINE OF goodsmvt_item.
DATA:lv_item_line TYPE int4.


CHECK it_data[] IS NOT INITIAL.

*抬头部分给值:
CLEAR: goodsmvt_item[],goodsmvt_header.
REFRESH: goodsmvt_item.


goodsmvt_header-pstng_date = sy-datum.
goodsmvt_header-doc_date = sy-datum.

goodsmvt_header-pr_uname = sy-uname.
goodsmvt_code = '04'.

*行项目部分给值

LOOP AT it_data INTO ls_data .


goodsmvt_item-material = ls_data-matnr.
goodsmvt_item-plant = ls_data-werks.
goodsmvt_item-stge_loc = ls_data-lgort.
goodsmvt_item-move_type = iv_move_type.
goodsmvt_item-move_plant = ls_data-werks.
goodsmvt_item-move_stloc = ls_data-lgort.
goodsmvt_item-entry_qnt = 1. " only 1

READ TABLE goodsmvt_item ASSIGNING <ls_item>
WITH KEY material = ls_data-matnr
plant = ls_data-werks
stge_loc = ls_data-lgort
move_type = iv_move_type
move_plant = ls_data-werks
move_stloc = ls_data-lgort.

IF sy-subrc = 0.
<ls_item>-entry_qnt = <ls_item>-entry_qnt + 1.
ELSE.
APPEND goodsmvt_item.
ENDIF.

DESCRIBE TABLE goodsmvt_item LINES lv_item_line.
goodsmvt_serialnumber-matdoc_itm = lv_item_line.
goodsmvt_serialnumber-serialno = ls_data-sernr.
APPEND goodsmvt_serialnumber.

**********

Call bapi

CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = goodsmvt_header
goodsmvt_code = '04' "#EC * "goodsmvt_code mb1b
IMPORTING
materialdocument = materialdocument
matdocumentyear = matdocumentyear
TABLES
goodsmvt_item = goodsmvt_item[]
goodsmvt_serialnumber = goodsmvt_serialnumber
return = return[].



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

READ TABLE return WITH KEY type = 'E'.
IF sy-subrc = 0.

CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = return-id
msgnr = return-number
msgv1 = return-message_v1
msgv2 = return-message_v2
msgv3 = return-message_v3
msgv4 = return-message_v4
IMPORTING
message_text_output = lv_msg.

ELSE.
lv_mblnr = materialdocument.
ENDIF.


BAPI_GOODSMVT_CREATE 带序列号_其它





标签:BAPI,return,move,GOODSMVT,item,ls,序列号,data,goodsmvt
From: https://blog.51cto.com/u_15680210/5757541

相关文章

  • 获取成本中心层级BAPI_COSTCENTERGROUP_GETDETAIL
    T-CODE:OKEON可以查看成本中心层级如果你查找对应的表,会查找到  SETHEADER和对应的SETHEADERT文本表对照数据可能发下问题应该还有别的判断条件,其他字段这里也不继续看......
  • 前端成神之路-WebAPIs07
    07-WebAPIs学习目标:能够写出移动端触屏事件能够写出常见的移动端特效能够使用移动端开发插件开发移动端特效能够使用移动端开发框架开发移动端特效能够写出sessio......
  • .net6 WebApi 之 Configuration
    .net6WebApi使用Configuration获取appsettings.json中的内容,用法如下:appsettings.json中的内容{"Logging":{"LogLevel":{"Default":"Informati......
  • SAP盘点:创建盘点凭证BAPI_MATPHY…
    ​​​​输入工厂,库存地点,在记账冻结打X,具体什么意思F1查看回车后,填写物料,回车,项目号会自动变更​​​​​​BAPI:BAPI_MATPHYSINV_CREATE_M......
  • 修改盘点数量MI04过账Mi07:BAPI_M…
    修改盘点数量、过账 3、MI09=MI01+MI04【MI04:库存盘点】​​​​回车输入盘点数量​​​​​点保存即可MI0......
  • 创建带有订单参考的外向交货:BAPI…
    测试bapi必须也要找前台能跑通的数据,不然,如果是数据本事问题,再怎么调都不会通(或者在订单修改VA02中创建交货)VL01N​​​​​​​​各个页签看看,哪......
  • BAPI_GOODSMVT_CREATE物料凭证创建…
    'BAPI_GOODSMVT_CREATE可以实现物料凭证创建和部分冲销全部冲销可以使用BAPI_GOODSMVT_CANCELFUNCTION 'BAPI_GOODSMVT_CREATE'        EXPORTING     ......
  • 删除和修改 预留 :BAPI_RESERVATION_CHANGE_SAP刘梦_新浪博客
     这里仅作测试,return没去校验结果 测试删除预留​​​​​行项目我开始习惯性给了个10,后来发现结果不对,打开了界面,看到是1而不是10。还有chan......
  • BAPI DEMO文章汇总
    序号描述1​​DEMO:BAPI_SALESORDER_CREATEFROMDAT2 创建订单​​2​​DEMO:BAPI_CUSTOMERRETURN_CREATE创建退货单​​3​​DEMO:修改销售订单BAPI_SALESORDER_CHANGE​​......
  • DEMO:针对销售订单的贷项凭证开票BAPI_BILLINGDOC_CREATEMULTIPLE_SAP刘梦_新浪博客
    ​​​​开票,冲销,再开票,VBFA和VBRK去查看如果VF01如果不输入日期,默认是读取订单上的开票日期​​​​*&-----------------------......