Skip to Content
-1

Value-Help with fields of data dictionary structure

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Sep 04, 2017 at 08: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.

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • Sep 04, 2017 at 08: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

    Add comment
    10|10000 characters needed characters exceeded

    • 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?