cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP Webdynpro - Populating second table based on data selected on first

Former Member
0 Kudos

Hi Experts,

I am new to ABAP Webdynpro. I have a requirement to show a search area, one table for header info, and second table for populating item level information.

I was successful building a search area and populating first table when the 'Search' button is pressed.

Now, I like to populate the second table with item details if a row on first table is selected. I tried to bind the OnSelect Event of first table to a method and try to get the results and bind to second table.. However, I am unsuccessful in this attempt.

Here are my questions/challenges.

1. When I select a row on first table, how can I extract the key information?

2. Is it sufficient to create a context attribute and populate it with FM and bind that with second table?

I appreciate your help in answering this question.

Thanks,

SG

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi ,

On selecting the row in alv,

you can get the row number and from the internal table try to get the required key.

Once u get the key..

process it as per your reqirement and bind it to the item table .

you can go for popup window on which the view is embedded to hold the item details .

Refer this component : SALV_WD_TEST_TABLE_SELECT.

I hope this will help you.

Regards,

RK

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Regarding...

1. When I select a row on first table, how can I extract the key information?

When you select any row in table, a lead selection will be set in the node which bound to the table.

To read this selected record you need to use the following code. Here the name of context node is "FLAGS". And the structure ls_flags contains all the attributes defined in the node.

DATA lo_nd_flags TYPE REF TO if_wd_context_node.
  DATA ls_flags TYPE wd_this->element_flags.

  lo_nd_flags = wd_context->get_child_node( name = wd_this->wdctx_flags ).

  CALL METHOD lo_nd_flags->get_static_attributes
    IMPORTING
      static_attributes = ls_flags.

Regarding....

2. Is it sufficient to create a context attribute and populate it with FM and bind that with second table?

Based on the data that you got in the first step, you can fill an internal table with data that needs to be displayed in 2nd table.

To bind the internal table you need to define the internal table of type context node. Use the following code to bind the internal table to context node which bound to 2nd table. Here name of the context node is "OVERVIEW".

DATA: lo_nd_overview TYPE REF TO if_wd_context_node,
            lt_overview TYPE wd_this->elements_overview.

<<<< Fill lt_overview with data >>>>>

        lo_nd_overview = wd_context->get_child_node( name = wd_this->wdctx_overview ).
        CALL METHOD lo_nd_overview->bind_table
          EXPORTING
            new_items            = lt_overview.

Alternatively you can use the Supply Function Method.

Vikrant Trivedi

Former Member
0 Kudos

Hi ,

You are in a right direction , i am not sure why it is not working for you.

You have a table say (master) which is bind to a node called Master.

You have a table say (detail) which is bind to a node called Detail.

Every element in master can contain 0 .. n detail elements.

If you have your Detail node inside your Master node then i would advice you to write a Supply function.

on each selection of the master element supply function is called with the Master element (Parent). You can get the key from the parent element and use your FM to fill the detail node (node).