冲销交货单WS_REVERSE_GOODS_ISSUE详解编程语言

LOOP AT ITAB. 
AT END OF VBELN. 
PERFORM FRM_LOCK_DELIVERY(ZSDS0002) USING ITAB-VBELN. 
CALL FUNCTION 'WS_REVERSE_GOODS_ISSUE' 
EXPORTING 
I_VBELN                   = ITAB-VBELN 
I_BUDAT                   = LV_BUDAT 
I_TCODE                   = 'VL09' 
I_VBTYP                   = 'J' 
TABLES 
T_MESG                    = LT_MESG 
EXCEPTIONS 
ERROR_REVERSE_GOODS_ISSUE = 1 
OTHERS                    = 2. 
IF SY-SUBRC =  0. 
COMMIT WORK. 
WRITE : / ITAB-VBELN, '冲销成功'. 
ELSE. 
WRITE : / ITAB-VBELN, '冲销失败'. 
ENDIF. 
ENDAT. 
ENDLOOP. 
***************************************************** 
FORM FRM_LOCK_DELIVERY  USING    P_DELIVERY. 
DATA : LV_TIME TYPE P DECIMALS 2 VALUE '0.50'. 
CHECK P_DELIVERY IS NOT INITIAL. 
DO 10 TIMES. 
CALL FUNCTION 'ENQUEUE_EVVBLKE' 
EXPORTING 
VBELN          = P_DELIVERY 
EXCEPTIONS 
FOREIGN_LOCK   = 1 
SYSTEM_FAILURE = 2 
OTHERS         = 3. 
IF SY-SUBRC <> 0. 
* Implement suitable error handling here 
ENDIF. 
IF SY-SUBRC EQ 0. 
CALL FUNCTION 'DEQUEUE_EVVBLKE' 
EXPORTING 
MODE_LIKP = 'E' 
MANDT     = SY-MANDT 
VBELN     = P_DELIVERY 
X_VBELN   = ' ' 
_SCOPE    = '3' 
_SYNCHRON = ' ' 
_COLLECT  = ' '. 
EXIT. 
ELSE. 
WAIT UP TO LV_TIME SECONDS. 
ENDIF. 
ENDDO. 
ENDFORM.                    " FRM_LOCK_DELIVERY

原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/18642.html

(0)
上一篇 2021年7月19日
下一篇 2021年7月19日

相关推荐

发表回复

登录后才能评论