cancel
Showing results for 
Search instead for 
Did you mean: 

Change column header in ALV to another DDIC Element type

Former Member
0 Kudos

Goal:

The ALV uses the data element LFDAT in the structure. And because of that the labels that are defined for LFDAT.

However, instead of using LFDAT labels, I want to use the labels of a different data element: VEBDT.

Now I have seen a lot of posts about changing the header with the SET_TEXT method, but I do not want to use that. The reason is simple: if I can use VEBDT, then all the translations are already there.

According to the documentation (http://help.sap.com/saphelp_nw04s/helpdata/en/f7/924a3de0384c2c893ca867cb936551/frameset.htm) it should be simple.

-


Specifying the Wording of the Column Header

● You can enter a separate DDIC data element whose field label is to be used as the column header.

For a DDIC relationship, you first of all enter the DDIC data element that returns the wording of the column header. You do this using method SET_PROP_DDIC_BINDING_ELEMENT. You make the following entries:

● Column header or tooltip

The text from the DDIC is to be used here as the column header.

● Name of the DDIC data element

-


The code I use:


  DATA: l_column             TYPE REF TO cl_salv_wd_column,
        l_column_header      TYPE REF TO cl_salv_wd_column_header.

  DATA: ltp_text             TYPE string.

  ltp_text = wd_assist->if_wd_component_assistance~get_text( key = value ).

  l_column = wd_this->m_alv_config_table->if_salv_wd_column_settings~get_column( column_id ).
  l_column_header = l_column->get_header( ).

  CALL METHOD l_column_header->set_prop_ddic_binding_element
    EXPORTING
      property = if_salv_wd_c_ddic_binding=>bind_prop_text
      value    = 'VEBDT'.
  CALL METHOD l_column_header->set_prop_ddic_binding_element
    EXPORTING
      property = if_salv_wd_c_ddic_binding=>bind_prop_tooltip
      value    = 'VEBDT'.
  l_column_header->set_ddic_binding_field( if_salv_wd_c_column_settings=>ddic_bind ).

But, after this, the column header are empty... Anyone done this before?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I found them...Have you checked it in debugging..

Try doing this- first set the normal DDIC binding as none then use the above method....

lr_colheader->set_ddic_binding_field( if_salv_wd_c_ddic_binding=>ddic_bind_none ).

Then use yuor method..

I havenot tried it..

Regards,

Lekha.

Edited by: Lekha on Oct 26, 2009 5:59 PM

Former Member
0 Kudos

Nope... No luck there...

Btw. We are on version 7.0.

Former Member
0 Kudos

Got it...

The only thing I needed to change (there was something wrong after all) was to use:

l_column_header->set_ddic_binding_field( if_salv_wd_c_column_settings=>ddic_bind_short ).

instead of:

l_column_header->set_ddic_binding_field( if_salv_wd_c_column_settings=>ddic_bind ).

Former Member
0 Kudos

Hi,

You are in which version ..

I m using the latest one, I donot find any l_column_header->set_prop_ddic_binding_element mehtod on this name.

Regards,

Lekha.