Deep structure - assign component

hi,
I have a structure like:
data: begin of wa_xxx,
        rec like bkpf,
        iba(10) TYPE c,
        bba(10) TYPE c,
      END OF wa_xxx.
Now I would like to assign the strucutre like:
field-symbols: <fs_1> like wa_xxx
loop....
assign component sy-tabix of structure <fs_1> to <fs_2>.
endloop.
The first compoment is rec, but I need <fs_1>-rec-...(fields of the structure)
How can I do this? Any Idea?
thanks
markus

Hi Markus,
I'm not sure exactly what you mean but here's some code:
types: begin of ty_xxx,                        
        rec like bkpf,                         
        iba(10) TYPE c,                        
        bba(10) TYPE c,                        
      END OF ty_xxx.                           
data t type table of ty_xxx.                   
data d type ty_xxx.                            
field-symbols: <el> type any, <str> type ty_xxx.  
you can assign the whole structure to a field-symbol...                                               
loop at t assigning <str>.   
you can refer                   directly to eleemnets within the filed-symbol structure...
if <str>-bba is initial. endif.                
do.         
you can loop through the individual components of the field symbol structure                                  
assign component sy-tabix of structure <str> to <el>.  
if sy-subrc <> 0.                              
exit.                                          
endif.  
you can operate on the current element within the structure
if <el> is initial. endif.                                                                               
enddo.                                                                               
endloop.

Similar Messages

  • ASSIGN COMPONENT x OF STRUCTURE not assigning !

    Hello,
    the problem is that the component PAKET is not getting assigned to my field symbol (<l_str_applparam> type any) and i don't understand why. The PAKET field is type INT4 and the value is 1111.  The importing structure i_str_applparam is also type any.
    See coding below:
      DATA: l_sel_tab TYPE TABLE OF rsparams,
                  l_rcl_type TYPE REF TO cl_abap_typedescr,
                  l_comp_table TYPE abap_component_tab,
                  l_rcl_struc TYPE REF TO cl_abap_structdescr,
                  l_tab_fields TYPE abap_compdescr_tab.
      m_var_beschreibung = i_var_beschreibung.
      DATA l_var_ddic_header TYPE x030l.
      l_rcl_struc ?= cl_abap_typedescr=>describe_by_data( i_str_applparam ).
      l_var_ddic_header = l_rcl_struc->get_ddic_header( ).
      CREATE DATA m_str_applparam TYPE (l_var_ddic_header-tabname).
      FIELD-SYMBOLS: <l_str_applparam> TYPE ANY.
      GET REFERENCE OF i_str_applparam INTO m_str_applparam.
      LOOP AT l_sel_tab INTO l_wrk_sel
        WHERE kind = 'P'.
        CASE l_wrk_sel-selname.
          WHEN 'PA_PAKET'.
            IF l_wrk_sel-low IS NOT INITIAL.
              ASSIGN COMPONENT 'PAKET' OF STRUCTURE m_str_applparam TO <l_str_applparam>.
              CHECK <l_str_applparam> IS ASSIGNED.  ?? NOT ASSIGNED ??
              <l_str_applparam> = l_wrk_sel-low.
            ENDIF.
        ENDCASE.
    Thank you in advance,
    Ioan Constantin.

    Hello Uwe,
    thank you for the first answer. I have another tiny question: i am not allowed to change the values of the import structure and i want to save them in my class, is there a simpler way to save the data besides the loop below ??
      DATA: l_var_ddic_header TYPE x030l.
      l_rcl_struc ?= cl_abap_typedescr=>describe_by_data( i_str_applparam ).
      l_var_ddic_header = l_rcl_struc->get_ddic_header( ).
      CREATE DATA m_str_applparam TYPE (l_var_ddic_header-tabname).
      FIELD-SYMBOLS: <l_str_applparam> TYPE ANY,
                     <l_str_m_applparam> TYPE ANY,
                     <l_var_comp> TYPE ANY,
                     <l_var_m_comp> TYPE ANY.
      ASSIGN i_str_applparam to <l_str_applparam>.
      ASSIGN m_str_applparam->* TO <l_str_m_applparam>. "m_str_applparam is a class attribute
      DATA l_wrk_rcl_struc TYPE abap_compdescr.
      LOOP AT l_rcl_struc->components INTO l_wrk_rcl_struc.
        ASSIGN COMPONENT l_wrk_rcl_struc-name OF STRUCTURE <l_str_applparam> TO <l_var_comp>.
        ASSIGN COMPONENT l_wrk_rcl_struc-name OF STRUCTURE <l_str_m_applparam> TO <l_var_m_comp>.
      <l_var_m_comp> = <l_var_comp>.
      ENDLOOP.
    Regards,
    Ioan.

  • Assign Component with dynamic structure.

    Hi,
    I like to get a field from a structure which i read from a customizing table. I think with a snippet it is easy to understand:
      FIELD-SYMBOLS:  <fs_value>         TYPE  Any.
    DATA: lv_field type text30,
           lv_structure type  but000,
           lv_Structure_name type text30.
    select single *
      into lv_structure
      from but000.
    lv_field = 'PARTNER'.
    lv_Structure_name = 'LV_STRUCTURE'.
    ASSIGN COMPONENT lv_field OF STRUCTURE lv_Structure_name TO <fs_value>.
    But this doesn't wok, because it seems, that this statement try to get the fieldname from the variable 'lv_Structure_name'.
    If i replace lv_Structure_name with lv_Structure than it works, but this is not what I like.
    Any ideas
    Stefan

    Hi,
    with a little addition of a second fs:
    FIELD-SYMBOLS: <fs_value> TYPE ANY.
    FIELD-SYMBOLS: <fs_struc> TYPE ANY.
    DATA: lv_field TYPE text30,
    lv_structure TYPE but000,
    lv_structure_name TYPE text30.
    SELECT SINGLE *
    INTO lv_structure
    FROM but000.
    lv_field = 'PARTNER'.
    lv_structure_name = 'LV_STRUCTURE'.
    ASSIGN (lv_structure_name) TO <fs_struc>.
    ASSIGN COMPONENT lv_field OF STRUCTURE <fs_struc> TO <fs_value>.
    it will work.
    regards
    Jörg

  • Question to ASSIGN COMPONENT 3 OF STRUCTURE LFC1 TO FS .

    Hi,
    i do this in abap (ECC6):
    FIELD-SYMBOLS: <FS> TYPE ANY.
    ASSIGN COMPONENT 3 OF STRUCTURE LFC1 TO <FS>.
    WRITE: / <FS>.
    it works as i need.
    Is it possible to get the fieldname of the 3. field of structure LFC1?
    thanks.
    regards, Dieter

    Hi,
    You can via a couple of method calls....
    report  zdescribe.
    data: gs_t001 type t001.
    data: go_struct type ref to cl_abap_structdescr,
          gt_comp   type abap_component_tab,
          gs_comp   type abap_componentdescr.
    start-of-selection.
      go_struct ?= cl_abap_typedescr=>describe_by_data( gs_t001 ).
      gt_comp = go_struct->get_components( ).
      loop at gt_comp into gs_comp.
        write: / gs_comp-name.
      endloop.
    Darren

  • 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

  • How can i point to a specific field in DEEP structure and populate it?

    Hello,
    I have declared a internal table as below,
    DATA: BEGIN OF wa_data,
                  vkorg TYPE vkorg
                  vtweg TYPE vtweg
                  spartTYPE spart
                  field_name TYPE CHAR30
                   value TYPE CHAR50
                END OF wa_data
    DATA: ls_data TYPE wa_data,
                lt_data TYPE STANDARD TABLE OF wa_data.
    The lt_data is populated as below,
    VKORG-------VTWEG-------SPART-------FIELD_NAME-------VALUE
    1000-----------10-------------01------------KALKS---------------ZP00 "Pricing procedure
    1000-----------10-------------01------------ZTERM---------------15 days "Payment terms
    1000-----------10-------------01------------MAHNA---------------09 "Dunning
    Fine.
    Now, i have a DEEP DEEP DEEP structure as belowm
    DATA: ls_deep TYPE cmds_ei_extern. "Pls. see this deep structure 'cmds_ei_extern' in SAP DDIC / SE11
    This deep structure is part of Customer master creation. Now, i would like to POPULATE this deep structure from my lt_data itab DYNAMICALLy, i mean, with out mentioning the field names (like, ZTERM, KALKS, MAHNA etc etc), bcz its these i am pulling this lt_data from a custom table, so going further business may also ADD a new record / field like BUSAB (Accouting clerk) with a value of AL (Allen Christi), hence i want to hv dynamic and its less tediuos also bcz,
    We can LOOP lt_data INTO ls_data (for example, the ls_data-field_name = KALKS)
    Now, point the KALKS in the deep deep deep structure and populate it with a value of ls_data-value (= 15 days)
    ENDLLOOP.
    Pls. let me know How can i do this, i guess, we need to use field symbols, pls. let me know the code to achieve my requirement
    Thank you

    Hi,
    Please refer below code.This will populate field kunnr of the deep structure. Once you select the data as per your requirement,you can write similar code to populate rest of the fields in the deep strucure.
    TYPES : BEGIN OF ty_data,
                 kunnr TYPE kunnr,
                 END OF ty_data.
    FIELD-SYMBOLS : <lfs_cmds_ei_header>   TYPE cmds_ei_header,
                    <lfs_cmds_ei_instance>              TYPE cmds_ei_instance,
                    <lfs_kunnr>                                   TYPE kunnr.
    DATA:  lfs_cmds_ei_extern  TYPE cmds_ei_extern,
                 lr_dytable                  TYPE REF TO data,
                 lr_dytable_wa           TYPE REF TO data,
                 lt_data                       TYPE STANDARD TABLE of ty_data ,
                 wa_data                   TYPE ty_data.
      SELECT kunnr
      FROM yalb_kunde
      UP TO 1 ROWS
      INTO TABLE lt_data.
      IF sy-subrc = 0.
        LOOP AT lt_data INTO lwa_data.
          ASSIGN COMPONENT 'HEADER' OF STRUCTURE lfs_cmds_ei_extern TO <lfs_cmds_ei_header>.
          IF sy-subrc = 0.
            ASSIGN COMPONENT 'OBJECT_INSTANCE' OF STRUCTURE <lfs_cmds_ei_header> TO <lfs_cmds_ei_instance>.
            IF sy-subrc = 0.
              ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <lfs_cmds_ei_instance> TO <lfs_kunnr>.
              IF sy-subrc = 0.
                <lfs_kunnr> = lwa_data-kunnr.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDIF.
    Thanks,
    Priya

  • Dynamic Table - Deep Structure

    Hi Gurus,
    this is my first posting, so be patient!
    I want to create a deep structure dynamic table via method
    cl_alv_table_create=>create_dynamic_table, is this possible? Are there tricks to make it happen?
    Background: i wanna create an alv with dynamic fieldcatalalog, in this case i want to colour special fields, which is done by lvc_s_layo-?csp_fieldname? in combination with a field in my internal table which is typed ?lvc_t_scol?. Is this possible under 6.2.43
    thanxs for your replies
    juergen
    - ?i dont actually know by rote the correct fieldnames of lvc_xxxxx?

    Hi Jurgen, I took on the challenge.  This program provides a dynamic table with the ability to set the colors of the cells.
    Create the structure ZCDF_CELL_COLOR in the dictionary as described in the program.
    Create screen 100 as empty, with next screen set to 0, and the following flow logic:
    PROCESS BEFORE OUTPUT.
      MODULE initialization.
    PROCESS AFTER INPUT.
    REPORT  zcdf_dynamic_table.
    * Dynamic ALV Grid with Cell Coloring
    DATA:
      r_dyn_table      TYPE REF TO data,
      r_wa_dyn_table   TYPE REF TO data,
      r_dock_ctnr      TYPE REF TO cl_gui_docking_container,
      r_alv_grid       TYPE REF TO cl_gui_alv_grid,
      t_fieldcat1      TYPE lvc_t_fcat, "with cell color
      t_fieldcat2      TYPE lvc_t_fcat, "without cell color
      wa_fieldcat      LIKE LINE OF t_fieldcat1,
      wa_cellcolors    TYPE LINE OF lvc_t_scol,
      wa_is_layout     TYPE lvc_s_layo.
    FIELD-SYMBOLS:
      <t_dyn_table>    TYPE STANDARD TABLE,
      <wa_dyn_table>   TYPE ANY,
      <t_cellcolors>   TYPE lvc_t_scol,
      <w_field>        TYPE ANY.
    START-OF-SELECTION.
    * Build field catalog based on your criteria.
      wa_fieldcat-fieldname = 'FIELD1'.
      wa_fieldcat-inttype   = 'C'.
      wa_fieldcat-outputlen = '10'.
      wa_fieldcat-coltext   = 'My Field 1'.
      wa_fieldcat-seltext   = wa_fieldcat-coltext.
      APPEND wa_fieldcat TO t_fieldcat1.
      wa_fieldcat-fieldname = 'FIELD2'.
      wa_fieldcat-inttype   = 'C'.
      wa_fieldcat-outputlen = '10'.
      wa_fieldcat-coltext   = 'My Field 2'.
      wa_fieldcat-seltext   = wa_fieldcat-coltext.
      APPEND wa_fieldcat TO t_fieldcat1.
    * Before adding cell color table,
    *  save fieldcatalog to pass
    *  to ALV call.
      t_fieldcat2[] = t_fieldcat1[].
    * Add cell color table.
    *  ZCDF_CELL_COLOR is a structure in the
    *   dictionary with one
    *   field called T_CELL_COLOR of type LVC_T_SCOL.
      wa_fieldcat-fieldname = 'T_CELLCOLORS'.
      wa_fieldcat-ref_field = 'T_CELL_COLOR'.
      wa_fieldcat-ref_table = 'ZCDF_CELL_COLOR'.
      APPEND wa_fieldcat TO t_fieldcat1.
    * Create dynamic table.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = t_fieldcat1
        IMPORTING
          ep_table                  = r_dyn_table
        EXCEPTIONS
          generate_subpool_dir_full = 1
          OTHERS                    = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    * Get access to new table using field symbol.
      ASSIGN r_dyn_table->* TO <t_dyn_table>.
    * Create work area for new table.
      CREATE DATA r_wa_dyn_table LIKE LINE OF <t_dyn_table>.
    * Get access to new work area using field symbol.
      ASSIGN r_wa_dyn_table->* TO <wa_dyn_table>.
    * Get data into table from somewhere.  Field names are
    *  known at this point because field catalog is already
    *  built.  Read field names from the field catalog or use
    *  COMPONENT <number> in a DO loop to access the fields. 
    *  A simpler hard coded approach is used here.
      ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table>
        TO <w_field>.
      <w_field> = 'ABC'.
      ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table>
        TO <w_field>.
      <w_field> = 'XYZ'.
      APPEND <wa_dyn_table> TO <t_dyn_table>.
      ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_dyn_table>
        TO <w_field>.
      <w_field> = 'TUV'.
      ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table>
        TO <w_field>.
      <w_field> = 'DEF'.
      APPEND <wa_dyn_table> TO <t_dyn_table>.
    * Color cells based on your criteria. 
    *  In this example, a test on
    *  FIELD2 is used to decide on color.
      LOOP AT <t_dyn_table> INTO <wa_dyn_table>.
        ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_dyn_table>
          TO <w_field>.
        ASSIGN COMPONENT 'T_CELLCOLORS'
          OF STRUCTURE <wa_dyn_table> TO <t_cellcolors>.
        CLEAR wa_cellcolors.
        wa_cellcolors-fname     = 'FIELD2'.
        IF <w_field> = 'DEF'.
          wa_cellcolors-color-col = '7'.
        ELSE.
          wa_cellcolors-color-col = '5'.
        ENDIF.
        APPEND wa_cellcolors TO <t_cellcolors>.
        MODIFY <t_dyn_table> FROM <wa_dyn_table>.
      ENDLOOP.
      CALL SCREEN 100.
    *  MODULE initialization OUTPUT
    MODULE initialization OUTPUT.
    * Set up for ALV display.
      IF r_dock_ctnr IS INITIAL.
        CREATE OBJECT r_dock_ctnr
               EXPORTING
                  side  =  
                    cl_gui_docking_container=>dock_at_left
                  ratio = '90'.
        CREATE OBJECT r_alv_grid
               EXPORTING i_parent = r_dock_ctnr.
    *   Set ALV controls.
        wa_is_layout-ctab_fname = 'T_CELLCOLORS'.
    *   Display.
        CALL METHOD r_alv_grid->set_table_for_first_display
          EXPORTING
            is_layout       = wa_is_layout
          CHANGING
            it_outtab       = <t_dyn_table>
            it_fieldcatalog = t_fieldcat2.
      ELSE.     "grids already prepared
    *   Refresh display.
        CALL METHOD r_alv_grid->refresh_table_display
          EXPORTING
            i_soft_refresh = ' '
          EXCEPTIONS
            finished       = 1
            OTHERS         = 2.
      ENDIF.
    ENDMODULE.                 " initialization  OUTPUT

  • Deep Structures

    Hi experts,
    Pls tell me how to create deep structures and use them in the program with an example?Urgent.
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Apr 14, 2008 5:47 PM

    these are the steps to create deep structures
    Procedure
    In the initial screen of the ABAP Dictionary, enter the structure name in field Data type and choose Create.
    A dialog box appears in which you must select the type category.
    Select Structure and choose .
    The maintenance screen for structures appears.
    Enter an explanatory short text in the field Short text.
    You can for example find the structure at a later time using this short text.
    Carry out the following steps for all the components you want to insert in the structure.
    You can also include structures, tables or views instead of individual components.
    the link is
    http://help.sap.com/saphelp_nw04/helpdata/en/90/8d7301b1af11d194f600a0c929b3c3/frameset.htm
    The procedure here is described in Inserting an Include(internal table in case of deep structure).
           Inserting an Include
    Prerequisites
    Only flat structures may be included in a table. No field refers to another structure in a flat structure. All the fields of a flat structure therefore refer either to a data element or were directly assigned a data type, field length and decimal places.
    A field name may not have more than 16 places in a table. A structure therefore can only be included in a table if none of the field names of the structure are longer than 16 places.
    Procedure
    Place the cursor under the line in which you want to insert the include and choose Edit ® Include ® Insert.
    A dialog box appears.
    Enter the structure name. You can optionally enter a group name (see Named Includes) or a three-place suffix.
    With the group name, you can access the fields in the include together in ABAP programs.
    The suffix can be used to avoid name collisions between fields of the include and fields already in the table. The suffix is added to all the fields of the include, whereby the field name is first truncated if necessary.
    Choose .
    A line with .INCLUDE in the Fields field and the name of the include in the Field type field is inserted in the field maintenance screen for the table.
    Select column Key if all the fields in the include should be key fields of the table.
    The table key must be at the start of the field list. If you select column Key, you must insert the include after the last key field or between the existing key fields of the table.
    If you do not select column Key, none of the included fields is a key field of the table.
    Choose .
    Result
    The fields of the include are added to the table in the database. If you inserted the fields of the include as key fields, the primary index of the table is built again.
    You can find information about the activation flow in the activation log, which you can display with Utilities ® Activation log. The activation log is displayed immediately if errors occur when the table is activated.
    Other Options
    You can display the fields contained in an include by placing the cursor on the line of the include and choosing  . The fields of the include are now shown below this line. You can cancel this action with  .
    Enter a name in column Components.
    If you want to insert the structure as an include in a transparent table at a later time, the component names may not be longer than 16 characters.
    Enter the name of the type whose attributes should be used in the component in field Component name. You can enter any type (data element, structure or table type) here.
    If you want to add components by entering the data type and length directly, choose Built-in type. You can now enter values for fields DTyp, Length, Dec.places, and Short description. With Component type you can switch back to the screen for entering references to existing types.
    You can also enter a Reference Type in the Component Type field. If you enter a class, interface, or generic reference (ANY, OBJECT, or DATA) in the Component Type field, the R type field is set automatically. If you enter a reference type already defined in the Dictionary as a reference type, a blue arrow appears in the D type column.
    If the type defined in the ABAP Dictionary or the built-in type is a reference type, set the indicator in the R Type column.
    You can combine components with direct type definition and components that are defined by referencing an existing type as you like.
    The reference field and reference table must be specified for components of type CURR (currency) and QUAN (quantity).
    You can make these entries on the Currency/quantity fields tab page.
    Now maintain the foreign keys of the structure.
    Proceed as when maintaining the foreign keys of a table (see Creating Foreign Keys).
    Choose Search Help, if you want to assign a search help to a structure field that points to a data element. Enter the name of a search help in the dialog box that appears. See Attaching a Search Help to a Table or Structure Field.
    Save your entries once you have defined all the components of the structure.
    You are asked to assign the structure a development class. You can change the development class later with Goto ® Change object directory entry.
    Choose an enhancement category. For more information, see Structure Enhancements.
    Choose
    You can expand all the includes contained in a table with  . Cancel this action with  .
    You can copy the fields contained in the include directly to the table with Edit ® Include ® Copy components. The fields of the include become table fields. They are no longer adjusted to changes in the include.
    the link is
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ebd6446011d189700000e8322d00/frameset.htm
        Enter a name in column Components.
    If you want to insert the structure as an include in a transparent table at a later time, the component names may not be longer than 16 characters.
    Enter the name of the type whose attributes should be used in the component in field Component name. You can enter any type (data element, structure or table type) here.
    If you want to add components by entering the data type and length directly, choose Built-in type. You can now enter values for fields DTyp, Length, Dec.places, and Short description. With Component type you can switch back to the screen for entering references to existing types.
    You can also enter a Reference Type in the Component Type field. If you enter a class, interface, or generic reference (ANY, OBJECT, or DATA) in the Component Type field, the R type field is set automatically. If you enter a reference type already defined in the Dictionary as a reference type, a blue arrow appears in the D type column.
    If the type defined in the ABAP Dictionary or the built-in type is a reference type, set the indicator in the R Type column.
    You can combine components with direct type definition and components that are defined by referencing an existing type as you like.
    The reference field and reference table must be specified for components of type CURR (currency) and QUAN (quantity).
    You can make these entries on the Currency/quantity fields tab page.
    Now maintain the foreign keys of the structure.
    Proceed as when maintaining the foreign keys of a table (see Creating Foreign Keys).
    Choose Search Help, if you want to assign a search help to a structure field that points to a data element. Enter the name of a search help in the dialog box that appears. See Attaching a Search Help to a Table or Structure Field.
    Save your entries once you have defined all the components of the structure.
    You are asked to assign the structure a development class. You can change the development class later with Goto ® Change object directory entry.
    Choose an enhancement category. For more information, see Structure Enhancements.
    Choose .
    for clear expalnation
    http://help.sap.com/saphelp_nw04/helpdata/en/90/8d7301b1af11d194f600a0c929b3c3/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ebd6446011d189700000e8322d00/frameset.htm
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Apr 14, 2008 5:49 PM

  • 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

  • Source and destination are deep structures.. can't seem to map the detail table

    So, both my source data structure and my destination structure are very similarly built:
    They both have a HEADER and BODY component. The HEADER has the standard AIF fields (MSGGUID, NS, IFNAME, IFVER).
    I have defined the BODY as a deep structure composed of a Header Structure + a Detail Table. Each row in the BODY has a structure with a few header fields, then a table of detail data attached to it.
    In my Structure Mappings, I've created 2 rows:
    The first to map BODY-HEADER to my header structure.
    The second to map BODY-DETAILS to my details table. Here, I've chosen "Indirect Mapping".
    Selecting that row and navigating to "Define Field Mappings", I choose my destination table (DTL) and enter the Sub-table from my source structure.
    At this point, I only have 1 action - to save the data in Ztables. I'm seeing that the header data is passed in fine. But there aren't any detail lines coming through.
    Any ideas?
    thanks alot.
    RP.

    Christoph,
    In your reply, I only have the ability to perform the First Structure Mapping (please see the below screenshots):
    Source Structure; BODY
    Destination Structure: BODY
    Field Mapping:
    1. Field in Dest.Struc=HDR, Sub-Table = SCH_HEADER
    2. Field in Dest.Struc=DTL,  Sub Table = SCH_DETAILS
    I presume I'm following your suggestion, but when I try to create the other two structure mappings, I only have HEADER or BODY as available options to choose from: I've attached screenshots of the F4 dropdown of the Source Structure and also the Destination Structure fields.
    I believe this is because my Interface Definition is defined as a HEADER and BODY:
    Source Data Structure
    Destination Data Structure

  • Please explain,  the job of the  "ASSIGN COMPONENT ".

    Please read this popular example appended below. I am newbie to ABAP.
    At the end of the execution the code is printing 33. Don't get it.
    Please explain,  the job of the  "ASSIGN COMPONENT ". How or why it is printing value 33.  What is the meaning of the statement, "ASSIGN COMPONENT <F2> OF STRUCTURE <F1> TO <F3>." ?
    DATA: BEGIN OF LINE,
    COL1 TYPE I VALUE '11',
    COL2 TYPE I VALUE '22',
    COL3 TYPE I VALUE '33',
    END OF LINE.
    DATA COMP(5) VALUE 'COL3'.
    FIELD-SYMBOLS: <F1>, <F2>, <F3>.
    ASSIGN LINE TO <F1>.
    ASSIGN COMP TO <F2>.
    DO 3 TIMES.
    ASSIGN COMPONENT SY-INDEX OF STRUCTURE <F1> TO <F3>.
    WRITE <F3>.
    ENDDO.
    ASSIGN COMPONENT <F2> OF STRUCTURE <F1> TO <F3>.
    WRITE / <F3>.
    11 22 33
    33

    DATA: BEGIN OF LINE,
    COL1 TYPE I VALUE '11',
    COL2 TYPE I VALUE '22',
    COL3 TYPE I VALUE '33',
    END OF LINE.
    DATA COMP(5) VALUE 'COL3'.
    FIELD-SYMBOLS: <F1>, <F2>, <F3>.
    ASSIGN LINE TO <F1>.
    ASSIGN COMP TO <F2>.      "here you are assigning the column name which is COL3 to <f2>.
    DO 3 TIMES.
    ASSIGN COMPONENT SY-INDEX OF STRUCTURE <F1> TO <F3>.
    WRITE <F3>.
    ENDDO.
    ASSIGN COMPONENT <F2> OF STRUCTURE <F1> TO <F3>.
    ASSIGN 'COL3' of structure <f1> to <f3>. "it is equal to above statement.
    WRITE / <F3>.
    11 22 33
    33
    ASSIGN COMPONENT <F2> OF STRUCTURE <F1> TO <F3>. means
    assigining  COL3  value of the structure <f1> to <f3>, so value is 33 , it will be assigned to <f3> .it prints 33.

  • Read a Deep Structure

    Hi Abapers, how can i read a Deep Structure? i mean, read a field inside a table that i'ts inside another table.
    [TABLE1 [TABLE2-FIELD] ]  -> I need read the "Field" Value

    Hi Carlos
    Here is an approach I believe that can help:
    LOOP AT <i><main_table></i> INTO <i><main_wa></i> .
      LOOP AT <i><wa>-<inner_table></i> INTO <i><inner_wa></i> .
        <i><var_1></i> = <i><inner_wa>-<field_to_be_read></i> .
      ENDLOOP .
    ENDLOOP .
    <i>And as a last thing, let me introduce you the SDN forums pointing system: You can assign points to posts you find helpful while solving your question. You can reward points by clicking the yellow star icon at header of each reply post. You can reward;
    - one 10 points (solved)
    - two 6 points (very helpful answer)
    - many 2 points (helpful answer)</i>
    Kind Regards...
    *--Serdar

  • Create deep structure to disable some cells in Dynamic ALV GRID

    Hi,
    I want to disable some cells in a Dynamic ALV Grid before calling "SET_tABLE_Display" Method.
    I check the BCALV_EDIT_02, where some cells are grayed out by assign the  CL_GUI_ALV_GRID-MC_STYLE_DISABLED  to the field name.
    But I want the same using Field symbol.
    I'm creating Dynamic table and dynamic structure based on the Dynamic field catalog.
    Example: <FT_TAB> TYPE STANDARD TABLE,
                    <FS_TAB> TYPE ANY,            
    DATA: INT_TAB  is my dynamic table values.
    For the INT_TAB internal table, I created dynamic Structure and dynamic field symbol table.
    LOOP AT INT_TAB.
    ASSIGN COMPONENT 'MATNR'  OF STRUCTURE <FS_TAB> TO <F_VALUE>
    <F_VALUE> = INT_TAB-MATNR.
    APPEND <FS_TAB> TO <FT_TAB>
    "Here is the problem occurs, I want to grayed out the MATNR value based on some condition.
    ENDLOOP.
    I would like to set the 'MATNR' value to be grayed out by passing the CL_GUI_ALV_GRID-MC_STYLE_DISABLED.
    and update into <FT_TAB>(       <FT_TAB> structure will have 2 structures)
    Finally the fieldsymbol should have two structure ( <F_TAB> = DYNAMIC STRUCTURE + LVC_S_STYLE )
    Display alv grid by passing <FT_TAB> to set_table_display method.
    Thanks in advance,
    Kumar.

    Hi,
    I am  not sure whether I really understand your request. Let me try to help.
    > Example: <FT_TAB> TYPE STANDARD TABLE,
    >                 <FS_TAB> TYPE ANY,            
    >
    > DATA: INT_TAB  is my dynamic table values.
    >
    >
    > LOOP AT INT_TAB.
    >  ASSIGN COMPONENT 'MATNR'  OF STRUCTURE <FS_TAB> TO <F_VALUE>
    > <F_VALUE> = INT_TAB-MATNR.
    >  APPEND <FS_TAB> TO <FT_TAB>
    Here <FT_TAB> must already be assigned to some internal table with a given (dynamic) structure. Did this happen before this piece of code?
    What I would do is to create a dynamic table (see documentation to CREATE DATA) with MATNR and the STYLE field (LVC_T_STYL). See the documentation for CREATE DATA - creation of internal tables. When collection the field descriptions for that internal table I would also build the field catalogue for the ALV.
    Then assign <FT_TAB> to that newly created internal table, <FS_TAB> to a newly created structure (same as a table line).
    Move the MATNR to component 1 (or component 'MATNR') of the table and fill the style table according to your needs. Then insert the <FS_TAB> into <FT_TAB>.
    Finally call the ALV SET_TABLE... method with your dynamic table and your field catalogue.
    Regards,
    Gerd Rother

  • How to add deep structure like LVC_T_SCOL in dynamic internal table

    Hello,
    can any one help me with adding a deep structure to a dynamically created internal table. the deep structure which needs to be added is for the color purpose for each record i.e.  LVC_T_SCOL .
    Dynamic table created with below method.
        CALL METHOD cl_alv_table_create=>create_dynamic_table
          EXPORTING
            it_fieldcatalog  = gt_struct
            i_length_in_byte = 'X'
          IMPORTING
            ep_table         = dy_table.
        ASSIGN: dy_table->* TO <dyn_table>,
                dy_table->* TO <dyn_line>.
    gt_struct has the list of fields and their technical attributs.
    Thanks In Advance.
    BR,
    Rajesh

    can you add a column name and attribs in gt_struct?  It needs to be declared like:
    <colorcolumnname>    type lvc_t_scol.

  • Read Table with Key in a Deep Structure

    Hello,
    I'd like to read a table while comparing a value in a deep structure.  So in the following code the key ID is a deep structure within cs_purchase_order_message-purchase_order-item-value.
    For some reason code check returns no errors with the following code, but I get a short dump with a syntax error on id-value when I execute the code.
    read table cs_purchase_order_message-purchase_order-item assigning <fs_xml_item> with key id-value = <fs_item>-number_int.
    How do I use "with key" when the value is in a deep structure?
    Thanks,
    Matt

    Refer to example link below:
    http://sap.ittoolbox.com/groups/technical-functional/sap-dev/read-deep-structure-736023.
    Regards,
    Venkat.

Maybe you are looking for

  • Schedule a job using dbms_job package

    SQL to schedule a job using DBMS_JOB. variable jobno number; variable status number; begin dbms_job.submit(:jobno, 'x(:status);', trunc(sysdate)+8/24, 'trunc(sysdate)+1+8/24', null); commit; end; It fails and returns the following error ... ORA-01008

  • Opening Word 2003 manual problems

    Hello, I have a manual with linked bitmaps and imported bitmaps. All bitmaps that are links, are not imported in Pages 08. A table with imported bitmaps (bitmaps that are in the Word doc) has only 30% of the pictures. I also opened our Word doc in Op

  • New cache size then FF restore it again to 75...

    Well, i'be set a new Cache size ( Default is 75 ) to 250mb, but after a few minutes or when i close and Re-open FF the default chache is 75 insted of the new 250mb, any way to make solve this?, some config in about;config?, or in a .ini file?, any ad

  • Problems with the jax-rpc testcase from the JWSDP tutorial

    Hello. I have e few problems with the hello case from the JWSDP tutorial. Everything works fine during the build/compile/installation phase but when I'm accessing the url http://localhost:8080/jaxrpc-hello/jaxrpc, the server wont find the service and

  • Screen Problem/Will not boot?

    My black macbook purchased in 2008 running OS X (10.5.8 I believe) would appear to not be starting up. When I turn it on, the screen flashes and I hear the chime and then it goes black. I'm not sure if this is a screen problem or something else. I ca