当前位置:网站首页>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
边栏推荐
- What does the expression > > 0 in JS mean
- Talk about seven ways to realize asynchronous programming
- Api 接口优化有哪些技巧?
- Router view cannot be rendered (a very low-level error)
- Oracle实例无法启动的问题如何解决
- Erc20 Standard Code
- Feign call fails. JSON parse error illegal character ((ctrl-char, code 31)) only regular white space (R
- Solutions such as failed plug-in installation and slow speed of linking remote server under vscode
- 动态规划问题(四)
- How to solve the problems of MQ message loss, duplication and backlog?
猜你喜欢

MySQL的存储过程

MQ 消息丢失、重复、积压问题,如何解决?

Attack and defense world web master advanced area PHP_ rce

The difference between {} and ${}

Attack and defense world web master advanced area php2

Html+css+php+mysql realize registration + login + change password (with complete code)

Attack and defense world web master advanced area web_ php_ unserialize

Alibaba code index technology practice: provide reading experience of local IDE for code review

MySQL安装配置教程(超级详细、保姆级)

Flyway's quick start tutorial
随机推荐
总结:POD与容器的区别
pnpm的安装与使用
Advanced area of attack and defense world web masters warmup
MySQL transaction (this is enough...)
Oracle实例无法启动的问题如何解决
Immutable x officially opens IMX token pledge detailed IMX pledge introduction optimistic about the development prospect of IMX
Recursion / backtracking (middle)
MySQL安装配置教程(超级详细、保姆级)
Idea connection database
Camera Hal OEM module ---- CMR_ preview.c
手把手教你安装Latex(保姆级教程)
MySQL的存储过程
动态规划问题(四)
Solutions such as failed plug-in installation and slow speed of linking remote server under vscode
What are the skills of API interface optimization?
Applet verification code login
15.模型评估和选择问题
MySQL事务(transaction) (有这篇就足够了..)
分布式限流 redission RRateLimiter 的使用及原理
NFTScan 与 NFTPlay 在 NFT 数据领域达成战略合作