‎2008 Mar 17 1:05 PM
Hi,
I got a requirement that i have two select-options.
The selection should allow me to enter data only in one select option at any cost.
Try to send a picece of code if possible
‎2008 Mar 17 1:10 PM
This should help
REPORT yptc_goof3 .
TABLES: kna1, knvv, cepc.
*____________________________________________ Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-b01.
PARAMETER: pasofdt LIKE sy-datum DEFAULT sy-datum OBLIGATORY.
SELECT-OPTIONS:
pcust FOR kna1-kunnr,
pcmpy FOR knvv-vkorg.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-b02.
PARAMETERS:
cb_all AS CHECKBOX DEFAULT 'X' MODIF ID xxx USER-COMMAND sel,
rb_cash RADIOBUTTON GROUP rbg1 USER-COMMAND sel MODIF ID all,
* DEFAULT 'X',
rb_fin RADIOBUTTON GROUP rbg1 MODIF ID all.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-b03.
PARAMETERS:
rb_allf RADIOBUTTON GROUP rbg2 MODIF ID fin,
rb_free RADIOBUTTON GROUP rbg2 MODIF ID fin,
rb_land RADIOBUTTON GROUP rbg2 MODIF ID fin,
rb_subd RADIOBUTTON GROUP rbg2 MODIF ID fin,
rb_spec RADIOBUTTON GROUP rbg2 MODIF ID fin.
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF BLOCK b1.
*____________________________________________ Screen Actions
AT SELECTION-SCREEN OUTPUT.
IF cb_all = 'X'.
CLEAR: rb_cash,
rb_fin,
rb_allf,
rb_free,
rb_land.
PERFORM hide_finance_options.
PERFORM hide_options.
ELSE.
PERFORM unhide_options.
ENDIF.
IF NOT rb_fin = 'X'.
CLEAR: rb_allf,
rb_free,
rb_land.
PERFORM hide_finance_options.
ELSE.
PERFORM unhide_finance_options.
ENDIF.
START-OF-SELECTION.
EXIT.
*&---------------------------------------------------------------------*
*& Form hide_options
*&---------------------------------------------------------------------*
FORM hide_options.
LOOP AT SCREEN.
IF screen-group1 EQ 'ALL'
OR screen-group1 EQ 'FIN'.
screen-input = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDFORM. " hide_options
*&---------------------------------------------------------------------*
*& Form hide_finance_options
*&---------------------------------------------------------------------*
FORM hide_finance_options.
LOOP AT SCREEN.
IF screen-group1 EQ 'FIN'.
screen-input = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDFORM. " hide_finance_options
*&---------------------------------------------------------------------*
*& Form unhide_finance_options
*&---------------------------------------------------------------------*
FORM unhide_finance_options.
LOOP AT SCREEN.
IF screen-group1 EQ 'FIN'.
screen-input = 1.
screen-invisible = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDFORM. " unhide_finance_options
*&---------------------------------------------------------------------*
*& Form unhide_options
*&---------------------------------------------------------------------*
FORM unhide_options.
LOOP AT SCREEN.
IF screen-group1 EQ 'ALL'.
screen-input = 1.
screen-invisible = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDFORM. " unhide_options
‎2008 Mar 17 1:10 PM
This should help
REPORT yptc_goof3 .
TABLES: kna1, knvv, cepc.
*____________________________________________ Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-b01.
PARAMETER: pasofdt LIKE sy-datum DEFAULT sy-datum OBLIGATORY.
SELECT-OPTIONS:
pcust FOR kna1-kunnr,
pcmpy FOR knvv-vkorg.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-b02.
PARAMETERS:
cb_all AS CHECKBOX DEFAULT 'X' MODIF ID xxx USER-COMMAND sel,
rb_cash RADIOBUTTON GROUP rbg1 USER-COMMAND sel MODIF ID all,
* DEFAULT 'X',
rb_fin RADIOBUTTON GROUP rbg1 MODIF ID all.
SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-b03.
PARAMETERS:
rb_allf RADIOBUTTON GROUP rbg2 MODIF ID fin,
rb_free RADIOBUTTON GROUP rbg2 MODIF ID fin,
rb_land RADIOBUTTON GROUP rbg2 MODIF ID fin,
rb_subd RADIOBUTTON GROUP rbg2 MODIF ID fin,
rb_spec RADIOBUTTON GROUP rbg2 MODIF ID fin.
SELECTION-SCREEN END OF BLOCK b3.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF BLOCK b1.
*____________________________________________ Screen Actions
AT SELECTION-SCREEN OUTPUT.
IF cb_all = 'X'.
CLEAR: rb_cash,
rb_fin,
rb_allf,
rb_free,
rb_land.
PERFORM hide_finance_options.
PERFORM hide_options.
ELSE.
PERFORM unhide_options.
ENDIF.
IF NOT rb_fin = 'X'.
CLEAR: rb_allf,
rb_free,
rb_land.
PERFORM hide_finance_options.
ELSE.
PERFORM unhide_finance_options.
ENDIF.
START-OF-SELECTION.
EXIT.
*&---------------------------------------------------------------------*
*& Form hide_options
*&---------------------------------------------------------------------*
FORM hide_options.
LOOP AT SCREEN.
IF screen-group1 EQ 'ALL'
OR screen-group1 EQ 'FIN'.
screen-input = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDFORM. " hide_options
*&---------------------------------------------------------------------*
*& Form hide_finance_options
*&---------------------------------------------------------------------*
FORM hide_finance_options.
LOOP AT SCREEN.
IF screen-group1 EQ 'FIN'.
screen-input = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDFORM. " hide_finance_options
*&---------------------------------------------------------------------*
*& Form unhide_finance_options
*&---------------------------------------------------------------------*
FORM unhide_finance_options.
LOOP AT SCREEN.
IF screen-group1 EQ 'FIN'.
screen-input = 1.
screen-invisible = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDFORM. " unhide_finance_options
*&---------------------------------------------------------------------*
*& Form unhide_options
*&---------------------------------------------------------------------*
FORM unhide_options.
LOOP AT SCREEN.
IF screen-group1 EQ 'ALL'.
screen-input = 1.
screen-invisible = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDFORM. " unhide_options
‎2008 Mar 17 1:17 PM
Thanks,
but my intension is after the selection screen is displayed to user and we mused to choose a radio button based on the radio button the field should enable or disable.
‎2008 Mar 17 1:21 PM
Hi
One radio button would be default when the selection screen is displayed. So In the AT-SELECTION SCREEN OUTPUT event you can write logic according to the defaulted radio button.
Give Screen group name to each of the select option and modif id to the radio button. U can do this requirement.
Thanks
Pavan
‎2008 Mar 17 1:28 PM
Almost the same, but...
TABLES: kna1, knvv, cepc.
*____________________________________________ Selection Screen
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-b01.
PARAMETERS:
rb_cus RADIOBUTTON GROUP rbg1 DEFAULT 'X' USER-COMMAND sel,
rb_cmp RADIOBUTTON GROUP rbg1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-b02.
SELECT-OPTIONS:
pcust FOR kna1-kunnr MODIF ID cus,
pcmpy FOR knvv-vkorg MODIF ID cmp.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF BLOCK b1.
*____________________________________________ Screen Actions
AT SELECTION-SCREEN OUTPUT.
IF rb_cus = 'X'.
PERFORM hide_cmpy_options.
ELSE.
PERFORM hide_cust_options.
ENDIF.
START-OF-SELECTION.
EXIT.
*&---------------------------------------------------------------------*
*& Form hide_cmpy_options
*&---------------------------------------------------------------------*
FORM hide_cmpy_options.
LOOP AT SCREEN.
IF screen-group1 EQ 'CMP'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDFORM. " hide_cmpy_options
*&---------------------------------------------------------------------*
*& Form hide_cust_options
*&---------------------------------------------------------------------*
FORM hide_cust_options.
LOOP AT SCREEN.
IF screen-group1 EQ 'CUS'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDFORM. " hide_cust_options
‎2008 Mar 17 1:15 PM
Hi,
Do the validation in at selection-screen.
U can check if one select option is initial when other has value.
If not then, throw error message.
But, if u have to restrict user from entering inself, then it may be achieved by checking if one select option is not initial,
then disable the other one by giving screen-input = 0 at selection-screen output.
I am not sure about the second one though.
Reward if helpful.
Regards,
Ramya