cancel
Showing results for 
Search instead for 
Did you mean: 

co01 co02 about function CO_ZV_ORDER_POST Enhanced

0 Kudos
1,190

Purpose: To find the (se11 table jest) state,At the beginning, I set a breakpoint and found that there was no problem with the enhancement. Afterwards, I removed the breakpoint and it was not enough. I thought that removing the breakpoint sap did not come in. Looking for a long time result, I added a line of code to solve it. I hope to help other friends. Attach my code below

"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""$"$\SE:(2) Function Module CO_ZV_ORDER_POST, End A
*$*$-Start: (2)---------------------------------------------------------------------------------$*$*
ENHANCEMENT 1 ZCO_ZV_ORDER_POST. "active version
*BREAK-POINT.
DATA:LS_JEST TYPE JEST.
DATA:lt_ZTEST03 TYPE STANDARD TABLE OF ZTEST03,
LS_ZTEST03 TYPE ZTEST03.

CLEAR:LS_JEST,lt_ZTEST03[],ls_ZTEST03.
IF SY-TCODE = 'CO01'.
** objn_tab_exp[] = objnr_old_new[].
* CAUFVDG[]
wait UP TO 2 SECONDS.“ this is Necessary, otherwise the code does not work

READ TABLE OBJNR_OLD_NEW INDEX 1.
IF OBJNR_OLD_NEW-NEW_OBJNR IS NOT INITIAL.
clear:LS_JEST.
SELECT SINGLE * INTO CORRESPONDING FIELDS OF LS_JEST FROM JEST
WHERE OBJNR = OBJNR_OLD_NEW-NEW_OBJNR AND STAT = 'I0002' AND INACT <> 'X'.
IF SY-SUBRC = 0.
READ TABLE CAUFVDG INDEX 1.
LS_ZTEST03-AUFNR = CAUFVDG-AUFNR.
LS_ZTEST03-MANDT = SY-MANDT.
APPEND LS_ZTEST03 TO LT_ZTEST03.CLEAR:LS_ZTEST03.
MODIFY ZTEST03 FROM TABLE LT_ZTEST03.
IF SY-SUBRC = 0.
COMMIT WORK AND WAIT.
ENDIF.
ELSE.
DELETE FROM ZTEST03 WHERE AUFNR = CAUFVDG-AUFNR.
IF SY-SUBRC = 0.
COMMIT WORK AND WAIT.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
IF SY-TCODE = 'CO02'.
wait up to 2 SECONDS..“ this is Necessary, otherwise the code does not work

* 结构CAUFVBO
IF CAUFVBO-OBJNR IS NOT INITIAL.
clear:LS_JEST.
SELECT SINGLE * INTO CORRESPONDING FIELDS OF LS_JEST FROM JEST
WHERE OBJNR = CAUFVBO-OBJNR AND STAT = 'I0002' AND INACT <> 'X'.
IF SY-SUBRC = 0.
READ TABLE CAUFVDG INDEX 1.
LS_ZTEST03-AUFNR = CAUFVDG-AUFNR.
LS_ZTEST03-MANDT = SY-MANDT.
APPEND LS_ZTEST03 TO LT_ZTEST03.CLEAR:LS_ZTEST03.
MODIFY ZTEST03 FROM TABLE LT_ZTEST03.
IF SY-SUBRC = 0.
COMMIT WORK AND WAIT.
ENDIF.
ELSE.
DELETE FROM ZTEST03 WHERE AUFNR = CAUFVDG-AUFNR.
IF SY-SUBRC = 0.
COMMIT WORK AND WAIT.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDENHANCEMENT.

Accepted Solutions (0)

Answers (0)