‎2007 Jun 06 9:20 PM
Hi Gurus,
I am not able to understand how to use loop at screen command..can someone help me with that...also what is a screen table...and how do we actually use this in our program..
thanks
Cheers:Jim
"SAP is an Ocean, swim and find your own shore".
‎2007 Jun 06 9:26 PM
Screen is System structure ,when ever we have screen ( Report program ( Selection-screen,dialog program ) ,screen structure will trigger in runtime.
if you want keep input disable or enable depends on condition then we use screen struture.
even sap login password also Screen structure.
loop at screen.
here you can write the code :
endloop.
Screen structure contains 16 fields and see documentation in help.sap.com
‎2007 Jun 06 9:26 PM
Screen is System structure ,when ever we have screen ( Report program ( Selection-screen,dialog program ) ,screen structure will trigger in runtime.
if you want keep input disable or enable depends on condition then we use screen struture.
even sap login password also Screen structure.
loop at screen.
here you can write the code :
endloop.
Screen structure contains 16 fields and see documentation in help.sap.com
‎2007 Jun 06 9:30 PM
When you work with dialog programming, you define a Dynpro (Tx. SE51) and some field attached to it....Supposed that you need to make some fields invisible, disabled or protected.
You use LOOP AT SCREEN, to do a loop to the fields contained in the dynpro...
LOOP AT SCREEN.
IF SCREEN-NAME EQ 'MY_FIELD'.
SCREEN-VISIBLE = SPACE.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
If the loop found a field called MY_FIELD, it would make it invisible.
Screen Table....I guess you mean Table Control....Is like an ALV, but without the fancy funciobality -;) SE51 comes with a Table Control Wizard for easy creation.
Greetings,
Blag.
‎2007 Jun 07 6:01 AM
Hi,
Screen is a structure used to Activate,Invisible or visisble the fields in the screen.
for eg in your selection screen if you want to diasble the field based on the radio buttons then you can use Loop at screen in At Selection-Screen Output.
Loop at Screen
if RB1= 'X'.
if SCREEN-NAME = 'P_MATNR'.
Screen-active = 0.
endif.
endif.
endloop.
to see the SCREEN structre goto SE11 and type SCREEN in the space provideed and display it.
Reward points if it is helpful.
Regards,
Sangeetha.a
‎2007 Jun 07 6:05 AM
Hi,
In the event at selection-screen output. one internal table named screen is formed.
in which all the parameters or select-options and whatever you declare in selection screen is present. if you want to modify any of them dynamically. you will use loop at screen.
see the following example.
AT SELECTION-SCREEN OUTPUT.
*disable the date range selection screen option
IF rb_today EQ 'X' OR
rb_cntm EQ 'X' OR
rb_cntyr EQ 'X' OR
rb_past EQ 'X' OR
rb_all EQ 'X' OR
rb_fut EQ 'X'.
LOOP AT SCREEN.
IF screen-name EQ 'S_D_RAN-LOW' .
screen-input = '0'.
MODIFY SCREEN.
EXIT.
ENDIF.
ENDLOOP.
LOOP AT SCREEN.
IF screen-name EQ 'S_D_RAN-HIGH'.
screen-input = '0'.
screen-required = '0'.
MODIFY SCREEN.
CLEAR screen.
EXIT.
ENDIF.
ENDLOOP.
regards,
Ruchika
reward points if useful.
‎2007 Jun 07 6:07 AM
hi,
the screen table contains all the scrren elements n attributes...
u can change the atrributes (eg: visbility..) by looding thro the table..
chk out the link to understan how to use lood at screen...
<u><b>http://www.sap-img.com/abap/common-used-of-dialog-screen-for-display-change-delete.htm</b></u>
<b><u>http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbab6f35c111d1829f0000e829fbfe/content.htm</u></b>
Regards,
viji.
‎2007 Jun 07 6:10 AM
hi,
generally we use LOOP at screen to disable the fields in selection screen.
ex:
REPORT ZSUDHA_SCREEN.
**--- Radiobuttons
PARAMETERS: p_up RADIOBUTTON GROUP a DEFAULT 'X' USER-COMMAND rb,
p_list RADIOBUTTON GROUP a.
PARAMETERS: p_pcfile LIKE rlgrap-filename OBLIGATORY DEFAULT 'C:\'
MODIF ID ccc,
p_pctype LIKE rlgrap-filetype OBLIGATORY DEFAULT 'ASC'
MODIF ID ccc,
p_unix LIKE rlgrap-filename OBLIGATORY DEFAULT '.\'
MODIF ID ccc.
PARAMETERS: p_dir LIKE rlgrap-filename OBLIGATORY DEFAULT '.'
MODIF ID ddd,
p_fp LIKE rlgrap-filename
MODIF ID ddd.
AT SELECTION-SCREEN OUTPUT.
IF p_up = 'X' .
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'CCC'.
screen-input = 1. "Enable
screen-invisible = 0. "Disable
MODIFY SCREEN.
WHEN 'DDD'.
screen-input = 0.
screen-invisible = 1.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
ENDIF.
IF p_list = 'X'.
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'CCC'.
screen-input = 0.
screen-invisible = 1.
MODIFY SCREEN.
WHEN 'DDD'.
screen-input = 1.
screen-invisible = 0.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
ENDIF.
Sreen tables :
A table can be created in transaction. These tables, when designed on the screen are called as SCREEN TABLES.
These are of two types.
Table Controls and Step loops
These tables are treated as Loops.
Features of Table Controls:
Data is displayed in the form of table.
Table control gives user the feeling of an actual table.
You can scroll through the table vertically as well as horizontally.
You can select rows and columns.
You can resize the with of columns.
You can have separator lines between rows and columns.
Automatic resizing of the table when the user resizes the window.
You can update information in the table control and it can be updated in the database table by writing code for it.
ere is a step by step example. you can learn by following the steps:
http://www.planetsap.com/online_pgm_main_page.htm
Check out these demo programs
RSDEMO_TABLE_CONTROL
DEMO_DYNPRO_TABLE_CONTROL_1
DEMO_DYNPRO_TABLE_CONTROL_2
Check
http://www.sap-img.com/ab031.htm
through this link
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbac1d35c111d1829f0000e829fbfe/content.htm
table control scrolling:
STERLOOPS:
Step loops are type of screen tables as already mentioned.
Step loops are nothing but repeated blocks of fields in a screen.
Each block contains one or more fields.
Step loops dont give you feeling of actual table.
You can scroll vertically but not horizontally.
‎2007 Jun 07 6:11 AM
Hi,
Here is another use for loop at screen
<b>parameters : p_check as checkbox default 'X' user-command ac.
select-options : s_pernr for zpernrs-pernr modif id id2.
at selection-screen output.
loop at screen.
if screen-group1 = 'ID2'.
if p_check ne 'X'.
screen-input = 1.
else.
refresh s_pernr.
screen-input = 0.
modify screen.
endif.
endif.</b>
Here if the check box p_check is checked, the parameter p_pernr is open for input, otherwise, it is not (greyed out)
Thanks
Arun
‎2007 Jun 07 6:12 AM
hi Jimmy,
Loop at screen
endloop .
The above syntax you use for doing any kind of modifications to the screen fields during runtime .
A screen table is nothing but gives a list of elements present in a screen during runtime and you can modify them inside the loop at screen statement .
Regards,
Ranjita
‎2007 Jun 07 6:17 AM
Hi Jimmy Wiliams,
The statements LOOP AT SCREEN defines a loop around a statement block.
This is used to manipulate the dynamic changes we intend to perform on our select criterion.
Here below is one of the examples which I implemented in one of my programs.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF pc_upl = 'X'.
IF screen-name = 'P_FILE1'.
CLEAR p_file1.
screen-input = 0.
ENDIF.
ELSEIF ap_upl = 'X'.
IF screen-name = 'P_FILE'.
CLEAR p_file.
screen-input = 0.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
Here: (1) pc_upl is the radio button variable.
(2) P_FILE1 is the parameter type "rlgrap-filename" to fetch the file from Desktop.
(3) ap_upl is the radio button variable.
(4) 'P_FILE' is the parameter type "rlgrap-filename" to create the file in application server.
Here "screen-input = 0" makes the field P_FILE or P_FILE1 to go inactive if the other radio button is selected.
While using Loop at screen syntax always remember to use <b>MODIFY SCREEN</b> as it needs to bring into effect the changes done by us while using this syntax.
Hope this Serves your query.
Reward Points if useful.
Thanks,
Tej..
‎2007 Jun 07 6:21 AM
hi jimmy,
just debugg this code in your se38 once then u'll come to know abt loop at sreen,
REPORT zsmodifid.
*
data: result type p decimals 2.
*SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
*
*PARAMETERS: div RADIOBUTTON GROUP gp DEFAULT 'X' .
*FORMAT COLOR 7 INTENSIFIED ON.
*PARAMETERS: mul RADIOBUTTON GROUP gp .
*FORMAT COLOR 5 INTENSIFIED ON.
*PARAMETERS: add RADIOBUTTON GROUP gp.
*FORMAT COLOR 3 INTENSIFIED ON.
*PARAMETERS:sub RADIOBUTTON GROUP gp.
*FORMAT COLOR 1 INTENSIFIED ON.
*SELECTION-SCREEN: END OF BLOCK b1 .
*
*SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
**PARAMETERS: value1 TYPE i MODIF ID div,
value2 TYPE i MODIF ID div.
*PARAMETERS: d1 TYPE i MODIF ID div,
d2 TYPE i MODIF ID div.
*FORMAT COLOR 3.
*PARAMETERS: m1 TYPE i MODIF ID mul,
m2 TYPE i MODIF ID mul.
*FORMAT COLOR 1.
*PARAMETERS: a1 TYPE i MODIF ID add,
a2 TYPE i MODIF ID add.
*FORMAT COLOR 5.
*PARAMETERS: s1 TYPE i MODIF ID sub,
s2 TYPE i MODIF ID sub.
*FORMAT COLOR 7.
*SELECTION-SCREEN: END OF BLOCK b2 .
*
*AT SELECTION-SCREEN OUTPUT.
CASE 'X'.
WHEN div.
LOOP AT SCREEN.
IF screen-group1 = 'DIV'.
screen-active = 1.
ELSEIF screen-group1 = 'MUL'
OR
screen-group1 = 'ADD'
OR
screen-group1 = 'SUB'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
WHEN mul.
LOOP AT SCREEN.
IF screen-group1 = 'MUL'.
screen-active = 1.
ELSEIF screen-group1 = 'DIV'
OR
screen-group1 = 'ADD'
OR
screen-group1 = 'SUB'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
WHEN add.
LOOP AT SCREEN.
IF screen-group1 = 'ADD'.
screen-active = 1.
ELSEIF screen-group1 = 'MUL'
OR
screen-group1 = 'DIV'
OR
screen-group1 = 'SUB'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
*
ENDLOOP.
WHEN sub.
LOOP AT SCREEN.
IF screen-group1 = 'SUB'.
screen-active = 1.
ELSEIF screen-group1 = 'MUL'
OR
screen-group1 = 'ADD'
OR
screen-group1 = 'DIV'.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
*
ENDLOOP.
ENDCASE.
*
*START-OF-SELECTION.
CASE 'X'.
WHEN div.
result = value1 / value2.
WRITE: result.
WHEN mul.
result = value1 * value2.
WRITE: result.
WHEN add.
result = value1 + value2.
WRITE: result.
WHEN sub.
result = value1 - value2.
WRITE: result.
ENDCASE.
regards,
seshu.