Ricardo Ishida
Dicas ABAP / ABAP tips
Translate this blog
Mostrando postagens com marcador
domain
.
Mostrar todas as postagens
Mostrando postagens com marcador
domain
.
Mostrar todas as postagens
segunda-feira, 9 de setembro de 2013
Pegar valores dos domínios / Get domain values
Português
|
English
Português
Preencher um campo de um relatório com dados de uma tabela transparênte pode ser fácil, levando em consideração que você saiba fazer um SELECT. O que complicava, no meu caso, era quando existia a necessidade de pegar os valores de um domínio. A solução que achava na epoca era colocar os valores fixos, hardcode mesmo!
Mas sempre há uma maneira de tornar a solução mais inteligente! No caso, podemos usar tanto alguns SELECTs quanto uma função Standard. As tabelas que contém informação dos domínios são DD07L (valores fixos) e DD07T (textos descritivos) e a função é a GET_DOMAIN_VALUES:
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
DATA
:
t_dd07v
TYPE TABLE OF
dd07v
,
s_dd07v
TYPE
dd07v
.
CALL FUNCTION
'GET_DOMAIN_VALUES'
EXPORTING
domname
=
'J_1BMATORG'
* TEXT = 'X'
* FILL_DD07L_TAB = ' '
TABLES
values_tab
=
t_dd07v
* VALUES_DD07L =
EXCEPTIONS
no_values_found
=
1
OTHERS
=
2
.
LOOP AT
t_dd07v
INTO
s_dd07v
.
WRITE
:
s_dd07v-ddlanguage
.
"Código do idioma
WRITE
:
s_dd07v-valpos
.
"Valores fixos
WRITE
:
s_dd07v-ddtext
,
/
.
"Texto com a descrição
ENDLOOP
.
English
Fill out a report field with transparent tables can be simple, considering you know how to build a SELECT. One problem I faced many times was when I had to use values from a domain. The easy solution I first found was to use fixed values, hardcode indeed!
There's always an easy way to make things more inteligent! In this case, we can use both ways: SELECT or Standard Function. The tables that have the informations about the domains are DD07L (fixed values) and DD07T (descriptive texts) and the function is GET_DOMAIN_VALUES:
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
DATA
:
t_dd07v
TYPE TABLE OF
dd07v
,
s_dd07v
TYPE
dd07v
.
CALL FUNCTION
'GET_DOMAIN_VALUES'
EXPORTING
domname
=
'J_1BMATORG'
* TEXT = 'X'
* FILL_DD07L_TAB = ' '
TABLES
values_tab
=
t_dd07v
* VALUES_DD07L =
EXCEPTIONS
no_values_found
=
1
OTHERS
=
2
.
LOOP AT
t_dd07v
INTO
s_dd07v
.
WRITE
:
s_dd07v-ddlanguage
.
"Language code
WRITE
:
s_dd07v-valpos
.
"Fixed Values
WRITE
:
s_dd07v-ddtext
,
/
.
"Descriptive texts
ENDLOOP
.
Postagens mais antigas
Página inicial
Assinar:
Postagens (Atom)