cancel
Showing results for 
Search instead for 
Did you mean: 

Change button text after user selection in pop up - ALV Webdynpro.

0 Kudos

Hi,

I have 2 windows. Window1 has ALV table with one of its fields having user name in the form of buttons. Once this button is clicked there will be a pop up (from Window 2) with list of user names. The user can choose any user name. Once he chooses the user name from Window 2, the same name must appear as button text in Window 1. As of now I get the index of the line which the user clicked in Window 1 and also the pop up with the user name list in Window 2. But the button text does not change.

I do not know how to achieve the change of button text for the index i have. Please help.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member198833
Active Participant
0 Kudos

Hi Deepak,

You can use the Index of the selected element to read the text of user name from the context:


data: l_node  type ref to IF_WD_CONTEXT_NODE,

        l_element  type ref to IF_WD_CONTEXT_ELEMENT,

        l_my_string  type string.

l_node  = wd_context->get_child_node( wd_this->wdctx_node_1 ).

l_element  = l_node->get_element( 2 ).

l_element->get_attribute(

     exporting name = 'ATTR1_1'

     importing value = l_my_string ).

"l_my_string" will have the user name string. Then you can dynamically set the button text to this element or you can bind the Text property of the button to a Context Attribute and modify this attribute after the user selects a element from the second window.

Regards,

Felipe

0 Kudos

Hi Felipe,

Thanks for your response. The problem I am facing is change the text of a button on say row 4 on 3rd field. I am able to retrieve records from the index. Setting the text on a particular index is where i am stuck. Need help on this part.

Thanks,

Deepak

former_member198833
Active Participant
0 Kudos

Hi Deepak,

You can create a Context Attribute, named 'MY_CXT_ATTRIBUTE' of cardinality 1..1 with type STRING and bind it to Text property of the Button UI element. Then, after you get the text selected by user, just access this context attribute and modify it to the value selected by the user:


data: l_node  type ref to IF_WD_CONTEXT_NODE,

        l_my_string  type string.

l_node  = wd_context->get_child_node( wd_this->wdctx_node_1 ).

l_node->SET_ATTRIBUTE(

       EXPORTING

         NAME  = 'MY_CXT_ATTRIBUTE'

         VALUE = l_my_string ).

Regards,

Felipe

Former Member
0 Kudos

Hi,

Why don't you read the selected value and set it back to the window1 value as required.

Hope this helps you.

Thanks

KH

0 Kudos

Hi KH,

Thankyou for the response. Reading and setting the value works for input fields because once we modify bind the whole table, the changes will be visible. But when the button text has to be changed, the binding property does not work as expected.

CALL METHOD lo_column->set_cell_editor

       EXPORTING

         value = lo_button.


The above code changes all the button text instead of a particular row where i want to see the change.


Thanks,

Deepak M S