访问Domain的Value Range有两种方法:
1、直接访问表
dd07l和dd07T
select * from dd07l
where domname = 'domname' and
as4local = active.
2、使用SAP的标准函数
CALL FUNCTION 'DD_DOMVALUES_GET'
EXPORTING
domname = 'ZOCCLS'
text = 'T'
TABLES
dd07v_tab = it_dd07v
EXCEPTIONS
wrong_textflag =
OTHERS = .
IF sy-subrc <> .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
SORT it_dd07v BY domvalue_l.
3:DOMAIN_VALUE_GET
根据DOMAIN值去取出描述
sap 如何访问域(domain)的value range?
domain的value range可以用于搜索帮助,sap的value range如下图所示:
我们关心的是如何取到上面的这些值呢?下面介绍通过两种方法来获取这些东东。
1、通过视图,如下所示。
例子:取SD 凭证类别的DOMAIN(VBTYP)
DATA: T_DD07V TYPE TABLE OF DD07V.
SELECT *
INTO T_DD07V
FROM DD07V
WHERE DOMNAME = 'VBTYP'
AND DDLANGUAGE = '1'.
2、通过函数(function)。
DD_DOMVALUES_GET
例子:取SD凭证类别的DOMAIN(VBTYP)
DATA: T_DDO7V TYPE TABLE OF DD07V,
L_SUBRC TYPE SY-SUBRC.
CALL FUNCTION 'DD_DOMVALUES_GET'
EXPORTING
DOMNAME = 'VBTYP'
TEXT = 'X'
LANGU = '1'
BYPASS_BUFFER = 'X'
IMPORTING
RC = L_SUBRC
TABLES
DD07V_TAB = T_DDO7V
EXCEPTIONS
WRONG_TEXTFLAG = 1
OTHERS = 2
3.根据域和值取描述
PERFORM frm_domain_value_get USING 'VBTYP' 'A'
CHANGING value. *&---------------------------------------------------------------------*
*& Form frm_domain_value_get
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_DOMNAME text
* -->P_DOMVALUE text
* -->P_VALUE text
*----------------------------------------------------------------------*
FORM frm_domain_value_get USING p_domname
p_domvalue
CHANGING p_value. DATA: e_ddtext LIKE dd07v-ddtext,
i_domname LIKE dd07v-domname,
i_domvalue LIKE dd07v-domvalue_l. i_domname = p_domname.
i_domvalue = p_domvalue.
CALL FUNCTION 'DOMAIN_VALUE_GET'
EXPORTING
i_domname = i_domname
i_domvalue = i_domvalue
IMPORTING
e_ddtext = e_ddtext
EXCEPTIONS
not_exist =
OTHERS = .
IF sy-subrc <> .
* Implement suitable error handling here
ENDIF.
p_value = e_ddtext. ENDFORM. "frm_domain_value_get