获得domain中fix value 对应text的另外一种方法

来源:互联网 发布:老司机 知乎 编辑:程序博客网 时间:2024/05/18 02:13

GET DOMAIN FIXED VALUE

Author: Bhumika Mahawar
Submitted: 18 March,2009
Related Links: N/A

The F4 for screen field can be fetched either through value table, explicit F4 help or through fixed values associated with the domain.
There is sometimes a requirement to fetch the fixed values associated with a domain. Database view "DD07V" contains this information along with the text maintained for these fixed value. To fetch these values we have a simple Function Module "DD_DOMA_GET". There are other FM's as well. However the advantage of using this FM is that unlike other FM's you have the option to fetch the text as and when required.
As the following fig shows, the fixed value for the domain XFELD are:-

The code is as follows:-

*&--------------------------------------------------------------------**& Report ZTEST_GETDOMVAL*&--------------------------------------------------------------------**This report is used to fetch the fixed values associated with domain*&--------------------------------------------------------------------*REPORT  ztest_yh1148.DATA:  fs_taba TYPE dd07v.DATA:it_taba TYPE STANDARD TABLE OF dd07v,it_tabb TYPE STANDARD TABLE OF dd07v.CALL FUNCTION 'DD_DOMA_GET'  EXPORTING    domain_name   = 'XFELD'    langu         = sy-langu    withtext      = 'X'  TABLES    dd07v_tab_a   = it_taba    dd07v_tab_n   = it_tabb  EXCEPTIONS    illegal_value = 1    op_failure    = 2    OTHERS        = 3.IF sy-subrc <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.ENDIF. WRITE: 'The fixed values for the domain','''XFELD''','are:-'. LOOP AT  it_taba INTO fs_taba.  WRITE:  / sy-tabix,fs_taba-domvalue_l CENTERED ,fs_taba-ddtext CENTERED.ENDLOOP.ULINE.*----------------------END OF CODE-----------------------------------*

The output is shown below :-