Description of the Abap dictionary

I am trying to query a SAP data dictionary via ERAPonnect ABAP API. The code below retrieves the table names and various field properties, but does not show the field description. Does anyone know why?

thank

REPORT  ZSELECTCOMMAND.
TABLES: DD02L,
    DD03L,
    DD02T, DD04T.

DATA: BEGIN OF tb_meta,
    tabname   TYPE  DD02L-tabname,
    fieldname   TYPE  DD03L-fieldname,
    datatype    TYPE  DD03L-datatype,
    leng        TYPE  DD03L-leng,
    decimals    TYPE  DD03L-decimals,
    position    TYPE  DD03L-position,
desc    TYPE  DD04T-ddtext,
    END OF tb_meta.
DATA utb_meta LIKE STANDARD TABLE OF tb_meta.
DATA: ln_meta LIKE LINE OF utb_meta, m1 TYPE i, m2 TYPE i.
SELECT
    tb~tabname
fld~fieldname
    fld~datatype    fld~leng
    fld~decimals    fld~position
x~ddtext
    INTO CORRESPONDING FIELDS OF TABLE utb_meta
FROM
    dd02L AS tb
INNER JOIN dd03L AS fld
    ON tb~tabname = fld~tabname
INNER JOIN DD04T AS x
ON fld~ROLLNAME = x~ROLLNAME
AND x~DDLANGUAGE = 'EN'
WHERE
    CONTFLAG IN ('A', 'C', 'S')  
    AND 
    APPLCLASS <> '' 
    AND 
    tb~TABNAME NOT LIKE '/%' 
    AND 
    tb~TABNAME NOT LIKE '%_BAK'
    AND
   tb~TABNAME = 'BSAK'.
*GET RUN TIME FIELD m1. 
loop at utb_meta into ln_meta.
    write:/ 
    ln_meta-tabname 
    && '>>' && ln_meta-fieldname 
    && '>>' && ln_meta-datatype
    && '>>' && ln_meta-leng
    && '>>' && ln_meta-decimals
    && '>>' && ln_meta-position
    && '>>' && ln_meta-desc.
endloop.

      

+3


source to share


2 answers


There are various places where text information of a table or structure field can be stored. The item texts you choose from DD04T

are only one place for those texts. You can define table components with built-in data types instead of dictionary data types, then the texts will be stored in DD03T

(for example)



For these reasons (technical details of tables DD*

), I highly recommend that you use a function module DDIF_FIELDINFO_GET

instead of moving your own DD*

. Just pass the parameters TABNAME

and LANGU

, and the resulting internal table DFIES_TAB

will contain all the information you need, including the texts.

+6


source


In addition to @rplantiko's suggestions, I would suggest using feature modules RPY_*

that are already included in the RFC and may be easier to access out of the box.



+2


source







All Articles