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

Calling DB_GET_TABLE_FIELDS

avinashd_m
Participant
0 Likes
1,169

Hi all,

I trying to extract field name of the specified table using DB_GET_TABLE_FIELDS, but while calling this function module ,in " tables = "  after exporting and importing parameter,what type of internal table i have to specify. I tried " lt_itab type table of DBFIELD " ,but getting error. Please suggest me

Thanks,

Avinash

5 REPLIES 5
Read only

former_member202818
Active Contributor
0 Likes
956

Hi Avinash,

Use table DD03L.

Read only

Former Member
0 Likes
956

Hi Avinash,

your definition should work, lt_itab TYPE SHDBFIELDS should work, too, and you can get the data directly from table DD03L.

Please post the error (short dump?) you get exactly here.

Regards,

Klaus

Read only

0 Likes
956

Hi,

please try this:

REPORT  ztable_fields.

DATA: lt_itab  TYPE TABLE OF dbfield.

DATA: xv_lines TYPE sy-dbcnt.

PARAMETERS: xp_table TYPE tabname OBLIGATORY DEFAULT 'MARA'.

START-OF-SELECTION.

  CALL FUNCTION 'DB_GET_TABLE_FIELDS'

    EXPORTING

*     FIELD_INFO       = 'A'

      tabname          =  xp_table

*   IMPORTING

*     SUBRC            =

    TABLES

      dbfields         =  lt_itab.

  DESCRIBE TABLE lt_itab LINES xv_lines.

  WRITE: /1 xv_lines.

It was working for me.

Regards,

Klaus

Read only

RaymondGiuseppi
Active Contributor
0 Likes
956

For a DDIC table, you should use DDIF_FIELDINFO_GET which is a released FM, better than DB_GET_TABLE_FIELDS which is not released.

But if you actually want to use this one, look thru SE37 at parameter definition, so use structure DBFIELD...

Are you trying to get information on a DB table not defined in ddic, or looking for difference between DDIC and database (as DB02 and similar transactions) ?

NB: There should be no

in " tables = " 

in your source, did you erase the DBFIELDS parameter name ?

Regards,

Raymond

Read only

former_member201285
Active Participant
0 Likes
956

Here is an OO-solution:

    DATA: info TYPE dd_x031l_table,
              descr_ref TYPE REF TO cl_abap_typedescr,
              ls_mara type mara.

  descr_ref = cl_abap_typedescr=>describe_by_data( ls_mara ).

  info = descr_ref->get_ddic_object( ).