2015 Apr 07 8:32 AM
Hello,
may be this kind of question have many times duscussed before, but i didn't find any of them as answered,
May requirement is something 2 fold.
I have a Editable alv with dropdowns using class cl_gui_alv_grid, below screenshot.
What i want:
1. I need the description to appear strictly without key, in place of key.
For example:
01 should be replaced by primary school
02 should be replaced by lower secandary and so on.
When ever user select any description, its key should gets captured in internal table.
It seems that this can be achieved using conversion exits, but i don't have enough info how to use them exactly.
2. Whenever any value is selected from dropdown, Function code should gets triggered(like in module pool)
and based on that values choosed, i want to change/refresh grid.
Please guide me .
2015 Apr 07 10:04 AM
uncheck extras->settings - display technical names
if not
under sap gui options
uncheck interaction desing->visulization 1 - Show keys within dropdown lists
2015 Apr 07 10:32 AM
2015 Apr 07 10:53 AM
Hello!
You can explicitly control the behaviour of the dropdown boxes over the field catalog. Where do you get your field catalog from? In order to give you proper advise, you may have to provide additional information. Is the field you are referring to a dictionary field?
One option you have is, roughly speaking, the following: You can always append a field to your field catalog and explicitly control the content of the dropdown list.
Then handle the event data_changed of cl_gui_alv_grid (you have to do that anyways) to fill your internal table with the corresponding key values rather than the description texts.
Inside the same event handler method, you may also call the transactions required.
2015 Apr 07 11:04 AM
Hi Christian ,
The field catalogue is generated by the function module 'LVC_FIELDCATALOG_MERGE' and passing DDIC Structure in parameter ' i_structure_name'.
Something Like This:
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = w_tabname
CHANGING
ct_fieldcat = et_fieldcat_lvc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF
.
Dropdown Handles are created like that:
*--- Create Dropdowns Handles
LOOP AT et_fieldcat_lvc INTO gs_et_fieldcat_lvc.
l_index = sy-tabix.
READ TABLE gt_dfies WITH KEY
fieldname = gs_et_fieldcat_lvc-fieldname
valexi = zedit_x TRANSPORTING NO FIELDS.
CHECK sy-subrc IS INITIAL.
ADD 1 TO l_count.
gs_et_fieldcat_lvc-drdn_hndl = l_count.
gs_et_fieldcat_lvc-drdn_alias = zedit_x.
gs_et_fieldcat_lvc-convexit = 'ZABCD'."use of conversion exits
gs_et_fieldcat_lvc-outputlen = 15.
MODIFY et_fieldcat_lvc FROM gs_et_fieldcat_lvc INDEX l_index.
CLEAR gs_et_fieldcat_lvc.
ENDLOOP
I have used 'ALIAS' also but they are not working in my case.
I am still seeing keys.
I tried convesion exit in field catalgue, they seems ok, but i need to pass something also in conversion FM,other than input.
Based on which i'll fetch alias.
2015 Apr 07 11:23 AM
In the snippet you are providing you only create the dropdown handles, but not the actual content of the dropdown boxes. If there is no other code related to dropdown fields, the content of the dropdown boxes is managed via the ddic reference of your table fields, which is not sufficient for your requirement.
As far as I have understood, you want to have description texts displayed in your grid, but key values saved in the corresponding db table, am I correct?
Also, you may eventually take a look at the BCALV* example programs, it may as well be the case that these cover your requirement.
2015 Apr 07 1:25 PM
Christian Kuhl wrote:
As far as I have understood, you want to have description texts displayed in your grid, but key values saved in the corresponding db table, am I correct?
Yes Correct. Exactly.
These are actually domain fixed values, i want their description to show in alv and key to be stored in db table.
2015 Apr 07 2:02 PM
OK then, I'm afraid you have to control the dropdown content as well as your table display explicitly, for the following reasons:
1. To my knowledge, there is no way to directly influence the behaviour of dropdown fields defined only by their dictionary reference.
2. As you noted yourself, the "alias"-mechanism does work only if you pass explicit contents to your dropdown list and has the major drawback, that after a table refresh, the aliases are not shown anymore, instead the key values are displayed.
Hence I suggest you do the following: divide your data up into two internal tables: one (itab1) for display and one (itab2) for storing into your db table.
Before display, read your data into itab2 and fill itab1 with the corresponding description texts. Then display itab1 in your ALV grid.
In the field catalog, you can explicitly control the contents of the dropdown boxes via something like this:
data:
lt_dropdown type lvc_t_drop,
ls_dropdown type lvc_s_drop,
[...]
ls_dropdown-handle = '1'.
ls_dropdown-value = 'Description 1'.
append ls_dropdown to lt_dropdown.
ls_dropdown-handle = '2'.
ls_dropdown-value = 'Description 2'.
append ls_dropdown to lt_dropdown.
[...]
your_alv->set_drop_down_table(
it_drop_down = lt_dropdown ).
Then, upon saving, translate the content of itab1 into itab2 and save it.
2015 Apr 07 11:10 AM
hello,
when you append the values to drop down internal table at that time pass only descrption and that valeus only appear in the screen
2015 Apr 07 11:18 AM
that values are appearing on screen indeed.
But i want the description to appear instead of key
2015 Apr 07 11:33 AM
if you display only the description then user can select description it wil appear in screen
LW_CATALOG-DRDN_HNDL = GC_COUNT_TWO.
LW_CATALOG-DRDN_ALIAS = 'X'.
2015 Apr 07 11:29 AM
I managed to find a great step-by-step guide with same methodology, but with more detail: ABAP &#8211; Problems with combo box in ALV | Spider&#039;s web
2015 Apr 07 11:38 AM
Hi Abhishek,
In your first requirement you need to have the drop down to only have the key description inside of showing both key and description
for that kindly check the code
in the code where you are defining the drop down
DATA: lt_dropdown TYPE lvc_t_drop,
ls_dropdown TYPE lvc_s_drop.
* First row'educational est'.
ls_dropdown-handle = '1'.
ls_dropdown-value = '01 Primary school'. // change this to ls_dropdown-value = 'Primary school'
APPEND ls_dropdown TO lt_dropdown.
to fill the internal table with the key you need to write the logic as
ls_dropdown-int_value = '01'. pass this value to the required internal table for processing.
and in the second requirement
In the PAI logic you have to write the refreshing code
module PAI
case refresh *place this in the button*
perform alv_output *the subroutine where you are showing the ALV display*
end module.
hope that i have answered the queries.
vishnu
2015 Apr 07 11:51 AM
Dear Abhishek,
press ALT + F12 -----> Options...
Select visualization1 and uncheck Show keys with dropdown list
Following is the screen shot
Thanks....
2015 Apr 07 1:39 PM
2015 Apr 07 1:30 PM
The example you have quoted is nice and would have been helpful if:
There is hardcoded domain name:ZDOM_TEST
- FUNCTION CONVERSION_EXIT_ZPRIO_OUTPUT.
- *"----------------------------------------------------------
- *"*"Local Interface:
- *" IMPORTING
- *" VALUE(INPUT)
- *" EXPORTING
- *" VALUE(OUTPUT)
- *"----------------------------------------------------------
- DATA:
- lt_dd07v TYPE TABLE OF dd07v.
- FIELD-SYMBOLS:
- <ls_dd07> TYPE dd07v.
-
- CALL FUNCTION 'DDIF_DOMA_GET'
- EXPORTING
- name = 'ZDOM_TEST'
- langu = sy-langu
- TABLES
- dd07v_tab = lt_dd07v.
-
- READ TABLE lt_dd07v ASSIGNING <ls_dd07>
- WITH KEY domvalue_l = input.
- CHECK sy-subrc = 0.
-
- output = <ls_dd07>-ddtext.
- ENDFUNCTION.
I have more than 15 domains.
how can i pass the domain name into this conversion exit and thus i will call this FMDDIF_DOMA_GET
and fetch fixed values and assign them to output .
2015 Apr 07 2:22 PM
I'm afraid you cannot do that, since the interface of the conversion routines are fixed.
The most you can do is to write generic routines in the function pool where you place the exits, which will be called from each of them, but the wrapper FM's are still needed.