2013 Dec 12 5:28 AM
Hi All, I want to a field mandatory thru code, please help me out how to do it with condition which is given below. if PSMERK-ZZACTIVITE = 'AVVT' or PSMERK-ZZFONCTION = 'VTE' then filed PSMERK-ZZMARKET should be mandary endif. if PSMERK-ZZACTIVITE = ' ' or PSMERK-ZZFONCTION = ' ' show message 'please put some value' 'I'. I am not getting how to do filed PSMERK-ZZMARKET madatory for given condition. Thanks and Regards Sankil
Hi,
In Module pool
You can do validation in the PAI for the fields
For multiple fields validation you can use CHAIN..ENDCHAIN
Include the fields in a FIELD statement, and enclose it in a CHAIN-ENDCHAIN block statment. Eg. Screen flow logic: CHAIN. FIELD: SPFLI-CARRID, SPFLI-CONNID. MODULE CHECK_FLIGHT. ENDCHAIN. When an error is found inside a chain, the screen is re-displayed, and all fields found anywhere in the chain are input-enabled. All non-chain fields remain disabled.
In Report .
You can validate these in
At Selection screen or at selection screen on parameter event.
write the necessray code in these events.
2013 Dec 12 5:30 AM
Is it standard tcode or custom one..If custom in PAI you can simply display an error message in chain-endchain statement
Nabheet
2013 Dec 12 5:50 AM
but need to do PSMERK-ZZMARKET filed mandatory for given 2 conditions. i have done like this: IF PSMERK-ZZACTIVITE = 'AVVT' or PSMERK-ZZFONCTION = 'VTE'. PSMERK-ZZMARKET = 'OBLIGATORY' ENDIF. IF PSMERK-ZZACTIVITE = ' ' or PSMERK-ZZFONCTION = ' '. MESSAGE 'PLS PUT SOME VALUE' 'I' ENDIF. The way i have done its right or required some more modification. Thanks and Regards Sankil
2013 Dec 12 6:10 AM
If ( ( PSMERK-ZZACTIVITE = 'AVVT' or PSMERK-ZZFONCTION = 'VTE' )
or (PSMERK-ZZACTIVITE = ' ' or PSMERK-ZZFONCTION = ' ' ) )
message e000 with text 'Please enter value'.
endif.,
2013 Dec 12 6:15 AM
2013 Dec 12 5:49 AM
2013 Dec 12 5:55 AM
Hi,
In Module pool
You can do validation in the PAI for the fields
For multiple fields validation you can use CHAIN..ENDCHAIN
Include the fields in a FIELD statement, and enclose it in a CHAIN-ENDCHAIN block statment. Eg. Screen flow logic: CHAIN. FIELD: SPFLI-CARRID, SPFLI-CONNID. MODULE CHECK_FLIGHT. ENDCHAIN. When an error is found inside a chain, the screen is re-displayed, and all fields found anywhere in the chain are input-enabled. All non-chain fields remain disabled.
In Report .
You can validate these in
At Selection screen or at selection screen on parameter event.
write the necessray code in these events.
2013 Dec 12 6:02 AM
Hi,
How about this.
TABLES : mara, marc.
SELECT-OPTIONS :s_matnr for mara-matnr,
s_mtart for mara-mtart,
s_werks for marc-werks.
AT SELECTION-SCREEN.
If s_matnr is NOT INITIAL and s_mtart is NOT INITIAL.
If s_werks is INITIAL.
Set CURSOR FIELD 'S_WERKS-LOW'.
MESSAGE 'CANNOT BE EMPTY' TYPE 'E'.
ENDIF.
ENDIF.
If s_matnr is INITIAL and s_mtart is INITIAL and s_werks is INITIAL.
Set CURSOR FIELD 'S_MATNR-LOW'.
MESSAGE 'PLEASE PUT SOME VALUE' TYPE 'E'.
ENDIF.
START-OF-SELECTION.
WRITE : 'Hello'.
Regards
2013 Dec 12 8:22 AM
Hi
You can make the field mandatory by giving fieldname-required = 'X' or you can put all the fields that has to be filled mandatory in chain.....endchain and print appropriate messages if values entered are wrong.
With regrads
Suneesh
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |