cancel
Showing results for 
Search instead for 
Did you mean: 

user status on PM order

Former Member
0 Kudos

Hi Experts

Is there any way to block the change on PM order via user status.

Requirement is, when a user status is set to block the change in PM order, user should not allow to do any change in PM order unless the user status is set to allow for change.

Regards

Saidasan

View Entire Topic
jogeswararao_kavala
Active Contributor
0 Kudos

Hello Saidasan,

In my opinion user-exit solution works well for such requirements. IWO10009 is the user-exit here. In your specific case the following code in include ZXWOCU07 would fulfill your requirement.


Assuming your user status is WCNP which should stop changes in Order, then the code is:


DATA:I_STAT LIKE JSTAT OCCURS 0 WITH HEADER LINE,
      L_OBJNR TYPE J_OBJNR.

SELECT SINGLE OBJNR FROM AUFK INTO L_OBJNR WHERE AUFNR = CAUFVD_IMP-AUFNR.

CALL FUNCTION 'STATUS_READ'
   EXPORTING
     OBJNR       = L_OBJNR
     ONLY_ACTIVE = 'X'
   TABLES
     STATUS      = I_STAT.

IF SY-TCODE = 'IW32'.
   LOOP AT I_STAT.
     IF I_STAT-STAT = 'E0001'.
       MESSAGE: 'You can not make changes in Order with ''WCNP'' status'
     TYPE 'E' DISPLAY LIKE 'I'.
     ENDIF.
   ENDLOOP.
ENDIF.

Note: 'E0001 ' value used in the code above, is the code for WCNP status in table TJ30T.

This code throws the following pop-up where user tries to change the Order which has WCNP user status set. If the userstatus is changed then the changes can take place.

Good luck

KJogeswaraRao