Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Drop-down values in ALV grid

Former Member
0 Likes
21,325

I'm using the class CL_GUI_ALV_GRID.

I want to create a drop-down field on a column of the grid so to show in the ALV a text but the real value saved in the internal table is a code.

I'm using the method SET_DROP_DOWN_TABLE using the table parameter IT_DROP_DOWN_ALIAS: the structure of this table contains two fields, VALUE and INT_VALUE, used to contain, respectively, the value to be saved in the internal table and the text to be showed in the ALV.

When the drop-down is select the text is showed but after a refresh of the ALV the text is substituted by the internal value.

Is there a way to always show the text value and not the internal value of the drop-down ?

Thanks,

Antonino Musciumarra

I'm using the class CL_GUI_ALV_GRID.

I want to create a drop-down field on a column of the grid so to show in the ALV a text but the real value saved in the internal table is a code.

I'm using the method SET_DROP_DOWN_TABLE using the table parameter IT_DROP_DOWN_ALIAS: the structure of this table contains two fields, VALUE and INT_VALUE, used to contain, respectively, the value to be saved in the internal table and the text to be showed in the ALV.

When the drop-down is select the text is showed but after a refresh of the ALV the text is substituted by the internal value.

Is there a way to always show the text value and not the internal value of the drop-down ?

Thanks,

Antonino Musciumarra

7 REPLIES 7
Read only

suhaskrishna_sondur
Product and Topic Expert
Product and Topic Expert
0 Likes
7,189

Hi,

Did you happen to find a solution to this problem? I am,too, facing this issue and seeking a solution.

Regards,

Suhas

Read only

0 Likes
7,189

Check the sample programs.

BCALV_EDIT_06
BCALV_EDIT_07

They are very simple to understand.

Read only

0 Likes
7,189

Hi vijay,

The programs you mentioned use the "value" field directly. In my case, the value field will be the value that would be stored in DB but the value I want to display on the ALV screen is different. Hope you are understanding the problem.

Regards,

Suhas

Read only

0 Likes
7,189

You can have option to Display different values outside(Alias) and Internal values inside.

instead of populating the IT_DROP_DOWN table populate alias table IT_DROP_DOWN_ALIAS

LS_DRAL-HANDLE = '1'.

LS_DRAL-VALUE = 'ALIASVALUE'.

LS_DRAL-INT_VALUE = 'INTERNALVALUE'.

APPEND LS_DRAL TO LT_DRAL.

Ex:-

LS_DRAL-HANDLE = '1'.
      LS_DRAL-VALUE =  'Kilogram'.
      LS_DRAL-INT_VALUE =  'KG'.
    APPEND LS_DRAL TO LT_DRAL.

  CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
    EXPORTING
      IT_DROP_DOWN_ALIAS = LT_DRAL.

in the fieldcatalog for the Drop down field.

X_FIELDCAT-DRDN_HNDL = '1'.
  X_FIELDCAT-DRDN_ALIAS = 'X'. "<---Important.

Read only

frederick_dufour
Associate
Associate
0 Likes
7,189

Hello everyone,

I have the same problem! I specified all required parameters, and the int_values are displayed in the drop-down list, but after a refresh the code values are displayed! Does anyone have a solution to this issue?

Thanks in advance and best regards!

Read only

7,189

Bit of a late reply I know, but I had the same issue and could not find the answer in SDN, so here is what I did to solve this :

In the ALV grid I used in the Field catalogue field CONVEXIT to set a conversion exit.

I created the conversion exit by copying CONVERSION_EXIT_ALV3_OUPUT and _INPUT to my own Z version (for example CONVERSION_EXIT_ZXXXX_OUPUT and _INPUT). Please note ZXXXX should be a maximum of 5 characters.

The Input function CONVERSION_EXIT_ZXXXX_INPUT  I coded as OUTPUT = INPUT. No other code.

In the output function CONVERSION_EXIT_ZXXXX_OUPUT I get the description from the INPUT value from a text table and set this as the output. e.g.

OUTPUT =  INPUT.

SELECT SINGLE BEZEI FROM ZTEXTTABLE INTO OUTPUT

  WHERE SPRAS = SY-LANGU

   AND ZZCODE = INPUT.

As mentioned, in the fieldcat (in your program) I then use field CONVEXIT to call the conversion exit.

ls_fieldcat-drdn_hndl = '1'.

ls_fieldcat-output_len = '35'.

ls_fieldcat-drdn_alias = 'X'.

ls_fieldcat-convexit = 'ZXXXX'.

This will result in the ALV grid displaying descriptions instead of internal values and when selecting from the drop downs in edit mode, the description remains after a refresh.

Hope this will help others.

Cheers.

Read only

Former Member
0 Likes
7,189

Hi,

Dropdown Listbox at Column Level:- BCALV_EDIT_06

Dropdown Listbox at Cell Level:- BCALV_EDIT_07

have a look at given link,

with regards,

Mamta Kumari