Skip to Content
0
Jun 09, 2006 at 01:47 PM

[Domain]Text table of a Value table

639 Views

Hi,

I read this old post regarding values for a particular domain.

FM for reading Value Table for a domain

I did the same and it works quite well. Now, I would like to get the texts associated to the values and I am facing an issue.

First, the value table :

- is in fact a view (in my case /BI0/MCOUNTRY)

- might not have a text table or is not linked to the text table

Thus, how to programatically get the text table (the better would be to retrieve it from the domain directly if possible).

I post here the code I use:

   CALL FUNCTION 'DDIF_DOMA_GET'
        EXPORTING
          name          = o_domain
          langu         = i_langu
        IMPORTING
          dd01v_wa      = wa_dd01v
        EXCEPTIONS
          illegal_input = 1
          OTHERS        = 2.

      IF sy-subrc = 0 AND wa_dd01v-entitytab IS NOT INITIAL.
        CALL FUNCTION 'DDIF_FIELDINFO_GET'
          EXPORTING
            tabname        = wa_dd01v-entitytab
            langu          = 'E'
          TABLES
            dfies_tab      = ta_valuetab_dfies
          EXCEPTIONS
            not_found      = 1
            internal_error = 2
            OTHERS         = 3.

*       A domain has a value table if only one of the key field
*       belongs to this domain
        LOOP AT ta_valuetab_dfies ASSIGNING <fs_dfies>
                                  WHERE domname = o_domain.

          w_valuetab_field = <fs_dfies>-fieldname.
          EXIT.
        ENDLOOP.
        IF sy-subrc = 0.
          CREATE DATA ta_entries TYPE TABLE OF (o_type).
          ASSIGN ta_entries->* TO <ft_entries>.

          SELECT DISTINCT (w_valuetab_field) FROM (wa_dd01v-entitytab)
                                             INTO TABLE <ft_entries>.
          IF sy-subrc = 0.
            LOOP AT <ft_entries> ASSIGNING <fs_entry>.
              APPEND INITIAL LINE TO o_values ASSIGNING <fs_ddlb_value>.
              <fs_ddlb_value>-name  = <fs_entry>.
              <fs_ddlb_value>-value = <fs_entry>.
            ENDLOOP.
          ENDIF.
        ENDIF.

      ENDIF.

Thanks in advance.

Best regards,

Guillaume