Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Dyanmically changing selection screen components

Former Member
0 Likes
570

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
550

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


5 REPLIES 5
Read only

Former Member
0 Likes
551

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


Read only

0 Likes
550

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.

Read only

0 Likes
550

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

Read only

0 Likes
550

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

Read only

Former Member
0 Likes
550

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