‎2014 Jul 17 5:39 AM
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
‎2014 Jul 17 5:55 AM
‎2014 Jul 17 5:56 AM
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
‎2014 Jul 17 6:12 AM
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
‎2014 Jul 17 9:12 AM
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
‎2014 Jul 17 10:28 AM
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( ).