‎2007 Sep 04 4:25 PM
I am using the code below to create a toggling selection screen. So based on the radio button selected, it displays different select options. In BLOCK b3, the matnr and werks is obligatory, so when I try to change the screen, it gives out all required fields must be entered error. How to resolve this? I would like to change the screens even if the fields are left blank. But they need to be obligatory if I am on Screen 2
**********************************************************************
* S E L E C T I O N S C R E E N
**********************************************************************
* Block to display the selection options (By Inventory or By document)
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.
PARAMETERS: radio1 RADIOBUTTON GROUP rnd USER-COMMAND fcode DEFAULT 'X',
radio2 RADIOBUTTON GROUP rnd.
SELECTION-SCREEN END OF BLOCK b2.
* Block to display By document options
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
PARAMETERS:
vbeln_va TYPE vbak-vbeln MODIF ID sc1, "Sales Order
vbeln_vl TYPE likp-vbeln MODIF ID sc1. "Delivery Note
SELECTION-SCREEN END OF BLOCK b1.
* Block to display By inventory options
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETERS:
matnr TYPE mara-matnr MODIF ID sc2 OBLIGATORY,
werks TYPE mard-werks MODIF ID sc2 OBLIGATORY,
kunag TYPE vbak-kunnr MODIF ID sc2,
p_vrkme TYPE char4 AS LISTBOX VISIBLE LENGTH 10 MODIF ID sc2,
negativ LIKE am07m-seneg MODIF ID sc2.
SELECTION-SCREEN END OF BLOCK b3.
**********************************************************************
* A T S E L E C T I O N S C R E E N
**********************************************************************
* To toggle the selection options
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = 'SC1' AND radio1 EQ 'X'.
screen-active = '0'. "make screen invisible
gv_sel = '1'. "assign 1 for select by inventory options
MODIFY SCREEN.
CONTINUE.
ELSEIF screen-group1 = 'SC2' AND radio2 EQ 'X'.
screen-active = '0'. "make screen invisible
gv_sel = '2'. "assign 2 for select by document options
MODIFY SCREEN.
CONTINUE.
ENDIF.
ENDLOOP.
‎2007 Sep 04 4:55 PM
I tried this .. that did not work. I dont think changing screen-required will work as I tried all the combinations.
**********************************************************************
* A T S E L E C T I O N S C R E E N
**********************************************************************
* To toggle the selection options
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = 'SC1' AND radio1 EQ 'X'.
screen-active = '0'. "make screen invisible
gv_sel = '1'. "assign 1 for select by inventory options
MODIFY SCREEN.
CONTINUE.
ELSEIF screen-group1 = 'SC2' AND radio2 EQ 'X'.
screen-required = '0'.
screen-active = '0'. "make screen invisible
gv_sel = '2'. "assign 2 for select by document options
MODIFY SCREEN.
CONTINUE.
ENDIF.
ENDLOOP.
‎2007 Sep 04 4:34 PM
Hi,
For making obligatory off use
Loop at screen .
set the scree-required field to '1' .
modify screen.
endloop .
a®
‎2007 Sep 04 4:36 PM
if you use obligatory then you need to enter values and you will able to select radio button.
Try to use validation like if material number is initial then raise error message ,please use check in start-of-selection.
Check the below code.
REPORT ZSAI1.
**********************************************************************
S E L E C T I O N S C R E E N
**********************************************************************
Block to display the selection options (By Inventory or By document)
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-001.
PARAMETERS: radio1 RADIOBUTTON GROUP rnd USER-COMMAND fcode DEFAULT 'X',
radio2 RADIOBUTTON GROUP rnd.
SELECTION-SCREEN END OF BLOCK b2.
Block to display By document options
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
PARAMETERS:
vbeln_va TYPE vbak-vbeln MODIF ID sc1, "Sales Order
vbeln_vl TYPE likp-vbeln MODIF ID sc1. "Delivery Note
SELECTION-SCREEN END OF BLOCK b1.
Block to display By inventory options
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
PARAMETERS:
matnr TYPE mara-matnr MODIF ID sc2 ,"OBLIGATORY,
werks TYPE mard-werks MODIF ID sc2 ,"OBLIGATORY,
kunag TYPE vbak-kunnr MODIF ID sc2,
p_vrkme TYPE char4 AS LISTBOX VISIBLE LENGTH 10 MODIF ID sc2,
negativ LIKE am07m-seneg MODIF ID sc2.
SELECTION-SCREEN END OF BLOCK b3.
**********************************************************************
A T S E L E C T I O N S C R E E N
**********************************************************************
To toggle the selection options
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = 'SC1' AND radio1 EQ 'X'.
screen-active = '0'. "make screen invisible
gv_sel = '1'. "assign 1 for select by inventory
*options
MODIFY SCREEN.
CONTINUE.
ELSEIF screen-group1 = 'SC2' AND radio2 EQ 'X'.
screen-active = '0'. "make screen invisible
gv_sel = '2'. "assign 2 for select by document options
MODIFY SCREEN.
CONTINUE.
ENDIF.
ENDLOOP.
start-of-selection.
if matnr is initial.
message e001(z01).
endif.
if werks is initial.
message e001(z01).
endif.
Thanks
Seshu
‎2007 Sep 04 4:55 PM
I tried this .. that did not work. I dont think changing screen-required will work as I tried all the combinations.
**********************************************************************
* A T S E L E C T I O N S C R E E N
**********************************************************************
* To toggle the selection options
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = 'SC1' AND radio1 EQ 'X'.
screen-active = '0'. "make screen invisible
gv_sel = '1'. "assign 1 for select by inventory options
MODIFY SCREEN.
CONTINUE.
ELSEIF screen-group1 = 'SC2' AND radio2 EQ 'X'.
screen-required = '0'.
screen-active = '0'. "make screen invisible
gv_sel = '2'. "assign 2 for select by document options
MODIFY SCREEN.
CONTINUE.
ENDIF.
ENDLOOP.
‎2007 Sep 04 5:03 PM
Hello Megan,
Did you check the my reply,just keep the condition at start-of-selection,if user does not enter any value on matnr or werks,when he cliks on execute button,
he will get message ,if you keep obligatory then you need to enter all values in selection-screen then you will able to select radio button.
if you see my code then you can select radio button without entering any values.
I guess there is no option other than this.
Thanks
Seshu
‎2007 Sep 04 5:05 PM
Hi,
Chekc this code:
PARAMETERS: SP_CHECK AS CHECKBOX USER-COMMAND CHECK.
SELECT-OPTIONS: SO_MATNR FOR MARA-MATNR MODIF ID GRP.
AT SELECTION-SCREEN OUTPUT.
IF SP_CHECK IS INITIAL.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'GRP'.
SCREEN-INPUT = '0'.
SCREEN-OUTPUT = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
CLEAR: SO_MATNR.
REFRESH: SO_MATNR.
ENDIF.
AT SELECTION-SCREEN ON SP_CHECK.
PERFORM MATERIAL_CHECK.
FORM MATERIAL_CHECK.
IF NOT SP_CHECK IS INITIAL AND SY-UCOMM = 'ONLI'.
IF SO_MATNR[] IS INITIAL.
LOOP AT SCREEN.
IF SCREEN-NAME = 'SO_MATNR-LOW'.
SCREEN-INPUT = '1'.
SCREEN-OUTPUT = '0'.
SCREEN-REQUIRED = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM.
a®
‎2007 Sep 04 5:06 PM
hi megan ,
i tried removing the code...USER-COMMAND fcode DEFAULT 'X'
and it was ok..yet the first radio button was checked..
regards,
sampath