cancel
Showing results for 
Search instead for 
Did you mean: 

Assign values to UI element at runtime

Former Member
0 Kudos

Hi,

I want to assign values to TextView user interface element at run time in ABAP webdynpro? how? plz give the syntax.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi Mog ,

What do you exactly mean by "assign values to TextView user interface element at run time " .

After my Understanding you can do

Sol. 1 ) You said you want assingn value to Textview at runtime .

Do one thing .Make Node with element .Now Bind your property of textview (Which you want to have at runtime ) to element in Context . Now Based on Value itgets it shows you Textview in that way .

Solution 2) If you want creat UI element at run time and set its properties , you can do one thing go for Dynamic Programming .

<a href="/people/thomas.szcs/blog/2005/12/28/dynamic-programming-in-web-dynpro-abap--introduction-and-part-i-understanding-ui-elements Programming Web blog</a>

<a href="/people/thomas.szcs/blog/2006/01/03/dynamic-programming-in-web-dynpro-abap--part-ii-handling-viewelements Programming Web blog 2</a>

Sample code for Dynamic Programming .

**********************************************************************************************

METHOD wddomodifyview .

DATA:

lr_container TYPE REF TO cl_wd_uielement_container,

lr_button TYPE REF TO cl_wd_button,

text TYPE string.

CONSTANTS:

lc_description TYPE string VALUE 'DESCRIPTION'.

  • let's do it only once

CHECK first_time = abap_true.

  • get a pointer to the RootUIElementContainer

lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).

  • create the button and add it to the container

lr_button = cl_wd_button=>new_button( bind_text = lc_description on_action = 'ON_ACTION' ).

cl_wd_flow_data=>new_flow_data( element = lr_button ).

lr_container->add_child( lr_button ).

  • fill the context attribute with the OTR text

text = cl_wd_utilities=>get_otr_text_by_alias( 'SOTR_VOCABULARY_BASIC/CONFIRM' ).

  • set the value of the text in the context attribute

wd_context->set_attribute( name = lc_description value = text ).

ENDMETHOD.

**********************************************************************************************

Hope I have given some Direction to you.

Cheers

Parry

former_member182372
Active Contributor
0 Kudos

Mog, what do you mean "assign values to TextView user interface element at run time"? You wanna change binding of UI element properties? Or you wanna just change value of context attribute bound to UI element properties?

Former Member
0 Kudos

Hi Mog,

Check out the standard WD ABAP examples,

WDR_TEST_UI_ELEMENTS

WDR_TEST_EVENTS

In this they have mentioned all the reaquired UI elements and their different

properties. You can fill the context node at runtime.

Hope this will help you.

Cheers,

Darshna.