Hello Nagaraju,
Here is the solution.
Objective:
This code prevents changes in Operation text if the Operation is in confirmed status.
Notes:
- This prevention error triggers only when such operation is in fully confirmed status
- This prevention error triggers while Saving the Order.
- If the confirmation of operation is cancelled (IW45), then the text changes take place.
- This does not stop you from making text changes in operations of other statuses.
- This does not stop from adding or deleting operations.
The following code to be used in the include ZXWOCU07 of user-exit IWO10009 .
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: wa2 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_afvc INTO wa1.
READ TABLE i_afvg INTO wa2 WITH KEY objnr = wa1-objnr.
IF sy-subrc = 0.
DATA:i_stat LIKE jstat OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'STATUS_READ'
EXPORTING
objnr = wa1-objnr
only_active = 'X'
TABLES
status = i_stat.
LOOP AT i_stat.
IF i_stat-stat = 'I0009'.
IF wa1-ltxa1 <> wa2-ltxa1.
MESSAGE: 'You can not make changes in texts of confirmed Operations'
TYPE 'E' DISPLAY LIKE 'I'.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDIF.
This triggers the following error pop-up, while saving the Order, in case some text changes are found in any one of the confirmed operations of the Order.
Upon hitting the Enter key the popup goes away and user gets access to correct the changes made and Save the Order.
Believe this is the solution you are looking for. Implement with support of ABAPer, if you are not one.
Good luck
KJogeswaraRao