Application Development 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: 

function module - DDIF_FIELDINFO_GET

Former Member
0 Kudos

hi experts,

i have a requirement

how can we select first 10 fields of table dynamically.

can anyone send me a sample code using fm DDIF_FIELDINFO_GET.

4 REPLIES 4

Former Member
0 Kudos

The field(DFIES-POSITION) of the TABLES paramater(DFIES_TAB) returned by the FM holds the position of the field in the data dictionary.

Former Member
0 Kudos

If you want to extract first 10 fields of a dictionary table.

Write Select Query for table DD03L

Select tabname fieldname

from DD03l

into corresponding fields of i_dd03l

where tabname in s_table

and position in s_position.

s_table is select option for DD03l-tabname

s_position is select option for table field DD03L-POSITION.

or else

if you want to know FM here is the prototype. Try it out.

TABLES: DFIES,

X030L.

DATA: BEGIN OF INTTAB OCCURS 100.

INCLUDE STRUCTURE DFIES.

DATA: END OF INTTAB.

PARAMETERS: TABLENM TYPE DDOBJNAME DEFAULT 'MSEG',

FIELDNM TYPE DFIES-FIELDNAME DEFAULT 'MENGE'.

call function 'DDIF_FIELDINFO_GET'

exporting

tabname = TABLENM

FIELDNAME = FIELDNM

LANGU = SY-LANGU

TABLES

DFIES_TAB = INTTAB

EXCEPTIONS

NOT_FOUND = 1

INTERNAL_ERROR = 2

OTHERS = 3.

if sy-subrc <> 0.

WRITE:/ 'Field name not found'.

endif.

LOOP AT INTTAB.

WRITE:/ INTTAB-TABNAME, INTTAB-FIELDNAME, INTTAB-FIELDTEXT.

ENDLOOP.

All the very best to you.

- Mohan.

Edited by: MohanVamsi Krishna on Dec 28, 2007 1:56 AM

Edited by: MohanVamsi Krishna on Dec 28, 2007 1:57 AM

Former Member
0 Kudos

data l_dfies_wa type dfies.

CALL FUNCTION 'DDIF_FIELDINFO_GET' destination desti

EXPORTING

tABNAME = p_tabname

FIELDNAME = p_fieldname

ALL_TYPES = 'x'

IMPORTING

DFIES_WA = l_dfies_wa

tables

DFIES_TAB = p_dfies

EXCEPTIONS

NOT_FOUND = 1

INTERNAL_ERROR = 2

OTHERS = 3.

case sy-subrc.

when 0.

when 1.

message e009 with p_tabname p_fieldname.

when others.

message e010 with 'DDIF_FIELDINFO_GET'.

endcase.

if not l_dfies_wa is initial.

append l_dfies_wa to p_dfies.

endif.

Please reward if useful.

Former Member
0 Kudos

hi Krithika,

A simple prog. using the FM..

data: dbdiff_values type ddfixvalues,

dbdiff_val type ddfixvalue.

start-of-selection.

call function ‘DDIF_FIELDINFO_GET’

exporting

tabname = ‘VBAK’ ” Table Name

fieldname = ‘VBTYP’

lfieldname = ‘VBTYP’

tables

fixed_values = dbdiff_values.

loop at dbdiff_values into dbdiff_val.

write:/ dbdiff_val-low, dbdiff_val-ddtext.

endloop.

Reward if hrlpful.

Thank you,

Regards.