Analyse structure component dynamically

Hi all,
i'm in 4.6C version.
i would like create a FORM with a structure as a parameter and i would like to analyse the components of the structure and finally serialize all fields of the structure in a string.
My problem is that in my FORM i don't have the type of the structure, i can get it, but i can not access to the field of the structure, compiler tell me 'no type for the structure'.
For example:
data: l_data type p0045,
        l_str    type string.
PERFORM FILL_data changing l_data.
PERFORM serialize_struc using l_data changing l_str.
Can you help me please ?
Thanks

Hi,
try this and on break have a look in l_fields_table:
REPORT test.
DATA:
  struc TYPE mara,
  l_oref_structure TYPE REF TO cl_abap_structdescr,
  l_fields_table TYPE TABLE OF rfc_fields.
PERFORM form_with_unknown_struc USING struc.
*&      Form  FORM_WITH_UNKNOWN_STRUC
FORM form_with_unknown_struc  USING struc.
  DATA:
    l_oref_structure TYPE REF TO cl_abap_structdescr,
    l_fields_table TYPE TABLE OF rfc_fields.
  l_oref_structure ?= cl_abap_typedescr=>describe_by_data( struc ).
  PERFORM build_field_table TABLES l_fields_table
                            USING l_oref_structure.
  BREAK-POINT.
ENDFORM.                    " FORM_WITH_UNKNOWN_STRUC
*&      Form  build_field_table
FORM build_field_table TABLES pc_tab_fields STRUCTURE rfc_fields
                       USING  value(pi_oref_structure)
                                       TYPE REF TO cl_abap_structdescr.
  DATA l_tabname TYPE  dd02l-tabname.
  DATA l_component TYPE abap_compdescr.
  DATA l_field TYPE rfc_fields.
  DATA l_offset TYPE i.
  SEARCH pi_oref_structure->absolute_name FOR '\TYPE='.
  IF sy-subrc = 0.
    sy-fdpos = sy-fdpos + STRLEN( '\TYPE=' ) .
    l_tabname = pi_oref_structure->absolute_name+sy-fdpos.
  ELSE.
    l_tabname = 'UNKNOWN'.
  ENDIF.
  CLEAR l_offset.
  l_field-tabname = l_tabname.
  LOOP AT pi_oref_structure->components INTO l_component.
    MOVE-CORRESPONDING l_component TO l_field.
    l_field-fieldname = l_component-name.
    l_field-exid = l_component-type_kind.
    l_field-intlength = l_component-length.
    l_field-position = sy-tabix.
    l_field-offset = l_offset.
    l_offset = l_offset + l_field-intlength.
    APPEND l_field TO pc_tab_fields.
  ENDLOOP.
ENDFORM.                               " BUILD_FIELD_TABLE
With kind regards
Walter Habich

Similar Messages

  • Reading a field symbol whose structure is dynamic

    Hi Experts,
    I have used the concept of dynamic internal tables to select data from COSS/COSP for e.g.database tables.Field symbol of type " ANY TABLE" has been used to select data , as the dynamic structure is assigned directly to the field symbol.
    To calculate the values of various fields I need to read the this field symbol for diferent line items , but I get a compilation error saying " Key not Found ". I understand that I am not able to read the field symbol because its structure is of type 'ANY TABLE' .How do I read this field symbol ?
    The field symbol gets the structure of dynamic internal table as formed initially by using class concept.Is their any way in which I could get the structure of this field symbol or any other way to read it?
    Thanks in advance.
    Regards
    Reetwika

    Hi Ritwika,
    Even if u use the concept if dynamic internal table, u can read the each of the field of ur structure,
    if u know the name of the field.
    for example:
    MATNR being one of the field of internal table
    field-symbols : <fs> type any.
    loop at <fs_it> into <fs_wa>.
    ASSIGN COMPONENT 'MATNR' OF STRUCTURE <fs_wa> to <fs_matnr>.
    " in this case matnr field value will be assigned to the field symbol <fs_matnr>, so it can be used further.
    endloop.
    " do reply if still confused.
    Rohit G
    Edited by: Rohit Gaharwar on Aug 12, 2009 11:51 AM

  • How to Create a Table Component Dynamically based on the Need

    Hello all,
    I have a problem i need to create dynamically tables based on the no of records in the database. How can i create the table object using java code.
    Please help.

    Winston's blog will probably be helpful:
    How to create a table component dynamically:
    http://blogs.sun.com/roller/page/winston?entry=creating_dynamic_table
    Adding components to a dynamically created table
    http://blogs.sun.com/roller/page/winston?entry=dynamic_button_table
    Lark
    Creator Team

  • To create a deep structure for dynamic internal table.

    Hello
    My ALV has fields which are defined dynamically during execution.
    so, i did it in the following way,
    Declared Field symbolds, DREF and fieldcatalog as,
    FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE,
                  <fs_dyntable>.
    DATA:   dref_dyntab    TYPE REF TO data,
            dref_dynwa     TYPE REF TO data.
    DATA: ts_fieldcatalog TYPE lvc_t_fcat.
    DATA: wa_fieldcatalog TYPE lvc_s_fcat.
    Updated Fieldcatalog dynamically as,
    *function module to read segment structure
        CALL FUNCTION 'SEGMENT_READ'
          EXPORTING
            segmenttyp           = v_segment_name
          TABLES
            segmentstructure     = ts_seg_structure
          EXCEPTIONS
            no_authority         = 1
            segment_not_existing = 2
            OTHERS               = 3.
        IF sy-subrc <> 0.
          CASE sy-subrc.
            WHEN '1'.
              MESSAGE e024.
              STOP.
            WHEN '2'.
              MESSAGE e025 WITH v_segment_name.
              STOP.
            WHEN OTHERS.
              MESSAGE e023.
          ENDCASE.
        ENDIF.
    *FETCH FIELDS FROM STRUCTURE OF SEGMENT AND CREATE FIELDCATALOG FOR
    EACH FIELD OF SEGMENT (DYNAMIC FIELD CATALOG)
        LOOP AT ts_seg_structure INTO wa_seg_structure.
          ADD 1 TO v_counter.
          wa_fieldcatalog-fieldname = wa_seg_structure-fieldname.
          wa_fieldcatalog-col_pos   = v_counter.
          wa_fieldcatalog-ref_table = wa_seg_structure-segtyp.
          APPEND wa_fieldcatalog TO ts_fieldcatalog.
          CLEAR wa_fieldcatalog.
        ENDLOOP.
    and generated dynamic internal table using fieldcatalog as,
    *--Method to get the structure of table using fieldcatalog.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = ts_fieldcatalog
        IMPORTING
    *--Variable of type REF TO DATA.
          ep_table        = dref_dyntab.
      IF sy-subrc <> 0.
        MESSAGE e023.
      ENDIF.
    *--Dynamic internal tables required when show segments selected
      IF p_selseg IS NOT INITIAL.
        ASSIGN dref_dyntab->* TO <t_dyntable>.
    *--Create dynamic work area and assign to FS
      CREATE DATA dref_dynwa LIKE LINE OF <t_dyntable>.
        ASSIGN dref_dynwa->* TO <fs_dyntable>.
    And then i populated this <t_dyntable> which is being passed as data-table to method
    CL_GUI_ALV_GRID => SET_TABLE_FOR_FIRST_DISPLAY
    for ALV grid Display along with above used filedcatalog ts_fieldcatalog.
    Things are fine till here, but now i have the requirement to edit selected rows of the ALV display..
    As you might be aware, we need a field
            TS_STYLEROW  TYPE lvc_t_styl, (i.e, a field of type 'h' and we can say as an internal table inside an internal table or else as a deep structure)
    in the output internal table <t_dyntable> to meet our requirement.
    My issue is about declaring one such field of type 'h' in this dynamically created internal table ''<t_dyntable>".
    I tried in the following way by adding one such field to fieldcatalog :
    *Field for Styling
      ADD 1 TO v_counter.
      wa_fieldcatalog-fieldname   = 'TS_STYLEROW'.
      wa_fieldcatalog-tabname     = 'TS_STYLE'.
      wa_fieldcatalog-col_pos     = v_counter.
      wa_fieldcatalog-no_out      = 'X'.
      wa_fieldcatalog-inttype     = 'h'.      " I even mentioned this
      APPEND wa_fieldcatalog TO ts_fieldcatalog.
      CLEAR  wa_fieldcatalog.
    But this is creating a field of type 'C' in the table <t_dyntable> instead of what i was expecting
    Guyz and respected,
    Please advice me with the solution or ur ideas....
    Note : The overall requirement is create a deep structure for dynamically generated internal table.
    Your help is highly appreciated and unforgettable..!!!!!!!

    hi,
    Dynamic append
    Dynamic internal table
    Dynamic internal table
    dynamic columns in ALV
    Variant for dynamic selection
    thanks

  • Loading MXML Component Dynamically

    Hi all,
    I am new to Flex and was trying out small things . I created
    a MXML Application and also MXML components.
    I tried loading MXML component to application using xmlns and
    it worked fine.(
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute" backgroundColor="#ffffff" xmlns:mi="com.*">
    <mi:base1 id="base1" />
    <mi:base2 id="base2" />
    This method is ok if we are loading 3-4 components .
    but , if i have to load a mxml component dynamically how do I
    do it?
    for example ,if base1 and base2 are two components and i want
    to load them based on some event performed.
    I have tried the method which uses ViewStack and code
    myViewStack.selectedChild=Container(myViewStack.getChildByName(selectedNode))
    ,where each child will have one component declared or initialized.
    Following this method is not a feasible when we have hundred
    of components to be loaded.
    Can anyone help me on this??

    "srirama.83" <[email protected]> wrote in
    message
    news:gpkoui$g3u$[email protected]..
    > Hi all,
    > I am new to Flex and was trying out small things . I
    created a MXML
    > Application and also MXML components.
    > I tried loading MXML component to application using
    xmlns and it worked
    > fine.(
    > <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    > layout="absolute"
    > backgroundColor="#ffffff" xmlns:mi="com.*">
    > <mi:base1 id="base1" />
    > <mi:base2 id="base2" />
    > )
    > This method is ok if we are loading 3-4 components .
    > but , if i have to load a mxml component dynamically how
    do I do it?
    > for example ,if base1 and base2 are two components and i
    want to load them
    > based on some event performed.
    >
    > I have tried the method which uses ViewStack and code
    >
    myViewStack.selectedChild=Container(myViewStack.getChildByName(selectedNode))
    > ,where each child will have one component declared or
    initialized.
    >
    > Following this method is not a feasible when we have
    hundred of components
    > to
    > be loaded.
    > Can anyone help me on this??
    >
    >
    http://www.magnoliamultimedia.com/flex_examples/Amys_Flex_FAQ.pdf
    Q4

  • How to create a table less structure with dynamic menu module

    Hi guys,
    I am using dynamic menu module for creating a main menu for http://firstsite08.businesscatalyst.com/
    but it is generating table structure. What changes to do i had to make to generate a table less structure from dynamic menu module.

    Hi Andy,
    When you create a Menu, the option dropdown for the menu has Default, but under that you will see HTML CSS Only option which creates a ul li structure.
    For the Menu Module options you can find more information from the knowledgebase: http://kb.worldsecuresystems.com/134/bc_1345.html?bc-partner#main_Menu_Modules
    If you would like to use the version 2 menu module you can find a bit of a guide I wrote here: http://forums.adobe.com/docs/DOC-1903

  • How to create a table component dynamically in netbeans 6.0 (JSF 1.2)?

    How to create a table component dynamically in netbeans 6.0 (JSF 1.2)?
    This example http://developers.sun.com/jscreator/reference/techart/2/createTableDynamically.html works only with JSF 1.1.

    Please help my write correct code.
    How to replace this strings for run example?
    rowGroup.setValueBinding("sourceData", getApplication().createValueBinding("#{Page1.tripDataProvider}"));
    staticText1.setValueBinding("text", getApplication().createValueBinding("#{currentRow.value['TRIP.TRIPID']}"));

  • Portfolio analyzer-  No active analysis structure available

    Hi experts,
    We are planning to use portfolio analyzer. but i m getting an error "No active analysis structure available".
    I want to maintain this setting in config. but i m not having a clear understanding of this please help and suggest.
    Query 1.
    SPRO -> Financial Supply Chain Management -> Treasury and Risk Management -> Basic Analyzer Settings -> Reporting Characteristics -> Copy Sample Customizing Settings -> Analysis Characteristics and Structure: Activate Sample Sett
    in this link i have found 2 things
    a.  create charactersis  - i have run this and it s showing that "Characteristic WY....... already existed and was not changed"
    b. create chrachtersis and analysis structure  and in this config it is demanding  name of analysis structure..
        Please suggest which analysis structure wh should maintain here.
        is any structure provided by SAP ? or it is user defined filed ?
    Query 2.
    SPRO -> Financial Supply Chain Management -> Treasury and Risk Management -> Basic Analyzer Settings -> Reporting Characteristics -> Copy Sample Customizing Settings -> Analysis Structure: Copy Customizing from Sample Settings
    what is the use of above link.
    Thanks
    Gaurav Gupta

    Hi Gaurav,
    To activate analysis structure you can use the transaction AFWA.
    And then you have to run the transaction JBRGE and select all the checkboxes to recreate the environment.
    Regards,
    Sumant

  • UIScrollBar component dynamic text capital letter Y not appearing

    I'm using the UIScrollBar component, dynamic text is my setting.  When I view the swf or exe, all my text appears except for capital letter Y, it appears in flash, but not the swf or exe file.
    Any reason why this happens?
    Any help is appreciated.

    I finally found the answer but this scenario doesn't make
    sense. It seems you have to create a dynamic text field with a
    scrollbar during runtime through actionscript, rather then creating
    the text field and scrollbar in design mode. Here is the code that
    worked:
    import fl.controls.UIScrollBar;
    var myTxt:TextField = new TextField();
    myTxt.background = true;
    myTxt.backgroundColor = 0xFFFFFF;
    myTxt.border = true;
    myTxt.wordWrap = true;
    myTxt.width = 200;
    myTxt.height = 200;
    myTxt.x = 22;
    myTxt.y = 75;
    var mySb:UIScrollBar = new UIScrollBar();
    mySb.direction = "vertical";
    // Size it to match the text field.
    mySb.setSize(myTxt.width, myTxt.height);
    // Move it immediately right the text field.
    mySb.move(myTxt.x + myTxt.width, myTxt.y);
    // put them on the Stage
    addChild(myTxt);
    addChild(mySb);
    // load text
    var loader:URLLoader = new URLLoader();
    var request:URLRequest = new URLRequest("breakroomText.txt");
    loader.load(request);
    loader.addEventListener(Event.COMPLETE, loadcomplete);
    function loadcomplete(event:Event) {
    // move loaded text to text field
    myTxt.htmlText = loader.data;
    // Set myTxt as target for scroll bar.
    mySb.scrollTarget = myTxt;

  • Create a deep structure for dynamic internal table

    Hi All,
    I am creating a dynamic table using method cl_alv_table_create=>create_dynamic_table.
    The normal structure gets created. but now I want to creat a Deep structure for having information of colors also for each column. So I want to add a COLTAB type LVC_T_SCOL for colors information .
    How should I create this using above method?
    Rgds,
    Madhuri

    I created a zcelltab structure as below. But while creating dynamic internal table, I received the error  with
    'Type "ZCELLTAB" is unknown 68 ZCELLTAB-CELLTAB
    Here is the code.
    DATA: BEGIN OF ZCELLTAB,
             CELLTAB LIKE LVC_S_STYL,
         END OF ZCELLTAB.
    FIELD-SYMBOLS <T_CELLTAB> TYPE LVC_T_STYL.
    DATA : LT_CELLTAB TYPE LVC_T_STYL.
    DATA:  WA_CELLTAB TYPE LINE OF LVC_T_STYL.
    DATA: GT_FCAT1 TYPE LVC_T_FCAT,
               GW_FCAT1 TYPE LVC_S_FCAT,
                GT_FCAT2 TYPE LVC_T_FCAT,
                GW_FCAT2  TYPE LVC_S_FCAT.
    After filling the FCAT1, I added the field in FCAT2  like below
      GT_FCAT2[ ] = GT_FCAT1[ ].
      G_TABIX = G_TABIX + 1.
      GW_FCAT2-INTTYPE = 'C'.
      MOVE G_TABIX TO GW_FCAT2-COL_POS.
      GW_FCAT2-OUTPUTLEN = '10'.
      GW_FCAT2-FIELDNAME = 'T_CELLTAB'.
      GW_FCAT2-TABNAME = 'ZCELLTAB'.
      GW_FCAT2-REF_FIELD = 'CELLTAB'.
      GW_FCAT2-REF_TABLE = 'ZCELLTAB'.
      APPEND GW_FCAT2 TO GT_FCAT2
      CLEAR GW_FCAT2.
    While calling the below method, the error with
    CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
         EXPORTING
          IT_FIELDCATALOG = GT_FCAT2
        IMPORTING
          EP_TABLE        = GT_REQ.
      ASSIGN GT_REQ->* TO <F_TAB>.
      CREATE DATA GWA_REQ LIKE LINE OF <F_TAB>.
      ASSIGN GWA_REQ->* TO <F_WA>.
    LOOP AT ITAB.
    ASSIGN COMPONENT 'MATNR'  OF STRUCTURE <F_WA> TO <F_VAL>
    <F_VAL> = ITAB-MATNR.
    IF ITAB-MATNR IS INITIAL.
    ASSIGN COMPONENT 'T_CELLTAB' OF STRUCTURE <F_WA> TO <T_CELLTAB>
            CLEAR WA_CELLTAB.
            WA_CELLTAB-FIELDNAME = 'MATNR'.
            WA_CELLTAB-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
            INSERT WA_CELLTAB INTO TABLE <T_CELLTAB>.
    ENDIF.
    APPEND <F_WA> TO <F_TAB>
    ENDLOOP.
    CALL METHOD GR_GRID->SET_TABLE_FOR_FIRST_DISPLAY
            EXPORTING
              I_CONSISTENCY_CHECK  = G_CONSISTENCY_CHECK
              IT_TOOLBAR_EXCLUDING = G_EXCLUDE
              I_SAVE               = G_SAVE
           I_DEFAULT            = 'X'
              IS_LAYOUT            = G_LAYOUT
            CHANGING
              IT_OUTTAB            = <F_TAB>
              IT_FIELDCATALOG      = F_CAT1.
    Please let me know where I was wrong.
    Should I remove the T_CELLTAB as the field name is not mentioned in the structure 'ZCELLTAB'.
    Thanks,
    Kumar.
    Edited by: venn e on May 7, 2010 4:10 PM

  • Structure of Dynamic Table in Function Module

    Hi,
    I'm trying to find a way to get as OUTPUT a dynamic Table from a Function Module.
    I declared a table called T_DATA without a type.
    And this table should have a dynamic table back.
    The problem that I get the data back but, I only found a data without any field-elements.
    The data is there but there's no structure, no table.
    Is there any way that I can send the Data in a proper structure?

    Hi
       Try using the following code
    type-pools:slis.
    data:it_fcat type lvc_t_fcat,
         wa_fcat type lvc_s_fcat,
         itab type ref to data.
    data:it_fcat1 type slis_t_fieldcat_alv,
         wa_fcat1 like line of it_fcat1.
    data:cl_tab type ref to cl_alv_table_create,
         wa_ref type ref to data.
    field-symbols:<itab> type table,
                  <wa> type any,
                  <comp>.
    create object cl_tab.
    refresh:it_fcat.
    wa_fcat-fieldname = 'NAME'.
    wa_fcat-inttype  = 'C'.
    wa_fcat-intlen = '10'.
    wa_fcat1-fieldname = 'NAME'.
    wa_fcat1-inttype  = 'C'.
    wa_fcat1-intlen = '10'.
    append wa_fcat to it_fcat.
    append wa_fcat1 to it_fcat1.
    wa_fcat-fieldname = 'NAME2'.
    wa_fcat-datatype  = 'CHAR10'.
    wa_fcat1-fieldname = 'NAME2'.
    wa_fcat1-datatype  = 'CHAR10'.
    append wa_fcat to it_fcat.
    append wa_fcat1 to it_fcat1.
    cl_alv_table_create=>create_dynamic_table(
      exporting
       I_STYLE_TABLE             = I_STYLE_TABLE
        it_fieldcatalog           = it_fcat
       I_LENGTH_IN_BYTE          = I_LENGTH_IN_BYTE
      importing
        ep_table                  = itab
       E_STYLE_FNAME             = E_STYLE_FNAME
    EXCEPTIONS
       GENERATE_SUBPOOL_DIR_FULL = 1
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    assign itab->* to <itab>.
    create data wa_ref like line of <itab>.
    assign wa_ref->* to <wa>.
    do.
      assign component 'NAME' of structure <wa> to <comp>.
      <comp> = 'AA'.
      unassign <comp>.
      assign component 'NAME2' of structure <wa> to <comp>.
      <comp> = 'AB'.
      insert <wa> into table <itab>.
      exit.
    enddo.
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       i_callback_program                = sy-repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_TOP_OF_PAGE            = ' '
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  = I_STRUCTURE_NAME
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      = I_GRID_TITLE
      I_GRID_SETTINGS                   = I_GRID_SETTINGS
      IS_LAYOUT                         = IS_LAYOUT
       it_fieldcat                       = it_fcat1
      IT_EXCLUDING                      = IT_EXCLUDING
      IT_SPECIAL_GROUPS                 = IT_SPECIAL_GROUPS
      IT_SORT                           = IT_SORT
      IT_FILTER                         = IT_FILTER
      IS_SEL_HIDE                       = IS_SEL_HIDE
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        = IS_VARIANT
      IT_EVENTS                         = IT_EVENTS
      IT_EVENT_EXIT                     = IT_EVENT_EXIT
      IS_PRINT                          = IS_PRINT
      IS_REPREP_ID                      = IS_REPREP_ID
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   = IT_ALV_GRAPHICS
      IT_HYPERLINK                      = IT_HYPERLINK
      IT_ADD_FIELDCAT                   = IT_ADD_FIELDCAT
      IT_EXCEPT_QINFO                   = IT_EXCEPT_QINFO
      IR_SALV_FULLSCREEN_ADAPTER        = IR_SALV_FULLSCREEN_ADAPTER
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           = E_EXIT_CAUSED_BY_CALLER
      ES_EXIT_CAUSED_BY_USER            = ES_EXIT_CAUSED_BY_USER
      tables
        t_outtab                          = <itab>
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
    Regards

  • Read structure FIELD Dynamically

    Hi All Experts,
    I am working on CO-PA exit EXIT_SAPLKEAB_001.
    In this exit we have a structure EP_SOURCE. This structure gets its structure dynamically. In my case this is of type CE1SN00. These CE1 tables gets generated in SAP dynamically when you maintain any Operating Concern in CO-PA. In my case Operating concern SN00 has been maintained. And in this CE1SN00 there are multiple Value fields. I have to apply a formula on one of the fields.
    The problem is that I have to apply a formula on different fields everytime. I have a Z table which has fields 'Operating Concern', 'Field' and 'Active Indicator'. I have to read this Z table based on the Operating Concern and get the 'Field' name.
    For example in my Z table if I have a Operating Concern 'S_AL' and field 'KWBLOK_ME'. And the EP_SOURCE structure has got an entry from table 'CE1S_AL'. I have to read 'EP_SOURCE-KWBLOK_ME' and apply the formula on it.
    And next time if I have a Operating Concern 'S_AL' and field 'KWFLHR_ME'. I have to read 'EP_SOURCE-KWFLHR_ME' and apply the formula on it.
    What I have done so far is I have defined a structure IT_CE1S_AL as type CE1S_AL and moving all the values from EPSOURCE to IT_CE1S_AL. Now I have to read the value of only that field which is there in 'Z' table.
    I hope I have explained this well. Please help me in solving this problem.

    Hi Richa,
    Thanks for ur reply. But my requirement is something different. I have tried the field symbols but getting an error message - "Data object 'EP_SOURCE' does not have a component called <FS1>".
    Once again my requirement is:
    I have a Z table ZCO_VALUE. The structure of the table is:
    MANDT  |  OP_CON  |  FIELD   |  A_IND |
    And there 2 two entries in this table:
    100    |  S_AL    |KWBLOK_ME |  A     |
    100    |  S_AL    |KWBLHR_ME |  A     |
    And I have a structure EP_SOURCE in user-exit which is just like CE1S_AL. KWBLOK_ME & KWBLHR_ME are technical field names in CE1S_AL. I want to read the value of either CE1S_AL-KWBLOK_ME or CE1S_AL-KWBLHR_ME.
    Now in my first instance I want to read
    EP_SOURCE-KWBLOK_ME, but I have KWBLOK_ME as a value in ITAB_ZCO_VALUE. I have defined a field-symbol <fs1> to get values KWBLOK_ME or KWBLHR_ME. And trying to read by write the code as:
    get_value = EP_SOURCE-<fs1> or
    Assign ep_source-<fs1> to get_value.
    But because ep_source is not referenced to any structure I can't use any of the above statement.
    Thanks

  • Assign component - dynamic field

    Hey experts,
    I want to do this:
    ASSIGN COMPONENT (wa_dd08l-fieldname) of structure  <wa_deleted> to <ls_id>
    but the (wa_dd08l-fieldname) is incorrect, I can't put there those parentheses.
    The <wa_deleted> is a dynamic field symbol and I need to get the ID from it, I have the fieldname of the ID in wa_dd08l-fieldname, but
    I can't use it in ASSIGN COMPONENT, so how could I get the value of the fieldname (wa_dd08l-fieldname) from <wa_deleted>?
    Regards,
    Robert    

    Why do you want to use the parenthesis?
    ASSIGN COMPONENT (wa_dd08l-fieldname) of structure  <wa_deleted> to <ls_id>
    ASSIGN COMPONENT wa_dd08l-fieldname of structure  <wa_deleted> to <ls_id>
    Max

  • Dynamic node creation from RTTI structure and dynamic mapping

    Hi,
    I'd like to create a dynamic node in my component controller then map this node to a node in my view and bind it to a dynamic table.
    I create the dynamic node in my component controller using the add_new_child_node method :
    CALL METHOD root_node_info->add_new_child_node
        EXPORTING
          name                    = 'MY_TABLE'
          static_element_rtti     = struct_type
          is_static               = ABAP_true
        RECEIVING
          child_node_info              = node_info
    Then I use the add_new_mapped_child_node method to map the node in the view :
    * Map the context node dynamically
      wa_path = 'COMPONENTCONTROLLER.MY_TABLE'.
      insert wa_path into table tab_mapping_path.
      stru_mapping_info-controller = 'COMPONENTCONTROLLER'.
      stru_mapping_info-path = tab_mapping_path.
      lo_node_info = wd_context->get_node_info( ).
      CALL METHOD lo_node_info->add_new_mapped_child_node
        EXPORTING
          child_name      = 'MY_TABLE'
          mapping_info    = stru_mapping_info
        receiving
          child_node_info = lo_dyn_node_info
    The child node is created in my view context but it doesn't have any attribute or static element RTTI.
    Do I have to add each attribute with the add_attribute method and then the add_new_mapped_child_node method will copy them over?
    Regards,
    Pierre

    Problem solved, the path was not good :
    * Map the context node dynamically
    *  wa_path = 'COMPONENTCONTROLLER.MY_TABLE'.
    *  insert wa_path into table tab_mapping_path.
      stru_mapping_info-controller = 'COMPONENTCONTROLLER'.
    *  stru_mapping_info-path = tab_mapping_path.
      append 'COMPONENTCONTROLLER' to stru_mapping_info-path.
      append 'MY_TABLE' to stru_mapping_info-path.
      lo_node_info = wd_context->get_node_info( ).
      CALL METHOD lo_node_info->add_new_mapped_child_node
        EXPORTING
          child_name      = 'MY_TABLE'
          mapping_info    = stru_mapping_info
        receiving
          child_node_info = lo_dyn_node_info
    Regards,
    Pierre

  • Create structure in Dynamic ALV for color and editing cells

    Hi experts,
    I created dynamic ALV . in this i want coloring and editing of cells.
    this can be done by strucutture lvc_t_scol, lvc_t_styl.
    My problem is how to create structure in field catalogue of Dynamic ALV.
    Thanks

    Hello
    I am not sure if you have missed the following part of the coding:
    " Add table type (LVC_T_STYL) as field to structure ==> complex structure
      CLEAR: gs_comp.
      gs_comp-type ?= cl_abap_typedescr=>describe_by_data( celltab ).
      gs_comp-name  = 'CELLTAB'.
      APPEND gs_comp TO gt_components.
      go_sdescr  = cl_abap_structdescr=>create( gt_components ).
      go_tdescr  = cl_abap_tabledescr=>create( go_sdescr ).
      CREATE DATA gdo_handle TYPE HANDLE go_tdescr.
      ASSIGN gdo_handle->* TO <gt_itab>.
    This is exactly your requirement.
    Regards
      Uwe

Maybe you are looking for