cancel
Showing results for 
Search instead for 
Did you mean: 

ALV: show the description instead of code value in a column

Former Member

Hello everyone,

I'm creating a simple ALV to output the content of a table. Everything works fine, but about the content showed I would like that, for the fields with list of valid values (in the data element, SE11), the alv shows the description instead of the code.

For instance, suppose that in the table there is a field called RESULT which has the following set of values: "CO" for complete, "IP" for In Progress and "NS" for Not Started. I would like that in the alv, instead of showing CO, IP or NS the ALV showed Complete, In Progress or Not Started, in each row.

This is the standar behaviour when you create a table maintenance in SE11/SM30, but is this possible in webdynpro's ALV?

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If your text (description) is coming from some table, then create a text attribute in the node and bind your field to that nodel and read the text for this key...suppose complete for 'CO'.

If it's defined in the domain level, then try to find out the sap table where it's storing the text for this key.

and then do the same as I mentioned above.

But one thing it's can not be automatic as your key and value both are having different data elements.

Former Member
0 Kudos

Ok, I thank you very much for your answers, it makes sense.

Answers (4)

Answers (4)

former_member189058
Active Contributor

Hi,

Create an attribute in the node for text. Delete the column for key from the ALV.

Reema

Former Member
0 Kudos

Hi,

thanks for your answer. As you say it´s an option to create a text field and manually (i.e. getting the description for the code with a select statement for example) fill the cell. But in my case the domain for the field has a list of possible values, not a table an external table as a check for valid values.

In the table maintenance (SM30) this is done automatically, I mean when you enter the table maintenance you see the description instead of the codes, my question is if this is possible to do with ALVs

Thanks again

wajahatrizvipk
Discoverer
0 Kudos

Hi,

The thing that worked for me was to search the domain name associated with your field. then open the table DD07T and pass your domain name here. you will get the required text associated with that domain.

Regards.

Former Member
0 Kudos

Hi,

An easy way without creating a new context node is changing the cell editor of the column:

DATA lo_cell_editor TYPE REF TO if_salv_wd_table_cell_editor.

DATA lo_col TYPE REF TO cl_salv_wd_column.

lo_col = wd_this->wd_cpifc_alv( )->get_model( )->if_salv_wd_column_settings~get_column( 'RESULT' ).

CREATE OBJECT lo_cell_editor TYPE cl_salv_wd_uie_dropdown_by_key          

     EXPORTING       

          selected_key_fieldname = 'RESULT'.

lo_col->set_cell_editor( lo_cell_editor ).

Best Regards,

Sascha

Former Member
0 Kudos

Hi,

Check this Article [Recreate the SE16 Data Browser|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/bf20e84f-0901-0010-fe9e-91d100013a59] written by Thomas Jung.It might help you to solve the problem.

Former Member
0 Kudos

Hello,

nice and really useful article, but it doesn't answer my question. Let's use the SFLIGHT table from the article, my question will be, is it possible to show in the CARRID column "American Airlines" instead of "AA"?

When you have a table maintenance and look at it in SM30 this is possible. And to be more specific imagine that instead of a validation table (SCARR) the data element for CARRID had a list of valid values (hardcoded in the domain). Is it possible to show the description instead of the codes, without doing coding?

I'm thinking on a configuration property for the ALV column or something like that...

Regards,