首页 > 其他分享 >DEMO:修改外向交货单BAPI_OUTB_DELIVERY_CHANGE

DEMO:修改外向交货单BAPI_OUTB_DELIVERY_CHANGE

时间:2022-09-30 23:31:06浏览次数:51  
标签:BAPI DEMO LIPS ITEM LT LS 交货单 SERIAL DATA


货铺QQ群号:834508274


DEMO:修改外向交货单BAPI_OUTB_DELIVERY_CHANGE_序列号



TABLES:LIKP,LIPS.

PARAMETERS:P_VBELN TYPE VBELN_VL.PARAMETERS:P_SERNR TYPE OBJK-SERNR.

DATA:LS_HEADER_DATA LIKE BAPIOBDLVHDRCHG,LS_HEADER_CONTROL LIKE BAPIOBDLVHDRCTRLCHG,LV_DELIVERY LIKE BAPIOBDLVHDRCHG-DELIV_NUMB.DATA:LT_ITEM_DATA LIKE TABLE OF BAPIOBDLVITEMCHG,LT_ITEM_CONTROL LIKE TABLE OF BAPIOBDLVITEMCTRLCHG,LT_ITEM_SERIAL_NO LIKE TABLE OF BAPIDLVITMSERNO.DATA:LS_ITEM_DATA LIKE BAPIOBDLVITEMCHG,LS_ITEM_CONTROL LIKE BAPIOBDLVITEMCTRLCHG,LS_ITEM_SERIAL_NO LIKE BAPIDLVITMSERNO.
DATA:LT_RETURN TYPE TABLE OF BAPIRET2.DATA:LT_LIPS TYPE TABLE OF LIPS.DATA:LS_LIPS TYPE LIPS.DATA:LT_SER01 TYPE TABLE OF SER01.DATA:LS_SER01 TYPE SER01.DATA:LT_OBJK TYPE TABLE OF OBJK.DATA:LS_OBJK TYPE OBJK.

"交货单信息SELECT * FROM LIPS INTO TABLE LT_LIPS WHERE VBELN = P_VBELN.
"交货单系列号的凭证抬头SELECT * FROM SER01 INTO TABLE LT_SER01 WHERE LIEF_NR = P_VBELN.
"交货单对应的物料+序列号IF LT_SER01[] IS NOT INITIAL.SELECT * FROM OBJK INTO TABLE LT_OBJK FOR ALL ENTRIES IN LT_SER01WHERE OBKNR = LT_SER01-OBKNR.ENDIF.

CLEAR LT_ITEM_SERIAL_NO[].
"填写物料+序列号LOOP AT LT_LIPS INTO LS_LIPS.
READ TABLE LT_SER01 INTO LS_SER01WITH KEY LIEF_NR = LS_LIPS-VBELNPOSNR = LS_LIPS-POSNR.
CHECK SY-SUBRC = 0.
LOOP AT LT_OBJK INTO LS_OBJK WHERE OBKNR = LS_SER01-OBKNR.
CLEAR LS_ITEM_SERIAL_NO.LS_ITEM_SERIAL_NO-DELIV_NUMB = LS_LIPS-VBELN.LS_ITEM_SERIAL_NO-ITM_NUMBER = LS_LIPS-POSNR.LS_ITEM_SERIAL_NO-SERIALNO = LS_OBJK-SERNR.
APPEND LS_ITEM_SERIAL_NO TO LT_ITEM_SERIAL_NO[].ENDLOOP.
ENDLOOP.
*&最后一个行项目上 数量加一,加一个物料 和序列号LS_ITEM_SERIAL_NO-DELIV_NUMB = LS_LIPS-VBELN.LS_ITEM_SERIAL_NO-ITM_NUMBER = LS_LIPS-POSNR.LS_ITEM_SERIAL_NO-SERIALNO = P_SERNR.
APPEND LS_ITEM_SERIAL_NO TO LT_ITEM_SERIAL_NO[].
"修改交货单数量CLEAR LS_ITEM_DATA.CLEAR LT_ITEM_DATA[].LS_LIPS-LFIMG = LS_LIPS-LFIMG + 1.
LS_ITEM_DATA-DELIV_NUMB = LS_LIPS-VBELN.LS_ITEM_DATA-DELIV_ITEM = LS_LIPS-POSNR .LS_ITEM_DATA-MATERIAL = LS_LIPS-MATNR .LS_ITEM_DATA-DLV_QTY = LS_LIPS-LFIMG .LS_ITEM_DATA-DLV_QTY_IMUNIT = LS_LIPS-LFIMG.LS_ITEM_DATA-FACT_UNIT_DENOM = 1.LS_ITEM_DATA-FACT_UNIT_NOM = 1.LS_ITEM_DATA-SALES_UNIT = 'EA'.LS_ITEM_DATA-BASE_UOM = 'EA'.

APPEND LS_ITEM_DATA TO LT_ITEM_DATA.
CLEAR LS_ITEM_CONTROL.CLEAR LT_ITEM_CONTROL[].LS_ITEM_CONTROL-DELIV_NUMB = LS_LIPS-VBELN..LS_ITEM_CONTROL-DELIV_ITEM = LS_ITEM_DATA-DELIV_ITEM.LS_ITEM_CONTROL-CHG_DELQTY = 'X'.
APPEND LS_ITEM_CONTROL TO LT_ITEM_CONTROL.

LV_DELIVERY = P_VBELN.LS_HEADER_DATA-DELIV_NUMB = P_VBELN.LS_HEADER_CONTROL-DELIV_NUMB = P_VBELN.


CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'EXPORTINGHEADER_DATA = LS_HEADER_DATAHEADER_CONTROL = LS_HEADER_CONTROLDELIVERY = LV_DELIVERYTABLES ITEM_DATA = LT_ITEM_DATAITEM_CONTROL = LT_ITEM_CONTROLITEM_SERIAL_NO = LT_ITEM_SERIAL_NO RETURN = LT_RETURN .
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'EXPORTINGWAIT = 'X'.


标签:BAPI,DEMO,LIPS,ITEM,LT,LS,交货单,SERIAL,DATA
From: https://blog.51cto.com/u_15680210/5727565

相关文章

  • Demo:替代
    货铺QQ群号:834508274下面开始干货:Tcode:OBBH:新建步骤:选择替换字段:设置先决条件:这里demo输入常量:替换:维护出口代码:Tcode:Gcx2:代码由两部分构成:在form get_exit_titles先声明......
  • Demo:校验
    货铺QQ群号:834508274下面开始干货:tcode:GGB0设置先决条件设置检查点这里ZU01对应的代码是需要配置维护的。不然是显示不出来ZU01的。ZU01代码的相关配置维护点:Tcode:GCX2Co......
  • 如何查找BAPI
    干货铺QQ群号:834508274有人问怎么找BAPI的问题,这里说一下。文章最早是发在博客里的,2014年写的,略作调整这里发一下,依然适用:​​http://blog.sina.com.cn/s/blog_c0978c9b0102......
  • XD01创建扩展客户前台以及BAPI测试步骤
    前两天有人在群里问SD_CUSTOMER_MAINTAIN_ALL怎么创建客户。我在demo机上测试XD01创建客户,然后再测试使用BAPI。Demo机是ECC,S4已结不用XD01了,统一使用BP创建客户和供应商等......
  • 关于手机端H5通知已读未读的一个简单demo
    情景:系统发通知给每一个员工,每个员工有一个系统系统,点击提示,通知列表有已读和未读主要通过redis来实现,大致思路:将通知和员工绑定作为key,如果员工点进链接证明已读则将key......
  • 前端面试总结12-WebApi-存储
    简述cooki,localstorage,sessionstorage的区别(1:cookie数据存放在浏览器上,session存放在服务器上(2:cookie安全性低(3:session占用服务器性能(4:单个cookie最大存储数据不超过4k......
  • 前端面试总结11-WebApi-Ajax
    1.同源策略:ajax请求时,浏览器要求当前网页和serve必须同源(安全),即协议,域名,端口三者必须一致2.可无视同源策略的情况(1:<img/>可用于统计打点,可使用第三方统计服务(2:<link/><......
  • 四、react-redux(demo可对比redux)
    react-redux调用关系: react-reducdemo1.安装插件:npminstall--savereact-redux2.创建项目:demo效果还是和redux的demo是一样的 demo目录结构:src下新增了containers文......
  • controller接受body为 application/x-www-form-urlencoded类型的请求demo
    @RequestMapping(value="/receive",method=RequestMethod.POST,consumes=MediaType.APPLICATION_FORM_URLENCODED_VALUE)publicStringqdjk(@RequestParamMap<S......
  • webapi 问题收集
    webapi问题收集1请确保在所有其他初始化代码后面的应用程序启动代码中调用HttpConfiguration.EnsureInitialized()当启动webapi项目调用其中一个url时报该错误,解决方法如......