2017 Sep 04 8:54 AM
Hello guys,
is it possible to create a value-help for the fields (not the content!) of a data dictionary structure? I have my custom ddic structure Z1 with the fields A, B and C. Now I have ddic table Z2 where I want to input field-names. Therefor i have a field FIELDNAMES in this table. For this field I want as value-help the names of fields A, B and C of structure Z1. Is this possible?
Regards
Michael
Hello guys,
is it possible to create a value-help for the fields (not the content!) of a data dictionary structure? I have my custom ddic structure Z1 with the fields A, B and C. Now I have ddic table Z2 where I want to input field-names. Therefor i have a field FIELDNAMES in this table. For this field I want as value-help the names of fields A, B and C of structure Z1. Is this possible?
Regards
Michael
2017 Sep 04 9:06 AM
I am not aware of any standard feature to enable this, but should be easy enough to create by reading the fields with cl_abap_structdef and building your selections from that.
2017 Sep 04 9:14 AM
Yes, I know that too. But I need the value help in the ddic field when user inputs fieldnames with SM30 and not in some report.
Regards
Michael
2017 Sep 04 9:23 AM
Ah, ok. I interpreted 'value help' as the one you define in a report, as opposed to a search help.
You can create your own Z search help. I would go this way and attach it to a custom data element based on the fieldname domain.
2017 Sep 04 9:32 AM
Hello,
- Copy function module F4IF_SHLP_EXIT_EXAMPLE in a new function module ZF4_Z1_FIELDNAMES
- Create a new domain Z1_FIELDNAMES (same as FIELDNAMES) with ZF4_Z1_FIELDNAMES as exit search-help.
- Create a new data element in SE11 Z1_FIELDNAMES with domain Z1_FIELDNAMES
- Customize output RECORD_TAB from FM ZF4_Z1_FIELDNAMES at will.
Something like :
IF callcontrol-step = 'DISP'.
DATA: lo_struct_descr TYPE REF TO cl_abap_structdescr,
lt_struct_fields TYPE cl_abap_structdescr=>component_table.
FIELD-SYMBOLS <struct_fields> TYPE any.
lo_struct_descr ?= cl_abap_typedescr=>describe_by_name( 'Z1' ).
lt_struct_fields = lo_struct_descr->get_components( ).
LOOP AT lt_struct_fields ASSIGNING <struct_fields>.
* Append <struct_fields>-NAME to record_tab
ENDLOOP.
ENDIF.
Best regards,
Bertrand
2017 Sep 04 11:55 AM
That sounds good but I have some problems with the search help. When I only enter the exit in the data element, I get some errors while activating because it says parameters of search help are missing. But how can I use them? I do not have any fields or any database table where I can refer on some parameter fields. Therefor I use the exit I thought?
2017 Sep 04 12:40 PM
In your custom search help with ZF4_Z1_FIELDNAMES as exit you just have to have 1 parameter : FIELDNAME as export of type Z1_FIELDNAMES (positions 1).
2017 Sep 04 12:50 PM
Ok, worked for me. Thanks a lot until here. Now I have two detail questions.
1) How exact is the name of the export parameter? In my table where I use my search help I have three fields which all should use the same search help. But of course I can use only one field name as export parameter. I took the first field for example. As far as I can see it now it works for the other fields as well but is it also technically correct?
2) My goal was to avoid invalid entries. As far as I can see I now only have the search help but no value-check like in foreign keys. How can I achieve this? Also in the function to popup some custom message?
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |