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

Screen Elements

Former Member
0 Likes
607

Hi,

I have to disable screen elements at run time.

Please suggest possible solutions.

Many Thanks,

Ramotar Sahoo.

5 REPLIES 5
Read only

Former Member
0 Likes
588

refer:

Read only

Former Member
0 Likes
588

Hi,

Check this sample code. Though this code is for selection screen, but same kind of logic is used in screen programming . You just have to use screen table, loop on screen table and change attributes of screen elements at run time .


REPORT z_sdn.
 
PARAMETERS:
  p_num RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND abc,
  p_char RADIOBUTTON GROUP rad1.
 
PARAMETERS:
  p_num1 TYPE i MODIF ID num,
  p_num2 TYPE i MODIF ID num,
  p_char1 TYPE c MODIF ID chr,
  p_char2 TYPE c MODIF ID chr.
 
 
AT SELECTION-SCREEN OUTPUT.
  IF p_num EQ 'X'.
    LOOP AT SCREEN.
      IF screen-group1 EQ 'CHR'.
        screen-active = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ELSE.
    LOOP AT SCREEN.
      IF screen-group1 EQ 'NUM'.
        screen-active = 0.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
  ENDIF.

Regards

Abhijeet

Read only

Former Member
0 Likes
588

Hi,

You did not mention the exact problem.

take the scenario-

Suppose you have two Parameters and two radio buttons now if you click on First radiobutton First Parameters will be enable and when you click on second radiobutton second parameters will be enable. for this try this way-

Parameters:p_para1 type mara-matnr,
                  p_para2 type mara-matnr,
                  p_rad1 radiobutton group gr1 user-command gr1,
                  p_rad2 radiobutton group gr1.



At Selection-screen output.
  if p_rad1 = 'X'.
   Loop at Screen.
   if Screen-name cs 'P_PARA2'.
          screen-input = 0.
       Modify screen.
   endif.
  endloop.
elseif p_rad2 = 'X'.
Loop at screen.
 if screen-name cs 'P_PARA1'.
  screen-input = 0.
Modify screen.
Endif.
Endloop.
endif.

Regards,

Sujit

Read only

Former Member
0 Likes
588

HI,

The best way to inactive the screeen elements is to put screen elements under any group in screen painter.

There are four groups in the attributes of any screen element. Write any string for eg: 'GR' for any screen element

& write a query like:

Loop at screen.

if screen-group1 = 'GR'.

screen-active = 0.

modify screen.

endif.

endloop.

like this you cn put any number of screen elements in the same group with the same string name & can inactive all of them together.

Hope this will help you.

Read only

Former Member
0 Likes
588

Hi,

You can write this code in the PBO of that screen

IF sy-tcode = 'Your transaction code'.

LOOP AT SCREEN.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

hope this will help you.

regards,

Lokesh