访问Domain的Value Range有两种方法:
1、直接访问表
dd07l和dd07T
select * from dd07l
where domname = 'domname' and
as4local = active.
2、使用SAP的标准函数
1 CALL FUNCTION 'DD_DOMVALUES_GET' 2 EXPORTING 3 domname = 'ZOCCLS' 4 text = 'T' 5 TABLES 6 dd07v_tab = it_dd07v 7 EXCEPTIONS 8 wrong_textflag = 1 9 OTHERS = 2. 10 IF sy-subrc <> 0. 11 MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno 12 WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. 13 ENDIF. 14 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 *
我们关心的是如何取到上面的这些值呢?下面介绍通过两种方法来获取这些东东。
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
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.根据域和值取描述
1 PERFORM frm_domain_value_get USING 'VBTYP' 'A' 2 CHANGING value. 3 4 *&---------------------------------------------------------------------* 5 *& Form frm_domain_value_get 6 *&---------------------------------------------------------------------* 7 * text 8 *----------------------------------------------------------------------* 9 * -->P_DOMNAME text 10 * -->P_DOMVALUE text 11 * -->P_VALUE text 12 *----------------------------------------------------------------------* 13 FORM frm_domain_value_get USING p_domname 14 p_domvalue 15 CHANGING p_value. 16 17 DATA: e_ddtext LIKE dd07v-ddtext, 18 i_domname LIKE dd07v-domname, 19 i_domvalue LIKE dd07v-domvalue_l. 20 21 i_domname = p_domname. 22 i_domvalue = p_domvalue. 23 CALL FUNCTION 'DOMAIN_VALUE_GET' 24 EXPORTING 25 i_domname = i_domname 26 i_domvalue = i_domvalue 27 IMPORTING 28 e_ddtext = e_ddtext 29 EXCEPTIONS 30 not_exist = 1 31 OTHERS = 2. 32 IF sy-subrc <> 0. 33 * Implement suitable error handling here 34 ENDIF. 35 p_value = e_ddtext. 36 37 ENDFORM. "frm_domain_value_get