Quantcast
Channel: Enterprise Asset Management (SAP EAM)
Viewing all articles
Browse latest Browse all 209

IW32 to Display mode

$
0
0

Hello friends,

 

Continuing the process of preserving the solutions to Frequently Asked Questions, today I chose this subject. Few might have understood the possible need behind this simple title. However, I will explain.

 

The Background:

There were threads asking for solution where they want Orders with some status to be prohibited from processing. The 'Do not Execute' function is the ready answer for the Orders which are in CRTD status. But generally the queries were for REL Orders? There are two situations of this requirement.

  • In Case1, customer wants all the Orders of certain Order type and in REL status are to be prevented from changes, Only viewing should be possible through IW32.
  • In Case2, specific Orders faultily created and released need to be prevented from processing.

 

Similarly there were queries where Authorization check at the initial screen of IW32 was sought. Obviously this as an alternative route to control through Roles.

  • We take this as Case3 of this blog .

 

One way of doing addressing all these is definitely through user-exit IWO10009. But this method stops users at the time of Saving the Order. Means, user spends time and effort to make all changes in the Order and system refuses his changes when he tries to Save the Order. Also achieving a perfect solution for Cases1,2 through user-status (OIBS) transaction control is not possible.

 

So the requirement is to stop the user in the beginning itself of IW32. The ways to do it.

  • Change the IW32 to display mode for all such Orders
  • Stop user at the initial screen of IW32 itself by throwing a message such as 'This Order is prohibited from changes, use IW33 for viewing' OR 'You are not authorized for IW32' .



The Solutions:

The solutions discussed here are very effective using an Implicit Enhancement point in the include LCOIHF7R of Order program (SAPLCOIH). Here there is an enhancement point at line number 250 which is at the end of the form AUTHORITY_CHECK_AUART_SMOD .

 

The place to put our code:

1.JPG

 

Means, I have created an Enhancement named ZPM_STAT at the enhancement point provided by the system, where I got access to put my code. Now let's see the codes for various cases and situations.

 

First we look at the Case1, Situation1: For all Orders of certain Type and in REL status, Converting IW32 to Display mode


The code:

DATA: it_stat TYPE STANDARD TABLE OF jstat,       wa_stat TYPE jstat.
 IF caufvd-auart = 'ZM03' AND  sy-tcode = 'IW32'.   CALL FUNCTION 'STATUS_READ'     EXPORTING       objnr            = caufvd-objnr       only_active      = 'X'     TABLES       status           = it_stat     EXCEPTIONS       object_not_found = 1       OTHERS           = 2.   IF sy-subrc <> 0.   ENDIF.   LOOP AT it_stat INTO wa_stat.     IF wa_stat-stat = 'I0002'.       tc10-trtyp = 'A'.   "Replace 'V' by 'A'.       MESSAGE: 'Changing to Display' TYPE 'S'.     ENDIF.   ENDLOOP.
 ENDIF.

This code turns IW32 to Display mode for all released ZM03 Orders (you will change this Order type to yours)

 

 

Case1: Situation2: For all Orders of certain Type and in REL status, Stopping user to enter the Order through IW32.

 

The syntax to be used here has little changes. (Same code as above upto line no.18)

DATA: it_stat TYPE STANDARD TABLE OF jstat,       wa_stat TYPE jstat.
 IF caufvd-auart = 'ZM03' AND  sy-tcode = 'IW32'.   CALL FUNCTION 'STATUS_READ'     EXPORTING       objnr            = caufvd-objnr       only_active      = 'X'     TABLES       status           = it_stat     EXCEPTIONS       object_not_found = 1       OTHERS           = 2.   IF sy-subrc <> 0.   ENDIF.   LOOP AT it_stat INTO wa_stat.     IF wa_stat-stat = 'I0002'.     MESSAGE: 'This Order has been prohibited from changes. For viewing use tcode ''IW33''.'       TYPE 'E' DISPLAY LIKE 'I'.     ENDIF.   ENDLOOP.
 ENDIF.

 

This throws this error popup at the initial screen of IW32 for all ZM03 Released Orders.

Capture.JPG.

 

NOTE:

In cases like this, the user can do TECO and CLSD through IW38.

 

 

 

Now let's look at Case2

Case2: Specific Orders to be barred from handling. Means users to be stopped at the initial screen of IW32.
Obviously, these Orders can be any type. Because this requirement as mentioned earlier is often for defective Creations which were already put into REL status.

 

Pre-requisite to handle this situation

Create a Ztable say ZPM_BLK_ORD having the Order(aufnr) field. (If you want more Order related fields you can have). Create this table with TMG (Table maintenance Generator) so that you will be able to update this table (Add/Delete) with Order numbers through tcode SM30 or through a Ztcode.

 

Now, the code in this case.

DATA: v_aufnr TYPE aufk-aufnr.
 CLEAR: v_aufnr.
 SELECT single aufnr FROM zpm_blk_ord  INTO v_aufnr WHERE aufnr = caufvd-aufnr.   IF v_aufnr IS NOT INITIAL.   MESSAGE: 'This Order has been prohibited from changes.' TYPE 'E' DISPLAY LIKE 'I'.   ENDIF.

This also throws similar error popup as shown earlier when user tries to use IW32 for all such Orders which are entered in the ztable ZPM_BLK_ORD.



Now let's see the Case3.

Case3: Specific Users to be restricted from handling IW32.


Pre-requisite to handle this situation

Create a Ztable say ZPM_BLK_USR having the UserId(uname) field. As above create this table with TMG .

 

Now the code in this case.

DATA: v_uname TYPE uname.
 CLEAR: v_uname.
 SELECT single uname FROM zpm_blk_usr  INTO v_unmae WHERE uname = sy-uname.   IF v_uname IS NOT INITIAL.   MESSAGE: 'You are not authorized for IW32.' TYPE 'E' DISPLAY LIKE 'I'.   ENDIF.

 

This also throws similar error popup as shown earlier when user tries to use IW32 , whoseuserId has been included in the ztable ZPM_BLK_USR..



Conclusion

We may have several similar situations. How this post helps is, it is giving the information about the enhancement point and giving sample codes which will be helpful in meeting similar requirements. All cases other than already illustrated can be very easily managed through simple changes in the codes given.

 

 

Hope members will find this post useful.


Thank you and Regards

KJogeswaraRao


Viewing all articles
Browse latest Browse all 209

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>