‎2009 Jun 18 9:40 AM
Hi,
I am trying to access data from a cluster. The type of data being retrieved is different. Therefore i use a field symbol to create the type and then import the data. Now the data retrived has got different structures and sometimes they are even deep structures.
I want to access a particular value from all these different structures (Object_id). Sometimes it is just located at the firsty level
<Filed_symbol>->object_id.
Sometimes the data is available as <Field_symbol>->structure->Object_id.
How can i retrieve the data(Object_id) from such structures irrespective of the type of data being fetched from IMPORT.
Regards,
Rishav
‎2009 Jun 18 9:54 AM
Hi try this:
type-pools: abap.
data: r_struct type ref to cl_abap_structdescr.
data: it_components type abap_component_tab with header line.
data: component_addr type string.
field-symbols: <component> type any, "component name i.e. OBJECT_ID
<component_adrr> type any. "component absolute address i.e STRUCTURE-COMPONENT-OBJECT_ID
r_struct ?= cl_abap_typdescr=>DESCRIBE_BY_DATA( <field_symbol> ). "get strcutre
it_components = r_struct->GET_COMPONENTS( ). "get its components
loop at it_components.
concatenate <field_symbol> it_components-name into component_addr
separated by '-'. "STRUCTURE-COMPONENT-OBJECT_ID
assign component_addr to <component>.
<component> = ...."give value here
endloop.
Regards
Marcin
‎2009 Jun 18 9:54 AM
Hi try this:
type-pools: abap.
data: r_struct type ref to cl_abap_structdescr.
data: it_components type abap_component_tab with header line.
data: component_addr type string.
field-symbols: <component> type any, "component name i.e. OBJECT_ID
<component_adrr> type any. "component absolute address i.e STRUCTURE-COMPONENT-OBJECT_ID
r_struct ?= cl_abap_typdescr=>DESCRIBE_BY_DATA( <field_symbol> ). "get strcutre
it_components = r_struct->GET_COMPONENTS( ). "get its components
loop at it_components.
concatenate <field_symbol> it_components-name into component_addr
separated by '-'. "STRUCTURE-COMPONENT-OBJECT_ID
assign component_addr to <component>.
<component> = ...."give value here
endloop.
Regards
Marcin
‎2009 Nov 02 8:52 AM
The object type that you are importing is impotant to be known. Later you can import or export to the cluster