Application Development and Automation 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: 
Read only

Get Table-Fields attributes at runtime

Former Member
0 Likes
1,937

Hi all you experts!

I need to create a program that get some Table-Fields name from an input file and then compare them with SAP Data Dictionary.

For instance, program reads from the input file "MARA-MARC" then what program have to do is to get the attributes of "MARA-MARC" such as data type (C, N, D, etc.) and length (18 for MARC).

How can I get those attributes giving the TABLE-FIELD name at runtime? Is there any function module to do so? Many thanks in advance for your help.

4 REPLIES 4
Read only

Former Member
0 Likes
1,003

DDIF_FIELDINFO_GET

Read only

Clemenss
Active Contributor
0 Likes
1,003

Hi Ricardo,

search for RTTS Run Time Type Services with classes CL_ABAP_TYPEDESCR, ..STRUCTDESCR,..

Regards,

Clemens

Read only

Former Member
0 Likes
1,003

Hi Ricardo,

A conventional technique getting the required fields, attributes etc. for a given table is using the transparent table DD03L.

Have success,

Heinz

Read only

venkat_o
Active Contributor
0 Likes
1,003

Hi Ricardo, <li>If you want to know single field properties, DESCRIBE statement needs to be used. <li>If you want to know multiple fields properties, use DDIF_FIELDINFO_GET as suggested by Srinivas above


  REPORT ztest_notepad.
  TABLES:mara.
  DATA:typ TYPE string.
  DATA:len TYPE i.
  DESCRIBE FIELD  mara-matnr
           TYPE   typ
           LENGTH len IN CHARACTER MODE.

  WRITE:/ typ, len.

   DATA:it_table_info TYPE TABLE OF dfies.
  DATA:wa_table_info LIKE LINE OF it_table_info.
  CALL FUNCTION 'DDIF_FIELDINFO_GET'
    EXPORTING
      tabname   = 'MARA'
    TABLES
      dfies_tab = it_table_info.
  LOOP AT it_table_info INTO wa_table_info.
    WRITE:/ wa_table_info.
  ENDLOOP. 
Thanks Venkat.O