on 01-09-2007 12:34 PM
Hi team,
I have created a group in a view in design time. Now in runtime I want to change the attribute e.g vgutter or design of the view programmatically . I don't know how to do that.
Please reply with a sample code.
Thanks,
Mainak
Hi Mainak,
Some properties, like vGutter cannot be bound, because they are not intended to be changed often.
As Heidi suggested, you should change this via dynamic programming and this is explained in Thomas' blogs.
Ciao, Regina
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Mainak,
You must have binded the Group UI element of your view to a node in the view's context.This has to done in WDDOMODIFY method the view.
The solution to your problem:
1: Add another attribute in your context Node. Please dnt give any Dict Type to the properties of your Node, because it would not take it, as the new attribute does not belong to that structure. Give The Dict type of this new attribute as String.
2: Bind your UI Element property to that context attribute. In your case the UI element property happens to be Group and its property as vGutter.
3: Now in any function Module you can read this attribute, change its value and set it back to the context.
Some Code example:
In my case the node happens to be 'Flights' and the newly added attribute as 'Variable'.
data:
Node_Flights type ref to If_Wd_Context_Node,
Elem_Flights type ref to If_Wd_Context_Element,
Stru_Flights type Wd_This->Element_Flights ,
Item_CARRID like Stru_Flights-CARRID.
navigate from <CONTEXT> to <FLIGHTS> via lead selection
Node_Flights = wd_Context->get_Child_Node( Name = wd_This->wdctx_Flights ).
@TODO handle not set lead selection
if ( Node_Flights is initial ).
endif.
get element via lead selection
Elem_Flights = Node_Flights->get_Element( ).
@TODO handle not set lead selection
if ( Elem_Flights is initial ).
endif.
alternative access via index
Elem_Flights = Node_Flights->get_Element( Index = 1 ).
@TODO handle non existant child
if ( Elem_Flights is initial ).
endif.
get single attribute
Elem_Flights->get_Attribute(
exporting
Name = `Variable`
importing
Value = Item_Variable ).
Item_Variable = 50.
Elem_Flights->set_Attribute(
Name = `Variable`
Value = Item_Variable ).
Hope This Helps.
Cheers!
Ashish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
see the weblogs by Thomas Szuecs on dynamic programming <a href="/people/thomas.szcs/blog/2005/12/28/dynamic-programming-in-web-dynpro-abap--introduction-and-part-i-understanding-ui-elements">one</a> and <a href="/people/thomas.szcs/blog/2006/01/03/dynamic-programming-in-web-dynpro-abap--part-ii-handling-viewelements
Regards, Heidi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Generally, you should bind those UI element properties to context attributes and change the values of these attributes. This can be done from any controller method.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.