2008 May 06 8:36 PM
Hi all,
I have two radio buttons on my screen. Based on the selection I want to display only one of the two select-options.
select-option 1 should be displayed for radiobutton 1
select-option 2 should be displayed for radiobutton 2
As soon as I make those select-options mandatory I am not able to get the desired result.
Even if the radio button is changed from 1 to 2, the select-option 2 is not displayed.
I tried putting the validations the other way by throwing messages and not by making the fields obligatory. Still not successful. Kindly help.
2008 May 07 9:13 AM
hi
Try this
FORM selection_screen_modifications.
LOOP AT SCREEN.
IF screen-group1 = 'SG2' and p_aspt = 'X'..
screen-input = 1.
screen-reuiered = 1.
elseif IF screen-group1 = 'SG1' and p_ocfd = 'X'.
screen-input = 1.
screen-reuiered = 1.
else.
screen-input = 0.
screen-reuiered = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDFORM.
hi
Try this
FORM selection_screen_modifications.
LOOP AT SCREEN.
IF screen-group1 = 'SG2' and p_aspt = 'X'..
screen-input = 1.
screen-reuiered = 1.
elseif IF screen-group1 = 'SG1' and p_ocfd = 'X'.
screen-input = 1.
screen-reuiered = 1.
else.
screen-input = 0.
screen-reuiered = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDFORM.
2008 May 06 8:45 PM
Hi,
use loop at screen... and validate the radio buttons
when u can post ur code and desired o/p clearly then we can help u out..
Regards
Syed
2008 May 06 8:48 PM
Hi,
Possibly there's not a way to do this, using radiobuttons.
Try discussing your requirement, if it's necessary.
Try putting your requirement here, if possible. Then we can help any further.
Regards,
Brian Gonsales
2008 May 06 8:51 PM
This is my code which is called in selection-screen output.
FORM selection_screen_modifications.
IF p_aspt = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'SG2'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
IF p_ocfd = 'X'.
LOOP AT SCREEN.
IF screen-group1 = 'SG1'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
call screen '1000'.
ENDIF.
ENDFORM.
The selection-screen is as follows.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-b01.
SELECT-OPTIONS :
*plant
s_werks FOR i_orders-werks NO INTERVALS.
*Parameter
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-b02.
*OCFD
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(39) text-co1 FOR FIELD p_aspt.
PARAMETERS: p_aspt RADIOBUTTON GROUP rb1 DEFAULT 'X' USER-COMMAND hit.
SELECTION-SCREEN END OF LINE.
*ASPT
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 3(39) text-co2 FOR FIELD p_ocfd.
PARAMETERS: p_ocfd RADIOBUTTON GROUP rb1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK b2.
SELECT-OPTIONS :
*Order creation date - to be displayed for ASPT
s_crd FOR vbak-erdat MODIF ID sg1,
*Date scheduled for OCFD
s_schd FOR vbak-zzsoldate MODIF ID sg2,
*Order number range
s_order FOR vbak-vbeln.
*test mode
PARAMETER : p_test AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK b1.
2008 May 06 8:54 PM
Hi Brian,
The requirement is as follows.
I have two radiobuttons.
Rad 1
Rad 2
If Rad 1 is selected then I want to input Order Creation date (Field1) as mandatory, and Order scheduled date (Field 2) should not be displayed.
If Rad 2 is selected then I want to input Order Scheduled date (FIeld2) as mandatory, and order creation date(field1) should not be displayed.
If I can make the fields as obligatory at runtime, that may also solve my problem.
2008 May 06 9:28 PM
Hi, Vipul.
To make the select-options obligatory during runtime, you can use this:
screen-required = 1.
screen-required = 1. (Field is mandatory)
screen-required = 0. (Field in NOT mandatory)
If there's any use for this, just let me know.
Regards,
Brian Gonsales
2008 May 06 10:03 PM
Hi again, Vipul.
My suggestion is: let both field NOT mandatory, and check the displayed field. Example, if the field 1 is not locked, check it.
Like that:
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF p_aspt IS NOT INITIAL.
IF screen-group1 = 'SG2'.
screen-input = 0.
ENDIF.
ELSEIF p_ocfd IS NOT INITIAL.
IF screen-group1 = 'SG1'.
screen-input = 0.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
And right after, you can check if the displayed field is not empty:
IF p_aspt IS NOT INITIAL.
IF s_crd-low IS INITIAL AND
s_crd-high IS INITIAL.
MESSAGE s000(zclass) WITH 'Fill in all required fields'
DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING AND RETURN TO SCREEN 0.
ENDIF.
ELSEIF p_ocfd IS NOT INITIAL.
IF s_schd-low IS INITIAL AND
s_schd-high IS INITIAL.
MESSAGE s000(zclass) WITH 'Fill in all required fields'
DISPLAY LIKE 'E'.
LEAVE LIST-PROCESSING AND RETURN TO SCREEN 0.
ENDIF.
ENDIF.
This will be like if the field which is displayed can't be empty, cause otherwise, the program will stop.
Hope it helps,
Brian Gonsales.
2008 May 07 9:13 AM
hi
Try this
FORM selection_screen_modifications.
LOOP AT SCREEN.
IF screen-group1 = 'SG2' and p_aspt = 'X'..
screen-input = 1.
screen-reuiered = 1.
elseif IF screen-group1 = 'SG1' and p_ocfd = 'X'.
screen-input = 1.
screen-reuiered = 1.
else.
screen-input = 0.
screen-reuiered = 0.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDFORM.
2008 May 07 1:44 PM
Thank you all.
The answers were helpful to some extent but the only way I could solve the problem was by putting some default values in the mandatory fields. THose were date fields so I defaulted the current date.
Brian's answer was very helpful. It could have worked but since I am using SAP 4.6C. display like 'E' did not work.
Thank you very much.
2008 May 07 1:45 PM
This problem was solved by putting a default value in the mandatory fields.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |