‎2007 Oct 04 5:07 AM
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
‎2007 Oct 04 5:09 AM
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.
‎2007 Oct 04 5:11 AM
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..
‎2007 Oct 04 5:22 AM
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>
‎2007 Oct 04 5:28 AM
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.
‎2007 Oct 04 5:11 AM
‎2007 Oct 04 5:16 AM
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?
‎2007 Oct 04 5:45 AM
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.