cancel
Showing results for 
Search instead for 
Did you mean: 

Check on user status

Former Member
0 Kudos

Dear Experts,

I have a case, where maintenance order user status are set using z tcode and can be set using iw32. but some users do not follow the designed process and bypass the process by changing user status through iw32.

Now can i restrict change of user status through iw32. what are the possible ways to handle it?? if i restrict iw32, users would not be able to do their other tasks. Please help...

Accepted Solutions (0)

Answers (2)

Answers (2)

jogeswararao_kavala
Active Contributor
0 Kudos

pawan

Responding to your initial query.

Solution

User-exit: IWO10009

Put the following code int he include of the exit  (ZXWOCU07).


DATA: itab  TYPE TABLE OF jcds,

       wa    TYPE jcds,

       v_stat TYPE tj30t-txt04.

SELECT * FROM jcds INTO TABLE itab WHERE objnr = caufvd_imp-objnr AND cdtcode = 'IW32'  AND inact = ''.

SORT itab BY chgnr DESCENDING.

DELETE ADJACENT DUPLICATES FROM itab COMPARING objnr.

LOOP AT itab INTO wa.

   CLEAR: v_stat.

   SELECT SINGLE txt04 FROM tj30t INTO v_stat WHERE estat = wa-stat AND stsma = 'PM_ORD1'.

   IF v_stat <> caufvd_imp-asttx+0(4).

     MESSAGE: 'User status change is not permitted from ''IW32''.' TYPE 'E'  DISPLAY LIKE 'I'.

   ENDIF.

ENDLOOP.

This throws the following error whenever the user status is attempted to be changed using IW32.

NOTE:

  • It is assumed that you have single status in the user status.
  • 'PM_ORD1' in the code above should be replaced by your Order Status profile .
  • If you want to confine the above to a particular order type say PM02, then put the above code between these two lines.

IF caufvd_imp-auart = 'PM02'.

<above code here >

ENDIF.

Good luck

KJogeswaraRao

Former Member
0 Kudos

Rao Sir,

Thanks for the reply,

But in my case there are 5 user status, but only last two need to be restricted using iw32, rest are allowed.

jogeswararao_kavala
Active Contributor
0 Kudos

In that case 75% of the code will be useful to you. Rest your ABAPer should fulfill. The above code gives you the guidelines in which the code has to proceed.

MTerence
Active Contributor
0 Kudos

Hi Pawan,

There are two ways on doing this

1. Authorization

You need to discuss with Basis / Security team to built up authorization.

Based on the limitation you provide, different roles can be created to control the process to access User Status. These roles will be assigned to specific user.

2. User Exit

You need to contact your abap team and provide your requirement to control the usage of User Status. They will create programs to do it.

In case if you are a end user, contact your Functional Consultant.

Regards

Terence

Former Member
0 Kudos

Thanks Maria,

Thanks for the reply

OPTION 1: it does not look feasible as user does the same process using designed ztcode and should not allowed to iw32. if i restrict it using role, other authorisation to set user status also failed in z code as it is calling standard bapi to change the status.

OPTION 2: It seems feasible but everyone including superusers could not do it using iw32 if i do it this way.

So i am still confused??

MTerence
Active Contributor
0 Kudos

Hi Pawan,

Will the user access both IW32 and Ztcode ? If not, then you need to have separate roles for IW32 and Ztcode with user status.

In one of our client, we have hard code a role in the program like changing basic start date of the work order. So the user with the specific role can change the basic start date, else system will display an error. This was done using role and user exit.

With the solution Jogeswara provided, if we are able to restrict with one status, then for sure we can have multiple user status. You need to discuss with your abaper, abaper will be able to resolve your issue.

Regards

Terence