Hi Folks,
yesterday i did some complete F4 with dropdown and with standard F4.
I did it on two trivial fields with a domain that has a value table ( T005T)
One field is nationality of a person ( FANAT), the other is the land of birth ( FGBLD).
There are 6 things i learned that i want to share
1) You always need a conversion exit if you want the description displayed instead of the "code" in both casese with and without drop down.
2) In case of normal F4 you need the edit mask too ( wa_fcat-edit_mask = '==NATSL' )
3) Referencing the fields to the DDIC does not mean that they are automatically displayed as in dynpros. neither you do have the possibilities that the dynpro "painter" gives you.
4) In order for the dropdown to work with the DRAL (drop down alias table ) you need to set the following flag in the fieldcatalogue wa_fcat-drdn_alias = 'X'.
5) In ALV almost everything is coding and cryptic fields in the fieldcatalogue, mainly undocumented.
6) there are no ready to use conversion exits for the fields you need, but only for the field you do not need.( This is a corollary of murphy's law)
Below you find the main coding. and here is the result in the pictures.
In the first picture you see the line of the grid. the first field is the Drop down. The second is the Field with F4.
The drop down on the firs field look like this
the F4 help on nationality looks like this:
And here is the coding. Have fun and beware of grid controls!
Cheers
WHEN 'FGBLD'.
wa_fcat-edit = 'X'.
wa_fcat-f4availabl = 'X'.
wa_fcat-drdn_alias = 'X'.
CALL METHOD set_fgbld_ddlb
CHANGING
ps_fcat = wa_fcat
pt_f4 = lt_f4
pt_dropdown = lt_dropdown
pt_dral = lt_dral.
WHEN 'FANAT'.
wa_fcat-edit = 'X'.
wa_fcat-f4availabl = 'X'.
wa_fcat-ref_field = 'FANAT'.
wa_fcat-ref_table = 'P0021'.
wa_fcat-edit_mask = '==NATSL'.
wa_fcat-convexit = 'NATSL'.
wa_fcat-outputlen = 15.
CALL METHOD enable_f4
CHANGING
ps_fcat = wa_fcat
pt_f4 = lt_f4.
METHOD: set_fgbld_ddlb.
DATA :ls_dropdown TYPE lvc_s_dral.
DATA ls_t005t TYPE t005t.
DATA: ls_f4 TYPE lvc_s_f4.
ps_fcat-drdn_hndl = '2'.
ps_fcat-outputlen = 15.
ps_fcat-f4availabl = 'X'.
ps_fcat-convexit = 'LAND1'.
* REFRESH lt_f4.
ls_f4-fieldname = ps_fcat-fieldname.
ls_f4-register = 'X'.
ls_f4-getbefore = 'X'.
ls_f4-chngeafter = 'X'.
INSERT ls_f4 INTO TABLE pt_f4.
sort at_t005t by landx.
LOOP AT at_t005t INTO ls_t005t.
ls_dropdown-handle = '2'.
ls_dropdown-value = ls_t005t-landx.
ls_dropdown-int_value = ls_t005t-land1.
APPEND ls_dropdown TO pt_dral.
ENDLOOP.
*
ENDMETHOD.