on 11-18-2004 7:37 AM
How to selection screen field mandatory at runtime
You can use the addition 'OBLIGATORY' to make a selection screen field mandatory while declaring the same.
Eg.
PARAMETERS: p_carr TYPE spfli-carrid OBLIGATORY.
SELECT-OPTIONS : s_carr for spfli-carrid OBLIGATORY.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you make it mandatory during runtime using
screen-required = '1'.
Then you may not be able to make it not mandatory later(If the user takes some other option).
So better try with user-command option with select-option
and give message(Status) forcing the user to enter the field.
Regards,
Bejoy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
To compile;
"OBLIGATORY" addition sets the parameter's or select-option's attribute staticaly, however it can be overwritten at
standard event 'AT SELECTION-SCREEN OUTPUT' .
Using 'AT SELECTION-SCREEN OUTPUT' event you can dynamically set selection screen field properties.
That is; it is like PBO of the selection screen. It is triggered before whenever the screen is displayed.
To change a screen field attribute, you can use 'LOOP AT SCREEN'. (no WHERE clause available)
<u><b>e.g.</b></u>
PARAMETERS p_par1 LIKE sy-datum .
....
AT SELECTION-SCREEN OUTPUT .
LOOP AT SCREEN .
IF screen-name = 'P_PAR1' . "always use uppercase"
screen-required = '1' .
MODIFY SCREEN . "do not forget to commit your change with this line"
ENDIF .
ENDLOOP .
To group some fields which will be treated similar at this manner, you can group them.
For example, the code snippet below will make <i>p_par1</i> and <i>p_par2</i> obligatory at runtime.
PARAMETERS: p_par1 LIKE sy-datum MODIF ID m01 ,
p_par2 LIKE mara-matnr MODIF ID m01 ,
p_par3 LIKE p0001-pernr .
AT SELECTION-SCREEN OUTPUT .
LOOP AT SCREEN .
IF screen-group1 = 'M01' . "always use uppercase"
screen-required = '1' .
MODIFY SCREEN . "do not forget to commit your change with this line"
ENDIF .
ENDLOOP .
For more information;
You can refer to Horst Keller's ABAP book, standard SAP courses and <a href="http://help.sap.com">online SAP Help</a>.
*--Serdar
LOOP AT SCREEN.
CASE SCREEN-NAME.
WHEN 'FIELDNAME'.
SCREEN-REQUIRED = 'X'. " or probably '1'
ENDCASE.
MODIFY SCREEN.
ENDLOOP.
For more help, you can refer PARAMETERS --> MODIF-ID
Regards,
Subramanian V.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HiKaushik,
Yes you can:
PARAMETERS:
pa_check TYPE c.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
CASE screen-name.
WHEN 'PA_CHECK'.
screen-required = '1'.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
Regards,
John.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
On selection screen output .
Loop at screen .
set the scree-required field to '1' .
modify screen.
endloop .
Regards
Raja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.