‎2007 May 09 7:19 PM
Hello friends,
I have a selection screen which has the chek box.
By default the check box is not checked and i have a obligatory field in my selection screen.
However when the check box is checked i need to make the obligatory field. as a non obligatory.
Please suggest me.
Ster.
SELECTION-SCREEN : BEGIN OF BLOCK 1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_matnr FOR zrcpt-matnr,
s_werks FOR zrcpt-werks OBLIGATORY,
s_lgort FOR zrcpt-lgort.
PARAMETERS : chkbox AS CHECKBOX.
SELECTION-SCREEN : END OF BLOCK 1.
‎2007 May 09 7:23 PM
Hi,
Instead of using the OBLIGATORY you can validate in the AT SELECTION-SCREEN event...CHanges marked in bold.
SELECTION-SCREEN : BEGIN OF BLOCK 1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_matnr FOR zrcpt-matnr,
s_werks FOR zrcpt-werks, <b>" REmoved the obligatory</b>
s_lgort FOR zrcpt-lgort.
PARAMETERS : chkbox AS CHECKBOX <b>USER-COMMAND USR</b>.
SELECTION-SCREEN : END OF BLOCK 1.
AT SELECTION-SCREEN.
IF chkbox IS INITIAL.
Validate
IF s_werks[] IS INITIAL.
MESSAGE E208(00) WITH 'Plant is Mandatory'.
ENDIF.
ENDIF.
Thanks,
Naren
‎2007 May 09 7:23 PM
Hi,
Instead of using the OBLIGATORY you can validate in the AT SELECTION-SCREEN event...CHanges marked in bold.
SELECTION-SCREEN : BEGIN OF BLOCK 1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_matnr FOR zrcpt-matnr,
s_werks FOR zrcpt-werks, <b>" REmoved the obligatory</b>
s_lgort FOR zrcpt-lgort.
PARAMETERS : chkbox AS CHECKBOX <b>USER-COMMAND USR</b>.
SELECTION-SCREEN : END OF BLOCK 1.
AT SELECTION-SCREEN.
IF chkbox IS INITIAL.
Validate
IF s_werks[] IS INITIAL.
MESSAGE E208(00) WITH 'Plant is Mandatory'.
ENDIF.
ENDIF.
Thanks,
Naren
‎2007 May 09 7:23 PM
Hi,
You will have to some of the following steps
1). Assign a USERCOMMAND for the check box.
2). Assign a MODIF ID to the filed for which you want to make changes.
3). Write the event AT SELECTION-SCREEN OUTPUT
4). Inside the event AT SELECTION-SCREEN OUTPUT loop at the SCREEN table and modify the atrribute of the field which you want to make it non mandatory.
A sample program
REPORT demo_at_selection_screen_pbo.
PARAMETERS: test1(10) TYPE c MODIF ID sc1,
test2(10) TYPE c MODIF ID sc2,
test3(10) TYPE c MODIF ID sc1,
test4(10) TYPE c MODIF ID sc2.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = 'SC1'.
screen-intensified = '1'.
MODIFY SCREEN.
CONTINUE.
ENDIF.
IF screen-group1 = 'SC2'.
screen-intensified = '0'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Cheers
VJ
Message was edited by:
Vijayendra Rao
‎2007 May 09 7:25 PM
In that case, you can use the OBLIGATORY keyword. You must do something like this.
report zrich_0001.
tables: mard.
selection-screen : begin of block 1 with frame title text-001.
select-options : s_matnr for mard-matnr,
s_werks for mard-werks, " OBLIGATORY,
s_lgort for mard-lgort.
parameters : chkbox as checkbox.
selection-screen : end of block 1.
at selection-screen.
if chkbox = 'X'.
if s_werks[] is initial.
message e001(00) with 'Hey, enter something in the S_WERKS field'.
endif.
endif.
Regards,
Rich Heilman
‎2007 May 09 7:37 PM