cancel
Showing results for 
Search instead for 
Did you mean: 

Show different output in ALV controlled by dropdown

Former Member
0 Kudos

Hi,

i am new in WebDynpro ABAP.

I want to change the Output from an ALV which is specified on an selection by the Dropdown.

For Example:

DropdownList containing values like value1, value2...

For value1 the Output for the ALV will be temp1.

For value2 the Output for the ALV will be temp2

Method temp1.

DATA: lo_nd_temp1 TYPE REF TO if_wd_context_node,
             lo_el_temp1 TYPE REF TO if_wd_context_element,
             ls_temp1   TYPE wd_this->element_template,
             lt_temp1         TYPE wd_this->elements_template,

...Code for filling lt_example

lo_el_temp1 = lo_nd_temp1->create_element( ).
lo_nd_temp1->bind_table( new_items = lt_temp1_).

Method temp2.

*The same like temp1 with different contant in it_temp1.

Method onaction.

  lo_el_dropdownbykey->get_attribute(
    EXPORTING
      name  = 'KEY'
    IMPORTING
      value = lv_value ).

CASE lv_value.
  WHEN 'value1'.
      *Show Content it_temp1.
  WHEN 'value2'.
      *Show Content it_temp2.
  WHEN OTHERS.

Do I Need two different ALV like ALV_temp1 and ALV_temp2 or can i modify the displayed Content for one ALV?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi David Ka,

In your case only one context node is required.

while coming to your question, different method- what it means, whether you are talking about the method in view level or assistance class level.

If it is view level, you can access the method with view reference in Attributes tab.

If it is assistance class level, you can easily access the method with wd_assist.

Thanks

Ananda

Answers (3)

Answers (3)

0 Kudos

Hi David Ka,

Hope you got the clear idea. If yes,close the thread.

Thanks

Ananda

Former Member
0 Kudos

At least I have used one alv bind with one context node were I change the Content in a seperate Methods and call it between the case - when - Statement. Thank you for your replies.

Szczerbowski
Active Participant
0 Kudos

Hi,

I guess the main question would be what is the structure - columns - in value1, and value2.

If they have the same structure, then you can use the same ALV with no big issues.

If they have different structures, then i guess you have two options:

a) Have two ALVs, and control the visibility of them (show/hide)

b) create a dynamic ALV with SALV_WD_TABLE and the structure definition based on the dropdown value, each time you change the dropdown value you reneder a new ALV.

Regards,

Michal

Former Member
0 Kudos

The structure of temp1 and temp2 are the same value1 and value2 are the "TEXT" that showing in the Dropdown menu.

Can you explain how I call an different ViewContainerUIElement as Default between the "WHEN" Statements?

Szczerbowski
Active Participant
0 Kudos

If you have one ALV bound to context, you only need to change the content of that context node.

It would help if you provide a screenshot or two, not sure i fully get your dropdown concept.

And the context structure..

M.

Former Member
0 Kudos

I have two VCUIElement, only the left one is relevant.

I the left top corner is the Dropdown, i want to Display each contant that is selected from Dropdown.

In the black rectangle will be Displayed which value is selected by the Dropdown.

The "value" is the above shown Methode temp1 or temp2.

Szczerbowski
Active Participant
0 Kudos

Then as i see your application:

- you have a context node already linked to that left-side ALV - NODE1

- in the event onselect event of your alv you just need to change the elements in that context node1

- alv will be refresh with new data

Isn't that so?

Former Member
0 Kudos

I have tried to search for an Event like onselect...I find the Eventhandler Method from the ALV.

But I don't now how and if this solves my Problem.

I think it is something with the bindings of the context nodes. It isn't possible to bind 2 context nodes to the DATA node of an ALV.
So I created 2 context nodes for each choose of Dropdown and 2 ALV that I bind to each context node.

former_member198833
Active Participant
0 Kudos

Hi David,


David Ka wrote:

I have tried to search for an Event like onselect...I find the Eventhandler Method from the ALV.

But I don't now how and if this solves my Problem.

I think it is something with the bindings of the context nodes. It isn't possible to bind 2 context nodes to the DATA node of an ALV.
So I created 2 context nodes for each choose of Dropdown and 2 ALV that I bind to each context node.


I believe the OnSelect event mentioned here is not on the ALV, but on the DropDown element.


Regards,

Felipe

Szczerbowski
Active Participant
0 Kudos

You only need one context node for that ALV, and you fill it each time the selection on the ALV changes, just like here

lo_nd_temp1->bind_table( new_items = lt_temp1_).

bind_table has a second parameter that clears previous entries.

Former Member
0 Kudos

How can I access it_temp1 when it is defined in a other method in the same webdynpro?

Szczerbowski
Active Participant
0 Kudos

Hi,

You fill it in somehow, preferably with an assistance class, or encapsulated in some method.

Call the same logic.

ONSELECT

- when value1
lt_table = <here you fill it from one place>
- when value2

lt_table = <here you fill it from another>

node->bind_Table( lt_table ).

...