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_member196517
Contributor
0 Likes
750

Hi all,

i need to do loop at screen twice and problem is that once i loop through it goes to last element and second time loop doesnt work so question is how can i go back to my first element on screen for second loop..

Regards

Anuj Goyal

7 REPLIES 7
Read only

Former Member
0 Likes
724

What is your requirement?

Is it not possible to handle both cases in one single loop. You can put IF statements and check respective conditions.

Read only

0 Likes
724

Hi Ashish..

here is what is am doing

LOOP AT SCREEN

ENDLOOP

LOOP AT SCREEN

ENDLOOP.

now after first loop my Screen is pointing to last element that is understandable .. now to execute second loop i need to make my screen pointer to go back to first element which is not happening..

Read only

0 Likes
724

Hi Anuj..

Try like this .. instead of LOOPing 2 times.

LOOP AT SCREEN.

IF SCREEN-NAME = 'P_FIELD1'.

SCREEN-INPUT = 0.

ENDIF.

IF SCREEN-NAME = 'P_FIELD2'.

SCREEN-INVISIBLE = 1.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

<b>reward if Helpful.</b>

Read only

0 Likes
724

Hi,

u can loop twice it will not cause any problem.

if u start the second loop automatically it will go to the first field.

post ur code so that we check where the problem is coming.

PARAMETERS:name1(10),

name2(10).

data:BEGIN OF itab OCCURS 0,

name type screen-name,

END OF itab.

AT SELECTION-SCREEN OUTPUT.

LOOP AT SCREEN.

itab-name = screen-name.

APPEND itab.

ENDLOOP.

LOOP AT SCREEN.

itab-name = screen-name.

APPEND itab.

ENDLOOP.

START-OF-SELECTION.

LOOP AT itab.

WRITE:/ itab-name.

ENDLOOP.

rgds,

bharat.

Read only

Former Member
0 Likes
724

at selection-screen.

used if condition.

Read only

0 Likes
724

Here is what i got for help for LOOP AT SCREEN.

The statements LOOP AT SCREEN ... ENDLOOP define a loop around a statement block. For every screen element of the current dynpro, to which a dynpro field is assigned, <b>one loop pass is executed.</b> After the LOOP statement either the predefined workarea screen or the workarea wa (when using INTO) contains the properties of the respective screen element. wa must have the same data type as screen.

If you see the bold letters, i am not sure if we can use LOOP AT SCREEN more than once.

Why do you want to loop at screen more than once?

Read only

0 Likes
724

hi

try this

LOOP AT SCREEN.

IF screen-group1 = 'GR3'.

screen-invisible = 0.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ELSE.

LOOP AT SCREEN.

IF screen-group1 = 'GR2'.

screen-invisible = 0.

screen-input = 0.

MODIFY SCREEN.

ENDIF.

ENDLOOP.

ENDIF.