当前位置:网站首页>SAP vl02n delivery note posting function WS_ DELIVERY_ UPDATE
SAP vl02n delivery note posting function WS_ DELIVERY_ UPDATE
2022-07-29 00:32:00 【Please enter the nickname inflated steamed bread】
SAP VL02N Delivery order posting function WS_DELIVERY_UPDATE
List of articles
Preface
use BDC simulation VL02N Posting is OK , Is not complicated
Just for SAP Provided Function Module Better scalability
Code Overview
Test report
TABLES: likp.
DATA: gs_likp TYPE likp,
gt_lips TYPE STANDARD TABLE OF lips,
gs_lips TYPE lips,
gs_return TYPE zcommon_return.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS: s_vbeln FOR likp-vbeln MEMORY ID vbe.
SELECTION-SCREEN END OF BLOCK blk1.
START-OF-SELECTION.
SELECT SINGLE * FROM likp WHERE vbeln IN @s_vbeln INTO CORRESPONDING FIELDS OF @gs_likp.
gs_likp-wadat_ist = gs_likp-wadat.
SELECT * FROM lips WHERE vbeln IN @s_vbeln INTO CORRESPONDING FIELDS OF TABLE @gt_lips.
CALL FUNCTION 'ZSDFM01_DELIVERY'
EXPORTING
wa_likp = gs_likp
IMPORTING
wa_return = gs_return
TABLES
it_lips = gt_lips.
WRITE gs_return.
END-OF-SELECTION.
FM ZSDFM01_DELIVERY
FUNCTION zsdfm01_delivery.
*"----------------------------------------------------------------------
*"*" Local interface :
*" IMPORTING
*" VALUE(WA_LIKP) TYPE LIKP
*" EXPORTING
*" VALUE(WA_RETURN) TYPE ZCOMMON_RETURN
*" TABLES
*" IT_LIPS STRUCTURE LIPS
*"----------------------------------------------------------------------
DATA: wa_lips LIKE LINE OF it_lips,
wa_vbkok TYPE vbkok.
DATA: it_vbpok TYPE STANDARD TABLE OF vbpok,
wa_vbpok TYPE vbpok.
DATA: it_prott TYPE STANDARD TABLE OF prott,
wa_prott TYPE prott.
DATA: v_msg TYPE string.
LOOP AT it_lips INTO wa_lips.
CLEAR:wa_vbpok.
wa_vbpok = VALUE #( vbeln_vl = wa_lips-vbeln
posnr_vl = wa_lips-posnr
vbeln = wa_lips-vgbel
posnn = wa_lips-vgpos
matnr = wa_lips-matnr
lgort = wa_lips-lgort
lfimg = wa_lips-lfimg
lgmng = wa_lips-lfimg " Based on the actual delivery quantity at the warehouse storage unit level
pikmg = wa_lips-lfimg " The reference quantity is calculated in buom
).
APPEND wa_vbpok TO it_vbpok.
ENDLOOP.
wa_vbkok = VALUE #( vbeln_vl = wa_likp-vbeln
wadat_ist = wa_likp-wadat_ist " Actual cargo movement date
wabuc = 'X' " Automatically post goods movement
komue = 'X' " Automatically overwrite the delivery quantity with the picking quantity
).
CALL FUNCTION 'WS_DELIVERY_UPDATE'
EXPORTING
vbkok_wa = wa_vbkok
commit = 'X'
delivery = wa_likp-vbeln
update_picking = 'X'
TABLES
vbpok_tab = it_vbpok
prot = it_prott.
DELETE it_prott WHERE msgty NE 'E' AND msgty NE 'A'.
IF it_prott IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
wa_return-mtype = 'S'.
wa_return-mtext = ' Posting succeeded !' .
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
LOOP AT it_prott INTO wa_prott.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = wa_prott-msgid
msgnr = wa_prott-msgno
msgv1 = wa_prott-msgv1
msgv2 = wa_prott-msgv2
msgv3 = wa_prott-msgv3
msgv4 = wa_prott-msgv4
IMPORTING
message_text_output = v_msg.
wa_return-mtext = wa_return-mtext && ' Posting failed ! Here's why :' && v_msg .
ENDLOOP.
wa_return-mtype = 'E'.
ENDIF.
ENDFUNCTION.
Code parsing
There is nothing to analyze ,vbpok Fields in type and lips The fields of the table are similar
Represents the detail line to be posted
What needs attention is the header data vbkok Actual goods movement date in wadat_ist and wabuc Automatic posting of goods movement requires value
wadat_ist = wa_likp-wadat_ist " Actual cargo movement date
wabuc = 'X' " Automatically post goods movement
then FM WS_DELIVERY_UPDATE Parameters need to be set for the input of commit and update_picking
The default values of these two parameters are empty , I need to set to abap_true
commit = 'X'
update_picking = 'X'
call FM After posting , obtain prot The return value of
it_prott Error messages will be stored in
adopt FM MESSAGE_TEXT_BUILD To get the text content
The final output
Conclusion
If this article is helpful to you, please like it
边栏推荐
- Immutable x officially opens IMX token pledge detailed IMX pledge introduction optimistic about the development prospect of IMX
- 【esn】 学习回声状态网络
- flyway的快速入门教程
- Idea connection database
- With this, your messages can't be monitored
- feign调用不通问题,JSON parse error Illegal character ((CTRL-CHAR, code 31)) only regular white space (r
- Redis learning notes
- Event extraction and documentation (2008-2017)
- MySQL事务(transaction) (有这篇就足够了..)
- @Detailed explanation of postconstruct annotation
猜你喜欢

Dynamic programming problem (6)

Using recursion and chain header interpolation to realize the group turnover of linked lists -- leetcode25 K group turnover linked lists

Advanced area of attack and defense world web masters ics-06

最长上升子序列

时间序列统计分析

ACM SIGIR 2022 | interpretation of selected papers of meituan technical team

递归/回溯刷题(下)

Linux下安装Mysql5.7,超详细完整教程,以及云mysql连接

I don't know how lucky the boy who randomly typed the log is. There must be a lot of overtime!

Api 接口优化有哪些技巧?
随机推荐
Idea error running 'application' command line is too long solution
MySql中的like和in走不走索引
MySQL事务(transaction) (有这篇就足够了..)
Teach you how to install latex (nanny level tutorial)
[development tutorial 10] crazy shell · open source Bluetooth heart rate waterproof sports Bracelet - Bluetooth ble transceiver
递归/回溯刷题(中)
Detailed explanation of the usage of exists in MySQL
pnpm的安装与使用
ORACLE not available如何解决
Api 接口优化有哪些技巧?
@PostConstruct注解详解
IDEA2021.2安装与配置(持续更新)
110 MySQL interview questions and answers (continuously updated)
MySQL transaction (this is enough...)
【飞控开发基础教程8】疯壳·开源编队无人机-I2C(激光测距)
#{}和${}的区别
【esn】 学习回声状态网络
Dynamic programming (V)
2022DASCTF7月赋能赛(复现)
PTA (daily question) 7-70 diamond