cancel
Showing results for 
Search instead for 
Did you mean: 

webdynpro abap

Former Member
0 Kudos

hi,

I have created a 3 views embeded in the main view.

In the first view i have created dynamic buttons . suppose there are 2 buttons in the first view , based on the selection i need data next to that button in second view2 .

my question is how to identify the button in view2. i have created the attributes dynamically as button_1 and button_2.

thanks,

Deepa

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

hi all,

Thanks for the replies.

I have created a global table  in component controller with one key field for button.

i populated this table with view1 entries..

i didnot create dynamic attribute for button.i simply dynamically created the button in view1 with action click

on action click method i wrote the below code. In wa_temp i have the desired row.

   l_button_name = wdevent->get_string( name = 'ID' ).

  it_temp = wd_comp_controller->gt_temp.

read table it_temp into wa_temp with  key key1 = l_button_name.

regards,

Deepa

Former Member
0 Kudos

Hi Deepa,

From the requirement you stated above here is one design I can suggest:

Create a context node TABLE and add an attribute ATTR1 of type string.

Use a Row Repeater UI element to arrange your data. Bind the dataSource property with the context node Table.

Add a Text and Button UI element to your Row Reapeater.

Assign an action to your button.

Bind the text property of the Button and TextView UI element to the ATTR1.

Now in the event handler of the action defined earlier add the following code:

    DATA lr_obj TYPE REF TO object.
  DATA lr_ctxt TYPE REF TO if_wd_context_element.
  DATA lv_value TYPE string.
  CALL METHOD wdevent->get_object
    EXPORTING
      name  = 'CONTEXT_ELEMENT'
    RECEIVING
      value = lr_obj.
  lr_ctxt ?= lr_obj.
  CALL METHOD lr_ctxt->get_attribute
    EXPORTING
      name  = 'ATTR1'
    IMPORTING
      value = lv_value.

lv_value will have the data of the button pressed. Using the value you can use case statements and navigate accordingly.

Hope it helps.

Regards,

Sayan

Former Member
0 Kudos

Hi,

See you need to take a data in Component controller(CONTEXT) which is a global one. So that the data or the selection values will be available in all the views.

Thanks

Vijay

former_member7958
Discoverer
0 Kudos

Hi,

I guess here you no need to identify any action or button. Onlick of that particular button(onaction method) you can pass that corresponding data to the global attributes or plugs and you can use.

or if you want to know which button was triggered you can create one global attribute and store the button name on click of the button (on action method)  and you can use that in your coding.

Thanks

Revati

Former Member
0 Kudos

hi revathi,

The buttons are dynamic ,suppose there are 3 records in first view and 3 buttons next to it, if the user clicks on button2 i want only button 2 data in the view2.

thanks,

deepa

Former Member
0 Kudos

Hi 

Is this kind of output u r looking.??

Thanks

Vijay

Former Member
0 Kudos

Hi Deepa,

Please check this thread http://scn.sap.com/thread/633878.

Also after cliking button fire an event with parameter passed with it so that you can guess which button is clicked. Or else if you have created attributes for these buttons then try to access the attributes with index.

Regards,

Sudhir Kothavale.

Former Member
0 Kudos

hi sudhir,

can u tell how to access the attributes with index.

thanks in advance,

deepa