12-28-2007 6:41 AM
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.
12-28-2007 6:48 AM
The field(DFIES-POSITION) of the TABLES paramater(DFIES_TAB) returned by the FM holds the position of the field in the data dictionary.
12-28-2007 6:54 AM
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
12-28-2007 7:11 AM
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.
12-28-2007 8:40 AM
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.