Passing content of field symbol to internal table

Hi experts,
I need to pass the content of a field symbol to a internal table. Below is the following structure of the field symbol and internal table. But I'm encountering a short dump:
TYPES: BEGIN OF fint_frange,
        fieldname    LIKE rsdstabs-prim_fname,
        fieldtype(1) TYPE c,
        selopt_t     TYPE fint_selopt_t,
       END OF fint_frange.
TYPES: fint_frange_t TYPE fint_frange OCCURS 10.
CONSTANTS: lc_save_selections(31) TYPE c VALUE '(RFINTITAR)GT_SAVE_SELECTIONS[]',
FIELD-SYMBOLS: <fs_save_selections> TYPE STANDARD TABLE.
ASSIGN (lc_save_selections) TO <fs_save_selections>.
i_save_selections[] = <fs_save_selections>.
Short dump: You attempted to move one data object to another.
This is not possible here because the internal tables concerned
are neither compatible nor convertible.
Thanks in advance.

Hi,
what is ur internal table structure?
if structure of both field symbol and internal table is not same,
u can not put equal betwwen them.
ur  <fs_save_selections> is having one constanat value lc_save_selections.
and ur assaigning that to an internal table with some structure ......
so structure is not same for both..........check it once.
Regards,
kk.

Similar Messages

  • Re: field symbols and interna table

    hi,
    here is field symbol which is table type
    FIELD-SYMBOLS: <gt_pos_data> TYPE table.
    there is one internal table it_data.
    how can  move <gt_pos_data> to it_data.
    please help me.
    rgds

    Hi
    You can assign field wise:
    like
    <gt_pos_data>- field to  to it_data-field.
    Field Symbols
    Field symbols are placeholders or symbolic names for other fields. They do not physically reserve space for a field, but point to its contents. A field symbol cam point to any data object. The data object to which a field symbol points is assigned to it after it has been declared in the program.
    Whenever you address a field symbol in a program, you are addressing the field that is assigned to the field symbol. After successful assignment, there is no difference in ABAP whether you reference the field symbol or the field itself. You must assign a field to each field symbol before you can address the latter in programs.
    Field symbols are similar to dereferenced pointers in C (that is, pointers to which the content operator * is applied). However, the only real equivalent of pointers in ABAP, that is, variables that contain a memory address (reference) and that can be used without the contents operator, are reference variables in ABAP Objects.
    All operations programmed with field symbols are applied to the field assigned to it. For example, a MOVE statement between two field symbols moves the contents of the field assigned to the first field symbol to the field assigned to the second field symbol. The field symbols themselves point to the same fields after the MOVE statement as they did before.
    You can create field symbols either without or with type specifications. If you do not specify a type, the field symbol inherits all of the technical attributes of the field assigned to it. If you do specify a type, the system checks the compatibility of the field symbol and the field you are assigning to it during the ASSIGN statement.
    Field symbols provide greater flexibility when you address data objects:
    If you want to process sections of fields, you can specify the offset and length of the field dynamically.
    You can assign one field symbol to another, which allows you to address parts of fields.
    Assignments to field symbols may extend beyond field boundaries. This allows you to address regular sequences of fields in memory efficiently.
    You can also force a field symbol to take different technical attributes from those of the field assigned to it.
    The flexibility of field symbols provides elegant solutions to certain problems. On the other hand, it does mean that errors can easily occur. Since fields are not assigned to field symbols until runtime, the effectiveness of syntax and security checks is very limited for operations involving field symbols. This can lead to runtime errors or incorrect data assignments.
    While runtime errors indicate an obvious problem, incorrect data assignments are dangerous because they can be very difficult to detect. For this reason, you should only use field symbols if you cannot achieve the same result using other ABAP statements.
    For example, you may want to process part of a string where the offset and length depend on the contents of the field. You could use field symbols in this case. However, since the MOVE statement also supports variable offset and length specifications, you should use it instead. The MOVE statement (with your own auxiliary variables if required) is much safer than using field symbols, since it cannot address memory beyond the boundary of a field. However, field symbols may improve performance in some cases.
    check the below links u will get the answers for your questions
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/field_sy.htm
    http://searchsap.techtarget.com/tip/1,289483,sid21_gci920484,00.html
    Syntax Diagram
    FIELD-SYMBOLS
    Basic form
    FIELD-SYMBOLS <fs>.
    Extras:
    1. ... TYPE type
    2. ... TYPE REF TO cif
    3. ... TYPE REF TO DATA
    4. ... TYPE LINE OF type
    5. ... LIKE s
    6. ... LIKE LINE OF s
    7. ... TYPE tabkind
    8. ... STRUCTURE s DEFAULT wa
    The syntax check performed in an ABAP Objects context is stricter than in other ABAP areas. See Cannot Use Untyped Field Symbols ad Cannot Use Field Symbols as Components of Classes.
    Effect
    This statement declares a symbolic field called <fs>. At runtime, you can assign a concrete field to the field symbol using ASSIGN. All operations performed with the field symbol then directly affect the field assigned to it.
    You can only use one of the additions.
    Example
    Output aircraft type from the table SFLIGHT using a field symbol:
    FIELD-SYMBOLS <PT> TYPE ANY.
    DATA SFLIGHT_WA TYPE SFLIGHT.
    ASSIGN SFLIGHT_WA-PLANETYPE TO <PT>.
    WRITE <PT>.
    Addition 1
    ... TYPE type
    Addition 2
    ... TYPE REF TO cif
    Addition 3
    ... TYPE REF TO DATA
    Addition 4
    ... TYPE LINE OF type
    Addition 5
    ... LIKE s
    Addition 6
    ... LIKE LINE OF s
    Addition 7
    ... TYPE tabkind
    Effect
    You can define the type of the field symbol using additions 2 to 7 (just as you can for FORM parameters (compare Defining the Type of Subroutine Parameters). When you use the ASSIGN statement, the system carries out the same type checks as for USING parameters of FORMs.
    This addition is not allowed in an ABAP Objects context. See Cannot Use Obsolete Casting for FIELD SYMBOLS.
    In some cases, the syntax rules that apply to Unicode programs are different than those for non-Unicode programs. See Defining Types Using STRUCTURE.
    Effect
    Assigns any (internal) field string or structure to the field symbol from the ABAP Dictionary (s). All fields of the structure can be addressed by name: <fs>-fieldname. The structured field symbol points initially to the work area wa specified after DEFAULT.
    The work area wa must be at least as long as the structure s. If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment problems may occur.
    Example
    Address components of the flight bookings table SBOOK using a field symbol:
    DATA SBOOK_WA LIKE SBOOK.
    FIELD-SYMBOLS <SB> STRUCTURE SBOOK
    DEFAULT SBOOK_WA.
    WRITE: <SB>-BOOKID, <SB>-FLDATE.
    Related
    ASSIGN, DATA
    Additional help
    Declaring Field Symbols
    Reward points if useful
    Regards
    Anji

  • Field-symbols and internal table

    Hello,
    How do I declare a field-symbol as an intenal table?
    I have a internal table declared, but i need to declare a field symbols as my internal table´s type. How do I do it?
    What I wrote was this:
    DATA: BEGIN OF IT_INTE OCCURS 0,
               FIELD(3) TYPE C,
           END OF IT_INTE.
    FIELD-SYMBOLS:  isn´t defined as an internal table, how do I fix it.
    Thanks!!!
    Gabriel.

    It is very much possible to have a field symbol point to a internal table.  Here is some sample code.
    report  zrich_0001.
    data: begin of itab1 occurs 0,
          fld1(10) type c,
          fld3(10) type c,
          fld5(10) type c,
          end of itab1.
    data: wa1 like line of itab1.
    field-symbols: <fs_table> type table.
    field-symbols: <fs_wa>.
    field-SYMBOLS: <fs_field>.
    * Setup the data
    itab1-fld1 = '0000000001'.
    itab1-fld3 = '0000000002'.
    itab1-fld5 = '0000000003'.
    append itab1.
    itab1-fld1 = '0000000004'.
    itab1-fld3 = '0000000005'.
    itab1-fld5 = '0000000006'.
    append itab1.
    assign itab1[] to <fs_table>.
    assign wa1     to <fs_wa>.
    loop at <fs_table> into <fs_wa>.
    * Write out each field of the line
      do.
           assign COMPONENT sy-index of structure <fs_wa> to <fs_field>.
        if sy-subrc <> 0.
          exit.
          endif.
          write:/ <fs_field>.
      enddo.
      skip 2.
    endloop.
    Regards,
    Rich Heilman

  • Usage of field-symbol to internal table generically.

    Hi gurus,
    please tell the usage of field symbol to an internall table.
    how do i use field symbol generically , so that i can use same field symbol for many different internal tables.
    regards,
    krishna
    TABLES: EKKO.
    DATA: ITAB TYPE STANDARD TABLE OF EKKO INITIAL SIZE 1.
    SELECT-OPTIONS: P_EBELN FOR EKKO-EBELN OBLIGATORY.
    FIELD-SYMBOLS <FS> TYPE any.
    SELECT *
    FROM EKKO
    INTO TABLE ITAB
    WHERE EBELN IN P_EBELN.
    LOOP AT ITAB ASSIGNING <FS> casting ekko.
      WRITE:/ <FS>-EBELN, <FS>-BUKRS, <FS>-LIFNR, <FS>-AEDAT, <FS>-EKGRP, <FS>-STATU, <FS>-SPRAS.
    ENDLOOP.

    How about something SIMPLE like this.
    This creates a dynamic table and displays it in an editable grid.
    The key to a real Generic internal table is to use the RTTI  functionality to generate a field catalog of the structure you want to use as an internal table and then create a dynamic table based on the FCAT created from your structure.
    For the code shown below code a simple screen ( SE51) with a custom container on it  called CCONTAINER1.
    Code also a standard status (SE41) with just the BACK, EXIT and CANCEL buttons on it.
    You can use this type of program as a model for ANY dynamic table. Note however that you still can't include DEEP structure in your dynamic table.
    With the program shown below you can edit the grid but you'll have to add your own functionality such as cell selection, double click etc etc.
    All the code is showning you really is how to take any user defined structure and simply without a whole load of fuss, buld an FCAT, a DYNAMIC TABLE, Populate it and display a grid.
    DO NOT EVER USE AGAIN THE OLD SLIS MODULES SUCH AS FM REUSE_ALV_etc.   Go for OO either cl_gui_alv_grid or if you don't need to edit anything the new SALV class.
    If you are still on 4.6 then the SALV class won't exist but the cl_gui_alv_grid class is fine.
    You can see also just by changing a few lines of codeyou can   display a grid of almost any structure you can think of (or populate another dynamic table).
    Note also if you have an actual table defined you can also always code something like your_itab[] = <dyn_table>  so you can retrieve your data easily enough via standard abap.
    All you need to do is define your structure, create the fcat and populate the dynamic table.
    Even if you don't want a a GRID you've got your data in a dynamic table which is what I believe you wanted in the first place. You don't have to display or use a GRID if you don't need to but I've added the code here as lots of applications need to display data in just these types of lists.
    Now surprise your Boss by coding in 10 mins a program he / she thought would take you 1 week. !!!!!.
    program zzz_simple_editable_grid.
    * Define any structure
    types:  begin of s_elements,
      vbeln   type vapma-vbeln,
      posnr   type vapma-posnr,
      matnr   type vapma-matnr,
      kunnr   type vapma-kunnr,
      werks   type vapma-werks,
      vkorg   type vapma-vkorg,
      vkbur   type vapma-vkbur,
      status  type c,
    end of  s_elements.
    * end of your structure
    data lr_rtti_struc type ref to cl_abap_structdescr .
    data:
        zog                     like line of lr_rtti_struc->components .
    data:
      zogt                    like table of zog,
    wa_it_fldcat type lvc_s_fcat,
    it_fldcat type lvc_t_fcat ,
    dy_line            type ref to data,
    dy_table           type ref to data.
    data:  dref               type ref to data.
    field-symbols: <fs> type any,
       <dyn_table>    type  standard table,
       <dyn_wa>.
    data grid_container1 type ref to cl_gui_custom_container .
    data grid1 type ref to cl_gui_alv_grid .
    data: ok_code type sy-ucomm.
    data: struct_grid_lset type lvc_s_layo.
    *now I want to build a field catalog
    * First get your data structure into a field symbol
    create data dref type s_elements.
    assign dref->* to <fs>.
    lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( <fs> ).
    * Now get the structure details into a table.
    * table zogt[] contains the structure details
    * From which we can build the field catalog
    zogt[]  = lr_rtti_struc->components.
    loop at zogt into zog.
      clear wa_it_fldcat.
      wa_it_fldcat-fieldname = zog-name .
      wa_it_fldcat-datatype = zog-type_kind.
      wa_it_fldcat-inttype = zog-type_kind.
      wa_it_fldcat-intlen = zog-length.
      wa_it_fldcat-decimals = zog-decimals.
      wa_it_fldcat-coltext = zog-name.
      wa_it_fldcat-lowercase = 'X'.
      append wa_it_fldcat to it_fldcat .
    endloop.
    * You can perform any modifications / additions to your field catalog
    * here such as your own column names etc.
    * Now using the field catalog created above we can
    * build a dynamic table
    * and populate it
    * First build the dynamic table
    * the table will contain entries for
    * our structure defined at the start of the program
    call method cl_alv_table_create=>create_dynamic_table
           exporting
                it_fieldcatalog = it_fldcat
           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>.
    * Now fill our table with data
    select vbeln posnr matnr kunnr werks vkorg vkbur
           up to 200 rows
           from vapma
           into  corresponding fields of table <dyn_table>.
    * Call the screen to display the grid
    call screen 100.
    * PBO module
    module status_0100 output.
    data: off type int4.
    break-point 1.
    if sy-batch = 'X'.
    call method cl_gui_alv_grid=>offline
    receiving
    e_offline = off.
    endif.
    if sy-batch = 'X'.
    if ( off is initial ).
        create object grid_container1
                exporting
                   container_name = 'CCONTAINER1'.
        create object  grid1
           exporting
              i_parent = grid_container1.
    endif.
    endif.
    if sy-batch ne 'X'.
       if grid_container1 is initial.
         create object grid_container1
                 exporting
                    container_name = 'CCONTAINER1'.
      endif.
        create object  grid1
           exporting
              i_parent = grid_container1.
       if sy-batch ne 'X'.
        struct_grid_lset-edit = 'X'.    "To enable editing in ALV
      endif.
      endif.
        call method grid1->set_table_for_first_display
          exporting is_layout =  struct_grid_lset
          changing
                     it_outtab       = <dyn_table>
                     it_fieldcatalog = it_fldcat.
      set pf-status '001'.
      set titlebar '000'.
    endmodule.
    * PAI module
    module user_command_0100 input.
      case sy-ucomm.
        when 'BACK'.
          leave program.
        when 'EXIT'.
          leave program.
        when 'RETURN'.
          leave program.
        when others.
      endcase.
    endmodule.
    Cheers
    jimbo

  • 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 to internal table

    Hi all,
    I need to fill in a table without konwing in advance its structure. The solution is to use a field symbol and assign its content and <b>that works</b>.
    DATA : TAB_DATA TYPE REF TO DATA ...
    FIELD-SYMBOLS: <fs> TYPE ANY TABLE ...
    ASSIGN tab_data->* TO <fs> ...
    OK, I can read the content of my table directly from <fs> and display it in the layout of my BSP.
    <b>But Now</b> : I want to sort this table when a user click on the header column of my BSP.
    The problem it's that I don't know the structure of my table and the following code :
    SORT <fs> BY event->column_key DESCENDING.
    gives me the following error :
    The specified type has no structure and therefore no component called "EVENT".
    Any idea to solve this problem ?
    Regards.

    Allan,
    I am assuming that somehow you will be able to know the name of the column on which the user has clicked at runtime.
    See if you can use something like this, provided you can get the name of the column at runtime.
    data : column(10) type c value 'Column name'.
    sort t_data by (column) descending.
    regards,
    Ravi
    Note : Please mark the helpful answers.
    Message was edited by: Ravikumar Allampallam

  • Changing the order of fields in an internal table

    Hi all,
    I'm using field symbol as internal table. this table has got a standard database structure.
    I want to make the 3rd column of this internal table as 1st colums keeping rest of the columns as it is.
    Is there any way to do this?
    Thanks,
    Anil.

    Hi
        Instead of directly taking the type as a standard structure , declare the FS  internal table as type of types structure.
    Data: fs_scarr like type_s_scarr.
    FIELD-SYMBOLS <scarr2> TYPE fs_scarr
    In the types put the third column as first one and use into corresponding in select query
    or else
    while displaying the internal table change the order of the columns
    Loop at itab into fs_itab.
    write : col3
    col2
    col4
    endloop.
    Thanks,
    Viquar Iqbal

  • Dynamic field access in internal tables

    Hi everyone.
    I woulkd like to know if there is any way to identify the fields of an internal table at runtime. I'm creating a method in a class, and i would like to accept any itab as a paramter and then access the fields of that itab. I currently have the itab passing no problem using field symbols, and i am able to loop at the data, but i am unsure how to get the field names.
    Any suggestions?
    Thanks!

    Hi,
    Check the code below:
    REPORT ZYKTEST3 .
    DATA: d_ref TYPE REF TO data,
    d_ref2 TYPE REF TO data,
    i_alv_cat TYPE TABLE OF lvc_s_fcat,
    ls_alv_cat LIKE LINE OF i_alv_cat.
    TYPES: tabname LIKE dcobjdef-name ,
    fieldname LIKE dcobjdef-name,
    desc LIKE dntab-fieldtext.
    PARAMETER: p_tablen TYPE tabname. -
    > Input table field
    DATA: BEGIN OF itab OCCURS 0.
    INCLUDE STRUCTURE dntab.
    DATA: END OF itab.
    FIELD-SYMBOLS : <f_fs> TYPE table,
    <f_fs1> TYPE table,
    <f_fs2> TYPE ANY,
    <f_fs3> TYPE ANY,
    <f_fs4> type any,
    <f_field> TYPE ANY.
    REFRESH itab.
    CALL FUNCTION 'NAMETAB_GET' -
    > Fetches the fields
    EXPORTING
    langu = sy-langu
    tabname = p_tablen
    TABLES
    nametab = itab
    EXCEPTIONS
    no_texts_found = 1.
    LOOP AT itab .
    ls_alv_cat-fieldname = itab-fieldname.
    ls_alv_cat-ref_table = p_tablen.
    ls_alv_cat-ref_field = itab-fieldname.
    ls_alv_cat-seltext = itab-fieldtext.
    ls_alv_cat-reptext = itab-fieldtext.
    APPEND ls_alv_cat TO i_alv_cat.
    ENDLOOP.
    internal table build
    CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
    it_fieldcatalog = i_alv_cat
    IMPORTING
    ep_table = d_ref.
    ASSIGN d_ref->* TO <f_fs>. -
    > Dynamic table creation with fields of the table
    DATA: l_field TYPE fieldname,
    l_field1 type fieldname.
    SELECT * FROM (p_tablen) INTO CORRESPONDING FIELDS OF TABLE <f_fs>.
    Fetching of the data from the table
    LOOP AT <f_fs> ASSIGNING <f_fs2>.
    Here u can check the validations and process
    ASSIGN COMPONENT 2 OF STRUCTURE <f_fs2> TO <f_fs3>.
    ASSIGN COMPONENT 3 OF STRUCTURE <f_fs2> TO <f_fs4>.
    IF sy-subrc = 0.
    MOVE <f_fs3> TO l_field.
    MOVE <f_fs4> TO l_field1.
    WRITE:/1 l_field(20),
    22 l_field1(10).
    ENDIF.
    ENDLOOP.
    Regards
    Kannaiah

  • Splitting a string into respective fields of dynamic internal table

    Hi,
        I've a string concatenated with a separator. I've to split the string and assign it to the respective fields of an internal table, which is dynamic.
    Table name will be passed through selection screen. The data is coming from another system via RFC.
    Eg : String ITAB :
                                100;89001;EN;Material1;MATERIAL1
                                100;89002;EN;Material2;MATERIAL2
    The String ITAB may contain any master data. Let's say the above data is from MAKT table. So, I want to assign the above data to the respective fields of MAKT internal table(Dynamic).
    I heard, this requirement can be achieved using some standard CLASS.
    Please help me in doing this task.
    Regards,
    Sunny

    Hello,
    you can use dynamic programming for this issue, i.e.:
    DATA: gv_table_name   TYPE string,
          gr_type_desc    TYPE REF TO cl_abap_typedescr,
          gr_struct_desc  TYPE REF TO cl_abap_structdescr,
          gr_table_desc   TYPE REF TO cl_abap_tabledescr,
          gv_t            TYPE c,
          gv_comp         TYPE i,
          gr_table_ref    TYPE REF TO data,
          gr_struc_ref   TYPE REF TO data.
    DATA: gt_itab   TYPE TABLE OF string,
          gt_split  TYPE TABLE OF string,
          gv_str    TYPE string.
    FIELD-SYMBOLS: <table>    TYPE ANY TABLE,
                   <struct>   TYPE ANY,
                   <comp>     TYPE ANY.
    APPEND '100;89001;EN;Material1;MATERIAL1' TO gt_itab.
    APPEND '100;89002;EN;Material2;MATERIAL2' TO gt_itab.
    "go!
    gv_table_name = 'MAKT'.
    cl_abap_tabledescr=>describe_by_name(
          EXPORTING p_name = gv_table_name
          RECEIVING p_descr_ref = gr_type_desc
          EXCEPTIONS type_not_found = 4 ).
    gr_struct_desc ?= gr_type_desc.
    gr_table_desc = cl_abap_tabledescr=>create( gr_struct_desc ).
    CREATE DATA gr_table_ref TYPE HANDLE gr_table_desc.
    CREATE DATA gr_struc_ref TYPE HANDLE gr_struct_desc.
    ASSIGN gr_table_ref->* TO <table>.
    ASSIGN gr_struc_ref->* TO <struct>.
    DESCRIBE FIELD <struct> TYPE gv_t COMPONENTS gv_comp.
    LOOP AT gt_itab INTO gv_str.
      CLEAR: gt_split.
      SPLIT gv_str AT ';' INTO TABLE gt_split.
      DO gv_comp TIMES.
        READ TABLE gt_split INTO gv_str INDEX sy-index.
        ASSIGN COMPONENT sy-index OF STRUCTURE <struct> TO <comp>.
        <comp> = gv_str.
        CLEAR gv_str.
      ENDDO.
      INSERT <struct> INTO TABLE <table>.
    ENDLOOP.
    After this code you will have all data in <table> field symbol in proper type.
    Regards,
    Jacek

  • Fields in an internal table

    How to find number of fields in an internal table ?
    my requirement is i have 20 internal tables and the data is being uploaded into an application server. so how to find no of fields in a particular internal table

    concatenate all the fields and move them to final internal table , call the function module "GET_COMPONENT_LIST" and pass the work area of the final internal table in the parameter fieldname
    ***For getting no of FIELDS in an internal table ********
    CALL FUNCTION 'GET_COMPONENT_LIST'
      EXPORTING
        PROGRAM          = syrepid
        FIELDNAME        = 't_payr'
      TABLES
        COMPONENTS       = fieldlist.
    describe table fieldlist lines pyr_no_fields.
    ********end of getting no of fields**********
    TRANSFER wa_mat_out_head TO P_FNAME.
    LOOP AT GT_PAYR.
    MOVE:  GT_payr-LIFNR TO T_payr-lifnr,
           GT_payr-ZBUKR TO T_payr-zbukr,
           GT_payr-LAUFD TO T_payr-LAUFD,
           GT_payr-CHECT TO T_payr-CHECT,
           GT_payr-RWBTR TO T_payr-RWBTR.
    Concatenate T_payr-lifnr  t_payr-zbukr T_payr-laufd T_payr-chect
                T_payr-rwbtr into wa_mat_out-rec SEPARATED by ',' .

  • Coloring a field in the internal table

    Hi all,
    How can I color a field in the internal table knowing that I'm developing a classic report.
    Thanks in advance.

    hi,,,
    check this code.
    *-----TABLES DECLARATION
    tables : kna1,                     "Customer Master
           vbak,                     "Sales Document Header
             vbap,                     "Sales Document Item
             sscrfields.               "Screen Field Table
    &               D A T A   D E C L A R A T I O N                       &
    data : begin of it_kna1 occurs 0,
            kunnr type kna1-kunnr,      "Customer Number
            land1 type kna1-land1,      "Country Key
            name1 type kna1-name1,      "Name
            ort01 type kna1-ort01,      "City
           end of it_kna1.
    data : begin of it_kna2 occurs 0,
            kunnr type kna1-kunnr,      "Customer Number
            land1 type kna1-land1,      "Country Key
            name1 type kna1-name1,      "Name
            ort01 type kna1-ort01,      "City
           end of it_kna2.
    data:  begin of it_vbak occurs 0,
            vbeln type vbak-vbeln,      "Sales Document
            erdat type vbak-erdat,      "Date
            ernam type vbak-ernam,      "Name of Person
            auart type vbak-auart,      "Sales Document Type
           end of it_vbak.
    data:  begin of it_vbap occurs 0,
            vbeln type vbap-vbeln,      "Sales Document
            posnr type vbap-posnr,      "Sales Document Item
            matnr type vbap-matnr,      "Material Number
            matkl type vbap-matkl,      "Material group
           end of it_vbap.
    data: v_count type int4,           "Current Row Index
           v_line like sy-lisel,        "Contents of selected line
           v_kunnr like kna1-kunnr.
    &                S E L E C T I O N  S C R E E N                       &
    selection-screen begin of block b1 with frame title text-001.
    selection-screen begin of line.
    parameters : rb1 radiobutton group g1 default 'X'.
    selection-screen comment 5(20) text-002 for field rb1.
    selection-screen end of line.
    select-options : so_kunnr for kna1-kunnr obligatory.
    parameters : p_hits(3) type c.
    selection-screen begin of line.
    parameters : rb2 radiobutton group g1.
    selection-screen comment 5(20) text-003 for field rb2.
    selection-screen end of line.
    parameters : p_file like rlgrap-filename default 'c:\test'.
    selection-screen pushbutton /33(10) custl user-command push1.
    selection-screen pushbutton 58(10) custd user-command push2.
    selection-screen end of block b1.
    &                  I N I T I A L I Z A T I O N                        &
    initialization.
      move 'LOAD' to custl.
      move 'DISP' to custd.
    &                  A T  L I N E  S E L E C T I O N                    &
    at selection-screen.
      perform validate_kunnr.
    &  A T  S E L E C T I O N  S C R E E N  O N  V A L U E-R E Q U E S T  &
    at selection-screen on value-request for p_file.
      call function 'F4_FILENAME'
        exporting
          program_name  = syst-cprog
          dynpro_number = syst-dynnr
          field_name    = ' '
        importing
          file_name     = p_file.
    &              S T A R T  O F  S E L E C T I O N                      &
    start-of-selection.
      perform cust_details.
    &              S T A R T  O F  S E L E C T I O N                      &
    top-of-page.
      format color 3 intensified off.
      write :/02(25) sy-repid.
      write : 39(15) 'Page'(010), sy-pagno.
      format color off.
      format color 6 intensified off.
      format color col_heading.
      uline at :/1(60).
      write: /1 sy-vline,
              2 'Cust Number'(000),
              14 sy-vline,
              16 'Country'(007),
              25 sy-vline,
              26 'City'(008),
              42 sy-vline,
              43 'Region'(009),
              60 sy-vline.
      uline at :/1(60).
      format color col_heading off.
    &   T O P  O F  P A G E  D U R I N G  L I N E  S E L E C T I O N      &
    top-of-page during line-selection.
      if sy-lsind eq 1 or sy-ucomm eq 'VBAK'.
        format color col_heading.
        uline at :/1(60).
        write : /1 sy-vline,
                     2 'Docu No.'(011),
                     14 sy-vline,
                     16 'Date'(012),
                     26 sy-vline,
                     27 'Name'(013),
                     42 sy-vline,
                     43 'DType'(014),
                     60 sy-vline.
        uline at :/1(60).
      elseif sy-lsind eq 2 or sy-ucomm eq 'VBAK'.
        set pf-status space.
        uline at :/1(60).
        write : /1 sy-vline,
                     2 'Docu No.'(015),
                     14 sy-vline,
                     16 'Sales Item'(016),
                     25 sy-vline,
                     26 'Mat No'(017),
                     42 sy-vline,
                     43 vbap-matkl,
                     50 'Mat Grp'(018),
                     60 sy-vline.
        uline at :/1(60).
      endif.
    &  AT USER-COMMAND                                                    &
    at user-command.
      case sy-ucomm.
        when 'VBAK'.
          perform sales_item.
        when 'DELIVERY'.
          clear it_vbak-vbeln.
          get cursor value it_vbak-vbeln.
          set parameter id 'AUN' field it_vbak-vbeln.
          call transaction 'VA03' and skip first screen.
        when 'DISP'.
          perform display_basic.
      endcase.
    &      AT LINE SELECTION                                              &
    at line-selection.
      if sy-lsind = 1.
        set pf-status 'DDDD'.
        perform sales_header.
      elseif  sy-lsind = 2.
      case sy-ucomm.
        when 'PICK'.
        set pf-status space.
        perform sales_item.
        when 'DELIVERY'.
          clear it_vbak-vbeln.
          get cursor value it_vbak-vbeln.
          set parameter id 'AUN' field it_vbak-vbeln.
          call transaction 'VA03' and skip first screen.
        when 'DISP'.
          perform display_basic.
      endcase.
       PERFORM sales_item.
      endif.
    &  AT USER-COMMAND                                                    &
    at user-command.
      case sy-ucomm.
        when 'VBAK'.
          perform sales_item.
        when 'DELIVERY'.
          clear it_vbak-vbeln.
          get cursor value it_vbak-vbeln.
          set parameter id 'AUN' field it_vbak-vbeln.
          call transaction 'VA03' and skip first screen.
        when 'DISP'.
          perform display_basic.
      endcase.
    &      Form  CUST_DETAILS                                             &
    form cust_details .
      select kunnr
             land1
             name1
             ort01
             from kna1
             into table it_kna1
             where kunnr in so_kunnr.
      if sy-subrc <> 0.
        message 'SELECT VALID CUST NO' type 'I'.
      else.
        loop at it_kna1.
         v_count = v_count + 1.
          if sy-tabix < p_hits.
         IF v_count <= p_hits.
            move it_kna1 to it_kna2.
            append it_kna2.
          else.
            exit.
          endif.
        endloop.
      endif.
      if not it_kna2[] is initial.
        loop at it_kna2.
          write : /1 sy-vline,
                   2 it_kna2-kunnr,
                   14 sy-vline,
                   16 it_kna2-land1,
                   25 sy-vline,
                   26 it_kna2-name1,
                   42 sy-vline,
                   43 it_kna2-ort01,
                   60 sy-vline.
          uline at :/1(60).
        endloop.
      endif.
    endform.                    " CUST_DETAILS
    **&      Form  load_file
    *form load_file .
    *endform.                    " load_file
    **&      Form  disp_file
    *form disp_file .
    *endform.                    " disp_file
    *&      Form  VALIDATE_KUNNR
    form validate_kunnr .
      select single kunnr
                    from kna1
                    into kna1
                    where kunnr = so_kunnr.
    endform.                    " VALIDATE_KUNNR
    *&      Form  SALES_HEADER
    form sales_header .
    data : v_kna1(13).
    v_kna1 = 'IT_KNA2-KUNNR'.
    *get cursor line sy-lilli value v_line
    clear v_kunnr.
      get cursor  field v_kna1 value v_kunnr.
    v_kunnr = v_line+1(10).
      call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exporting
          input  = v_kunnr
        importing
          output = v_kunnr.
      select vbeln
             erdat
             ernam
             auart
             from vbak
             into table it_vbak
             where  kunnr = v_kunnr.
      if sy-subrc = 0.
        loop at it_vbak.
          write : /1 sy-vline,
                   2 it_vbak-vbeln,
                   14 sy-vline,
                   16 it_vbak-erdat,
                   26 sy-vline,
                   27 it_vbak-ernam,
                   42 sy-vline,
                   43 it_vbak-auart,
                   60 sy-vline.
          uline at :/1(60).
        endloop.
      endif.
    endform.                    " SALES_HEADER
    *&      Form  SALES_ITEM
    form sales_item .
    data : v_vbeln(13).
    v_vbeln = 'IT_VBAK-VBELN'.
    clear it_vbak-vbeln.
    get cursor  field v_vbeln value it_vbak-vbeln.
      call function 'CONVERSION_EXIT_ALPHA_INPUT'
        exporting
          input  = it_vbak-vbeln
        importing
          output = it_vbak-vbeln.
      select vbeln
             posnr
             matnr
             matkl
      from vbap
      into table it_vbap
      where vbeln = it_vbak-vbeln.
      loop at it_vbap .
        write : /1 sy-vline,
                   2 it_vbap-vbeln,
                   14 sy-vline,
                   16 it_vbap-posnr,
                   25 sy-vline,
                   26 it_vbap-matnr,
                   42 sy-vline,
                   43 it_vbap-matkl,
                   60 sy-vline.
        uline at :/1(60).
      endloop.
    endform.                    " SALES_ITEM
    *&      Form  DISP_DOCU
    form display_basic .
      loop at it_kna1 into it_kna1.
        format hotspot on.
        write : /03 it_kna1-kunnr,
                 24  it_kna1-name1.
        hide it_kna1-kunnr.
      endloop.
    endform.                    " display_basic
    pls reward if useful
    regards,
    rekha

  • Add field in an internal table

    Hi There,
    How to add a field in an internal table created at the runtime using
    CREATE DATA D1 TYPE TABLE OF (VAR).
    where say var contains name of a DDIC table.
    Rgds,
    deb.

    after creating internal table use the method for creation of dynamic table and try , i am not sure
    DATA: LineType TYPE string,
          ItabRef  TYPE REF TO DATA.
    FIELD-SYMBOLS:   TYPE STANDARD TABLE.
    LineType = 'SFLIGHT'.
    " Create internal table and attach a field-symbol
    CREATE DATA ItabRef TYPE STANDARD TABLE OF (LineType).
    ASSIGN ItabRef->* TO .
    <b>after this check this and try</b>
    ******DATA DECLARATION*****************************
    FIELD-SYMBOLS : <it_final> TYPE STANDARD TABLE,
                    <wa_final> TYPE ANY,
                    <w_field> TYPE ANY.
    ***DYNAMIC CREATION OF FIELDCATALOG****************
    *FIRST 2 FIELDS FIELDS FIELD1 AND FIELD2 ARE CONSTANT, FIELDS OBTAINED IN THE LOOP ENDLOOP ARE DYNAMIC,
    *LIKEWISE DYNAMIC FIELDCATALOG IS CREATED
      wa_fieldcatalog-fieldname  = 'FIELD1'.
      wa_fieldcatalog-ref_table  = 'E070'.
      wa_fieldcatalog-outputlen  = '13'.
      wa_fieldcatalog-reptext    = 'Created On'.
      wa_fieldcatalog-seltext    = 'Created On'.
      APPEND wa_fieldcatalog TO it_fieldcatalog.
      CLEAR wa_fieldcatalog.
      wa_fieldcatalog-fieldname  = 'FIELD1'.
      wa_fieldcatalog-ref_table  = 'E070'.
      wa_fieldcatalog-outputlen  = '13'.
      wa_fieldcatalog-reptext    = 'Created On'.
      wa_fieldcatalog-seltext    = 'Created On'.
      APPEND wa_fieldcatalog TO it_fieldcatalog.
      CLEAR wa_fieldcatalog.
      LOOP AT it_mandt WHERE mandt IN s_mandt.
        CONCATENATE 'CLNT' it_mandt INTO wa_fieldcatalog-fieldname.
        wa_fieldcatalog-inttype    = 'NUMC'.
        wa_fieldcatalog-outputlen  = '14'.
        wa_fieldcatalog-reptext    = it_mandt.
        wa_fieldcatalog-seltext    = it_mandt.
        APPEND wa_fieldcatalog TO it_fieldcatalog.
        CLEAR :wa_fieldcatalog ,it_mandt.
      ENDLOOP.
    ********CREATE DYNAMIC TABLE************************
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog           = it_fieldcatalog
        IMPORTING
          ep_table                  = new_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.
      ASSIGN new_table->* TO <it_final>.
    *********CREATE WORK AREA****************************
    CREATE DATA new_line LIKE LINE OF <it_final>.
      ASSIGN new_line->* TO <wa_final>.
    *********INSERTTING WORK AREAR TO INTERNAL TABLE******
        INSERT <wa_final> INTO TABLE <it_final>.
    *******POPULATING DATA******************************* 
      LOOP.
       ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <wa_final> TO <w_field>.
       <w_field> = '12345'.
        ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <wa_final> TO <w_field>.
       <w_field> = '21453DD'.
       FIELD1 AND FIELD2 ARE COMPONENTS OF FIELDCATALOG.
    ENDLOOP.     
      ENDLOOP.

  • To Find the type of field in the internal table.

    I have internal table i_tab.
    TYPES : BEGIN OF t_makt,
              matnr    TYPE    matnr,
              maktx    TYPE    maktx,
              qty      type    mseg-menge,
              show     type    char01,
            END OF t_makt.
    DATA : i_tab      TYPE t_makt  OCCURS 0 WITH HEADER LINE.
    I want to know the type of the field of the i_tab at some stage in the program.
    is there any piece of code or FM available to find the TYPE of the field of the internal table.

    Check out the following code
    TYPES:
      BEGIN OF my_struct,
        comp_a type i,
        comp_b type f,
      END OF my_struct.
    DATA:
      my_data   TYPE my_struct,
      descr_ref TYPE ref to cl_abap_structdescr.
    FIELD-SYMBOLS:
      <comp_wa> TYPE abap_compdescr.
    START-OF-SELECTION.
      descr_ref ?= cl_abap_typedescr=>describe_by_data( my_data ).
      WRITE: / 'Typename     :', descr_ref->absolute_name.
      WRITE: / 'Kind         :', descr_ref->type_kind.
      WRITE: / 'Length       :', descr_ref->length.
      WRITE: / 'Decimals     :', descr_ref->decimals.
      WRITE: / 'Struct Kind  :', descr_ref->struct_kind.
      WRITE: / 'Components'.
      WRITE: / 'Name              Kind   Length   Decimals'.
      LOOP AT descr_ref->components ASSIGNING <comp_wa>.
        WRITE: / <comp_wa>-name, <comp_wa>-type_kind,
                 <comp_wa>-length, <comp_wa>-decimals.
      ENDLOOP.

  • Colour to field in an internal table

    how to colour a particular data in a particular field of an internal table.

    See this
    1. add one more field to ur final internal table say COLOR(4)
    2. in layout wa_layout-style_fname = 'COLOR'. " if its grid
    wa_layout-style_fieldname = 'COLOR'. "if its list
    3. read table itab index 3.
    itab-color = 'C410'.
    modify itab index 3
    4. see program SHOWCOLO for all color codes
    1. Add a field of data type CHAR(3) to the internal output table.
    2. Enter the color code in the appropriate field of the row to be colored in the internal
    output table:
    Code: 'Cxy'
    C = Color (all codes begin with 'C')
    x = color number ('1' - '9')
    y = highlight ('0' = off, '1' = on)
    3. Assign the internal output table color code field name to the IS_LAYOUT importing
    structure IS_LAYOUT-INFO_FIELDNAME field and pass this structure in the ALV call
    interface.
    To enable row coloring, you should add an additional field to your list data table. It should be of character type and length at least 4. This field will contain the color code for the row. So, let’s modify declaration of our list data table “gt_list”.
    you should fill the color code to this field. Its format will be the same as explained before at section C.6.3. But how will ALV Grid know that you have loaded the color data for the row to this field. So, you make it know this by passing the name of the field containing color codes to the field “INFO_FNAME” of the layout structure.
    e.g.
    ps_layout-info_fname = <field_name_containing_color_codes>. “e.g. ‘ROWCOLOR’
    You can fill that field anytime during execution. But, of course, due to the flow logic of screens, it will be reflected to your list display as soon as an ALV refresh occurs.
    You can color an entire row as described in the next section. However, this method is less time consuming.
    Coloring Individual Cells
    This is the last point about coloring procedures for the ALV Grid. The procedure is similar to coloring an entire row. However, since an individual cell can be addressed with two parameters we will need something more. What is meant by “more” is a table type structure to be included into the structure of the list data table. It seems strange, because including it will make our list data structure deep. But anyhow ALV Grid control handles this.
    The structure that should be included must be of type “LVC_T_SCOL”. If you want to color the entire row, this inner table should contain only one row with field “fname” is set to space, some color value at field “col”, “0” or “1” at fields “int” (intensified) and “inv” (inverse).
    If you want to color individual cells, then for each cell column, append a line to this inner table which also contains the column name at field “fname”. It is obvious that you can color an entire column by filling this inner table with a row for that column for each row in the list data table.
    If it is in ALv refer the following code:
    *& Report  ZDEMO_ALVGRID                                               *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic ALV grid, Enhanced to display each row in a different     *
    *& colour                                                              *
    REPORT  zdemo_alvgrid                 .
    TABLES:     ekko.
    type-pools: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
      line_color(4) type c,     "Used to store row color attributes
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
          gd_tab_group type slis_t_sp_group_alv,
          gd_layout    type slis_layout_alv,
          gd_repid     like sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    There are a number of ways to create a fieldcat.
    For the purpose of this example i will build the fieldcatalog manualy
    by populating the internal table fields individually and then
    appending the rows. This method can be the most time consuming but can
    also allow you  more control of the final product.
    Beware though, you need to ensure that all fields required are
    populated. When using some of functionality available via ALV, such as
    total. You may need to provide more information than if you were
    simply displaying the result
                  I.e. Field type may be required in-order for
                       the 'TOTAL' function to work.
      fieldcatalog-fieldname   = 'EBELN'.
      fieldcatalog-seltext_m   = 'Purchase Order'.
      fieldcatalog-col_pos     = 0.
      fieldcatalog-outputlen   = 10.
      fieldcatalog-emphasize   = 'X'.
      fieldcatalog-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'EBELP'.
      fieldcatalog-seltext_m   = 'PO Item'.
      fieldcatalog-col_pos     = 1.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'STATU'.
      fieldcatalog-seltext_m   = 'Status'.
      fieldcatalog-col_pos     = 2.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'AEDAT'.
      fieldcatalog-seltext_m   = 'Item change date'.
      fieldcatalog-col_pos     = 3.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MATNR'.
      fieldcatalog-seltext_m   = 'Material Number'.
      fieldcatalog-col_pos     = 4.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MENGE'.
      fieldcatalog-seltext_m   = 'PO quantity'.
      fieldcatalog-col_pos     = 5.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'MEINS'.
      fieldcatalog-seltext_m   = 'Order Unit'.
      fieldcatalog-col_pos     = 6.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'NETPR'.
      fieldcatalog-seltext_m   = 'Net Price'.
      fieldcatalog-col_pos     = 7.
      fieldcatalog-outputlen   = 15.
      fieldcatalog-datatype     = 'CURR'.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
      fieldcatalog-fieldname   = 'PEINH'.
      fieldcatalog-seltext_m   = 'Price Unit'.
      fieldcatalog-col_pos     = 8.
      append fieldcatalog to fieldcatalog.
      clear  fieldcatalog.
    endform.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    form build_layout.
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    Set layout field for row attributes(i.e. color)
      gd_layout-info_fieldname =      'LINE_COLOR'.
    gd_layout-totals_only        = 'X'.
    gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
                                            "click(press f2)
    gd_layout-zebra             = 'X'.
    gd_layout-group_change_edit = 'X'.
    gd_layout-header_text       = 'helllllo'.
    endform.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    form display_alv_report.
      gd_repid = sy-repid.
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
               i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
               i_callback_user_command = 'USER_COMMAND'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
               IT_EVENTS                = GT_XEVENTS
                i_save                  = 'X'
               is_variant              = z_template
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 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.
    endform.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    data: ld_color(1) type c.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into table it_ekko.
    *Populate field with color attributes
    loop at it_ekko into wa_ekko.
    Populate color variable with colour properties
    Char 1 = C (This is a color property)
    Char 2 = 3 (Color codes: 1 - 7)
    Char 3 = Intensified on/off ( 1 or 0 )
    Char 4 = Inverse display on/off ( 1 or 0 )
              i.e. wa_ekko-line_color = 'C410'
      ld_color = ld_color + 1.
    Only 7 colours so need to reset color value
      if ld_color = 8.
        ld_color = 1.
      endif.
      concatenate 'C' ld_color '10' into wa_ekko-line_color.
    wa_ekko-line_color = 'C410'.
      modify it_ekko from wa_ekko.
    endloop.
    endform.                    " DATA_RETRIEVAL
    Please give me reward points...

  • Passing value from field symbol / variable type ref to data to variable

    hey ,
    DATA: NODE_FLIGHTS TYPE REF TO IF_WD_CONTEXT_NODE.
      DATA: RT_CARRID TYPE REF TO DATA.
      FIELD-SYMBOLS: <FS_CARRID> TYPE TABLE
    .* Retrieve the data from the select option
      RT_CARRID = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( I_ID = 'S_WEIGHT).
    Assign it to a field symbol
      ASSIGN RT_CARRID->* TO <FS_CARRID>.
    how can i pass RT_CARRID or <FS_CARRID> to a varible with type vbap-netgrw ( net weight ) ?
    thanks
    ASA

    >
    ASA MOKED wrote:
    > hey ,
    >
    >
    > DATA: NODE_FLIGHTS TYPE REF TO IF_WD_CONTEXT_NODE.
    >   DATA: RT_CARRID TYPE REF TO DATA.
    >   FIELD-SYMBOLS: <FS_CARRID> TYPE TABLE

    > .* Retrieve the data from the select option
    >   RT_CARRID = WD_THIS->M_HANDLER->GET_RANGE_TABLE_OF_SEL_FIELD( I_ID = 'S_WEIGHT).
    > * Assign it to a field symbol
    >   ASSIGN RT_CARRID->* TO <FS_CARRID>.
    create a work area of type <FS_CARRID>.
    field-symbol: <fs_wa> type line of <FS_CARRID>.
    loop at <FS_CARRID> into <fs_wa>.
    lv_netgr = <fs_wa>-netgr.

Maybe you are looking for