cancel
Showing results for 
Search instead for 
Did you mean: 

ALV row selection - navigation

Former Member
0 Kudos

Hi All,

I need to build an ALV with initial details for an employee, on selection of any of the row, i need to display another detailed ALV pertaining to the information selected in first view.

I am searching on options to imlement this, can you please give me some suggestions on this.

How do we capture the data that will be selected on first ALV, since the same data will be needed to render the 2nd ALV.

How do we pass the contents from one ALV to other? using Plugs?

Thanks in advance.

Thanks,

Chandru

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
How do we capture the data that will be selected on first ALV, since the same data will be needed to render the 2nd ALV.

Use this code in On_Lead_Select event handler :

*******Get the index of Row Selected.*****
data l_event type I.
l_event = R_PARAM->index.

 DATA lo_nd_cn_sflight TYPE REF TO if_wd_context_node.
  DATA lo_el_cn_sflight TYPE REF TO if_wd_context_element.
  DATA ls_cn_sflight TYPE wd_this->element_cn_sflight.
* navigate from <CONTEXT> to <CN_SFLIGHT> via lead selection
  lo_nd_cn_sflight = wd_context->get_child_node( name = wd_this->wdctx_cn_sflight ).

* get element via lead selection
  lo_el_cn_sflight = lo_nd_cn_sflight->get_element( index = l_event ).

********** Get data of Row index Selected *****************
* get all declared attributes
  lo_el_cn_sflight->get_static_attributes(
    IMPORTING
      static_attributes = ls_cn_sflight ).

How do we pass the contents from one ALV to other? using Plugs?

You need not pass the content from one ALV to Another. Just map the ALV1 with comp controller.

This way you will be able to access all data of ALV1 in any View.

Former Member
0 Kudos

Hello Saurav,

Thank you for your reply.

I was able to create 2 individual views, connected with inbound and outbound plugs. Tested the navigation using 2 simple buttons on each view - it works.

In View1 - I have an ALV -

1. I have declared the component usage of ALV Interface controller in the View's property.

2. Created a method H_ON_LEAD_SELECT to to use the ON_LEAD_SELECT event of ALV - i've used it by pressing F4 on Event field.

3. Inside this method i have a code to retrieve the Lead selection index and Node attributes (as mentioned by Saurav).

4. Application is activated and ran the appln. Break point set in the H_ON_LEAD_SELECT method to test.

I am able to see the output of the View1 with an ALV of initial employee set.

But i cannot select any of the Rows in the ALV output. Automatically 1st row is selected, but i am not able to select any other rows. Obviously the control does not break at the break point set in H_ON_LEAD_SELECT method.

I tried the below things to enable the selection, but still it does not work. This code is in Init method where the ALV is binded with data.

lr_config->if_salv_wd_table_settings~SET_ROW_SELECTABLE( abap_true ).

Can you please help me out with this issue?

On row selection, i need to fetch that row details and pass it to second View (View2) to display another ALV with detailed employee info.

Thanks in advance.

Thanks,

Chandru

Former Member
0 Kudos
But i cannot select any of the Rows in the ALV output.

You can check following things:

1. Check the cardinality and selection of node . Cardinality 0..n and Selection 0..1.

2. Check whether you have written anything in wd domify.

3. Try using auto mode for SET_SELECTION_MODE method :

Refer this thread wid similar problem:

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Make the table editable to select the row.

DATA:lr_table_settings TYPE REF TO if_salv_wd_table_settings,

lo_value = lo_interfacecontroller->get_model( ).

lr_table_settings ?= lo_value .

lr_table_settings->set_read_only( abap_false ).

Priya

Former Member
0 Kudos

Hi Saurav / Chaitanya,

Thank you for your reply.

My problem is still not solved.

I checked the below settings and implemented the code which you had provided.

1. Check the cardinality and selection of node . Cardinality 0..n and Selection 0..1. - Yes, also tried with selection 0..n

2. Check whether you have written anything in wd domify. - No, nothing is written in WD Modify

3. Try using auto mode for SET_SELECTION_MODE method : - Tried but no change. I tried both the below options and both dont cause any changes.

lr_config->if_salv_wd_table_settings~SET_SELECTION_MODE( CL_WD_TABLE=>E_SELECTION_MODE-AUTO ).

lr_config->if_salv_wd_table_settings~SET_SELECTION_MODE( '02' ).

I also tried to make it read only by using below code as mentioned by Chaitanya - but still the control does not go to H_ON_LEAD_SELECT event. I have code to read the lead selection node and method call to Outbound plug fire event. So the navigation is not happening to View2.

One change i see after making it read_only false is, the ALV becomes dull and now i see more buttons on the ALV (Insert row, delete row etc)

lr_config->if_salv_wd_table_settings~set_read_only( abap_false ).

lr_config->if_salv_wd_table_settings~SET_ROW_SELECTABLE( abap_true ).

call method lr_config->if_salv_wd_table_settings~set_row_selectable

exporting

value = abap_true.

Please help me out.

Thanks

Chandru

Former Member
0 Kudos

SET_ROW_SELECTABLE( abap_true ) this should work. I dont know why it is not working foryou.

Check whether some other code change is reflecting in your ALV or not.

Former Member
0 Kudos

Hello Sourav,

Yes, it is still not working after all those settings.

I even tried putting a hard coded BREAK-POINT in H_ON_LEAD_SELECT event. But the control never goes there.

I also checked with putting SICF HTTP debugging ON. even then it does not go.

Let me know if you have any other thoughts. I am now trying to create a fresh WD Comp to test this.

Thanks,

Chandru

Former Member
0 Kudos

Paste your code what you have written to do setting in ALV.

Former Member
0 Kudos

Hello,

I have attached the code below used to Configure my ALV. I tried several options, some of them are commented now.

Below are some more testing that i conducted today:

In SAP Standard component - SALV_WD_TABLE, i put a break point in method ONACTIONTABLE_LEAD_SELECT to see if my event is getting captured or not. But it is not getting triggered till that method at all. I set HTTP debugging using SICF and tried to debug on action, but was not able to figure out.

Cardinality used: 0..n

Selection : 1..n

Initialization lead selection: selected

Please let me know if you have any other thoughts or if i need to run any other tests.

Thanks,

Chandru

Former Member
0 Kudos

DATA lo_node_org_alv_table TYPE REF TO if_wd_context_node.

DATA lo_el_org_alv_table TYPE REF TO if_wd_context_element.

DATA ls_org_alv_table TYPE TABLE OF wd_this->element_org_alv_table.

DATA lwa_org_alv_table LIKE LINE OF ls_org_alv_table.

ls_org_alv_table[] = ls_it_orglist[].

**Bind data to ALV Context**

  • navigate from <CONTEXT> to <BUD_ALV_TABLE> via lead selection

lo_node_org_alv_table = wd_context->get_child_node( name = wd_this->wdctx_org_alv_table ).

lo_node_org_alv_table->bind_table( ls_org_alv_table ).

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

DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.

l_ref_cmp_usage = wd_this->wd_cpuse_compuse_org_alv( ).

IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.

l_ref_cmp_usage->create_component( ).

ENDIF.

DATA l_salv_wd_table TYPE REF TO iwci_salv_wd_table.

l_salv_wd_table = wd_this->wd_cpifc_compuse_org_alv( ).

**... Configure ALV

DATA lr_config TYPE REF TO cl_salv_wd_config_table.

lr_config = l_salv_wd_table->get_model( ).

*... ... Table Settings

data lv_row_count type I value 25.

lr_config->if_salv_wd_table_settings~set_visible_row_count( lv_row_count ).

lr_config->if_salv_wd_table_settings~SET_ENABLED( abap_true ).

lr_config->if_salv_wd_table_settings~SET_CELL_ACTION_EVENT_ENABLED( abap_true ).

  • lr_config->if_salv_wd_table_settings~SET_ON_SELECT_ENABLED( abap_false ).

  • lr_config->if_salv_wd_table_settings~set_fixed_table_layout( abap_true ).

  • lr_config->if_salv_wd_table_settings~set_row_selectable( abap_false ).

lr_config->if_salv_wd_table_settings~set_display_empty_rows( abap_false ).

  • lr_config->if_salv_wd_table_settings~SET_ROW_SELECTABLE( abap_true ).

  • call method lr_config->if_salv_wd_table_settings~set_row_selectable

  • exporting

  • value = abap_true.

  • lr_config->if_salv_wd_table_settings~SET_SELECTION_MODE( CL_WD_TABLE=>E_SELECTION_MODE-AUTO ).

  • lr_config->if_salv_wd_table_settings~SET_SELECTION_MODE( '02' ).

  • lr_config->if_salv_wd_table_settings~set_read_only( abap_false ).

Former Member
0 Kudos

Do you want single or multiple selection.

Selection as 1:1 or 0:1 for node.

If you want as single, then use the selection mode as SINGLE.

What have you coded in this lead selection....

Former Member
0 Kudos

I met same question.

At last,I found that need delete  wd_this->set_index( ).

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

1.Just make a normal ALV.

2. Implement the Lead Selection Event of ALV.

3. For this , create an Event handler for event ON_LEAD_SELECT.

4. Inside this method , you can get the index of row selected using :

data l_event type I.

l_event = R_PARAM->index.

5. With index , you can read the node binded to ALV and get the row data.

6. with this data, opend up second ALV .

Refer these demonstrations by Thomas :

/people/thomas.jung3/blog/2005/12/21/webdynpro-abap-alv

check out these useful links :

[original link is broken]

Configuring ALV

http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1190424a-0801-0010-84b5-ef03fd2d3...

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/db22242d-0701-0010-28a2-aeaa1fefd...

Above mentioned links are useful for begineers.

Edited by: Saurav Mago on Nov 25, 2009 5:52 PM