Quantcast
Channel: SCN : Blog List - All Communities
Viewing all articles
Browse latest Browse all 2548

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.

 

One way of doing this definitely 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 refused his changes when he tries to Save the Order.

 

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'.



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' see the codes for various cases and situations.

 

First we look at the Case1, Situation1: For all Orders of certain Order 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 Order type and in REL status, Stopping user to enter th 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.

 

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 any other Order related field you can have). Create this table with TMG (Table maintenance Generator) so that you will be able to update this table 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.



Conclusion

We may have several similar situations. How this post helps is, it presents a way for all such requirements to achieve 'Converting IW32 to Display mode' OR 'Outright refusal to enter the Order screen'. All cases other than already illustrated can be very easily managed through simple changes in the codes given by the ABAPer.



Thank you and Regards

KJogeswaraRao

 





Viewing all articles
Browse latest Browse all 2548

Trending Articles



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