09-15-2010 1:08 PM
Hi ,
Iam using below code to read the fields in the particular structure.
select single rollname into lv_rollname from dd03l where fieldname = gw_allowed-infty
and tabname = gw_allowed-tabname
and tabletype = 'X'.
if sy-subrc eq 0.
lo_descr = cl_abap_structdescr=>describe_by_name( lv_rollname ) .
lo_table ?= lo_descr .
lt_components = lo_table->key.
But in the lt_components except element maintained with data element DEC is not fetching in the table .
Please give me the methid which fetches all the fields from the structure.
Thanks,
Pavan kk
Edited by: Rob Burbank on Sep 15, 2010 9:30 AM
09-15-2010 1:24 PM
Please give me the methid which fetches all the fields from the structure
Which structure ?
lv_rollname holds a data element and not a structure.
Edited by: Rob Burbank on Sep 15, 2010 9:30 AM
09-15-2010 1:24 PM
Please give me the methid which fetches all the fields from the structure
Which structure ?
lv_rollname holds a data element and not a structure.
Edited by: Rob Burbank on Sep 15, 2010 9:30 AM
09-15-2010 1:30 PM
As Keshav noticed lv_rollname is a data element not a structure, but for structure you can use the following.
data lr_structdescr type ref to cl_abap_structdescr.
data lt_components type table of cl_structdescr=>component_table.
lr_structdescr ?= cl_abap_typedescr=>describe_by_name( 'STRUCTURE_NAME' ) .
lt_components = lr_structdescr->get_components( ). "holds structure components
Regards
Marcin
Edited by: Rob Burbank on Sep 15, 2010 9:31 AM
09-15-2010 3:58 PM
You can also use a structure data object if you have one in a memory.
data lr_structdescr type ref to cl_abap_structdescr.
data lt_components type table of cl_structdescr=>component_table.
data l_structure TYPE some_structure.
lr_structdescr ?= cl_abap_typedescr=>describe_by_data( l_structure ) .
lt_components = lr_structdescr->get_components( ). "holds structure components
09-16-2010 7:55 AM
Hello,
Not forgetting Krzysztof's fondness towards OO ABAP, if it is a DDIC structure i would use DDIF_FIELDINFO_GET / DDIF_NAMETAB_GET get the field info.
BR,
Suhas