cancel
Showing results for 
Search instead for 
Did you mean: 

ALV for Webdynpro

Former Member
0 Kudos

Hi all,

When I am displaying the data in the ALV it is populating the whole table. I have few fields which i have selected in the context node. but it is displaying all the fields, Please let me know how I can write the code when i want to display only the selected fields.

" DATA LO_ND_NODE_VBAK TYPE REF TO IF_WD_CONTEXT_NODE.

DATA LO_EL_NODE_VBAK TYPE REF TO IF_WD_CONTEXT_ELEMENT.

DATA LS_NODE_VBAK TYPE WD_THIS->ELEMENT_NODE_VBAK.

DATA IT_VBAK TYPE TABLE OF VBAK.

LO_ND_NODE_VBAK = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_NODE_VBAK ).

LO_EL_NODE_VBAK = LO_ND_NODE_VBAK->GET_ELEMENT( ).

SELECT * FROM VBAK INTO TABLE IT_VBAK.

DATA LO_ND_NODE_ALV TYPE REF TO IF_WD_CONTEXT_NODE.

DATA LS_NODE_ALV TYPE WD_THIS->ELEMENT_NODE_ALV.

  • NAVIGATE FROM <CONTEXT> TO <NODE_ALV> VIA LEAD SELECTION

LO_ND_NODE_ALV = WD_CONTEXT->GET_CHILD_NODE( NAME = 'NODE_ALV' ).

CALL METHOD LO_ND_NODE_ALV->BIND_TABLE

EXPORTING

NEW_ITEMS = IT_VBAK[]

  • SET_INITIAL_ELEMENTS = ABAP_TRUE

  • INDEX =

.

"

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi,

This is a common problem that you would with face with both a normal Table UI element or an ALV. When you create your context node you would have typed it by specifying the table name in the nodes "Dictionary structure" property. So in your case you would have typed VBAK in here and then you would have pressed upon the pushbutton ("From components of Structure") to select the field names from VABK which you would want to be created as attributes under your context node. Once you finish with this step just clear off the table name (VBAK) from the nodes "Dictionary structure" property. This should resolve your problem.

Regards,

Uday

Former Member
0 Kudos

Hi Uday,

I am not able to delete the structure from the context node. Please let me know what best can be done. Can we do it by writing the code. Please help.

Former Member
0 Kudos

Hi,

I guess, you might have tried to delete it in a view context rather than the component controller context.

Check wether this context is global...Delete it component controller then try to map it again to view's context.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Why not just hide the fields from display in the ALV:

data: l_ref_cmp_usage type ref to if_wd_component_usage.
  l_ref_cmp_usage =   wd_this->wd_cpuse_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_alv( ).
  data l_table type ref to cl_salv_wd_config_table.
  l_table = l_salv_wd_table->get_model( ).

  data l_column type ref to cl_salv_wd_column.
  l_column = l_table->if_salv_wd_column_settings~get_column( 'CLIENT' ).
  l_column->set_visible( cl_wd_uielement=>e_visible-none ).

Answers (0)