SD_ORDER_CREDIT_CANCEL
SD_WF_ORDER_REJECT
The idea is to mass reject any order older than 21 days.
I have tried with BDC recording of transaction VKM4, but the program I end up with stops if any line can not be rejected.
This is the code in include DBKMVF02, that preselects the lines that are pending and that are only sales orders and deliveries:
- Code: Select all
FORM USER_EXIT_FUELLEN_XVBKRED.
*{ INSERT D10K903236 1
*IF SY-BATCH = 'X'.
DATA: l_job TYPE TBTCM-JOBNAME.
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
JOBNAME = l_job
EXCEPTIONS
NO_RUNTIME_INFO = 1
OTHERS = 2 .
*IF l_job = 'ZVKM4MRP'.
DATA: ZDATE TYPE I.
LOOP AT XVBKRED.
ZDATE = SY-DATUM - XVBKRED-ERDAT.
IF ZDATE < 21.
DELETE XVBKRED.
CLEAR ZDATE.
CONTINUE.
ENDIF.
IF XVBKRED-VBTYP <> 'C' AND XVBKRED-VBTYP <> 'J'.
DELETE XVBKRED.
CONTINUE.
ENDIF.
*???
ENDLOOP.
*ENDIF.
*ENDIF.
*} INSERT
ENDFORM.

