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

Preventing TECO in case of GI is not done

$
0
0

Introduction

There were two queries in the past, where the control on TECO of Order was sought, in GI related matters.

  1. Prevent TECO if Components exist and Goods movement not done for an Order.
  2. Prevent TECO if open Reservations are there.


These questions are a sort of FAQ, during repetitions of which I often fail to search my own previous replies having solutions, due to the fact that the Titles have many variations. Due to this, to make my search easier and for the purpose of members to find solutions without posting a discussion, I am trying to preserve the solutions I worked out for those queries, which I always test and post.

 

Note:

As always, there can be opinions that we should be able to achieve this through user status route, . But what I observed is that this is not achievable through this method. That too complex requirements in the context of Operations and Components line items of an Order the user-exit/enhancement route does always work perfect.

 

Now let's see the solution codes for the above 2 codes.


The User Exit here

As many of us know that when it is the matter of TECO, the user-exit comes into picture is IWO10004. Here we need to put the codes given below to achieve the above requirements in the include  ZXWO1U03 .

 

The code below works for the 1strequirement.

Prevent TECO if Components exist and Goods movement not done for an Order.


FIELD-SYMBOLS: <fs_resb1> TYPE ANY.
 DATA: BEGIN OF i_resb1 OCCURS 100.         INCLUDE STRUCTURE resb.
 DATA:END OF i_resb1.
 DATA: i_aufm TYPE STANDARD TABLE OF aufm.
 ASSIGN ('(SAPLCOBC)resb_bt[]') TO <fs_resb1>.
 i_resb1[] = <fs_resb1>.  DELETE i_resb1[] WHERE xloek = 'X'.
 IF i_resb1[] IS NOT INITIAL.   SELECT * FROM aufm INTO CORRESPONDING FIELDS OF TABLE i_aufm 
WHERE aufnr = caufvd_imp-aufnr.   IF i_aufm IS INITIAL.     MESSAGE: 'TECO not possible because Goods movement not done.' 
TYPE 'E' DISPLAY LIKE 'I'.   ENDIF.
 ENDIF.
 UNASSIGN: <fs_resb1> .

 

This code, checks the entries in the AUFM table for Goods movement against the current Order and stops TECO if no entries are found. This takes care of the Delete line items also.

 

 

 

The code below works for the 2ndrequirement.

Prevent TECO if open Reservations are there.


FIELD-SYMBOLS: <fs_resb> TYPE ANY.
 DATA: BEGIN OF i_resb OCCURS 100.         INCLUDE STRUCTURE resb.
 DATA:END OF i_resb.
 ASSIGN ('(SAPLCOBC)resb_bt[]') TO <fs_resb>.
 i_resb[] = <fs_resb>.
 DELETE i_resb[] WHERE xloek = 'X'.
 IF i_resb[] IS NOT INITIAL.   LOOP AT i_resb.     IF i_resb-kzear <> 'X'.       MESSAGE: 'Open Reservations Exist, TECO not possible' 
TYPE 'E' DISPLAY LIKE 'I'.     ENDIF.   ENDLOOP.
 ENDIF.
 UNASSIGN: <fs_resb> .

 

This code, checks whether all Reservation items have been done GI or not. If a single one is left without GI or without Deletion indicator, then it prevents the TECO to happen.



Note:

Any user-exit codes we get, should be fine-tuned to our requirements by specifying its limits (like confining it to certain Order type or some other parameter) by enclosing the code into IF and ENDIF.

All user-exits function when they are assigned to a project created through CMOD.

It is obvious that we should text our work well in Dev servers to satisfaction before we adopt it.



Thank you & Regards

KJogeswaraRao


Viewing all articles
Browse latest Browse all 209

Trending Articles