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: 

how to find data type of field dynamically in abap

Former Member
0 Kudos

hi all,

I am hanged up in one issue. There an internal table is filled.

theres one field ,and i want to extract the data type of the field content.

Ex. i_tab is internal table having field var1.

let the content of var1 have data type same as that of matnr (material no.)

so here i want to extract this data type.

thanx in advance for efficient help

1 ACCEPTED SOLUTION

Former Member

Hi;

try DESCRIBE FIELD statement....

If the hint is usefulu2026 Say thanks by rewardu2026.

Regards,

Prabhu Rajesh

6 REPLIES 6

Former Member

Hi;

try DESCRIBE FIELD statement....

If the hint is usefulu2026 Say thanks by rewardu2026.

Regards,

Prabhu Rajesh

0 Kudos

thanks prabhu....

will the describe field work for the custom data type.....

prasanth_kasturi
Active Contributor
0 Kudos

hi,

Use the statemnt

DESCRIBE FIELD

Use the edition TYPE typ [COMPONENTS com]

More help use F1

example fropm F1 help

DATA: BEGIN OF struc1,

comp1 TYPE c LENGTH 1,

comp2 TYPE string,

BEGIN OF struc2,

comp1 TYPE c LENGTH 1,

comp2 TYPE i,

END OF struc2,

END OF struc1,

typ1 TYPE c LENGTH 1,

comp1 TYPE i,

typ2 TYPE c LENGTH 1,

comp2 TYPE i.

DESCRIBE FIELD: struc1 TYPE typ1 COMPONENTS comp1,

struc1-struc2 TYPE typ2 COMPONENTS comp2.

regards

prasanth

Former Member
0 Kudos

hiiii

to get field you can use

DATA: FIELD0(8) TYPE N, 
           FIELD1. 
DESCRIBE FIELD FIELD0 TYPE FIELD1.
Result: FIELD0 contains the value 'N'. 

you can also use following FM

DDIF_FIELDINFO_GET.

regards

twinkal

0 Kudos

hi...

i tried with fm DDIF_FIELDINFO_GET ,

but its saying it does not exists..

please verify it and tell me

Former Member
0 Kudos

Hi,

DESCRIBE FIELD wud solve ur prob.

Regards.