04-22-2008 9:16 AM
Hi
In the screen internal table attributes i have seen four groups namely by group1 to 4.
My doubt is what is the concept behind this??
How to find out the screen group for a particular field??
it is already assigned or we have to assign it??
Thanks and Regards
Arun Joseph
04-22-2008 10:35 AM
Hi Arun,
Thr purpose of GROUP1, GROUP2, GROUP3, GROUP4 is as follows.
Specifying three-character identifiers for modification groups 1 to 4 allows you to group fields together. You can process them all at the same time in the program using SCREEN modification statements.
If, for example, you want to make all fields that of the modification group 2 with the ID 222 invisible, you can define the following code in the PBO module:
LOOP AT SCREEN.
IF SCREEN-GROUP2 = '222'.
SCREEN-INVISIBLE = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
If the field has no name, there can be no group assignment.
Also refer to the following link.
[http://help.sap.com/saphelp_nw70/helpdata/EN/9f/dbab6f35c111d1829f0000e829fbfe/frameset.htm]
Hope this is helpful. Reward accordingly.
Thanks and Regards,
Maddineni Bharath.
04-22-2008 9:25 AM
You can change the attributes of a field by using group like
Loop at screen .
if screen-group1 = 'G1'.
screen-active = 1.
screen-input = 0.
screen-output = 1.
screen-invisible = 0.
modify screen.
endif.
endloop.
You can fing out the group of field on screen in the attribute window of a field on the screen.
if they are not already assigned then we can assign it but its not compulsary its totally depends on requirement whether to use it or not .
for more explanation
Specifying three-character identifiers for modification groups 1 to 4
allows you to group fields together. You can process them all at the
same time in the program using SCREEN modification statements.
If, for example, you want to make all fields that of the modification
group 2 with the ID 222 invisible, you can define the following code in
the PBO module:
LOOP AT SCREEN.
IF SCREEN-GROUP2 = '222'.
SCREEN-INVISIBLE = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
If the field has no name, there can be no group assignment.
reward if helpful
04-22-2008 10:05 AM
Hi Arun,
(1) what is the concept behind this??
I will try to give a simple example for the same
Imagine a field called TEST1 and test2 for which in the screen we have 4 groups
Now the requirement is that
(1) when user enters transaction X1 he needs to see the field TEST1 and TEST2
(2) when user enters transaction X1 he needs to see the field TEST1 and dont want to see TEST2
so if tcode = X1
we need both TEST1 and TEST2
so in group1 (first of the 4 boxes we write G1 for both TEST1 and TEST2)
we write the code
loop at screen
if screen-group1 = 'G1'
screen-active = 1.
else screen-active = 0.
so if tcode = X1
we need to see TEST1 and hide TEST2
in the second box of the group we write G2 only for TEST1
we write the code
loop at screen
if screen-group2 = 'G1'
screen-active = 1.
else screen-active = 0.
since TEST2 second box is empty the above code will execute the else part and hide field TEST2 but show TEST1
In short screen groups help us group a particular set of screen fields based on a particular requirement
in this case just 2 are mentioned , imagine a case with 10 fields,we can easily control thier screen properties through code by grouping them
(2) How to find out the screen group for a particular field??
Check the screen properties of the field in the screen painter and see which all groups are filled
In the screen painter just see the boxes which are filled for "Group"
if the first box is filled then in the ABAP code
check by writing if screen-group1 = 'XX'
if the second box is filled then in the ABAP code
check by writing if screen-group2 = 'XX'
the third box is filled then in the ABAP code
check by writing if screen-group3 = 'XX'
the fourth box is filled then in the ABAP code
check by writing if screen-group4 = 'XX'
this replaces the check if screen-name = a field and checks which all fields fall under a group and does action on all the fields based on the code written
(3)it is already assigned or we have to assign it??
If it is a stndard program then it comes predefined if the group property of the screen is used to control it..to change it an access key maybe required provided there are no user exits for the same
in a custom program we can fill the group properties of a screen element
Pls revert if you need more clarifications
Reward if helpful
Regards
Byju
04-22-2008 10:15 AM
Hi
Now the requirement is that
(1) when user enters transaction X1 he needs to see the field TEST1 and TEST2
(2) when user enters transaction X1 he needs to see the field TEST1 and dont want to see TEST2
In both the cases u have mentioned the transaction name as X1 its bit confusing for me??
Can you please xpalin it more clearly and what will happen it screen-active = 0??
Thanks and Regards
Arun
04-22-2008 10:30 AM
Hi Arun,
Just change the second half as X2
Now the requirement is that
(1) when user enters transaction X1 he needs to see the field TEST1 and TEST2
(2) when user enters transaction X2 he needs to see the field TEST1 and dont want to see TEST2
(1)so if tcode = X1
we need both TEST1 and TEST2
so in group1 (first of the 4 boxes we write G1 for both TEST1 and TEST2)
we write the code
loop at screen
if screen-group1 = 'G1'
screen-active = 1.
else screen-active = 0. *hide the fields
(2)so if tcode = X2
we need to see TEST1 and hide TEST2
in the second box of the group we write G2 only for TEST1
we write the code
loop at screen
if screen-group2 = 'G2'
screen-active = 1.
else screen-active = 0.
since TEST2 second box is empty the above code will execute the else part and hide field TEST2 but show TEST1
screen-active = 0 .
means it will make the screen inactive , it can hide the fields
....also you can use screen-invisible = 1.
Regards
Byju
04-22-2008 10:55 AM
Hi
Thanks for ur replies.
Can you please give me example for input,output,invible??
what is the functionality for input,output,invisible??
Thanks and Regards
Arun Joseph
04-22-2008 11:05 AM
Hi Arun,
You can refer the code in standard program demo_dynpro_modify_simple
screen has different properties which can be modified
Go to se11 -> SCREEN ->click display
All these fields are screen properties and most of them can be controlled in coding
eg:
loop at screen.
if screen-name = ZXXXX
if you give screen-input = 1
modify screen
then the screen field will become input only
if you give screen-input = 0
modify screen
screen field will become display only
if you give screen-invisible = 0
screen will be visible
if you give screen-invisible = 1
screen will become invisible
endif
For each and every property in the screen table refer
http://209.85.175.104/search?q=cache:egD5kekLDTQJ:www.sapmaterial.com/files/modifying_screen_fields....SCREEN-activescreen-outputpropertiesin+SAP&hl=en&ct=clnk&cd=8&gl=in
or
http://www.sapmaterial.com/files/modifying_screen_fields.pdf
Reward if helpful
Regards
Byju
04-22-2008 10:35 AM
Hi Arun,
Thr purpose of GROUP1, GROUP2, GROUP3, GROUP4 is as follows.
Specifying three-character identifiers for modification groups 1 to 4 allows you to group fields together. You can process them all at the same time in the program using SCREEN modification statements.
If, for example, you want to make all fields that of the modification group 2 with the ID 222 invisible, you can define the following code in the PBO module:
LOOP AT SCREEN.
IF SCREEN-GROUP2 = '222'.
SCREEN-INVISIBLE = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
If the field has no name, there can be no group assignment.
Also refer to the following link.
[http://help.sap.com/saphelp_nw70/helpdata/EN/9f/dbab6f35c111d1829f0000e829fbfe/frameset.htm]
Hope this is helpful. Reward accordingly.
Thanks and Regards,
Maddineni Bharath.