cancel
Showing results for 
Search instead for 
Did you mean: 

Merge columns for display in WD4A ALV

Former Member
0 Kudos

Hi,

I have a question. Is it posiible to merge two column in an ALV in WebDynpro, but only for display?

e.g: I have my context node DATA with following attributes: DATA ( ID, DESCRIPTION, DETAILS )

          This node is bound to the ALV DATA.

I must achieve the following display mode:

Is there any posibility to do it without creating another context node for ALV DATA?

Thanks a lot!

P.S.: I need the ID attribute in context node DATA for filtering the collection of elements.

Accepted Solutions (1)

Accepted Solutions (1)

anurag_abbi_tm
Participant
0 Kudos

Hi,

The following you may already know.

The context node is bound to the UI elements. So whatever comes in context node will be displayed in UI element.

Now, for the problem stated by you. Following are the facts:

1) You need ID for Filtering.

2) You need to display data as     ID hyphen Description

3) You want to hide column ID.

You may do the following to achieve this:

Option 1:

a) Hide column ID. (I can assist you with this but I am sure you will find out.

    CL_SALV_WD_COLUMN Method SET_VISIBLE apart from other ways)

b) At the time of filling the internal table (Context node) , use

    concatenate statement to stick 'ID hyphen Description'   together and fill your field description.

Make sure description field has enough space to accommodate field ID .

             OR

Option 2:

a) Create a field of length equivalent to length of field ID + field Description.

b) Concatenate ID and Description separated by a hyphen and fill the new field with the value.

c) Hide columns ID and Description.

               OR

Option 3:

You may play with the properties of individual columns like hiding grid lines

You use the methods of the interface class IF_SALV_WD_TABLE_SETTINGS for this

(implementing class CL_SALV_WD_CONFIG_TABLE). Show or hide lines  SET_GRID_MODE

and change the color (make ID and Description of same color with high contrast between text and background color and faded grid line) etc. Use

CL_SALV_WD_COLUMN Method SET_CELL_DESIGN

To answer your question:

There is no default function to achieve merging values of 2 cells in ALV.

Consider an example where a field is of type integer and another of type text.

If we try to merge them then what would be the type of resultant cell in context node (they are bound together) ?

If there was a feature then it would only be limited to text fields and your field 

ID is an integer. So  you would have to make it text which would mean that filtering will give correct results after the number 9 because for text fields filter is like

1,11,2,3,4 etc. instead of 1,2,3,4,11.

Hope the information will help you reason with me. Thanks.

Regards

Anurag

Answers (0)