Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Field description of an internal table

Former Member
0 Kudos

Hi,

I am trying to read the field description of an internal table, which consists of fields from different DD tables. I am able to read the descriptions of a DD table by using FM 'DDIF_FIELDINFO_GET'.

Can you please suggest me how can read the text descriptions of an internal table fields in a Language other than English.

Thanks

Lokman

1 ACCEPTED SOLUTION

andreas_mann3
Active Contributor
0 Kudos

try that:

TYPES: BEGIN OF my_struct,
        bukrs TYPE bkpf-bukrs,
        belnr TYPE bkpf-belnr,
        gjahr TYPE bkpf-gjahr,
        blart TYPE bkpf-blart,
        bldat TYPE bkpf-bldat,
END OF my_struct.
DATA header TYPE string.
DATA: itab TYPE my_struct,
descr_ref TYPE REF TO cl_abap_structdescr.
SELECT-OPTIONS s_werks FOR t001w-werks.
FIELD-SYMBOLS:
<comp_wa> TYPE abap_compdescr.
DATA wk TYPE t001w-werks VALUE '30++'.
PARAMETERS datei LIKE rlgrap-filename DEFAULT 'c:temptest01'.
DATA fname TYPE dd03l-fieldname.

AT SELECTION-SCREEN ON s_werks.
  IF wk IN s_werks.
*   MESSAGE e000(01) WITH 'false werks'.
  ENDIF.


START-OF-SELECTION.
  header = 'ITAB-'.
  descr_ref ?= cl_abap_typedescr=>describe_by_data( itab ).

  LOOP AT descr_ref->components ASSIGNING <comp_wa>.
    CONCATENATE 'ITAB-' <comp_wa>-name INTO fname.
    WRITE: / fname.
  ENDLOOP.

or use fm REUSE_ALV_FIELDCATALOG_MERGE

Andreas

Message was edited by: Andreas Mann

8 REPLIES 8

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

When calling the function module DDIF_FIELDINFO_GET, you can pass the lauguage key of the lauguage in which you want to text.

The import parameter is LANGU, move "DE" to it, it should bring back the texts as German.

REgard,

RIch Heilman

0 Kudos

Sample .




report zrich_0003 .


data: lang type sy-langu.
data: fields type table of dfies with header line.


lang = 'DE'.

call function 'DDIF_FIELDINFO_GET'
     exporting
          tabname        = 'MARA'
          langu          = lang
     tables
          dfies_tab      = fields
     exceptions
          not_found      = 1
          internal_error = 2
          others         = 3.

loop at fields.
  write:/ fields-tabname, fields-fieldname, fields-fieldtext.
endloop.

Regards,

Rich Heilman

0 Kudos

Here is my code. I am trying to use imternal table instead of DD table. If I use internal table I get short dump. The language is OK withh DD table.

CALL FUNCTION 'DDIF_FIELDINFO_GET'

EXPORTING

  • TABNAME = 'ZFISB_TRANSFERS'

TABNAME = trsf_sel_tab

LANGU = SY-LANGU

TABLES

DFIES_TAB = trsf_field_tab.

*delete trsf_field_tab where fieldname <> 'NR' OR FIELDNAME <> 'TDATE'

*OR

  • FIELDNAME <> 'FYEAR'.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

retfield = 'NR'

value_org = 'S'

callback_program = 'ZFI_SCHOOL_BANKING_APP'

callback_form = 'TRANSFERS_F4CALLBACK'

TABLES

field_tab = trsf_field_tab

value_tab = trsf_sel_tab

return_tab = return_tab

EXCEPTIONS

parameter_error = 1

no_values_found = 2

OTHERS = 3.

Former Member
0 Kudos

Hi Lokman,

Internal tables are temporary table generated during the execution of the program.So,you cant really know the field description,whether its English or any other language.

Former Member
0 Kudos

hi you can just login to sap using some other language other than english

andreas_mann3
Active Contributor
0 Kudos

try that:

TYPES: BEGIN OF my_struct,
        bukrs TYPE bkpf-bukrs,
        belnr TYPE bkpf-belnr,
        gjahr TYPE bkpf-gjahr,
        blart TYPE bkpf-blart,
        bldat TYPE bkpf-bldat,
END OF my_struct.
DATA header TYPE string.
DATA: itab TYPE my_struct,
descr_ref TYPE REF TO cl_abap_structdescr.
SELECT-OPTIONS s_werks FOR t001w-werks.
FIELD-SYMBOLS:
<comp_wa> TYPE abap_compdescr.
DATA wk TYPE t001w-werks VALUE '30++'.
PARAMETERS datei LIKE rlgrap-filename DEFAULT 'c:temptest01'.
DATA fname TYPE dd03l-fieldname.

AT SELECTION-SCREEN ON s_werks.
  IF wk IN s_werks.
*   MESSAGE e000(01) WITH 'false werks'.
  ENDIF.


START-OF-SELECTION.
  header = 'ITAB-'.
  descr_ref ?= cl_abap_typedescr=>describe_by_data( itab ).

  LOOP AT descr_ref->components ASSIGNING <comp_wa>.
    CONCATENATE 'ITAB-' <comp_wa>-name INTO fname.
    WRITE: / fname.
  ENDLOOP.

or use fm REUSE_ALV_FIELDCATALOG_MERGE

Andreas

Message was edited by: Andreas Mann

Former Member
0 Kudos

just try to use body of the internal table "DFIES_TAB = trsf_field_tab[]" instead of

"DFIES_TAB = trsf_field_tab".......this may workout

but iam not sure

0 Kudos

No. Its not working.