Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
jogeswararao_kavala
Active Contributor

As the title indicates, this post is to utilize the very useful user-exit IWO10009 for the purpose of preventing changes in Operation tab. In fact utilizing this exit for control over Components tab and Operation tab is not  straight forward, because here tables are involved, listing number of Components or number of Operations. For such requirements we need to know the respective program and the run-time memory (internal table). During such requirement in components tab by a member in the past, some research was done and the required program and the internal table were found to access the runtime memory of the program for Components tab. The program was SAPLCOBC and the internal table was RESB_BT . Using this information the control desired by the member was achieved and later this code was preserved in the post Specify conditions for Components in PM Order (User Exit IWO10009) .

In a similar way, recently one more member was asking for control over Operations tab, such as he should be able to Restrict changes in Operations tab once the Order has been released.

So things are similar, only thing is to know the Program and internal table corresponding to Operation tab. After I searched net, including SCN, I could get the information on this. The program is SAPLCOBO and the internal table is AFVG_BT. Once we knew this information a simple code (given below) in the include ZXWOCU07 of user-exit IWO10009, would prevent any changes in Operations tab after Order Release.


IF CAUFVD_IMP-IPHAS <> '0' AND SY-TCODE = 'IW32'.

   FIELD-SYMBOLS: <FS_AFVG> TYPE ANY.

   DATA: BEGIN OF I_AFVG OCCURS 100.
           INCLUDE STRUCTURE DFPS_AFVG_BT .
   DATA:END OF I_AFVG.

   ASSIGN ('(SAPLCOBO)AFVG_BT[]') TO <FS_AFVG>.
   I_AFVG[] = <FS_AFVG>.

   LOOP AT I_AFVG.
     IF I_AFVG-VBKZ <> ''.
       MESSAGE: 'Operation changes not permitted after Order release' TYPE 'E' DISPLAY LIKE 'I'.
     ENDIF.
   ENDLOOP.
  ENDIF.
























This throws the following pop-up error at the Save event, when user makes some changes in Operations tab.

There can be many deeper requirements for the users, to specify some conditions for changes in Operations tab, in stead of completely preventing changes. All these requirements will be now possible for an ABAPer by developing the above code. The key information is the program SAPLCOBO  and the internal table AFVG_BT  which has been already known to us.

Alternatively, a Function module to do the same job:

I was further researching and found a Function Module in this area to capture the runtime memory of the Operations tab. The FM is CO_BO_AFVGBT_GET.


So, I experimented and good results are there with the following code. This way we can make use of this FM to detect changes in specific fields of operations tab. In the later part of the following code this was illustrated through a field ARBEI (work involved in the activity).


IF CAUFVD_IMP-IPHAS <> '0' AND SY-TCODE = 'IW32'.
   DATA: VBKZ TYPE AFVGB-VBKZ.

   DATA: I_AFVC TYPE STANDARD TABLE OF VIAUF_AFVC,
         WA1 LIKE LINE OF I_AFVC.

   SELECT * FROM VIAUF_AFVC INTO TABLE I_AFVC WHERE AUFNR = CAUFVD_IMP-AUFNR.


   DATA: BEGIN OF I_AFVG OCCURS 100.
           INCLUDE STRUCTURE AFVGD.
   DATA:END OF I_AFVG.

   DATA: WA LIKE LINE OF I_AFVG.

   CALL FUNCTION 'CO_BO_AFVGBT_GET'
     EXPORTING
       AUFNR_IMP  = CAUFVD_IMP-AUFNR
     TABLES
       AFVGBT_EXP = I_AFVG[].


   LOOP AT I_AFVG.
     IF ( I_AFVG-PHFLG = '' AND I_AFVG-VSTTXT+0(3) = 'DLT' )
       OR
       I_AFVG-OBJNR+0(2) <> 'OV'.
       MESSAGE 'Operation addition /deletions not permitted after Order release' TYPE 'E' DISPLAY LIKE 'I'.
     ENDIF.
   ENDLOOP.


   LOOP AT I_AFVC INTO WA1.
     READ TABLE I_AFVG INTO WA WITH KEY AUFPL = WA1-AUFPL APLZL = WA1-APLZL.
     IF SY-SUBRC = 0.
       IF WA1-ARBEI <> WA-ARBEI.
         MESSAGE 'Operation changes not permitted after Order release' TYPE 'E' DISPLAY LIKE 'I'.
       ENDIF.
     ENDIF.
   ENDLOOP.

ENDIF.













The code from line 23 to 29, detects any operation deletion / additions and throws an error pop-up that  'Operation addition /deletions not permitted after Order release' ,  whereas the code from lines 32 to 39 identifies any changes done to the ARBEI field (Work), and if so throws an error pop-up that  'Operation changes not permitted after Order release'


Thus this FM brings every field in the Operations tab to user control for use in the user-exit IWO10009. Hope users will be benefited with this post. The main objective of post like this as I use to say, is to preserve this recently acquired piece of knowledge at a place, to be able to find easily (even by me), whenever needed.

----------------------------------------------------------------------------------------------------------------------------------------------------------------

12/02/2016

The discussion below is another case where a member had the requirement of preventing changes in texts of Confirmed operations.


Restrict end user to change confirmed operations texts in a  work order


------------------------------------------------------------------------------------------------------------------------------------------------

jogeswararao.kavala/content

------------------------------------------------------------------------------------------------------------------------------------------------

Thank you

KJogeswaraRao

9 Comments
Labels in this area