Skip to Content
author's profile photo Former Member
Former Member

Adding dynamic Field names to an Extract Structure

I am having a requirement where I need to read the Characteristics values from the Infocube. This Infocube is having multiple dimensions.

I am getting the Dimension table structure into a field-symbol.The fieldnames are coming dynamically into a field-symbol.The Field-symbol will have different structures at different moment( i.e. for the differenet dimensions). But Finally I need all the Characteristics values for the dimensions into some internal table kind of structure.Hence I store the data in the Field-symbol into some table structure( Here I am using Field Groups) as the next time the Field-symbol will have a different structure.

Is there any way where I can transfer the Fieldnames into this Field-group. I am not able to get the fieldnames as they are coming dynamically.

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Aug 04, 2004 at 01:09 PM

    Hi!

    I didn't actually get the whole picture of what you're doing, but if you need to get fieldnames of anything that can be assigned to a field symbol, you should use class CL_ABAP_TYPEDESCR and it's subclasses. You can get details by pressing F1 on DESCRIBE FIELD command and pressing "RTTI system" link.

    For example, this is how I'm getting the fieldnames of a table field symbol:

    DATA: o_table_desc TYPE REF TO cl_abap_tabledescr,

    o_struc_desc TYPE REF TO cl_abap_structdescr,

    t_components TYPE ABAP_COMPDESCR_TAB.

    o_table_desc ?= cl_abap_typedescr=>describe_by_data( <fs> ).

    o_struc_desc ?= o_table_desc->get_table_line_type( ).

    t_components = o_struc_desc->components.

    You'd have to add type checks before casting operators "?=", otherwise you might get dumps.

    On the other hand, if you're trying to make a dynamical internal table, you can use method CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE

    on 4.6c. I've seen on this forum that higher SAP releases have statement

    CREATE OBJECT ... TYPE TABLE OF (tabtype)

    Hope this helps!

    Kind regards,

    Igor Barbaric

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      Actually I need to read the values of the characteristics of the BW infocube depending on some key characteristics.

      Now these characteristics are present in the dimensions of the Cube. I have already worked out the way of retrieveing the values but that is working for one dimensional Cube. But as the Cubes can have multidimensions so I was thinking of extracts. As the structure of the Dimension differ in the various cubes.

      I cannot use ListCube or rsbo Transaction. And the output is needed to be stored in an Internal Table.

      But the problem I am facing is regarding the storage of the varying structures in the Extract.

      Hope I have cleared the scenerio.

      Or is there any other function module or program to retieve the value of the characteristics from a multidimensional Cube.

      Regards,

      Arunava