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

loop at screen...

Former Member
0 Likes
3,115

Hi All,

I am working on module pool. My requirement is

In the first screen i have plant as input , Below that i have a table control...

If the plant is valid then only i have to display the table control or else i have to make the table control as invisible...I am trying this using loop at screen method..but it is not working..could u please help me...

example code:

LOOP AT SCREEN.

IF SCREEN-NAME = 'TC1'.

SCREEN-INVISIBLE = '1'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

11 REPLIES 11
Read only

Former Member
0 Likes
1,920

Hi,

Is your scenario something like this?

When your screen is displayed, you dont want your table control to be displayed, but just the input for plant.

Now if your entered plant is valid, an event (say a button click or a Enter) is going to make your table control visible.

If so, then you can use this


"Write this in your PBO which will make your table control invisible on your first screen display
    LOOP AT tabcontrol1-cols[] INTO wa_control1.
      wa_control1-invisible = '1'.    
      MODIFY tabcontrol1-cols[] FROM wa_control1 INDEX sy-tabix.
    ENDLOOP.

Similarly code appropriately to make the table control visible on the occurrence of some event by changing the wa_control1-invisible parameter.

Read only

Former Member
0 Likes
1,920

This message was moderated.

Read only

vinod_vemuru2
Active Contributor
0 Likes
1,920

Hi,

Small change to your code.


IF Plant check fails.
LOOP AT SCREEN.
IF SCREEN-NAME CS 'TC1'.
SCREEN-ACTIVE = '0'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
IF SCREEN-NAME CS 'TC1'.
SCREEN-ACTIVE = '1'.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
ENDIF.

I am assuming TC1 is the table control name.

Thanks,

Vinod.

Read only

0 Likes
1,920

thanks for your reply,

I have tried as you said...but no use...while debugging screen-name i am able to see all the screen elements except table control...

..is there any alternate?

Read only

0 Likes
1,920

Hi,

Is your table control and plant field both are in same screen or different screens? If it is in same screen it should work fine.

If different screen then, call table control screen based on plany check if passed or not.

Thanks,

Vinod.

Read only

0 Likes
1,920

Both are in same screen...even i am able to find the table columns in the debugging as screen elements but table control is not...

Read only

0 Likes
1,920

Hi,

You gotto use the code that I gave you

Only then, the table control disappears.

Use it outside the LOOP...ENDLOOP in the PBO.

Read only

0 Likes
1,920

Hi,

Can you try with below sample code.


CONTROLS tc1 TYPE TABLEVIEW USING SCREEN 0100. 
LOOP WITH CONTROL tc1.
    LOOP AT SCREEN.
          IF screen-name CS 'TC1-'.
              screen-active = 0.
              MODIFY SCREEN.
         ENDIF.
        ENDLOOP.
  ENDLOOP.

Thanks,

Vinod.

Read only

Former Member
0 Likes
1,920

Hi Buddula,

in TOP include

data : repid type sy-repid value sy-repid,
          dynnr type sy-dynnr value '200'. " This is a dummy subscreen.


in PBO of main Screen.

call subscreen sub including repid dynnr.


in PAI.

module validate_plant

in Program.

module u validate_plant
" validate plant here and pass X to a Flag as below.
if valid_plant = 'X'
dynnr = '101' " This must be subscreen which contains your Table control.
else.
dynnr = '100' " Dummy Subscreen.
endmodule

Cheerz

Ram

Read only

0 Likes
1,920

In this scenario i should not use sub screens .... is there any alternate

Read only

venkat_o
Active Contributor
0 Likes
1,920

This message was moderated.