While replying to a query few days ago, I was searching for a previous thread where I replied in detail on that issue. I wanted to simply give the link and thereby save time and efforts in replying. I spent lot of time in locating the thread but had to reply without that link. There are several reasons for being unable to search such previous threads. However, the subject of this post is not that, but it is about how to preserve vital solutions previously worked and tested upon while replying to discussions. With this objective the author in the past documented few such works to Blog posts. The present post is also about one such solution provided to a query few months ago.
The author of that query was having a requirement to release his sub-order/s automatically when he releases his superior order. The solution provided was through User Exit IWO10009. Put the following code in the include ZXWOCU07.
TYPES: BEGIN OF TY_SO, AUFNR TYPE AUFK-AUFNR, OBJNR TYPE AUFK-OBJNR, END OF TY_SO. DATA: IT_SO TYPE TABLE OF TY_SO, WA_SO LIKE LINE OF IT_SO. SELECT AUFNR OBJNR FROM VIAUFKS INTO CORRESPONDING FIELDS OF TABLE IT_SO WHERE MAUFNR = CAUFVD_IMP-AUFNR. DATA: IT_STAT TYPE TABLE OF JSTAT, WA_STAT TYPE JSTAT. WA_STAT-STAT = 'I0002'. WA_STAT-INACT = ' '. APPEND WA_STAT TO IT_STAT. IF CAUFVD_IMP-IPHAS = '2'. LOOP AT IT_SO INTO WA_SO. CALL FUNCTION 'STATUS_CHANGE_INTERN' EXPORTING OBJNR = WA_SO-OBJNR TABLES STATUS = IT_STAT. ENDLOOP. ENDIF.
As per this code, when user Releases the superior order and saves; all the sub orders under the superior order are automatically released.
Hope that many other members with such requirements for sub-orders would be benefited with this ready solution.