05-22-2006 1:32 PM
Hi all,
I want to know the basic concepts of Loop at screen and where I can use it.
Pls explain it to me by code I am not getting the concepts.
Please experts help me out.
With regards,
Abir.
05-22-2006 1:42 PM
copy paste and execute this prog
REPORT ychatest.
DATA : flg TYPE i,
flg1 TYPE i.
PARAMETERS : chk1 TYPE c AS CHECKBOX USER-COMMAND ch1 MODIF ID m1,
chk2 TYPE c AS CHECKBOX USER-COMMAND ch2 MODIF ID m2.
INITIALIZATION.
flg = 1.
flg1 = 1.
AT SELECTION-SCREEN .
IF sy-ucomm = 'CH1'.
IF chk1 = 'X'.
flg = 1.
flg1 = 0.
ELSE.
flg = 1.
flg1 = 1.
ENDIF.
ELSEIF sy-ucomm = 'CH2'.
IF chk2 = 'X'.
flg = 0.
flg1 = 1.
ELSE.
flg = 1.
flg1 = 1.
ENDIF.
ENDIF.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = 'M1'.
screen-input = flg.
MODIFY SCREEN.
ELSEIF screen-group1 = 'M2'.
screen-input = flg1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
05-22-2006 1:35 PM
Hi Abir,
Please refrain from creating multiple posts on the same topic.
Close one of them.
Check the program DEMO_DYNPRO_MODIFY_SIMPLE for some inputs.
Regards,
Ravi
05-22-2006 1:38 PM
Hi,
check this code..
REPORT ZTEST_CHECK .
parameters: p_sale radiobutton group g1 user-command ABC default 'X',
p_mate radiobutton group g1 .
parameters: p_vbeln like vbak-vbeln,
p_matnr like mara-matnr.
at selection-screen output.
if p_sale = 'X'.
loop at screen.
if screen-name = 'P_MATNR'.
screen-input = 0.
endif.
modify screen.
endloop.
endif.
if p_mate = 'X'.
loop at screen.
if screen-name = 'P_VBELN'.
screen-input = 0.
endif.
modify screen.
endloop.
endif.
Regards
vijay
05-22-2006 1:42 PM
copy paste and execute this prog
REPORT ychatest.
DATA : flg TYPE i,
flg1 TYPE i.
PARAMETERS : chk1 TYPE c AS CHECKBOX USER-COMMAND ch1 MODIF ID m1,
chk2 TYPE c AS CHECKBOX USER-COMMAND ch2 MODIF ID m2.
INITIALIZATION.
flg = 1.
flg1 = 1.
AT SELECTION-SCREEN .
IF sy-ucomm = 'CH1'.
IF chk1 = 'X'.
flg = 1.
flg1 = 0.
ELSE.
flg = 1.
flg1 = 1.
ENDIF.
ELSEIF sy-ucomm = 'CH2'.
IF chk2 = 'X'.
flg = 0.
flg1 = 1.
ELSE.
flg = 1.
flg1 = 1.
ENDIF.
ENDIF.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = 'M1'.
screen-input = flg.
MODIFY SCREEN.
ELSEIF screen-group1 = 'M2'.
screen-input = flg1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
05-22-2006 1:42 PM
hi,
or look here:
<a href="http://help.sap.com/saphelp_47x200/helpdata/en/9f/dba70535c111d1829f0000e829fbfe/frameset.htm">Modifying Input Fields</a>
Andreas
05-22-2006 1:43 PM
Hi Abir,
The statement LOOP AT SCREEEN. is used for modifying the screeen elements.
The statement should be called in the PBO event to perform the required functionality.
eg: suppose that you want to make a field invisible when a button is clicked, then in the PBO of the screen, write this code.
LOOP AT SCREEN.
if screen-name = 'INP1'.
screen-invisible = '1'.
modify screen.
endif.
In this example , the processing is like this.
The statement LOOP AT SCREEN. causes each screen element to be processed. Each time the loop statement is executed, screen-name will be filled with the name of the screen element . Depending on the name of the screen element , you can process using the above mentioned statements.
SCREEN is a structure which has components like NAME,GROUP1,GROUP2,GROUP3 , GROUP4,INPUT,OUTPUT, INVISIBLE,ACTIVE etc.
For more details , just check this link in SAP Library.
http://help.sap.com/saphelp_nw04/helpdata/en/9f/dbab6f35c111d1829f0000e829fbfe/content.htm
Regards,
SP.
05-22-2006 1:46 PM
Hi,
the loop at screen is used whenever one wants to change the screen attributes.
what we can do is that we can group the screen elements(for which we want to change the attributes) into some group name in the screen layout, say, G1.
loop atscreen.
if screen-group = 'G1'.
we can change the screen attributes like :
screen-invisible = 0.
screen-input = 0.
*etc.
modify screen. "this statement is very imp.
endif.
endloop.
Regards,
Aswin
05-22-2006 1:57 PM
Hai Abir
Check the following Documentation
Basic form
LOOP AT SCREEN.
Effect
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.
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.
Overview of all SCREEN fields:
Field Length Type Meaning
SCREEN-NAME 30 C Field name
SCREEN-GROUP1 3 C Evaluation of
modification group 1
SCREEN-GROUP2 3 C Evaluation of
modification group 2
SCREEN-GROUP3 3 C Evaluation of
modification group 3
SCREEN-GROUP4 3 C Evaluation of
modification group 4
SCREEN-REQUIRED 1 C Field input mandatory
SCREEN-INPUT 1 C Field ready to accept input
SCREEN-OUTPUT 1 C Field will be displayed
SCREEN-INTENSIFIED 1 C Field highlighted
SCREEN-INVISIBLE 1 C Field invisible
SCREEN-LENGTH 1 X Field length
SCREEN-ACTIVE 1 C Field active
Example
Make all fields display only:
CONSTANTS OFF VALUE '0'.
LOOP AT SCREEN.
SCREEN-INPUT = OFF.
MODIFY SCREEN.
ENDLOOP.
Check the following Code
tables : mara,
marc.
data : V_matnr like marc-matnr,
V_werks like marc-werks.
data : RB1(1),
RB2(1).
data : MARC_TXT(20).
data : okcode like sy-ucomm.
&----
*& Module USER_COMMAND_0100 INPUT
&----
text
----
module USER_COMMAND_0100 input.
if okcode = 'BACK'.
leave program.
endif.
endmodule. " USER_COMMAND_0100 INPUT
&----
*& Module STATUS_0100 OUTPUT
&----
text
----
module STATUS_0100 output.
SET PF-STATUS 'SRI01'.
SET TITLEBAR 'xxx'.
if RB1 = 'X'.
loop at screen.
if screen-name = 'V_MATNR'.
screen-input = 1.
screen-required = 1.
modify screen.
endif.
if screen-name = 'MTRN'.
screen-invisible = 0.
modify screen.
endif.
if screen-name = 'V_WERKS'.
screen-active = 0.
modify screen.
endif.
if screen-name = 'PLNT'.
screen-invisible = 1.
modify screen.
endif.
endloop.
MARC_TXT = 'Data From Srinu'.
elseif RB2 = 'X'.
loop at screen.
if screen-name = 'V_MATNR'.
screen-input = 1.
screen-required = 0.
modify screen.
endif.
if screen-name = 'MTRN'.
screen-invisible = 0.
modify screen.
endif.
if screen-name = 'V_WERKS'.
screen-active = 1.
screen-required = 1.
modify screen.
endif.
if screen-name = 'PLNT'.
screen-invisible = 0.
modify screen.
endif.
endloop.
MARC_TXT = 'Data From Kiran'.
if V_matnr <> space and V_werks <> space.
select single matnr werks from marc into (V_matnr,V_werks)
where matnr = V_matnr and
werks = V_werks.
if sy-subrc <> 0.
message e003 with 'Input Does' 'Not Match' 'From MARC Table'.
endif.
endif.
endif.
endmodule. " STATUS_0100 OUTPUT
Thanks & regards
Sreeni
05-22-2006 2:13 PM
Hi Abir,
LOOP AT SCREEN is mainly used for processing your screen elements,say you can use it modify the appearance of your screen elements..
For eg,
PARAMETERS: P1 TYPE I MODIF ID MOD1,
P2 TYPE I MODIF ID MOD2.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF SCREEN-GROUP1 = 'MOD1'.
SCREEN-INPUT = 0.
MODIFY SCREEN.
ENDLOOP.
Cheers,
Abdul
Note: Mark All useful answers
06-10-2006 12:46 PM
How do I change the text of a text field during runtime of the program? in module pool.