04-21-2006 12:35 PM
Dear Experts,
I am facing a problem in Selection Screen.
<b>I have 2 radio buttons ,</b>
<b>Radio Button 1</b> - Choosing the file from desktop and
<b>Radio Button 2</b> - Executing from Database
Under Option1 - i have a <b>FILE</b> parameter which is <b><u>Mandatory.</u></b>
Problem Case -
<b>when I choose option 2, Option 1 should be disabled. in the sense the file name which is mandatory here should not be mandatory . Currently, when i choose option 2 - i have to provide some dummy characters in the file parameter because the file parameter is mandatory, and <u><b>I want to avoid this.</b></u>
Please see the entire code .</b>
REPORT ZTEST.
DATA: LV_FILE_PATH(20) TYPE C.
DATA: LV_MASK(20) TYPE C VALUE ',*.XLS ,*.XLS. '.
*-- Macro to put radiobutton on selection screen
*-- &1 - radiobutton parameter name
*-- &2 - text element (description)
*-- &3 - radiobutton group
DEFINE MAKE_RADIOBUTTON.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: &1 RADIOBUTTON GROUP &3.
SELECTION-SCREEN COMMENT 3(60) &2.
SELECTION-SCREEN END OF LINE.
END-OF-DEFINITION.
SELECTION-SCREEN BEGIN OF BLOCK A0 WITH FRAME TITLE T000.
* From Config File
MAKE_RADIOBUTTON RB_1 ALL_DATA SRC.
SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE T001.
* Config file from Presentation server
PARAMETERS: P_FILE1 LIKE T390D-DBNAME OBLIGATORY. "
SELECTION-SCREEN END OF BLOCK A1.
* From database table
MAKE_RADIOBUTTON RB_2 INC_DOWN SRC.
SELECTION-SCREEN END OF BLOCK A0.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE1.
CALL FUNCTION 'WS_QUERY'
EXPORTING
QUERY = 'CD' "// Current Directory
IMPORTING
RETURN = LV_FILE_PATH.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = 'TA_DOWNLOAD.MDB'
DEF_PATH = LV_FILE_PATH
MASK = LV_MASK
MODE = 'O'
IMPORTING
FILENAME = P_FILE1
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
INITIALIZATION.
ALL_DATA = 'From Desktop : ? '.
INC_DOWN = 'From Database : ?'.
T000 = 'Configuration Upload'.
Please help
Thanks
04-21-2006 12:49 PM
Hi,
First thing I suggest you should remove 'Obligatory' and instead do the required checkings in the program itself.
Also to deactivate the field you can use this code after modifying according to your need:
LOOP AT SCREEN.
IF screen-group3 = <>.
screen-active = '0'.
ELSE.
screen-active = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
04-21-2006 12:40 PM
Hello,
Remove mendatory from the FILE parameter.
Put check on in the start-of-selection.
if FIle is empty.
message s001 with 'Enter file'.
leave list processing.
Endif.
Regards,
04-21-2006 12:48 PM
Hi RMR,
You need not make that field obligatory.
U can check wheteher the field has been entered in event Start-of-Selection.
If the field is initial, then exit n go back to previous screen and display error message.
Hope that helps .
Regards,
Tanveer.
Please mark helpful answers.
04-21-2006 12:49 PM
Hi
Define the file parameter as not mandatory:
PARAMETERS: P_FILE1 LIKE T390D-DBNAME.
and check if the file name is inserted if user has choosen the first radiobutton
AT SELECTION-SCREEN.
IF RB_1 = 'X'.
IF P_FILE1 IS INITIAL.
MESSAGE E208(00) WITH 'Insert the file name'.
ENDIF.
ENDIF
Max
04-21-2006 12:49 PM
Hi,
First thing I suggest you should remove 'Obligatory' and instead do the required checkings in the program itself.
Also to deactivate the field you can use this code after modifying according to your need:
LOOP AT SCREEN.
IF screen-group3 = <>.
screen-active = '0'.
ELSE.
screen-active = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
04-21-2006 1:25 PM
Thanks Sir,
Can you explain more in detail as to how to modify the sceeen?
Thanks
04-21-2006 1:37 PM
Hi
You should do some modifications like these:
DEFINE MAKE_RADIOBUTTON_1.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: &1 RADIOBUTTON GROUP &3 USER-COMMAND &4.
SELECTION-SCREEN COMMENT 3(60) &2.
SELECTION-SCREEN END OF LINE.
END-OF-DEFINITION.
DEFINE MAKE_RADIOBUTTON_2.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: &1 RADIOBUTTON GROUP &3.
SELECTION-SCREEN COMMENT 3(60) &2.
SELECTION-SCREEN END OF LINE.
END-OF-DEFINITION.
SELECTION-SCREEN BEGIN OF BLOCK A0 WITH FRAME TITLE T000.
From Config File
MAKE_RADIOBUTTON_1 RB_1 ALL_DATA SRC AAA.
SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE T001.
Config file from Presentation server
PARAMETERS: P_FILE1 LIKE T390D-DBNAME MODIF ID FIL. "
SELECTION-SCREEN END OF BLOCK A1.
From database table
MAKE_RADIOBUTTON_2 RB_2 INC_DOWN SRC.
SELECTION-SCREEN END OF BLOCK A0.
AT SELECTION-SCREEN OUTPUT.
IF RB_2 = 'X'.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'FIL'.
SCREEN-ACTIVE = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
Max
04-21-2006 12:52 PM
Hi,
u will face this problem of validation in at-selection-screen-
use following step to avoid this
1) remove mandatory option
2) deactive code in at-selection-screen
3) validate at execute event in the start-of-selection with error statement given below
--
START-OF-SELECTION.
--
IF Radio Button 1 true and file path initial
MESSAGE erormessage number DISPLAY LIKE lc_e .
EXIT.
ENDIF.
Message was edited by: Manoj Gupta
Message was edited by: Manoj Gupta
04-21-2006 1:45 PM
Just try this simple code...
DEFINE MAKE_RADIOBUTTON.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: &1 RADIOBUTTON GROUP &3.
SELECTION-SCREEN COMMENT 3(60) &2.
SELECTION-SCREEN END OF LINE.
END-OF-DEFINITION.
SELECTION-SCREEN BEGIN OF BLOCK A0 WITH FRAME TITLE T000.
From Config File
MAKE_RADIOBUTTON RB_1 ALL_DATA SRC.
SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE T001.
Config file from Presentation server
PARAMETERS: P_FILE1 LIKE T390D-DBNAME.
SELECTION-SCREEN END OF BLOCK A1.
From database table
MAKE_RADIOBUTTON RB_2 INC_DOWN SRC.
SELECTION-SCREEN END OF BLOCK A0.
at selection-screen.
if rb_1 = 'X' and p_file1 = ' '.
break-point.
else.
endif
Modify SCREEN modifies the table SCREEN for the attributes. in debug mode type in SCREEN and check the relavant fields.