12-20-2016 8:31 AM
Hi,
i'm looking for an function module or method to read from a known domain the text of a value which is defined in a value table (not as a fixed value).
(All I found is to read the fixed values - but this i don't need.)
12-20-2016 9:45 AM
AFAIK there are only FMs for single value text. But you could use same tools than SQ01 generated queries, look for method if_text_identifier_obj-read_text in forum.
Regards,
Raymond
12-20-2016 11:25 AM
The closest I got was CL_TEXT_IDENTIFIER which did not suit my purposes. So I ended up writing my own... here are some key code snippets.
Some notes:
SELECT SINGLE * INTO l_dd1
FROM dd01l
WHERE domname = domname
AND as4local = 'A'
AND as4vers = '' ##WARN_OK.
...IF sy-subrc....
CALL FUNCTION 'DDUT_TEXTTABLE_GET' ##FM_SUBRC_OK
EXPORTING
tabname = l_dd1-entitytab
IMPORTING
texttable = l_chktab
EXCEPTIONS
OTHERS = 1.
...IF sy-subrc...
SELECT SINGLE fieldname position INTO (l_txtfield, l_position)
FROM dd03l
WHERE tabname = l_chktab
AND as4local = 'A'
AND as4vers = ''
AND keyflag = '' ##WARN_OK.
IF sy-subrc = 0.
l_position = l_position - 1.
SELECT SINGLE fieldname INTO l_chkfield
FROM dd03l
WHERE tabname = l_chktab
AND as4local = 'A'
AND as4vers = ''
AND position = l_position ##WARN_OK.
IF opt_crit IS NOT INITIAL.
l_position = l_position - 1.
SELECT SINGLE fieldname INTO l_optfield
FROM dd03l
WHERE tabname = l_chktab
AND as4local = 'A'
AND as4vers = ''
AND position = l_position ##WARN_OK.
IF sy-subrc = 0.
CONCATENATE l_optfield ` = '` opt_crit `' AND ` INTO l_entered.
APPEND l_entered TO li_entered.
ENDIF.
ENDIF.
" Assemble WHERE clause
CONCATENATE l_chkfield ` = '` chk_value `'` INTO l_entered.
APPEND l_entered TO li_entered.
SELECT SINGLE (l_txtfield) INTO e_text
FROM (l_chktab)
WHERE (li_entered)
AND spras = sy-langu.
IF sy-subrc <> 0.
l_error = abap_true.
ENDIF.
... And I had my method setup to be able to call it like this
field_text = my_class->chk_dd_value(
domname = 'KZDIF'
chk_value = l_kzdif
opt_crit = l_lgnum
).
12-20-2016 12:33 PM
12-20-2016 2:30 PM
This only works for fixed values, not from a value table. For example check the domain WERKS.