07-11-2008 6:41 PM
Hi,
I have a dropdown list in a field of an ALV Grid. Before I use the method SET_TABLE_FOR_FIRST_DISPLAY, I filled the dropdown list table with some values. After that, I filled another table with the data I want to display in the ALV Grid.
The problem is that when I put all this together in my ALV, the dropdown list just show the Key an not the Text of the Listbox. For the dropdown list table I use the structure LVC_T_DRAL and the method like this:
DATA: IT_DROPDOWN TYPE LVC_T_DRAL,
WA_DROPDOWN TYPE LVC_S_DRAL.
CLEAR WA_DROPDOWN.
WA_DROPDOWN-HANDLE = '1'.
WA_DROPDOWN-VALUE = '000001'.
WA_DROPDOWN-INT_VALUE = 'First Option'.
APPEND WA_DROPDOWN TO IT_DROPDOWN.
CLEAR WA_DROPDOWN.
WA_DROPDOWN-HANDLE = '1'.
WA_DROPDOWN-VALUE = '000002'.
WA_DROPDOWN-INT_VALUE = 'Second Option'.
APPEND WA_DROPDOWN TO IT_DROPDOWN.
CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
EXPORTING
IT_DROP_DOWN_ALIAS = IT_DROPDOWN.
In the fields catalog I put the field of the dropdown like this:
...
WA_FIELDCAT-FIELDNAME = 'OPTION'.
WA_FIELDCAT-DRDN_HNDL = '1'.
...
When I use the method SET_TABLE_FOR_FIRST_DISPLAY, it shows the data inside the dropdown list correctly, with the texts. But the selected option with the Key and not the Text.
For example, the table that I load with the data just have one value:
OPTION
------
000002
Then the field of the dropdown list shows me the Key 000002 and not the Text that should be 'Second Option'. If I open the dropdown list, it shows me 'First Option' and 'Second Option', but none of this was selected.
Somebody knows what I am doing wrong.
Regards,
Isaac Meléndez
07-11-2008 6:53 PM
Hi,
You need to give the handle name and values. both these fields are enough. so the value should be populated with First option and secodng option ...not the int_value field.
Cheers
Kothand
07-11-2008 7:04 PM
hi,
maybe this can help you as well
DATA: go_grid_ctrl TYPE REF TO cl_gui_alv_grid,
ls_dropdown-handle = '1'.
ls_dropdown-value = 'G'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = 'H'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = 'I'.
APPEND ls_dropdown TO lt_dropdown.
ls_dropdown-handle = '1'.
ls_dropdown-value = 'M'.
APPEND ls_dropdown TO lt_dropdown.
CALL METHOD go_grid_ctrl->set_drop_down_table
EXPORTING
it_drop_down = lt_dropdown.
07-11-2008 7:02 PM
Try this:
CLEAR WA_DROPDOWN.
WA_DROPDOWN-HANDLE = '1'.
WA_DROPDOWN-VALUE = 'First Option'..
APPEND WA_DROPDOWN TO IT_DROPDOWN.
CLEAR WA_DROPDOWN.
WA_DROPDOWN-HANDLE = '1'.
WA_DROPDOWN-VALUE = 'Second Option'.
APPEND WA_DROPDOWN TO IT_DROPDOWN.
CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
EXPORTING
IT_DROP_DOWN_ALIAS = IT_DROPDOWN.
Regards,
Joy.
Edited by: Joyjit Ghosh on Jul 11, 2008 8:03 PM
07-11-2008 7:28 PM
Hi,
Thanks guys, but that do not solve my problem.
I need to use an alias, because I reference the field with a key, but I want to show in the field the text that correspond to that key, like a mask.
Somebody have more ideas?
Regards,
Isaac Meléndez
07-11-2008 7:37 PM
Hi Isaac,
Maybe the form d0100_set_grid_drdn in the program - BCALV_TEST_GRID may help you. They used Alias in this program
Cheers
Kothand
07-21-2008 6:16 PM
Isaac,
Any resolve on this issue? I too am having this same problem where the key field displays instead of the corresponding alias value. Unfortuantely none of the replies to this address the specific issue.
Thanks,
Mike
07-21-2008 8:33 PM
Hi Michael,
I still have the same problem. Sorry. If you found something let me know.
Regards,
Isaac Meléndez
07-20-2009 1:21 PM
Hi,
in your field catalog you need to set the field 'drdn_alias' to 'X', otherwise the int_value will be ignored. There is an example program 'BCALV_TEST_GRID_EDIT' that shows how to work with aliases in dropdown list boxes.
HTH, Andreas
02-02-2015 8:39 AM
Hi Isaac,
I've faced the same problem and the only solution I've found for it was implementing INPUT/OUTPUT conversion routines for the required ALV field.
I've written quite self-explanatory article on my blog oprsteny.com where you can check details if it's still relevant issue for you.
With best regards
-- Miroslav