Application Development 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: 

how we can loop the screen table.

Former Member
0 Kudos

Hi All,

We are used loop the screen table but it is a structure how we are able to do this what sap doing behind this can any body please tell me.

Thanks,

Saleem.

5 REPLIES 5

amit_khare
Active Contributor
0 Kudos

Hi,

Consider this example -

INITIALIZATION.

LOOP AT SCREEN.

IF screen-name = 'PNPPERSG-LOW'.

screen-active = '1'.

screen-input = '0'.

screen-output = '1'.

ENDIF.

IF screen-name = 'PNPABKRS-LOW'.

screen-active = '1'.

screen-input = '0'.

screen-output = '1'.

screen-invisible = '1'.

ENDIF.

IF screen-name = '%_PNPABKRS_%_APP_%-TEXT'.

screen-active = '1'.

screen-input = '0'.

screen-output = '1'.

screen-invisible = '1'.

ENDIF.

IF screen-name = '%_PNPABKRS_%_APP_%-VALU_PUSH'.

screen-active = '1'.

screen-input = '0'.

screen-output = '1'.

screen-invisible = '1'.

ENDIF.

MODIFY SCREEN.

ENDLOOP.

Here when we are looping at screen, we are assigning some default values to certain fields on screen.

This helps a lot when you have to hide/display certain field from the screen.

Regards,

Amit

Former Member
0 Kudos

Can you post your code..

Former Member
0 Kudos

Hi,

All fields of the current screen are stored in the system table SCREEN with their attributes.

The LOOP AT SCREEN statement places this information in the header line of the system table.

If you want to change the attributes, you must put back the changed header line with MODIFY SCREEN. However, you can only do this in the PBO module of a screen.

If you use this statement for step loop processing, the information (and any changes) apply only to the current steploop line. Outside step loop processing, the information for a step loop field applies to the complete column.

You can also modify fields in the loop procerssing of a table view using this loop statement. Unlike a step loop, modifications before the loop have no effect, since the system gets the initial values for the columns from the column table of the table view.

Step loop fields should never be changed after the corresponding step loop processing has been performed.

You can use the CONTINUE statement to leave the current loop pass prematurely and continue with the next loop pass.

ex : LOOP AT SCREEN.

if screen-group = 'MAT' " Screen group

IF screen-name = 'F_MATNR'. " Screen name

screen-active = '1'. " Active = '1' (visible) Active = '0' (visible)

screen-input = '0'.

screen-output = '1'.

ENDIF.

regards,

Srini

Former Member
0 Kudos

hi,

SCREEN is a special memory object which gets generated at runtime and has a strucure with fields such as INVISIBLE,INPUT,ACTIVE,REQUIRED etc. at the same time we should keep in mind that it becomes an internal table as you can have many fields per screen each having the above characteristics.

see this example of SCREEN internal table generated at runtime -

<b> characteristics

field name INVISIBLE INPUT ACTIVE .....

FIELD1 0 1 1

FIELD2 1 0 0</b>

hope that helps...

reward if useful...

Former Member
0 Kudos

Hi,

I guess u are saying about a table control in a screen.

you need to loop on that table in your PBO & PAI in the module pool program.

Go to transaction DWDM. You'll get examples for table controls.