‎2008 Jan 11 6:44 AM
Hi,
How to change attributes of a screen dynamically? I need simple programs and basic idea about it
‎2008 Jan 11 6:48 AM
You can be able to change the screen attributes within loop and endloop of that particular screen.
loop at screen.
if screen-name cs 'ZZBATCH'. "custom field
screen-input = '1'.
modify screen.
endif.
endloop
Regards.
Edited by: Sravan Prakash.V on Jan 11, 2008 12:21 PM
‎2008 Jan 11 6:51 AM
Loop at screen.
if screen-name = ' '.
{screen-invisible = '1'.
screen-active = ''
}
MODIFY SCREEN.
endif.
Endloop.
Kanagaraja L
‎2008 Jan 11 6:54 AM
Setting Attributes Dynamically
Each field on a screen has a set of attributes that are fixed when you define the screen in the Screen Painter. During runtime of the ABAP program, a part of the attributes of every screen field can be read to a predefined structure screen using specific statements. These attributes can then modify the screen fields.
Check this sap link for sample program.Setting Attributes Dynamically
http://help.sap.com/saphelp_nw70/helpdata/en/9f/dbab6f35c111d1829f0000e829fbfe/content.htm
Also check this link for information abt screen attributes.
http://help.sap.com/saphelp_nw04/helpdata/en/17/5bf1b22ba211d2954f0000e8353423/frameset.htm
Regards,
Maha
‎2008 Jan 11 6:58 AM
Hi Kavitha,
Here is the explanation....
Each field on a screen has a set of attributes that are fixed when you define the screen in the Screen Painter. When an ABAP program is running, a subset of the attributes of each screen field can be addressed using the system table SCREEN.
LOOP AT SCREEN.
...
MODIFY SCREEN.
...
ENDLOOP.
You cannot use any further additions in the LOOP AT SCREEN statement.
Example
add the following code in PBO
loop at screen.
if screen-name = 'NAME_OF_FIELD_HERE_IN_CAPS'.
set attributes of screen such as REQUIRED, INPUT, OUTPUT, INTENSIFIED, INVISIBLE,ACTIVE, DISPLAY_3D, VALUE_HELP to 1(ON) or 0(OFF)
e.g. screen-output = 1.
modify screen.
endif.
endloop
if the field is part of a table control, put the above code within the the loop...endloop of the table control in PBO
Reward if helpful.
Thankyou,
Regards.
‎2008 Jan 11 7:06 AM
Hi,
The ABAP statement MODIFY SCREEN modifies the attributes of the current screen element with the values from the predefined screen work area.
Syntax
Effect
This statement can be used in the statement block after LOOP AT SCREEN only and makes sense only during PBO processing. If FROM is not specified, MODIFY SCREEN modifies the attributes of the current screen element with the values from the predefined screen work area. If a wa work area is specified, its contents are used for the modification.
The wa work area must have the same data type as screen. The name component must contain the name of the current screen element, otherwise the statement is not executed. nweisung nicht ausgeführt. Up to the group1 to group4 and length components, all remaining components of screen and wa must contain either the value 0 or 1. The value 0 deactivates the corresponding field attribute, and 1 activates it.
If MODIFY SCREEN is executed during PBO processing, the modified attributes for the display of the screen affect the current dynpro after PBO processing. The attributes of the screen element of the dynpro are reset to their static attributes at the start of each PBO processing, so that the execution of MODIFY SCREEN during PAI processing does not effect the display of the following screen.
The active component
The active component is used to set the input, output and invisible components at once. At the start of PBO processing, the active component always has the value 1. If active is set to 0 with MODIFY SCREEN, input and output are automatically set to 0 and invisible is set to 1. Other values in input, output and invisible are ignored. Conversely, setting input and output to 0 and invisible to 1 automatically sets active to 0 and a different value in active is ignored.
Modifications in Table Controls and Step Loops
During processing of a table control or a step loop, the changes affect the current line of the table control or the current step loop group. Before the processing of a table control, the change to the attributes of a screen element that is part of a line in the table control does not effect the table control, since the values are transferred from the structure created using CONTROLS. Before a step loop is processed, the change to the attributes of a screen elements that is part of a step loop group affects all groups in the step loop.
Modifications to Tabstrip Controls
If the active component for a tab title of a tabstrip control is set to 0, the whole tabstrip page is hidden.
Example
In the following PBO module, an input field called val is made mandatory and converted to display in the foreground.
MODULE modify_0100 OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'VAL'.
screen-required = '1'.
screen-intensified = '1'.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDMODULE.
Regards,
Renjith Michael.