SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

List SAP Table Fields and Properties using ABAP Function Module

SAP programmers especially using dynamic programming features of ABAP can use DDIF_NAMETAB_GET function module to list table columns and get field properties of a SAP database table.

Following ABAP code fetches SAP table properties for requested table and returns data in a table.

field-symbols <dfies> type dfies
data pp_tabname LIKE dfies-tabname.
data pt_dfies TYPE tt_dfies.
data lr_dataelement type ref to cl_abap_elemdescr.

pp_tabname = 'T001'.

call function 'DDIF_NAMETAB_GET'
  tabname = pp_tabname
  dfies_tab = pt_dfies
  not_found = 1
  others = 99.

It is possible for ABAP developers to get missing information about the table field name from data element information by calling ABAP class method cl_abap_typedescr=>describe_by_name( )

if sy-subrc = 0 and not pt_dfies[] is initial.

loop at pt_dfies assigning <dfies> where rollname is not initial.

 clear: lr_dataelement, lwa_dfies.
 lr_dataelement ?= cl_abap_typedescr=>describe_by_name( <dfies>-rollname ).
" Data element (semantic domain)
 lwa_dfies = lr_dataelement->get_ddic_field( ).

 <dfies>-scrtext_s = lwa_dfies-scrtext_s.
 <dfies>-scrtext_m = lwa_dfies-scrtext_m.
 <dfies>-scrtext_l = lwa_dfies-scrtext_l.




Install SAP Free
CRM Companies List
Web Based CRM Software

Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.