1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
REPORT zstkoes_fixed_values_en.
DATA:
gv_genflag TYPE genflag,
gv_char TYPE c,
gv_system_language TYPE langu,
gv_second_language TYPE langu,
gv_select_language TYPE langu VALUE 'I'.
call 'C_SAPGPARAM' id 'NAME' field 'zcsa/system_language'
id 'VALUE' field gv_system_language.
call 'C_SAPGPARAM' id 'NAME' field 'zcsa/second_language'
id 'VALUE' field gv_second_language.
* It's important to check that the variable exists in the dictionary to prevent Dump.
IF cl_abap_elemdescr=>describe_by_data( gv_char )->is_ddic_type( ) EQ abap_true.
DATA(gt_fixed_values_char) = CAST cl_abap_elemdescr( cl_abap_elemdescr=>describe_by_data( gv_char ) )->get_ddic_fixed_values( ).
ENDIF.
IF cl_abap_typedescr=>describe_by_data( gv_genflag )->is_ddic_type( ) EQ abap_true.
DATA(gt_fixed_values) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( gv_genflag ) )->get_ddic_fixed_values( ).
ENDIF.
IF cl_abap_typedescr=>describe_by_data( gv_genflag )->is_ddic_type( ) EQ abap_true.
DATA(gt_fixed_values_it) = CAST cl_abap_elemdescr( cl_abap_typedescr=>describe_by_data( gv_genflag ) )->get_ddic_fixed_values( gv_select_language ).
ENDIF.
cl_demo_output=>next_section( title = |Systeminformation| ).
cl_demo_output=>write_text( text = |System Language: { gv_system_language }{
cl_abap_char_utilities=>newline }Second Language: { gv_second_language }{
cl_abap_char_utilities=>newline }Logon Language: { sy-langu }| ).
cl_demo_output=>end_section( ).
cl_demo_output=>next_section( title = |Selection of fixed values in Logon Language| ).
cl_demo_output=>write_text( text = |If fixed values do not exist in Logon Language then values will be selected using Second Language| ).
cl_demo_output=>write_data(
name = |{ COND #( WHEN line_exists( gt_fixed_values[ 1 ] ) AND gt_fixed_values[ 1 ]-ddlanguage EQ sy-langu
THEN |Values in Logon Language|
ELSE |Values in Second Language| ) }|
value = COND #( WHEN line_exists( gt_fixed_values[ 1 ] ) THEN gt_fixed_values ) ).
cl_demo_output=>end_section( ).
cl_demo_output=>next_section( title = |Selection of fixed values in Selected Language { gv_select_language }| ).
cl_demo_output=>write_text( text = |If fixed values do not exist in selected language then values will be selected using Second Language| ).
cl_demo_output=>write_data(
name = |{ COND #( WHEN line_exists( gt_fixed_values_it[ 1 ] ) AND gt_fixed_values_it[ 1 ]-ddlanguage EQ gv_select_language
THEN |Values in Logon Language|
ELSE |Values in Second Language| ) }|
value = COND #( WHEN line_exists( gt_fixed_values_it[ 1 ] ) THEN gt_fixed_values_it ) ).
cl_demo_output=>end_section( ).
cl_demo_output=>display( ).
|