cancel
Showing results for 
Search instead for 
Did you mean: 

CO_ORDER : remove flag deletion

Former Member
0 Kudos

Hi expert,

do you know a program to remove flag deletion on internal orders set by the RKOREO01 program?

The orders flagged are still in use...8-§

Thanks a lot for your help.

ASO

Accepted Solutions (0)

Answers (1)

Answers (1)

oliviawalsh
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello...

Once the deletion indicator for internal orders has been set, the

standard design does not allow this to be altered. This is because

changing this indicator may result in inconsistencies between the

R/3 system and the archive files.

The code below describes how to reset this indicator. Please

be aware that SAP is NOT held responsible for any possible problems

resulting from the implementation of this program.

When you run the program, make sure that nobody else is doing

anything with the orders, especially that no archiving is run.

Normally you cannot take back the deletion indicator, so

inconsistencies might occur if the orders are accessed during the

run of the program.

As far as I know this program is useful if there are just a few orders

with this indicator set. But if there are many orders, you should

rethink the issue and the need to take back the indicator.

Best regards,

Olivia

PROGRAM ZKLOEKZ.

TABLES: vsaufk, aufk.

SELECTION-SCREEN: ULINE,

COMMENT /1(72) LINE1,

COMMENT /1(72) LINE2,

COMMENT /1(72) LINE3,

COMMENT /1(72) LINE4,

ULINE, SKIP 1.

PARAMETERS:

TESTMODE DEFAULT 'X' AS CHECKBOX.

SELECT-OPTIONS:

order FOR vsaufk-aufnr MATCHCODE OBJECT orde.

DATA: count LIKE sy-dbcnt.

DATA: BEGIN OF auf OCCURS 1.

INCLUDE STRUCTURE vsaufk.

DATA: END OF auf.

DATA: BEGIN OF status OCCURS 1.

INCLUDE STRUCTURE jstat.

DATA: END OF status.

INITIALIZATION.

MOVE 'ATTENTION !!!' TO LINE1.

MOVE 'SAP does not accept responsibility for problems that' TO LINE2.

MOVE 'might arise from the use of this report !' TO LINE3.

MOVE 'Please see note 196637.' TO LINE4.

START-OF-SELECTION.

SELECT * FROM vsaufk INTO TABLE auf

WHERE aufnr IN ORDER

AND stat = 'I0013'

AND ( autyp = '01' OR autyp = '04' )

AND loekz = 'X'.

status-stat = 'I0013'.

status-inact = 'X'.

APPEND status.

IF sy-subrc <> 0.

WRITE 'No internal/CO-production orders found !'.

EXIT.

ENDIF.

LOOP AT auf.

CALL FUNCTION 'STATUS_CHECK'

EXPORTING

objnr = auf-objnr

status = 'I0013'

EXCEPTIONS

status_not_active = 2.

IF sy-subrc = 2.

WRITE: / 'Order ', auf-aufnr, ': Deletion indicator not active.'.

CONTINUE.

ENDIF.

IF testmode IS INITIAL.

CALL FUNCTION 'ENQUEUE_ESORDER'

EXPORTING

aufnr = auf-aufnr

EXCEPTIONS

foreign_lock = 1.

IF sy-subrc <> 0.

WRITE: / 'Order ', AUF-AUFNR, ' is currently blocked.'.

CONTINUE.

ENDIF.

CALL FUNCTION 'STATUS_CHANGE_INTERN'

EXPORTING

objnr = auf-objnr

TABLES

status = status.

CHECK sy-subrc = 0.

UPDATE aufk SET aenam = sy-uname

aedat = sy-datum

WHERE aufnr = auf-aufnr.

IF sy-subrc <> 0.

WRITE: / 'Order ', auf-aufnr, ': Error during AUFK-Update.'.

ENDIF.

ENDIF.

WRITE: / 'Order ', auf-aufnr, ': Deletion indicator removed.'.

IF NOT testmode IS INITIAL.

WRITE: ' - Testmode'.

ENDIF.

ADD 1 TO count.

IF count = 100.

IF TESTMODE IS INITIAL.

COMMIT WORK.

ENDIF.

CLEAR count.

ENDIF.

ENDLOOP.

IF TESTMODE IS INITIAL.

COMMIT WORK.

ENDIF.

SKIP 1.

WRITE: 'Program finished.'.