Field-symbols table

Hi,
can i transfer data from an internat table (ex: data begin of t occurs 0...) to a field-symbols table (field-symbols: <itab> type any table )?
Thanx in advance.
CV

You mean assign the internal table to the field symbol?
assign itab[] to <itab>.
Regards,,
Rich Heilman

Similar Messages

  • Export field symbol table out of method

    Hi,
    i have a report, that takes any xml and converts it into a table structure. In a method I generate the table structure using method cl_alv_table_create=>create_dynamic_table. Later in the same method I have filled the content of the XML file into a table typed as:  FIELD-SYMBOLS: <outtab> type standard table
    Now I need to export this <outtab> out of my method. Because it is a unspecific field symbol table, I can not do this, by normal exporting.
    In the PAI, where my method is called, I have deffined the table to return into as:
    FIELD-SYMBOLS: <itab_message> type standard table.
    Any help will be greatly appreciated.
    Kind regards
    Mikkel

    Hi,
    Please check this:
    REPORT zmaschl_create_data_dynamic .
    TYPE-POOLS: slis.
    DATA: it_fcat TYPE slis_t_fieldcat_alv,
    is_fcat LIKE LINE OF it_fcat.
    DATA: it_fieldcat TYPE lvc_t_fcat,
    is_fieldcat LIKE LINE OF it_fieldcat.
    DATA: new_table TYPE REF TO data.
    DATA: new_line TYPE REF TO data.
    FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
    <l_line> TYPE ANY,
    <l_field> TYPE ANY.
    Build fieldcat
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_structure_name = 'SYST'
    CHANGING
    ct_fieldcat = it_fcat[].
    LOOP AT it_fcat INTO is_fcat WHERE NOT reptext_ddic IS initial.
    MOVE-CORRESPONDING is_fcat TO is_fieldcat.
    is_fieldcat-fieldname = is_fcat-fieldname.
    is_fieldcat-ref_field = is_fcat-fieldname.
    is_fieldcat-ref_table = is_fcat-ref_tabname.
    APPEND is_fieldcat TO it_fieldcat.
    ENDLOOP.
    Create a new Table
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = it_fieldcat
    IMPORTING
    ep_table = new_table.
    Create a new Line with the same structure of the table.
    ASSIGN new_table->* TO <l_table>.
    CREATE DATA new_line LIKE LINE OF <l_table>.
    ASSIGN new_line->* TO <l_line>.
    Test it...
    DO 30 TIMES.
    ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
    <l_field> = sy-index.
    INSERT <l_line> INTO TABLE <l_table>.
    ENDDO.
    LOOP AT <l_table> ASSIGNING <l_line>.
    ASSIGN COMPONENT 'SUBRC' OF STRUCTURE <l_line> TO <l_field>.
    WRITE <l_field>.
    ENDLOOP.
    Regards,
    Shiva Kumar

  • Copy  Field-symbols table

    My query is :
    I have a class, whenever i create an object the constructor is called which uses an data_tab variable of type TABLE.
    I'm making use of this class in my report which populates all the data into an internal table dynamically adding some other new fields.
    But I have created an class instance in the INITIALIZATION section itself.
    I wanted to pass the final internal table which is created dynamically to the CONSTRUCTOR.
    But when I pass the field-symbol table declared globally the program is getting dump and the message what I got is 'Field symbols is not assigned'.
    Please tell me how to proceed.
    Thanks & Regards
    Santhosh

    First you need to create another table with the structure that you have.
    call method cl_alv_table_create=>create_dynamic_table
         exporting
           it_fieldcatalog = LT_FIELDCATALOG
         importing
           ep_table = <FS_DATA2>
         exceptions
           generate_subpool_dir_full = 1
           others = 2
    field-symbols  : <fs_line1>, <fs_line2>, <fs_tmp1>, <fs_tmp2>.
    assign <FS_DATA2->* to <FS_2>.
    Now FS_1 and FS_2 are the tables.
    Also create work areas for the tables.
    CREATE DATA gw_line1 LIKE LINE OF <fs_1>
    CREATE DATA gw_line2 LIKE LINE OF <fs_2>.
    ASSIGN gw_line1->* TO <fs_line1>.
    assign gw_line2->* to <fs_line2>.
    With field symbols, you cannot move the rows directly, you will have to move it field by field.
    Once all the values are populated in the first table, copy it with the following logic.
    loop at <fs_1> into <fs_line1>
    Loop at   LT_FIELDCATALOG into LS_FIELDCATALOG.
    ASSIGN COMPONENT ls_fieldcatalog-fieldname OF STRUCTURE <fs_line1> TO <fs_tmp1>.
    ASSIGN COMPONENT ls_fieldcatalog-fieldname OF STRUCTURE <fs_line2> TO <fs_tmp2>.
    <fs_tmp2> = <fs_tmp1>
    endloop.
    append <fs_line2> to <fs_2>
    endloop.

  • Creating dynamic internal table(Not field symbol table)

    Hi Experts,
    I am facing problem creating Intarnal table
    I have fieldcatalog, I want create dynamic internal table(Not field symbol table).
    I have written----
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
       i_style_table             =
         it_fieldcatalog           = it_fldcat
          it_fieldcatalog           = me->gt_fieldcat
       i_length_in_byte          =
        IMPORTING
          ep_table                  = lt_new_table
       e_style_fname             =
        EXCEPTIONS
         generate_subpool_dir_full = 1
         OTHERS                    = 2.
        ASSIGN lt_new_table->* TO <gt_dyn_repdata>.
        CREATE DATA ls_new_line LIKE LINE OF <gt_dyn_repdata>.
        ASSIGN ls_new_line->* TO <gs_dyn_repdata>.
    above logic creating dynamic field symbol table.... But I want create normal internal table.
    Thanks,
    Rajasekhar

    Hi
    What do you mean?
    It needs to use the field-symbol, this is the price to pay if it wants a dynamic object
    Max

  • Problem in color a cell for field symbol table.

    Hi guru's
    when i'm trying to color a cell based on condition, getting the following error.
    ERROR:   the data object  <line> has no structure and therefore no component called  "cell_colour" .
    providing my code here:
    DATA: wa_cellcolor TYPE lvc_s_scol,
             lv_index     TYPE sy-tabix.
       break satishkumarc.
       LOOP AT <table> ASSIGNING <line>.
         lv_index = sy-tabix.
         ASSIGN COMPONENT 'COMPLIANCE' OF STRUCTURE <line> TO <field>.
         IF <field> EQ 'YES'.
           wa_cellcolor-fname     = 'COMPLIANCE'.
           wa_cellcolor-color-col = col_positive.
           wa_cellcolor-color-int = 0.
           wa_cellcolor-color-inv = 0.
         ELSE.
           wa_cellcolor-fname     = 'COMPLIANCE'.
           wa_cellcolor-color-col = col_negative.
           wa_cellcolor-color-int = 0.
           wa_cellcolor-color-inv = 0.
         ENDIF.
         APPEND wa_cellcolor TO <line>-cell_colour.                                                     "   error line
         MODIFY <table> FROM <line>  INDEX lv_index TRANSPORTING cell_colour.      "  error line
         CLEAR: wa_cellcolor.
       ENDLOOP.
    actually i know  that  <line>-cell_colour  won't work. but i don't know how to achive this functionality .
    could anybody please help me out in this.
    Thanks in Advance.
    regards
    satish
    thank

    hi ashish,
    i'm using
    field-symbols: <line> type any.
    CREATE DATA  mydata  LIKE LINE OF <table>.
           ASSIGN mydata->* TO <line>.
    to make the structure. so i guess i cannot give the structure name while declaring <line>.
    Thanks & regards
    satish

  • Loop at  field-symbol  (any table) into string ?

    Hi Everyone,
    I need little help, I have a requirement to extract table content with columns names as the header.
    After doing some search I figured out the best way to this since table name will be only avaialbe at runtime through
    a selection field . my problem is to loop through field-symbol and convert a structure to string value so that I can
    write to the file.
    REPORT  zlab_tbl_export.
    DATA table_name(30) VALUE 'ZSMARTTS_HTML'.
    DATA v_file(100) VALUE 'c:\sap_export.txt'.
    DATA line(1000).
    DATA: o_data TYPE REF TO data.
    CREATE DATA o_data TYPE TABLE OF (table_name).
    FIELD-SYMBOLS: <table> TYPE ANY TABLE.
    ASSIGN o_data->* TO <table>.
    SELECT * UP TO 100 ROWS FROM (table_name) INTO TABLE <table>.
    OPEN DATASET v_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    >>>>>>> LOOP at <table> into line.   >>>>>>>>>>>>  " Here the code breaks and fail
      TRANSFER line to v_file. 
      WRITE :/ line.          
    ENDLOOP.
    CLOSE DATASET v_file.
    Exception Message
    |Error analysis                                                                                |
    |    You attempted to move one data object to another.                                             |
    |    This is not possible here because the conversion of a data object                             |
    |    of type "v" to type "C" is not supported.                                                     |
    |                                                                                |
    |      List of internal ABAP types:                                                                |
    |                                                                                |
    |      C    Text (Character)                                                                       |
    |      N    Numerical text                                                                         |
    |      D    Date (YYYYMMDD)                                                                        |
    |      T    Time (HHMMSS)                                                                          |
    |      X    Hexadecimal                                                                            |
    |      I    Integer                                                                                |
    |      P    Packed number                                                                          |
    |      F    Floating point number                                                                  |
    |                                                                                |
    |      h    Internal table                                                                         |
    |      r    Object reference                                                                       |
    |      l    Data reference                                                                         |
    |      g    String of type C                                                                       |
    |      y    String of type X                                                                       |
    |      s    2-byte integer with plus/minus sign                                                    |
    |      b    1-byte integer without plus/minus sign                                                 |
    |      u    Structure (flat structure)                                                             |
    |      v    Structure (deep structure)                                                             |

    Hi Everyone, I need little help, I have a requirement to extract table content with columns names as the header. After doing some search I figured out the best way to this since table name will be only avaialbe at runtime through a selection field . my problem is to loop through field-symbol and convert a structure to string value so that I can write to the file.
    thie is the code
    REPORT  zlab_tbl_export.
    DATA table_name(30) VALUE 'ZSMARTTS_HTML'.
    DATA v_file(100) VALUE 'c:\sap_export.txt'.
    DATA line(1000).
    DATA: o_data TYPE REF TO data.
    CREATE DATA o_data TYPE TABLE OF (table_name).
    FIELD-SYMBOLS: <table> TYPE ANY TABLE.
    ASSIGN o_data->* TO <table>.
    SELECT * UP TO 100 ROWS FROM (table_name) INTO TABLE <table>.
    OPEN DATASET v_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
    LOOP at <table> into line.   " Fail here
      TRANSFER line to v_file. 
      WRITE :/ line.           
    ENDLOOP.
    CLOSE DATASET v_file.
    and this is the exception:
    Error analysis                                                                               
    You attempted to move one data object to another.                                            
        This is not possible here because the conversion of a data object                            
        of type v to type C is not supported.                                                    
    Edited by: Misbah on Jan 7, 2010 11:50 PM

  • FIELD SYMBOL and INTERNAL TABLE

    Hi friends !
    How can i move internal table data to field symbol with a similar structure or diferent strucuture with more some fields  ?
    Thanks.

    Hi Fabrício
    Here is an example containing usage of field symbol as alias of an internal table.
    DATA lv_itab_name(30) TYPE c .
    FIELD-SYMBOLS: <table> TYPE table ,
                   <line> TYPE ANY ,
                   <fvalue> TYPE ANY.
    lv_itab_name = 'GT_ITAB[]' .
    ASSIGN (lv_itab_name) TO <table> .
    IF sy-subrc = 0 .
      LOOP AT <table> ASSIGNING <line> .
        DO .
          ASSIGN COMPONENT sy-index OF STRUCTURE <line> TO <fvalue> .
          IF sy-subrc NE 0 .
            EXIT .
          ENDIF .
          target_field = <fvalue> .
        ENDDO .
      ENDLOOP .
    ENDIF .
    If you know names of the fields, for each field you want to transfer, you can use
    ASSIGN COMPONENT '<field_name>' OF STRUCTURE <line> TO <fvalue> .
    Hope this helps...
    *--Serdar [[ BC ] | https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk sag jiw=]

  • Field-symbol definition for a variable representing transparent tables

    Hi Gurus
    I'm trying to create a very simple report to display table descriptions and their DB number of records:
    Ex:
    MARA 50000
    MARD 123000
    I can't compile this piece of code:
    field-symbols: <table>.
    assign (DD02T-TABNAME) to <table>.
        clear n.
        *SELECT COUNT( * )*
           INTO n
           FROM <table>.
    The problem here is that <table> is not defined in the ABAP dictionary as a a table , projection view or databse view.
    1. Is there a way of defining <table> with a field-symbol data statement to make it work?
    2. Alternatively, how can you produce a list of all table DB entry counts for a dynamic list of transparent tables?
    Thanks
    Nuno

    With the code you have field symbol will "point" to a table contained in DD02T-TABNAME , not its name.
    What you need is to get the table name , not table itself
    field-symbols: <table_name>.
    assign DD02T-TABNAME to <table>.  "get table name, not its content
    clear n.
    SELECT COUNT( * )
    INTO n
    FROM (<table>).
    or simply without field symbol
    SELECT COUNT( * )
    INTO n
    FROM (DD02T-TABNAME).
    Regards
    Marcin

  • Assigning Table/Structure Types using Field-Symbols

    Hello Gurus,
    How can we assign a table or structure type to a particulart internal table?
    What I want to do is to make my data declaration for i_tab reusable.
    i.e.
    DATA: v_tab  TYPE string.
    v_tab = 'MARA'.
    DATA  : i_tab  TYPE STANDARD TABLE OF v_tab.
    The purpose is to make the declaration flexible so program can change v_tab to any table names like LIPS, KNA1...etc making the i_tab flexible and reusable enough. Can anyone help me please? I try to use field-symbols, but I can not achieve what I want. Any bright ideas please?

      DATA: dref TYPE REF TO data.
      FIELD-SYMBOLS: <table> TYPE STANDARD TABLE,
                     <line>  TYPE ANY.
      PARAMETERS: pa_tab TYPE tabname DEFAULT 'BUT000'.
      CREATE DATA dref TYPE STANDARD TABLE OF (pa_tab).
      ASSIGN dref->* TO <table>.
      SELECT * FROM (pa_tab) INTO TABLE <table>
               UP TO 10 ROWS.
    LOOP AT <table> ASSIGNING <line>.
    ENDLOOP.
    <LINE> will take the structure of the table line at runtime.
    This is quite flexible.
    But you can also declare it like this, as we did with the <table>:
    DATA: dref1 TYPE REF TO data.
    CREATE DATA dref1 TYPE (pa_tab).
    ASSIGN dref1->* TO <line>.
    This way <line> will already have the correct structure, even before the <ASSIGNING>.
    Edited by: Micky Oestreich on Mar 24, 2009 8:21 AM

  • Field symbols in Object Oriented ALV

    Hi Friends....Can somebody explain me what is the significance of field symbols in OO ALV. Why it is assigned to Field catalog. Also explain me the basic steps to do Object Oriented ALV. Thanks in advance...

    Hi Satyesh,
    Field symbols are symbolic names to which a memory area can be assigned during program runtime. A field symbol can be used instead of data objects at operand positions of statements.
    Please go through this following code.  This uses field symbols for OO ALV.
      LCL_TABLE_DISPLAY DEFINITION
    CLASS lcl_table_display DEFINITION.
      PUBLIC SECTION.
        TYPE-POOLS: abap, slis.
        CLASS-METHODS: display_list IMPORTING in_data TYPE STANDARD TABLE,
                       display_grid IMPORTING in_data TYPE STANDARD TABLE.
        METHODS: constructor IMPORTING in_data TYPE STANDARD TABLE
                             EXCEPTIONS casting_error
                                        empty_fieldcat.
        METHODS: output_list,
                 output_grid.
        METHODS: set_table_name   IMPORTING in_tabname  TYPE any,
                 set_alv_title    IMPORTING in_title    TYPE any,
                 set_alv_settings IMPORTING in_settings TYPE any,
                 set_alv_layout   IMPORTING in_layout   TYPE any,
                 set_alv_event    IMPORTING in_name     TYPE any
                                            in_form     TYPE any.
      PRIVATE SECTION.
        CLASS-DATA: g_table_object TYPE REF TO lcl_table_display.
        TYPES: BEGIN OF ty_defin,
                 fieldname     TYPE fieldname,
                 ref_tabname   TYPE tabname,
                 ref_fieldname TYPE fieldname,
               END OF ty_defin.
        DATA: g_repid  TYPE repid,
              g_struc  TYPE tabname,
              g_table  TYPE tabname.
        DATA: gt_data  TYPE REF TO data.
        DATA: g_title  TYPE lvc_title,
              gt_fcat  TYPE slis_t_fieldcat_alv,
              gs_sett  TYPE lvc_s_glay,
              gs_layo  TYPE slis_layout_alv,
              gt_evnt  TYPE slis_t_event.
        DATA: gt_defin TYPE TABLE OF ty_defin,
              g_level  TYPE tabname.
        METHODS: output_table IMPORTING data TYPE REF TO data
                                        mode TYPE c,
                 fill_fieldcat IMPORTING repid TYPE repid
                                         struc TYPE tabname
                                CHANGING fcat  TYPE slis_t_fieldcat_alv
                              EXCEPTIONS no_definition,
                 get_definition IMPORTING repid TYPE repid
                                          struc TYPE tabname
                                 CHANGING abap  TYPE rsfb_source,
                 recursive_definition IMPORTING repid TYPE repid
                                       CHANGING abap  TYPE rsfb_source,
                 map_structure IMPORTING source TYPE any
                                CHANGING destin TYPE any.
    ENDCLASS.
      LCL_TABLE_DISPLAY IMPLEMENTATION
    CLASS lcl_table_display IMPLEMENTATION.
      Display table in ALV list
      METHOD display_list.
        IF NOT g_table_object IS INITIAL.
          FREE: g_table_object.
        ENDIF.
        CREATE OBJECT g_table_object EXPORTING in_data = in_data.
        CALL METHOD g_table_object->output_list.
      ENDMETHOD.
      Display table in ALV grid
      METHOD display_grid.
        IF NOT g_table_object IS INITIAL.
          FREE: g_table_object.
        ENDIF.
        CREATE OBJECT g_table_object EXPORTING in_data = in_data.
        CALL METHOD g_table_object->output_grid.
      ENDMETHOD.
      Create table display
      METHOD constructor.
        DATA: ls_data TYPE REF TO data.
        DATA: ob_desc TYPE REF TO cl_abap_structdescr.
        DATA: l_absol TYPE char200,
              l_repid TYPE repid,
              l_struc TYPE tabname.
        FIELD-SYMBOLS: <table> TYPE STANDARD TABLE,
                       <struc> TYPE ANY.
      Get data and store it into attribute
        CREATE DATA me->gt_data LIKE in_data.
        ASSIGN me->gt_data->* TO <table>.
        <table> = in_data.
      Get global data definition
        CREATE DATA ls_data LIKE LINE OF <table>.
        ASSIGN ls_data->* TO <struc>.
        CATCH SYSTEM-EXCEPTIONS assign_casting_illegal_cast = 1.
          ob_desc ?= cl_abap_typedescr=>describe_by_data( <struc> ).
        ENDCATCH.
        IF sy-subrc = 1.
          RAISE casting_error.
        ENDIF.
      Get program name and main type used to define table
        l_absol = ob_desc->absolute_name.
        SPLIT l_absol AT '\TYPE=' INTO l_repid l_struc.
        SHIFT l_repid UP TO '='.
        SHIFT l_repid.
        CHECK l_struc NP '%_*'.
        IF me->g_repid NE l_repid
        OR me->g_struc NE l_struc.
        Set attributes
          me->g_repid = l_repid.
          me->g_struc = l_struc.
          me->g_table = l_struc.
          REPLACE 'TY' WITH 'WT' INTO me->g_table.
        Field catalog
          CALL METHOD fill_fieldcat EXPORTING repid = l_repid
                                              struc = l_struc
                                     CHANGING fcat  = me->gt_fcat.
          IF me->gt_fcat IS INITIAL.
            RAISE empty_fieldcat.
          ENDIF.
        ENDIF.
      ENDMETHOD.
      Output list
      METHOD output_list.
        CALL METHOD output_table EXPORTING data = me->gt_data
                                           mode = 'L'.
      ENDMETHOD.
      Output grid
      METHOD output_grid.
        CALL METHOD output_table EXPORTING data = me->gt_data
                                           mode = 'G'.
      ENDMETHOD.
      Output table
      METHOD output_table.
        DATA: ls_vari TYPE disvariant.
        FIELD-SYMBOLS: <table> TYPE STANDARD TABLE.
        ASSIGN me->gt_data->* TO <table>.
      Get default user variant
        ls_vari-report = me->g_repid.
        ls_vari-username = sy-uname.
        CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
             EXPORTING
                  i_save     = 'U'
             CHANGING
                  cs_variant = ls_vari
             EXCEPTIONS
                  OTHERS     = 0.
      Display table contents
        IF mode = 'G'.
          CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
               EXPORTING
                    i_callback_program = me->g_repid
                    i_grid_title       = me->g_title
                    i_grid_settings    = me->gs_sett
                    is_layout          = me->gs_layo
                    it_fieldcat        = me->gt_fcat
                    i_save             = 'U'
                    is_variant         = ls_vari
                    it_events          = me->gt_evnt
               TABLES
                    t_outtab           = <table>
               EXCEPTIONS
                    OTHERS             = 0.
        ELSE.
          CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
               EXPORTING
                    i_callback_program = me->g_repid
                    is_layout          = me->gs_layo
                    it_fieldcat        = me->gt_fcat
                    i_save             = 'U'
                    is_variant         = ls_vari
                    it_events          = me->gt_evnt
               TABLES
                    t_outtab           = <table>
               EXCEPTIONS
                    OTHERS             = 0.
        ENDIF.
      ENDMETHOD.
      Fill field catalog
      METHOD fill_fieldcat.
        DATA: lt_abap   TYPE TABLE OF rssource.
        DATA: ls_defin  TYPE ty_defin.
        DATA: lt_dfies  TYPE TABLE OF dfies,
              ls_dfies  TYPE dfies,
              ls_dd04v  TYPE dd04v,
              ls_dd01v  TYPE dd01v,
              l_flong   TYPE dfies-lfieldname,
              l_dname   TYPE dfies-domname.
        DATA: ls_fcat   TYPE slis_fieldcat_alv,
              ls_fcat2  TYPE slis_fieldcat_alv.
        DATA: l_index   TYPE i,
              l_nbfld   TYPE i.
        FREE: me->gt_defin.
      Process data definition
        CALL METHOD get_definition EXPORTING repid = repid
                                             struc = struc
                                    CHANGING abap  = lt_abap.
      Process sub levels if required
        CALL METHOD recursive_definition EXPORTING repid = repid
                                          CHANGING abap  = lt_abap.
        IF me->gt_defin IS INITIAL.
          RAISE no_definition.
        ENDIF.
        LOOP AT me->gt_defin INTO ls_defin.
          CLEAR: ls_fcat.
          MOVE-CORRESPONDING ls_defin TO ls_fcat.
        Retrieve info about this field
          FREE: ls_dfies, ls_dd04v, ls_dd01v, l_dname.
          l_flong = ls_fcat-ref_fieldname.
          SET LOCALE LANGUAGE 'E'.
          TRANSLATE: ls_fcat-ref_tabname   TO UPPER CASE,
                     ls_fcat-ref_fieldname TO UPPER CASE,
                     l_flong               TO UPPER CASE.
          IF NOT ls_fcat-ref_tabname IS INITIAL.
          Try to get info about field in table
            CALL FUNCTION 'DDIF_FIELDINFO_GET'
                 EXPORTING
                      tabname        = ls_fcat-ref_tabname
                      fieldname      = ls_fcat-ref_fieldname
                      lfieldname     = l_flong
                 IMPORTING
                      dfies_wa       = ls_dfies
                 EXCEPTIONS
                      not_found      = 1
                      internal_error = 2
                      OTHERS         = 3.
            IF sy-subrc = 0.
              MOVE-CORRESPONDING ls_dfies TO ls_fcat.
              ls_fcat-fieldname = ls_defin-fieldname.
              MOVE: ls_dfies-keyflag   TO ls_fcat-key,
                    ls_dfies-scrtext_m TO ls_fcat-seltext_l,
                    ls_dfies-domname   TO l_dname.
            ENDIF.
          ELSE.
          Try to get info about structure
            ls_defin-ref_tabname = ls_defin-ref_fieldname.
            CALL FUNCTION 'DDIF_FIELDINFO_GET'
                 EXPORTING
                      tabname   = ls_defin-ref_tabname
                 TABLES
                      dfies_tab = lt_dfies
                 EXCEPTIONS
                      OTHERS    = 0.
            IF NOT lt_dfies IS INITIAL.
            Process fields of this structure
              LOOP AT lt_dfies INTO ls_dfies.
                CLEAR: ls_fcat.
                MOVE-CORRESPONDING ls_dfies TO ls_fcat.
                CONCATENATE ls_defin-fieldname ls_fcat-fieldname
                       INTO ls_fcat-fieldname
                  SEPARATED BY '-'.
                MOVE ls_dfies-keyflag TO ls_fcat-key.
                MOVE ls_dfies-scrtext_m TO ls_fcat-seltext_l.
                ls_fcat-tabname = me->g_table.
                CLEAR: ls_fcat-col_pos,
                       ls_fcat-offset.
                IF ls_fcat-ref_tabname IS INITIAL.
                  ls_fcat-ddictxt = 'L'.
                ENDIF.
              Display Yes/No fields as checkboxes
                IF ls_dfies-domname = 'XFELD'.
                  ls_fcat-checkbox = 'X'.
                ENDIF.
              Add field to field catalog
                APPEND ls_fcat TO fcat.
              ENDLOOP.
            ELSE.
            Try to get info about data element
              CALL FUNCTION 'DDIF_DTEL_GET'
                   EXPORTING
                        name          = ls_fcat-ref_fieldname
                        langu         = sy-langu
                   IMPORTING
                        dd04v_wa      = ls_dd04v
                   EXCEPTIONS
                        illegal_input = 1
                        OTHERS        = 2.
              IF sy-subrc = 0.
                MOVE-CORRESPONDING ls_dd04v TO ls_fcat.
                MOVE: ls_dd04v-scrtext_m TO ls_fcat-seltext_l,
                      ls_dd04v-domname   TO l_dname.
              ELSE.
              Finally try to get info about domain
                CALL FUNCTION 'DDIF_DOMA_GET'
                     EXPORTING
                          name          = ls_fcat-ref_fieldname
                          langu         = sy-langu
                     IMPORTING
                          dd01v_wa      = ls_dd01v
                     EXCEPTIONS
                          illegal_input = 1
                          OTHERS        = 2.
                IF sy-subrc = 0.
                  MOVE-CORRESPONDING ls_dd01v TO ls_fcat.
                  MOVE: ls_dd01v-ddtext  TO ls_fcat-seltext_l,
                        ls_dd01v-domname TO l_dname.
                ENDIF.
              ENDIF.
            ENDIF.
          ENDIF.
        Table name must be internal table containing data
          ls_fcat-tabname = g_table.
        No offset
          CLEAR: ls_fcat-offset.
        Default text is stored in long text
          IF ls_fcat-ref_tabname IS INITIAL.
            ls_fcat-ddictxt = 'L'.
          ENDIF.
        Display Yes/No fields as checkboxes
          IF l_dname = 'XFELD'.
            ls_fcat-checkbox = 'X'.
          ENDIF.
        Add field to field catalog
          APPEND ls_fcat TO fcat.
        ENDLOOP.
      Link between fields
        DESCRIBE TABLE fcat LINES l_nbfld.
        LOOP AT fcat INTO ls_fcat.
          IF sy-tabix NE l_nbfld.
            l_index = sy-tabix + 1.
            READ TABLE fcat INTO ls_fcat2 INDEX l_index.
            IF sy-subrc = 0.
              IF ls_fcat-datatype = 'CURR'.
              Currency unit
                IF ls_fcat2-datatype = 'CUKY'.
                  ls_fcat-cfieldname = ls_fcat2-fieldname.
                  ls_fcat-ctabname   = ls_fcat2-tabname.
                  MODIFY fcat FROM ls_fcat.
                ELSE.
                  LOOP AT fcat INTO ls_fcat2
                               FROM l_index
                              WHERE datatype = 'CUKY'.
                  First currency unit after field
                    ls_fcat-cfieldname = ls_fcat2-fieldname.
                    ls_fcat-ctabname   = ls_fcat2-tabname.
                    MODIFY fcat FROM ls_fcat.
                    EXIT.
                  ENDLOOP.
                  IF sy-subrc NE 0.
                  No currency unit after field, try before
                    READ TABLE fcat INTO ls_fcat2
                                WITH KEY datatype = 'CUKY'.
                    IF sy-subrc = 0.
                      ls_fcat-cfieldname = ls_fcat2-fieldname.
                      ls_fcat-ctabname   = ls_fcat2-tabname.
                      MODIFY fcat FROM ls_fcat.
                    ENDIF.
                  ENDIF.
                ENDIF.
              ENDIF.
              IF ls_fcat-datatype = 'QUAN'.
              Quantity unit
                IF ls_fcat2-datatype = 'UNIT'.
                  ls_fcat-cfieldname = ls_fcat2-fieldname.
                  ls_fcat-ctabname   = ls_fcat2-tabname.
                  MODIFY fcat FROM ls_fcat.
                ENDIF.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDMETHOD.
      Get definition of type from code source
      METHOD get_definition.
        DATA: l_strng TYPE rssource,
              ls_abap TYPE rssource,
              l_fdpos TYPE i,
              l_first TYPE i,
              l_lastr TYPE i.
        DATA: lt_incl TYPE TABLE OF repid,
              ls_incl TYPE repid.
      Get program code
        READ REPORT repid INTO abap.
        CHECK sy-subrc EQ 0.
      Get first line of definition
        CONCATENATE 'BEGIN OF' struc INTO l_strng
                                SEPARATED BY space.
        LOOP AT abap INTO ls_abap.
          IF ls_abap CS l_strng.
            l_fdpos = strlen( l_strng ) + sy-fdpos.
            IF ls_abap+l_fdpos(1) CA ', "'.
              l_first = sy-tabix.
              EXIT.
            ENDIF.
          ENDIF.
        ENDLOOP.
        IF l_first IS INITIAL.
        Table is defined in an include
          CALL FUNCTION 'RS_GET_ALL_INCLUDES'
               EXPORTING
                    program    = repid
               TABLES
                    includetab = lt_incl
               EXCEPTIONS
                    OTHERS     = 1.
          IF sy-subrc = 0.
            LOOP AT lt_incl INTO ls_incl.
            Try to find definition in this include
              READ REPORT ls_incl INTO abap.
              LOOP AT abap INTO ls_abap.
                IF ls_abap CS l_strng.
                  l_fdpos = strlen( l_strng ) + sy-fdpos.
                  IF ls_abap+l_fdpos(1) CA ',. "'.
                    l_first = sy-tabix.
                    EXIT.
                  ENDIF.
                ENDIF.
              ENDLOOP.
              IF NOT l_first IS INITIAL.
                EXIT.
              ENDIF.
            ENDLOOP.
          ENDIF.
        ENDIF.
      Get last line of definition
        CONCATENATE 'END OF' struc INTO l_strng
                              SEPARATED BY space.
        LOOP AT abap INTO ls_abap.
          IF ls_abap CS l_strng.
            l_fdpos = strlen( l_strng ) + sy-fdpos.
            IF ls_abap+l_fdpos(1) CA ',. "'.
              l_lastr = sy-tabix - l_first.
              EXIT.
            ENDIF.
          ENDIF.
        ENDLOOP.
      Keep only relevant code lines
        IF l_first LE 0
        OR l_lastr LE 0.
          REFRESH abap.
        ELSE.
          DELETE abap TO l_first.
          DELETE abap FROM l_lastr.
        ENDIF.
      ENDMETHOD.
      Get definition of type recursively
      METHOD recursive_definition.
        DATA: lt_token TYPE TABLE OF stokex,
              ls_token TYPE stokex,
              lt_state TYPE TABLE OF sstmnt,
              ls_state TYPE sstmnt.
        DATA: ls_defin TYPE ty_defin,
              l_reffld TYPE fieldname.
        DATA: lt_recu  TYPE TABLE OF rssource.
      Retrieve tokens
        SCAN ABAP-SOURCE abap
                  TOKENS INTO lt_token
              STATEMENTS INTO lt_state.
        LOOP AT lt_state INTO ls_state.
          CLEAR: ls_defin.
        Field name
          READ TABLE lt_token INTO ls_token
                             INDEX ls_state-from.
          ls_defin-fieldname = ls_token-str.
        Reference type
          READ TABLE lt_token INTO ls_token
                             INDEX ls_state-to.
          l_reffld = ls_token-str.
        Check if this type is defined in program
          FREE: lt_recu.
          CALL METHOD get_definition EXPORTING repid = repid
                                               struc = l_reffld
                                      CHANGING abap  = lt_recu.
          IF lt_recu IS INITIAL.
            IF NOT g_level IS INITIAL.
             CONCATENATE g_level ls_defin-fieldname INTO ls_defin-fieldname
                                                           SEPARATED BY '-'.
              CONDENSE ls_defin-fieldname.
            ENDIF.
            IF l_reffld CS '-'.
              SPLIT l_reffld AT '-'
                           INTO ls_defin-ref_tabname
                                ls_defin-ref_fieldname.
              IF ls_defin-ref_tabname = 'SY'.
                ls_defin-ref_tabname = 'SYST'.
              ENDIF.
            ELSE.
              ls_defin-ref_fieldname = ls_token-str.
            ENDIF.
            APPEND ls_defin TO me->gt_defin.
          ELSE.
          Process sub levels
            IF me->g_level IS INITIAL.
              me->g_level = ls_defin-fieldname.
            ELSE.
              CONCATENATE me->g_level ls_defin-fieldname INTO me->g_level
                                                 SEPARATED BY '-'.
            ENDIF.
            CALL METHOD recursive_definition EXPORTING repid = repid
                                              CHANGING abap  = lt_recu.
            IF me->g_level CS '-'.
              SHIFT me->g_level RIGHT UP TO '-'.
              SHIFT me->g_level RIGHT.
              SHIFT me->g_level LEFT DELETING LEADING space.
            ELSE.
              CLEAR: me->g_level.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDMETHOD.
      Set table name
      METHOD set_table_name.
        me->g_table = in_tabname.
      ENDMETHOD.
      Set title
      METHOD set_alv_title.
        me->g_title = in_title.
      ENDMETHOD.
      Set settings
      METHOD set_alv_settings.
        CALL METHOD map_structure EXPORTING source = in_settings
                                   CHANGING destin = me->gs_sett.
      ENDMETHOD.
      Set layout
      METHOD set_alv_layout.
        CALL METHOD map_structure EXPORTING source = in_layout
                                   CHANGING destin = me->gs_layo.
      ENDMETHOD.
      Add event
      METHOD set_alv_event.
        DATA: ls_evnt TYPE slis_alv_event.
        ls_evnt-name = in_name.
        ls_evnt-form = in_form.
        COLLECT ls_evnt INTO gt_evnt.
      ENDMETHOD.
      Map fields from incoming structure into attribute
      METHOD map_structure.
        DATA: ob_desc  TYPE REF TO cl_abap_structdescr,
              ls_compo TYPE abap_compdescr.
        FIELD-SYMBOLS: <field> TYPE ANY,
                       <struc> TYPE ANY.
        ob_desc ?= cl_abap_typedescr=>describe_by_data( destin ).
        LOOP AT ob_desc->components INTO ls_compo.
          ASSIGN COMPONENT ls_compo-name OF STRUCTURE source TO <field>.
          IF <field> IS ASSIGNED.
            ASSIGN COMPONENT ls_compo-name OF STRUCTURE destin TO <struc>.
            CATCH SYSTEM-EXCEPTIONS conversion_errors = 1.
              MOVE <field> TO <struc>.
            ENDCATCH.
            UNASSIGN <field>.
          ENDIF.
        ENDLOOP.
      ENDMETHOD.
    ENDCLASS.
    PLZ REWARD POINTS

  • Append Field symbols

    Hi all,
    how can we move internal tables data to field symbol table.
    i am new to field symbol, can any one guide me in detail.. i have searched in forums but i am unable understand..
    i have defined fields symbols like this.
    FIELD-SYMBOLS: <F_TAB>   TYPE STANDARD TABLE,
                   <F_LINE>  TYPE ANY,
                   <F_FIELD> TYPE ANY.
    and i have data in ITAB1, ITAB2 & ITAB3.
    this tables data i need to move to final internal table i.e. <F_TAB>, whose structure is created dynamically..
    in this way i have created the dynamical internal table structure
    LOOP AT IT_WDAYS INTO WA_WDAYS.
          PERFORM MONTH_TEXT USING WA_WDAYS-PERIODAT CHANGING V_FNAME.
    *   Element Description
          LO_ELEMENT ?= CL_ABAP_ELEMDESCR=>DESCRIBE_BY_NAME( 'CHAR5' ).
          MOVE V_FNAME TO LA_COMP-NAME.
    *   Field type
          LA_COMP-TYPE = CL_ABAP_ELEMDESCR=>GET_P(
                            P_LENGTH   = LO_ELEMENT->LENGTH
                            P_DECIMALS = LO_ELEMENT->DECIMALS ).
    *   Filling the component table
          APPEND LA_COMP TO LT_TOT_COMP.
          CLEAR: LA_COMP.
        ENDLOOP.
    * 3. Create a New Type
        LO_NEW_TYPE = CL_ABAP_STRUCTDESCR=>CREATE( LT_TOT_COMP ).
    * 4. New Table type
        LO_NEW_TAB = CL_ABAP_TABLEDESCR=>CREATE(
                        P_LINE_TYPE  = LO_NEW_TYPE
                        P_TABLE_KIND = CL_ABAP_TABLEDESCR=>TABLEKIND_STD
                        P_UNIQUE     = ABAP_FALSE ).
    * 5. data to handle the new table type
        CREATE DATA LO_DATA TYPE HANDLE LO_NEW_TAB.
    * 6. New internal table in the fieldsymbols
        ASSIGN LO_DATA->* TO <F_TAB>.
    i dont want to create thru fieldcatalog method...
    just i want know how to pass 2 internal tables data into one final field symbol table..
    thanks
    Edited by: Matt on Mar 23, 2009 10:52 AM - added  tags

    Hi,
    Check this code:
    *& Report  Z_RTTS_TABLE
    REPORT  z_rtts_table.
    TYPE-POOLS: abap.
    DATA: gs_comp TYPE abap_componentdescr,
          gt_comp TYPE abap_component_tab.
    "example table
    DATA: BEGIN OF it OCCURS 3,   "<- your ITAB1
            pernr TYPE persno,
            kostl TYPE kostl,
            endda TYPE endda,
          END OF it.
    "data references
    DATA: r_type_struct TYPE REF TO cl_abap_structdescr,
          r_type_table  TYPE REF TO cl_abap_tabledescr,
          r_data_tab    TYPE REF TO data,
          r_data_str    TYPE REF TO data.
    * 1. ------------- filling example table IT  -> i.e your ITAB1
    it-pernr = '12345678'.
    it-kostl = '0112345678'.
    it-endda = sy-datum.
    APPEND it.
    it-pernr = '45678909'.
    it-kostl = '3452345678'.
    it-endda = sy-datum - 1.
    APPEND it.
    * 2. ------------ components structure type
    gs_comp-name = 'PERNR'.
    gs_comp-type ?= cl_abap_elemdescr=>describe_by_name( 'PERSNO' ).
    APPEND gs_comp TO gt_comp.
    gs_comp-name = 'KOSTL'.
    gs_comp-type ?= cl_abap_elemdescr=>describe_by_name( 'KOSTL' ).
    APPEND gs_comp TO gt_comp.
    gs_comp-name = 'BEGDA'.
    gs_comp-type ?= cl_abap_elemdescr=>describe_by_name( 'BEGDA' ).
    APPEND gs_comp TO gt_comp.
    * 3. ------------- create structure type
    TRY.
        r_type_struct = cl_abap_structdescr=>create(
                                  p_components = gt_comp ).
      CATCH cx_sy_struct_creation .
    ENDTRY.
    * 4. ------------- create table type
    TRY.
        r_type_table = cl_abap_tabledescr=>create( r_type_struct ).
      CATCH cx_sy_table_creation .
    ENDTRY.
    " 5. -------------- create table based on RTTS types
    CREATE DATA: r_data_tab TYPE HANDLE r_type_table,
                 r_data_str TYPE HANDLE r_type_struct.
    FIELD-SYMBOLS: <fs_table> TYPE INDEX TABLE,    "-> here table must by type INDEX TABLE in order to append to it
                               <fs_wa>    TYPE ANY.
    ASSIGN: r_data_tab->* TO <fs_table>,
            r_data_str->* TO <fs_wa>.         "work area for dynamic table (based on your dynamic structure)     
    " 6. ---------------- move internal table data (IT) to dynamic table
    LOOP AT it.
      MOVE-CORRESPONDING it TO <fs_wa>.
      APPEND <fs_wa> TO <fs_table>.
    ENDLOOP.
    Do the same with ITAB2 and ITAB3.
    Regards
    Marcin

  • Error in field symbol

    Hi all,
    i'm converting a field symbol table to internat table, where field symbol table structure is defined at runtime. for that i'm using
    call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = ifc1
                   importing
                      ep_table        = dy_table.
      assign dy_table->* to <dyn_table>.
      create data dy_line like line of <dyn_table>.
      assign dy_line->* to <dyn_wa>.
      LOOP AT <dyn_table> ASSIGNING <dyn_wa>.
      MOVE-CORRESPONDING <dyn_wa> TO dy_line.
      INSERT dy_line INTO TABLE dy_table.
      endloop.
    where
    data: dy_table type ref to data,
          dy_line  type ref to data,
    But in execution time it show a error that dy_table is not a internal table.
    pls give me ur suggestions.

    Hi Ravish,
    pls find yhe code, it;s throwing a error that dyn_table is not a internal table.
    TABLES : SFLIGHT.
    type-pools : abap.
    field-symbols: <dyn_table> type standard table ,
                   <dyn_wa>,
                   <dyn_field>.
    data: dy_table type ref to data,
          dy_line  type ref to data,
          xfc type lvc_s_fcat,
          ifc type lvc_t_fcat,
          IFC1 TYPE LVC_T_FCAT.
    selection-screen begin of block b1 with frame.
    parameters: p_table(30) type c default 'SFLIGHT'.
    *FIELD-SYMBOLS <F> TYPE table p_table.
    data : field(10) type c.
    SELECT-OPTIONS : P_FIELD  FOR field.
    selection-screen end of block b1.
    start-of-selection.
      perform get_structure.
      perform get_selected_field.
      perform create_dynamic_itab.
      perform get_data.
      perform write_out.
    form get_structure.
    data : idetails type abap_compdescr_tab,
           xdetails type abap_compdescr.
    data : ref_table_des type ref to cl_abap_structdescr.
      ref_table_des ?=
          cl_abap_typedescr=>describe_by_name( p_table ).
      idetails[] = ref_table_des->components[].
      loop at idetails into xdetails.
        clear xfc.
        xfc-fieldname = xdetails-name .
        xfc-datatype = xdetails-type_kind.
        xfc-inttype = xdetails-type_kind.
        xfc-intlen = xdetails-length.
        xfc-decimals = xdetails-decimals.
        append xfc to ifc.
      endloop.
    endform.
    form get_selected_field.
    data: wa like line of ifc.
    loop at ifc into wa.
    if wa-fieldname in p_field.
    append wa to ifc1.
    endif.
    sy-index = sy-index + 1.
    endloop.
    if ifc1 is initial .
    MESSAGE e000 WITH 'This field is not available in table'.
    endif.
    endform.
    form create_dynamic_itab.
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = ifc1
                   importing
                      ep_table        = dy_table.
      assign dy_table->* to <dyn_table>.
      create data dy_line like line of <dyn_table>.
      assign dy_line->* to <dyn_wa>.
    endform.
    form get_data.
    SELECT * INTO CORRESPONDING FIELDS OF TABLE <dyn_table>
    FROM (p_table) UP TO 20 ROWS.
    endform.
    form write_out.
    Write out data from table.
      loop at <dyn_table> into <dyn_wa>.
        do.
          assign component  sy-index
             of structure <dyn_wa> to <dyn_field>.
          if sy-subrc <> 0.
            exit.
          endif.
          if sy-index = 1.
            write:/ <dyn_field>.
          else.
            write: <dyn_field>.
          endif.
        enddo.
    code for convert field symbol internal table to internal table.
      LOOP AT <dyn_table> ASSIGNING <dyn_wa>.
      MOVE-CORRESPONDING <dyn_wa> TO dy_line.
      INSERT dy_line INTO TABLE dy_table.                    <----
      Error point
      endloop.
      endform.

  • Need Help On Field Symbol

    Hi Expert,
    I am working on the Standard routine.
    In which I have one standard field symbol table.Standard program some time assig it and some time doesn't.and i am getting DUMP.
    Is there any way to check beofre using  field Symbol whether it is assigned or not?
    Please help.
    Thanks

    after assign statement you can check for Sy-subrc = 0.
    or
    if not <fs>-comp is intial.
    endif.

  • How to assign values to a work area which is a Field Symbol?

    Hello Experts!
    I really need your help! this is the problem:
    I need to assign values to fields into a work area which is a field symbol. The values come from a flat file I uploaded and as I can't know the length I had to build the structure dynamically ( That's why I'm using FS). Each field comes from the file separated by ';', I tried using the SPLIT sentence:
    "SPLIT text AT ';' INTO TABLE <dyn_table>." but the values are assigned vertically into the same field instead of horizontally into each field of the table(field-symbol table).
    I know the name of the field dynamically
    (a TEXT + number) and I know I can't do this
    <dyn_wa>-TEXT1 or field_name = 'TEXT1' <dyn_wa>-(field_name).... ohhh I'm blocked, I don't seem to find the answer, please help!
    Thanks in advance!!
    Frinee

    Now that you have a table with the values, you can move them to the work area.
    data: begin of wa,
          fld1(20) type c,
          fld2(20) type c,
          fld3(20) type c,
    *     and so on
          end of wa.
    data: istr type table of string with header line.
    field-symbols: <fs>.
    split text at ';' into table istr.
    loop at istr.
    assign component sy-tabix of structure wa to <fs>.
    if sy-subrc <> 0.
    exit.
    endif.
    <fs> = istr.
    endloop.
    write:/ wa-fld1, wa-fld2, wa-fld3.
    Now, WA has the values in a horizontal fashion.
    Regards,
    Rich Heilman

  • Field symbols and READ TABLE with system code 4

    Hi,
    I have a hashed table and I am using field symbols to point to it to retrieve the field content. I then use it in the READ TABLE statement in the following way:
    Loop at x_data assign <fs>.
    ASSIGN COMPONENT 'xxx' OF STRUCTURE <fs> TO <c1>.
    ASSIGN COMPONENT 'xxx' OF STRUCTURE <fs> TO <c2>.
    READ TABLE ZZZZ assign <fs> with table key a1 = <c1>
                                               a2 = <c2>.
    If sy-subrc = 0.
    endif.
    I ran the debugger and I keep getting a 4. I am not able to get the value from a1 and a2 to see what it is and why it is causing a 4 sy-subrc. I know the value from the hashed table and the values c1 and c2 are the same, so the sy-subrc should be 0.
    How would I read a hashed table using field symbols? I know that usig a standard table, I have to sort the table on the key fields() before I actually can do the READ TABLE using the binary search.
    Please advise. Thanks
    RT

    Hai Rob
    Go  through the following Code
    Field-Symbols are place holders for existing fields.
    A Field-Symbol does not physically reserve space for a field but points to a field, which is not known until run time of the program.
    Field-Symbols are like Pointers in Programming language ‘ C ‘.
    Syntax check is not effective.
    Syntax :
    Data : v1(4) value ‘abcd’.
    Field-symbols <fs>.
    Assign v1 to <fs>.
    Write:/ <fs>.
    DATA: BEGIN OF LINE,
    COL1 TYPE I,
    COL2 TYPE I,
    END OF LINE.
    DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY COL1.
    FIELD-SYMBOLS <FS> LIKE LINE OF ITAB.
    DO 4 TIMES.
    LINE-COL1 = SY-INDEX.
    LINE-COL2 = SY-INDEX ** 2.
    APPEND LINE TO ITAB.
    ENDDO.
    READ TABLE ITAB WITH TABLE KEY COL1 = 2 ASSIGNING <FS>.
    <FS>-COL2 = 100.
    READ TABLE ITAB WITH TABLE KEY COL1 = 3 ASSIGNING <FS>.
    DELETE ITAB INDEX 3.
    IF <FS> IS ASSIGNED.
    WRITE '<FS> is assigned!'.
    ENDIF.
    LOOP AT ITAB ASSIGNING <FS>.
    WRITE: / <FS>-COL1, <FS>-COL2.
    ENDLOOP.
    The output is:
    1 1
    2 100
    4 16
    Thanks & regards
    Sreenivasulu P

Maybe you are looking for

  • Macbook Air 11" i7 corrupt files problem with Adobe Illustrator CS4

    Hi this problem may not be entirely related but maybe someone could help anyways or knows how I can proceed... I'm running Illustrator CS4 on a Macbook Air 11" (latest 2011 model, with i7, 4GB, 128SSD), and lately some files are getting corrupted. sp

  • Tag cloud with autosuggest feature in ADF

    We want to select multiple records or words from a huge list so we tried autosuggestor which selects one record but if we want to add multiple words or records and show it like tag cloud as we add multiple email address in gmail then how can we achie

  • Output Type problem

    Hi Experts,     We have a problem with Invoice Printing. We have made changes to driver program and developed a smartform for printing the Invoice. We have assigned it in the T.Code NACE under V3 Billing. But at the time printing from the Document...

  • Sorting issue in Classic table

    Hi, In my page we have two tables, Header and Detail. On selection of any record on the HeaderTable, corresponding records are fetche of the details table. Sorting is working fine on the details table. We want to implement sorting on the header table

  • Dimensions with buffer_pool = keep

    Hi, We have a data warehouse built with WareHouse Builder more than 5 years ago. At that time, on a 8i database, it was suggested that we put our dimensions with buffer_pool = keep to get a faster response in Discoverer. We have a fact table partitio