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

clear select-option value on selection screen

Former Member
0 Likes
6,983

Hi friends,

I have a requirement that based on radio button selection , I want to restrict the user to enter data based on selection.

so I have used Memory ID & grayed out the unnecessary field based on radio button.

case1 : when I click on Radio button1(Order type ) it will gray out the select-option(billing type ). as well

case2 : when I click on Radio button2(billing type ) it will gray out the select-option(order type ).

but when I execute for the first time with case1 , and then execute program with case2.

in above example , I want to clear the content of select-option(order type) which is entered for first time execution.

can anyone help me to solve this.

9 REPLIES 9
Read only

Former Member
0 Likes
3,590

Hi,

You should have written the code in the event AT SELECTION-SCREEN and AT SELECTION-SCREEN OUTPUT, to make the fields greyed out.

In the same place refresh the whole select option table, depends upon the radio button selection.

REFRESH : s_orttyp[].

Thanks,

Balu.

Read only

0 Likes
3,590

Hi

Try like this

TABLES : sflight.

PARAMETERS:p_r1 RADIOBUTTON GROUP g1 USER-COMMAND a,
            p_r2 RADIOBUTTON GROUP g1.

SELECT-OPTIONS :s_carrid FOR sflight-carrid MODIF ID i1,
                 s_ptype FOR sflight-planetype MODIF ID i2.

AT SELECTION-SCREEN OUTPUT.
   IF p_r1 = 'X'.
      refresh s_carrid.
     LOOP AT SCREEN.
       CHECK screen-group1 = 'I1'.
       screen-input = '0'.
       MODIFY SCREEN.
     ENDLOOP.
   ENDIF.

   IF p_r2 = 'X'.
     refresh s_ptype.
     LOOP AT SCREEN.
       CHECK screen-group1 = 'I2'.
       screen-input = '0'.
       MODIFY SCREEN.
     ENDLOOP.
   ENDIF.


Read only

FredericGirod
Active Contributor
0 Likes
3,590

Hi,

make a little search on the forum using the keyword :  LOOP AT SCREEN.

regards

Fred

Read only

Former Member
0 Likes
3,590

Hi,

Please try with below sample code based on your requirements and let me know.

AT SELECTION-SCREEN OUTPUT.

  IF pr_sc = 'X'. "Selection for Shopping cart

    CLEAR: s_po,s_po[]."Clear Selection for Purchase Order

    LOOP AT SCREEN.

      IF screen-group1 = 'ID2'.

        screen-input = '0'.

        MODIFY SCREEN.

      ENDIF.

    ENDLOOP.

  ELSEIF pr_po = 'X'. "Selection for Purchase Order

    CLEAR: s_sc,s_sc[]."Clear Selection for Shopping cart

    LOOP AT SCREEN.

      IF screen-group1 = 'ID1'.

        screen-input = '0'.

        MODIFY SCREEN.

      ENDIF.

    ENDLOOP.

  ENDIF.

You need to clear the prevoius selected field values in current loop at screen.

Best Regards,

Abirami

Read only

hemanth_kumar21
Contributor
0 Likes
3,590

You have to clear the values in the if condition.

Please see the below code:

SELECTION-SCREEN :BEGIN OF BLOCK test WITH FRAME TITLE text-001.
PARAMETERS:p_rad1 RADIOBUTTON GROUP one USER-COMMAND test,
                  p_rad2 RADIOBUTTON GROUP one.
SELECTION-SCREEN:END OF BLOCK test.
SELECTION-SCREEN:BEGIN OF BLOCK test2 WITH FRAME TITLE text-002.
PARAMETERS:p_file(10) TYPE c MODIF ID tl,
                  p_file1(10) TYPE c MODIF ID tt.
SELECTION-SCREEN:END OF BLOCK test2.

AT SELECTION-SCREEN OUTPUT.
   IF p_rad1 = 'X'.
     CLEAR p_file1.
     LOOP AT SCREEN.
       CHECK screen-group1 = 'TT'.
       screen-input = '0'.
       MODIFY SCREEN.
     ENDLOOP.
   ENDIF.

   IF p_rad2 = 'X'.
     CLEAR   p_file.
     LOOP AT SCREEN.
       CHECK screen-group1 = 'TL'.
       screen-input = '0'.
       MODIFY SCREEN.
     ENDLOOP.
   ENDIF.


Read only

former_member220538
Active Participant
0 Likes
3,590

Hi,

Use REFRESH to clear the select option based upon the radio button selected.

REFRESH : otype,btype.

Read only

venkat_aileni
Contributor
0 Likes
3,589

Hi-

Try below code:

TABLES: vbap,

         vbrp.

START-OF-SELECTION.

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.

PARAMETERS: rb1 RADIOBUTTON GROUP rg1 USER-COMMAND but DEFAULT 'X',

             rb2 RADIOBUTTON GROUP rg1.

SELECTION-SCREEN END OF BLOCK blk1.

SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.

   SELECT-OPTIONS: s_order FOR vbap-vbeln,

                   s_bill  FOR vbrp-vbeln.

SELECTION-SCREEN END OF BLOCK blk2.

AT SELECTION-SCREEN OUTPUT.

   LOOP AT SCREEN.

     IF rb1 = 'X'.

     IF screen-name CP 'S_ORDER*'.

       screen-input = 0.

       MODIFY SCREEN.

       REFRESH s_order.

     ENDIF.

     ELSEIF rb2 = 'X'.

     IF screen-name CP 'S_BILL*'.

       screen-input = 0.

       MODIFY SCREEN.

       REFRESH s_bill.

     ENDIF.

     ENDIF.

   ENDLOOP.

-Venkat

Read only

Former Member
0 Likes
3,589

Hi,

please use radiobutton with option USER-COMMAND (see keyword docu).

Clear input at event AT USER-COMMAND (see also keeword docu).

Regards,

Klaus

Read only

Former Member
0 Likes
3,589

clear all the selection screen fields at  at selection screen Event.

Make sure that your clear statements will be under sy-ucomm ne ONLI.