2005 Sep 14 5:36 PM
I need to modify the behaviour of VA42 (Contract Change) as follows:
If field VBAK-MAHDT is not initial and doc types are Z020-Z022, do not allow any changes to any fields except to field VBAK-MAHDT.
If that field is initial, VA42 should work as normal.
I've tried making this coding change in form userexit_field_modification in MV45AFZZ. However it does not perform as desired.
if sy-tcode = 'VA42'.
if ( ( vbak-auart = 'Z020' )
or ( vbak-auart = 'Z021' )
or ( vbak-auart = 'Z022' ) ).
if vbak-mahdt is initial.
else.
message W899 with 'Change not allowed'.
endif.
endif.
endif.
Any suggestions are welcome.
Thanks.
2005 Sep 14 6:09 PM
To change screen attributes you will have to loop in screen table in PAI user exit,
Try program MV45AFZZ_USEREXIT_FIELD_MODIFI
To change screen attributes you will have to loop in screen table in PAI user exit,
Try program MV45AFZZ_USEREXIT_FIELD_MODIFI
2005 Sep 14 5:44 PM
Hi ,
This subroutine userexit_field_modification is called in PBO. Please try subroutine USEREXIT_SAVE_DOCUMENT_PREPARE.
Cheers
2005 Sep 14 5:44 PM
2005 Sep 14 5:47 PM
Whenever I've become confused by to many nested 'if' statements, I try to rewrite it as a 'case' structure.
case vbak-auart .
when 'Z020'.
....
when 'Z021'.
...
when space .
...
when others .
endcase.
That makes each inspection point isolated.
2005 Sep 14 5:52 PM
2005 Sep 14 5:58 PM
Have you tried to use USEREXIT_CHECK_VBAK and
USEREXIT_CHECK_VBAP in MV45AFZB.
Max
2005 Sep 14 6:02 PM
Thanks everyone for their reply. I am still checking out some of the suggestions.
However I've modified the code as such and am very close to a solution. The problem with the below code is that not all fields are being protected from input, e.g. Contract Dates, and I can also add a line item. I guess what I am aiming for is for it to look and behave like VA43 where ALL fields are protected EXCEPT the one the user is allowed to change.
if sy-tcode = 'VA42'.
if ( ( vbak-auart = 'Z020' )
or ( vbak-auart = 'Z021' )
or ( vbak-auart = 'Z022' ) ).
if vbak-mahdt is initial.
else.
if screen-name = 'VBAK-MAHDT'.
else.
screen-input = 0.
endif.
endif.
endif.
endif.
2005 Sep 14 6:09 PM
To change screen attributes you will have to loop in screen table in PAI user exit,
Try program MV45AFZZ_USEREXIT_FIELD_MODIFI
2005 Sep 14 11:25 PM
Sanjay,
Your response seems to be working better for me than the others at the moment.
The problem with this section is that it's not called on any screen VEDA screen fields. Therefore they are all staying unprotected. Furthermore, the text field on the Text tabs are unprotected as well as any fields where there are multiple lines of input.
I tried to make a modification to the form USEREXIT_FIELD_MODIFICATION in include LV45WFZZ. I have access to the VEDA fields here. However I have no access to the contents of VBAK which are critical to my logic.
Do you or anyone else have other suggestions?
Bottom line under certain conditions of VBAK, I want VA42 to operate just like VA43 except ONE field is unprotected and modifiable.
2005 Sep 15 12:28 AM
I've resolved the screen protect problem on any VEDA related fields.
Now my only problem is that repeatable fields, such as line item, etc are still updateable.
Any other recommendations are welcome.
Wardell
2005 Sep 15 2:04 AM
If you want only certain few fields to be open for editing then put your if condition accordingly ( screen-input = 1 ) and for all other screen elements make screen-input = 0.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |