Internal table to field symbol

hi all,
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.
*data : dyn_itab2 type ANY table.
selection-screen begin of block b1 with frame.
parameters: p_table(30) type c.
selection-screen end of block b1.
start-of-selection.
BREAK-POINT.
perform get_structure.
perform create_dynamic_itab.
perform get_data.
PERFORM OUTPUT.
*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.
Get the structure of the table.
ref_table_des ?=
cl_abap_typedescr=>describe_by_name( p_table ).
idetails = ref_table_des->components.
*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 create_dynamic_itab.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = ifc
importing
ep_table = dy_table.
here i want  to assighn the structure of dy_table to internal atble.
assign dy_table->* to <dyn_table>.
Create dynamic work area and assign to FS
create data dy_line like line of <dyn_table>.
assign dy_line->* to <dyn_wa>.
endform.
form get_data.
Select Data from table.
select * into table <dyN_table> UP TO 10 ROWS
from (p_table).
endform.
Write out data from table.
FORM OUTPUT.
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.
endloop.
ENDFORM.
how can i achieve this one.
regards
siva

Hi,
Check this Code ...
LOOP AT <dyn_table> INTO <dyn_wa>.
    DO.
      ASSIGN COMPONENT sy-index
      OF STRUCTURE <dyn_wa> TO <fs_field> .
      IF sy-subrc NE 0.
        EXIT.
      ENDIF.
      IF sy-index = 1.
        WRITE:/ <fs_field>.
      ELSE.
        WRITE: <fs_field>.
      ENDIF.
    ENDDO.
  ENDLOOP.
For reference check below code
DATA: it_fieldcat        TYPE lvc_t_fcat                         . " Field catalog
DATA: wa_fieldcat  LIKE LINE OF it_fieldcat. " Field catalog
DATA: it_dyn_table      TYPE REF TO data,     " Dynamic table
      it_wa_dyn_table   TYPE REF TO data.     " Dynamic table
*       Field sysmbols           Begin with <fs>                      *
FIELD-SYMBOLS:  <fs_dyn_table>       TYPE STANDARD TABLE, " Dynamic tbale
                <fs_dyn_table_temp>  TYPE ANY           , " Dynamic tbale
                <fs_field>           TYPE ANY           , " Temp field for data assignment
                <fs_field_temp>      TYPE ANY           . " Temp field for data assignment
*       Macro                                                         *
* Macro Defination
* Building field catalog using macro defination
DEFINE m_fieldcat.
  wa_fieldcat-fieldname   = &1.
  wa_fieldcat-scrtext_l   = &2.
  wa_fieldcat-coltext     = &2.
  wa_fieldcat-no_zero     = &3.
  wa_fieldcat-hotspot     = &4.
  wa_fieldcat-outputlen   = &5.
  wa_fieldcat-emphasize   = &6.
* Appending workarea to internal table
  append wa_fieldcat to it_fieldcat.
  clear wa_fieldcat.
END-OF-DEFINITION.
*&      Form  f005_prepare_field_catalog
*       text
form f005_prepare_field_catalog .
  REFRESH: it_fieldcat.
* Build the field catalog
  m_fieldcat text-007 text-008 c_blank  c_blank c_30 c_blank.
  m_fieldcat text-009 text-010 c_blank  c_blank c_30 c_blank.
  SORT it_final_temp BY equnr point.
  SORT it_final BY equnr point psort idate.
  w_date1 = so_date-low.
* Loop to generate grid column at run time
* Loop - Till the lower date not equal to higer date
  WHILE so_date-high GE w_date1.
* Changing date into actual date format using edit mask
    WRITE w_date1 TO w_var4 USING EDIT MASK '__-__-____'.
    m_fieldcat w_var4 w_var4 c_flag c_blank c_12 c_blank.
    w_date1 = w_date1 + c_count.
    CLEAR w_var4.
  ENDWHILE.
*&      Form  f007_create_dynamic_table
*       text: Create dynamic table
form f007_create_dynamic_table .
* Call method to create dynamic internal table
  CALL METHOD cl_alv_table_create=>create_dynamic_table
    EXPORTING
      it_fieldcatalog           = it_fieldcat
    IMPORTING
      ep_table                  = it_dyn_table
    EXCEPTIONS
      generate_subpool_dir_full = 1
      OTHERS                    = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
  SORT it_final_temp BY equnr point.
  SORT it_final BY equnr point psort idate.
  ASSIGN it_dyn_table->* TO <fs_dyn_table>.
  CREATE DATA it_wa_dyn_table LIKE LINE OF <fs_dyn_table>.
  ASSIGN it_wa_dyn_table->* TO <fs_dyn_table_temp>.
  IF it_final_temp IS NOT INITIAL.
    LOOP AT it_final_temp INTO wa_final_temp.
* Assign equipment number and it's field data to field symbols (Dynamic table)
* Assign field name to field symbol
      ASSIGN text-007 TO <fs_field_temp>.
* Assign component name and it's value to dynamic table
      ASSIGN COMPONENT <fs_field_temp> OF STRUCTURE <fs_dyn_table_temp> TO <fs_field>.
* Assign equipment number value to field symbol
      <fs_field> = wa_final_temp-equnr.
* Assign Short Description and it's field data to field symbols (Dynamic table)
* Assign field name to field symbol
      ASSIGN text-009 TO <fs_field_temp>.
* Assign component name and it's value to dynamic table
      ASSIGN COMPONENT <fs_field_temp> OF STRUCTURE <fs_dyn_table_temp> TO <fs_field>.
* Assign short description value to field symbol
      <fs_field> = wa_final_temp-psort.
* Loop to assign value of run time generated column.
      IF it_final IS NOT INITIAL.
        LOOP AT it_final INTO wa_final WHERE equnr = wa_final_temp-equnr
                                        AND point = wa_final_temp-point.
          w_date1 = wa_final-idate.
          WRITE w_date1 TO w_var4 USING EDIT MASK '__-__-____'.
          ASSIGN w_var4 TO <fs_field_temp>.
          ASSIGN COMPONENT <fs_field_temp> OF STRUCTURE <fs_dyn_table_temp> TO <fs_field>.
          <fs_field> = wa_final-cdiff.
          CLEAR: wa_final, w_var4, w_date1.
        ENDLOOP.
      ENDIF.
      CLEAR: wa_final_temp.
* Assign field symbol temporary table to final dynamic table
      APPEND <fs_dyn_table_temp> TO <fs_dyn_table>.
      CLEAR: <fs_dyn_table_temp>.
    ENDLOOP.
  ENDIF.
endform.                    " f007_create_dynamic_table

Similar Messages

  • Delete row from internal table using field symbol.

    Hi friends,
      I created dynamic internal table using field symbol. I want to delete some data using where clause.
    for example. i want to use like,
        DELETE <FS> WHERE KUNNR = WA_KNA1-KUNNR.
    Like the above statment it won't work. How i can use delete with where clause in field symbols.
    Hope any one can help me.
    Thanks and regards
    Srikanth. S

    hi Srikanth,
    I think you have to LOOP through the whole internal table and check each line and decide to delete or not:
    LOOP at <itab> INTO <wa>.
    ASSIGN COMPONENT 'KUNNR' OF STRUCTURE <wa> TO <field>.
    CHECK <field> IS ASSIGNED.
    IF <field> EQ WA_KNA1-KUNNR.
    DELETE ...
    ENDIF.
    UNASSIGN <field>.
    ENDLOOP.
    hope this helps
    ec

  • 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

  • How to assign a whole internal table to field symbol

    Can anyone explain me that , can we assign the whole internal table to a field symbol .If yes please explain with some simple example by assigning an internal tabl data to a field symbol and how to loop on to that field symbol to write the data from it.
    Please don't paste the F1 help .
    Thanks,
    Rose.

    hi
    good
    check this code
    ) Defining the table records and the field symbol in a similar type.
    just an ordinary standard table
    TYPES: BEGIN OF it_vbak_line,
    vbeln LIKE vbak-vbeln,
    vkorg LIKE vbak-vkorg,
    vtweg LIKE vbak-vtweg,
    spart LIKE vbak-spart,
    kunnr LIKE vbak-kunnr,
    END OF it_vbak_line.
    DATA: it_vbak TYPE TABLE OF it_vbak_line.
    FIELD-SYMBOLS: <it_vbak_line> TYPE it_vbak_line.
    or as a screaming fast hash table for keyed reads
    TYPES: BEGIN OF it_vbpa_line,
    vbeln LIKE vbak-vbeln,
    kunnr LIKE vbak-kunnr,
    END OF it_vbpa_line.
    DATA: it_vbpa TYPE HASHED TABLE OF it_vbpa_line
    WITH UNIQUE KEY vbeln.
    FIELD-SYMBOLS: <it_vbpa_line> TYPE it_vbpa_line.
    2) In ITAB processing, utilize the ASSIGNING command.
    loop example
    LOOP AT it_vbak ASSIGNING <it_vbak_line>.
    look at records--populate it_zpartner
    read example
    READ TABLE it_vbpa ASSIGNING <it_vbpa_line>
    WITH TABLE KEY vbeln = <it_vbak_line>-vbeln.
    3) Refer to the field symbol's fields in the loop or after the read.
    wa_zpartner-vkorg = <it_vbak_line>-vkorg.
    wa_zpartner-vtweg = <it_vbak_line>-vtweg.
    wa_zpartner-spart = <it_vbak_line>-spart.
    wa_zpartner-kunag = <it_vbak_line>-kunnr.
    wa_zpartner-kunwe = <it_vbpa_line>-kunnr.
    See the code example below for further detail. The code was written in R/3 4.6C and should work for all 4.x versions.
    thanks
    mrutyun^

  • How to build a internal table of field symbols.

    Hi,
    I want to build a internal table, which consists of several field symbols. Each field symbol points to an entry of  other internal tables. All of these tables have different structure definition. How can I implement it. If it is possible, it can save a lot of table query time.
    I will be very appreciate for your help.
    Best Regards, Jun

    hello jun
    i hope the following example give the some idea to build internal table fileds with differen field symbol data types.
    FIELD-SYMBOLS:<f1> type any,<f2> TYPE ANY.
    data:BEGIN OF itab,
         t1 type i value 10,
         t2(30) type c value 'john',
       t3 type p DECIMALS 3 value '4.7658',
       END OF itab.
      ASSIGN itab to <f1>.
      DO 3 TIMES.
      ASSIGN COMPONENT sy-index OF STRUCTURE <f1> TO <f2>.
      WRITE <f2>.
      ENDDO.
    types:begin of it_line,
          i1 type i,
          t1 type string,
          p1 type p DECIMALS 3,
      end of it_line.
      data:itab1 type table of  it_line.
    FIELD-SYMBOLS:<f1>.
      ASSIGN itab1 to <f1>.
    and also u can refer the following links
    1->  http://help.sap.com/saphelp_wp/helpdata/en/fc/eb387a358411d1829f0000e829fbfe/content.htm
    2--> http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb3923358411d1829f0000e829fbfe/content.htm
    Thanks&Regards
    sreenivas p

  • Dynamic internal  tables using field symbols

    Hello,
    Is it possible to create a dynamic table where the no of fields in the internal table can be created dynamically(using field symbols).
    Say sometimes internal tables with 10 fields and depending upon the requirement the fields can be dynamically increased or decreased in runtime.
    Thanks.

    Hi,
    Go through the following code....
    *Data definitions
    *** Tables
    data: lt_data type ref to data.
    data: lt_fieldcatalog type lvc_t_fcat.
    *** Structure
    data: ls_fieldcatalog type lvc_s_fcat.
    *** Data References
    data: new_line type ref to data,
          fs_data type ref to data.
    *** Field Symbols
    field-symbols: <fs_data> type ref to data,
                   <fs_1> type any table,
                   <fs_2>,
                   <fs_3>.
    *Populating the internal table with fieldnames required for our dynamic
    *internal table
    ls_fieldcatalog-fieldname = 'MANDT'.
    append ls_fieldcatalog to lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CARRID'. "Fieldname
    ls_fieldcatalog-inttype = 'C'. "Internal Type C-> Character
    append ls_fieldcatalog to lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CONNID'.
    ls_fieldcatalog-inttype = 'N'.
    append ls_fieldcatalog to lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'FLDATE'.
    ls_fieldcatalog-inttype = 'D'.
    append ls_fieldcatalog to lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'PRICE'.
    ls_fieldcatalog-inttype = 'P'.
    append ls_fieldcatalog to lt_fieldcatalog.
    ls_fieldcatalog-fieldname = 'CURRENCY'.
    ls_fieldcatalog-inttype = 'C'.
    append ls_fieldcatalog to lt_fieldcatalog.
    *Calling the method CREATE_DYNAMIC_TABLE
    call method cl_alv_table_create=>create_dynamic_table
         exporting
           it_fieldcatalog = lt_fieldcatalog
         importing
           ep_table = fs_data
         exceptions
           generate_subpool_dir_full = 1
           others = 2
    if sy-subrc <> 0.
    endif.
    *Assigning Field-Symbol to our dynamic internal table
    assign lt_data to <fs_data>.
    *Internal Table is ready, now to put data in that table
    *** So <FS_1> now points to our dynamic internal table.
    assign fs_data->* to <fs_1>.
    *** Next step is to create a work area for our dynamic internal table.
    create data new_line like line of <fs_1>.
    *** A field-symbol to access that work area
    assign new_line->*  to <fs_2>.
    *** And to put the data in the internal table
    select
          mandt
          carrid
          connid
          fldate
          price
          currency
                  from sflight
                  into corresponding fields of table <fs_1>.
    *** Access contents of internal table
    loop at <fs_1> assigning <fs_2>.
    do 5 times.
    assign component sy-index of structure <fs_2> to <fs_3>.
    write:  <fs_3>.
    enddo.
    skip 1.
    endloop.
    top-of-page.
    write:/5 'FUJITSU CONSULTING COMPANY' inverse color 6,
           50 sy-datum inverse color 6,
           70 sy-pagno inverse color 6.
    uline.
    <REMOVED BY MODERATOR>
    Vijay C
    Code Formatted by: Alvaro Tejada Galindo on Apr 14, 2008 1:47 PM

  • Dynamic Internal table with field symbol

    I made the report where the user enters two different tables and two fields that are to be compared.
    Eg. If I enter (MARA & NAME1) and (MARC & NAME2) , I wish to compare all the entries of Mara-name1 against all entries in Marc-name2.
    <u>The code I need to write is:</u>
    DATA:
      gdo_data      TYPE REF TO data.
    DATA:
      gdo_data1      TYPE REF TO data.
    FIELD-SYMBOLS:
      <gt_itab>     TYPE table,
        <wa> LIKE <gt_itab>,                        "<gt_itab>,
      <gs_entry>    TYPE ANY.
    FIELD-SYMBOLS:
      <gt_itab1>     TYPE table,
        <wa1> LIKE <gt_itab>,                        "<gt_itab>,
      <gs_entry1>    TYPE ANY.
    PARAMETERS:
      p_table    TYPE tabname,            "    DEFAULT 'KNA1',
      p_fld      TYPE fieldname.          "  DEFAULT 'KUNNR'.
    PARAMETERS:
      p_table1    TYPE tabname,            "    DEFAULT 'KNA1',
      p_fld1      TYPE fieldname.
    DATA: var TYPE fieldname.
    var = p_fld.
    DATA: var1 TYPE fieldname.
    var1 = p_fld1.
    START-OF-SELECTION.
      CREATE DATA gdo_data TYPE TABLE OF (p_table).
      ASSIGN gdo_data->* TO <gt_itab>.
      CREATE DATA gdo_data1 TYPE TABLE OF (p_table1).
      ASSIGN gdo_data1->* TO <gt_itab1>.
      SELECT * FROM (p_table) INTO CORRESPONDING FIELDS OF TABLE <gt_itab>.
      SELECT * FROM (p_table1) INTO CORRESPONDING FIELDS OF TABLE <gt_itab1>.
    <b>  LOOP AT <gt_itab> ASSIGNING <gs_entry>.
        READ TABLE <gt_itab1> ASSIGNING <gs_entry1>
             WITH KEY (var1) = <gt_itab>-(var).
        IF sy-subrc EQ 0.
          MESSAGE 'Success' TYPE 'S'.
        ENDIF.
      ENDLOOP.</b>
    END-OF-SELECTION.
    But the portion in bold is creating error: <b><gt_itab> is a table without a header lineand therefore has no component called "".</b>
    please help.

    Hi Amit
    Try like this
    LOOP AT <gt_itab> ASSIGNING <gs_entry>.
    READ TABLE <gt_itab1> ASSIGNING <gs_entry1>
    WITH KEY (var1) = <b><gs_entry></b>-(var).
    IF sy-subrc EQ 0.
    MESSAGE 'Success' TYPE 'S'.
    ENDIF.
    ENDLOOP.
    Regards,
    Atish

  • Some help needed on dynamic internal tables and field symbols

    Hi,
    I have a dyn internal table <dyn_table_r>.
    One of its fields is kna1-kunnr.
    I have another wa <fs>, with only one field alt_kunnr.
    now i want to modify  the data of <dyn_table_r>-kna1-kunnr from <fs>-alt_kunnr
    How should i do it?
    Regards ,
    Harshit Rungta

    Harshit Rungta:
    You have opened a number of related questions today. I'd like to see the other ones closed before you continue with this one.
    I'll lock this but will re-open it once the others are marked as solved.
    Rob

  • How to pass the values from internal table to field groups

    hi all,
    how can i pass the internal  table values to field groups?
    already field groups are holding some values.. INSERT STATEMENT IS NOT WORKING as it is ovewriting the existing values..
    Use full answers will be rewared.
    Thanks.
    Moderator message - duplicate post locked
    Edited by: Rob Burbank on Jun 23, 2009 9:51 AM

    Hi,
    You can use INSERT statement to put a work area of an Internal table in Field-group
    and use Extract to get info out of it.
    Hope it helps,
    Raj

  • Sum for Dynamic Fields in a Dynamic Table with Field Symbol

    Hi All,
    I currently have an report which I am looking to update with some totals.  The information is currently output in an ALV which is fed data from a dynamic table defined with a field symbol.  The modification that needs to be applied is a summation per currency code where each of the fields to be summed is a dynamically named field at runtime.  I am now just looking to see if anyone has any recommendations on how to obtain these totals it would be appreciated.  I have no problem doing the leg work in piecing the solution together but am just stuck on which approach I should be investigating here.  I have looked into several options but do to the fact that the totals are for dynamic fields in a dynamic table and it is a field symbol I am having some difficulties thinking of the easiest approach to obtain these totals.
    Below is a simple sample of what the report currently looks like and what we are looking to add.
    ====================================================================================
    As-Is Report:
    DETAILED DATA ALV
    Company Code  |  Plant  |  2006 Total  |  2007 Total  |  2008 Total |  CURRENCY
    0001          |   ABCD  |    1,500     |    1,200     |    1,700    |    USD
    0001          |   BCDE   |    2,300     |    4,100     |    3,600    |    GBP
    0003          |   DBCA  |    3,200     |    1,600     |    6,200    |    USD
    Addition 1:
    TOTALS PER CURRENCY
    Currency                |  2006 Total  |  2007 Total  |  2008 Total |
    USD              |    4,700     |    2,800     |    7,900    |
    GBP                       |    2,300     |    4,100     |    3,600    |
    Addition 2:
    CONVERSIONS TO USD
                                          |  2006 Curr   |  2006 USD    |  2008 Curr   |  2006 USD   |
    USD                       |  4,700 USD   |  4,700 USD   |  7,900 USD  |  7,900 USD  |
    GBP   (1.5GBP/1 USD)    |  2,300 GBP   |  1,150 USD   |  2,300 GBP  |  1,800 USD  |
    ====================================================================================
    Any recommendations will be appreciated.

    Hi,
    We cannot use the key word SUM in the loop at assigning statement.
    The way i see is
    When  you are creating the first dynamic internal table , create one more with  the structure below:
    Currency | 2006 Total | 2007 Total | 2008 Total |
    Then while populating the data into first itab,also move the contents to the second itab using collect statement.

  • Modify internal table embedded in internal table as field

    Hi Experts,
    I am using function module CRM_DNO_READ_ORDER_TEXT.
    One of the output table of this fm is  ET_ALLTEXTS whixh is of structure COMT_TEXT_TEXTDATA_T.
    This structure has two fields one is GUI and other is LINES which itself contains the table in it.
    I want to delete one row from the data of this LINES table in main table ET_ALLTEXTS .
    Actually, this LINES table contains the texts entered by user from some application. So i want to edit the text.
    Pls help me..this is very complicated.
    thnx
    DIvya

    I guess Nilesh is right, there is something wrong with your declaration. Me for one, I've tried to reproduce your problem and I don't see any problem here. How did you declare your internal table for example?
    When you want to delete a line from table LINES you can't just say:
    delete et_alltexts-lines index 1.
    Because this will give you the error message with 'table without header line....". Instead you first have to loop at this ET_ALLTEXTS internal table and only then you have access to the individual lines, which is an internal table as well. The following is only an example, but it should be helpful:
    DATA: gv_header_guid TYPE crmt_object_guid.
    DATA: gt_textdata    TYPE comt_text_textdata_t ,
          gt_alltexts    TYPE comt_text_textdata_t.
    FIELD-SYMBOLS: <alltext>     LIKE LINE OF gt_alltexts.
    CALL FUNCTION 'CRM_DNO_READ_ORDER_TEXT'
      EXPORTING
        iv_header_guid = gv_header_guid
      IMPORTING
        et_textdata    = gt_textdata
        et_alltexts    = gt_alltexts.
    LOOP AT gt_alltexts ASSIGNING <alltext>.
      DELETE <alltext>-lines INDEX 1.
    ENDLOOP.

  • Can I pass a table using field-symbols to a PERFORM

    Can I pass an internal table using a field-symbol via a PERFORM that is stored in another program.
    For example, I want to pass lt_data using a field-symbol.  If I can do this, please tell me how to define a field-symbol for a table and how I setup the parameters on the FORM.
       perform TEST_FIELD_SYMBOLS in program zadd_data
                      changing lt_data[]
                       if found.
    Thanks.
    Regards,
    Ryan

    Since in ABAP all FORM-paramters are passe call-by reference, it makes imho no difference if u pass a table directly or via a fieldsymbol.
    U can pass a REF TO DATA to a form and then assign it to an FS like shown in the following example.
    TYPES: BEGIN OF s_data,
             data TYPE c,
           END OF s_data,
           s_tab TYPE STANDARD TABLE OF s_data.
    TYPES: r_tab TYPE REF TO data.
    START-OF-SELECTION.
      DATA: t_foo TYPE s_tab.
      DATA: ref_foo TYPE r_tab.
      GET REFERENCE OF t_foo INTO ref_foo.
      PERFORM my_form_fs USING ref_foo.
    FORM my_form_fs USING u_ref TYPE r_tab.
      FIELD-SYMBOLS: <fs> TYPE s_tab.
      DATA: w_tab TYPE s_data.
      ASSIGN u_ref->* TO <fs>.
      w_tab-data = 'X'.
      APPEND w_tab TO <fs>.
    ENDFORM.
    This also works for external performs....
    Best regards,
        Sebastian
    Message was edited by:
            Sebastian Rötzel

  • Move-corresponding in table type Field-Symbols

    Hi,
        I have to use one statement in field-symbol similar to "move-corresponding" in normal internal table.Is it possible to use statement similar to "Move-corresponding in field-symbols".
    For Eg:
    Field-symbols <FA_IT> type standard table.
    data:begin of wa_ekk,
       f1 type i,
       f2 type werks_d,
       f4 type posnr,
       end of wa_ekk,
    it_ekk  like standard table of wa_ekk.
    begin of wa_final,
       f1 type i,
       f2 type werks_d,
       f3 type i,
       f4 type n,
    end of wa_final,
    it_final like standard table of wa_final.
    assign it_ekk to <fs_it>.
    Loop at <fs_it>.
    *???????-i dont know how to move the value to it_final
    *---I know I can use assign component statement
    *-to move each field  to the target field
    but for that we need to know the field name or index position of the structure-
    Endloop.
    My requirment is now i want to move the content of <fs_it> into it_final internal table.
    I know that In normal itab we can use "move-corresponding" to move the value from it_ekk to it_final.
    In the same way how to use it in field-symbol concept.
    Requirement:Real time Processing of Internal table
    1) Content of it_ekk:
    f1   f2       f4
    12  1000  0023
    23  2000  0037
    2)After ASSIGN statement:
    Content of <fs_it> is:
    f1   f2       f4
    12  1000  0023
    23  2000  0037
    3)Now I want to move the content of <fs_it> to it_final
    Output of It_final:
    F1   F2    F3    F4
    12  1000   ---    0023
    23  2000   ---    0037
    Regards,
    Vigneswaran S

    Andrey's code is going to work only if you are running it in a non-unicode system.
    See code below for a Unicode system using similar effect to "Move-Corresponding" statement.
    FIELD-SYMBOLS: <fs_ekk> LIKE wa_ekk,
                   <fs_final> LIKE wa_final.
    ASSIGN it_ekk TO <fs_it> .
    LOOP AT <fs_it> ASSIGNING <fs_ekk>.
      ASSIGN <fs_ekk> TO <fs_final> CASTING.
      CLEAR <fs_final>-f3.
      APPEND <fs_final> TO it_final.
    ENDLOOP.
    Hope this solves your problem and please don't forget to reward points.
    Cheers,
    Sougata.

  • Create Internal table with fields coming as query result of multiple tables

    Hi
    I want to create internal table with the fileds which come as a result of a select query from multiple tables

    My code is something like this. I need  the data from various fields of diff tables depending on the excel file. This data is then to be put in a internal table
    *& Report  Z_EXTC
    report  z_extc.
    type-pools : abap.
    parameter: objname(25) type c.
    data : idetails type abap_compdescr_tab,
           xdetails type abap_compdescr.
    data : ref_table_des type ref to cl_abap_structdescr.
    data: p_table type string.
    data:l_string type string,
         l_filename(200) type c,
         dy_line  type ref to data,
         xfc type lvc_s_fcat,
         ifc type lvc_t_fcat.
    types:begin of itab,
         tabname type dd03l-tabname,
         fieldname type dd03l-fieldname,
         end of itab.
    types:begin of atab,
          tabname type dd03l-tabname,
          cnt type string,
          end of atab.
    field-symbols: <dyn_table> type table,
                   <dyn_table1> type standard table,
                   <dyn_wa>,
                   <dyn_field>.
    data: dy_table type ref to data,
          dy_table1 type ref to data.
    data: itab1 type itab occurs 0 with header line.
    data atab1 type atab occurs 0 with header line.
    data frstrec type i value 0.
    data lastrec type i value 0.
    l_string = ''.
    call function 'GUI_UPLOAD'
      exporting
        filename                      = 'C:\excel_files\FIELDS_CC.TXT'
       filetype                      = 'TXT'
       has_field_separator           = 'X'       .
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    *Refresh itab1.
    loop at itab1.
      on change of: itab1-tabname.
        if lastrec = 1.
          move l_string to atab1-cnt.
       move itab1-tabname to atab1-tabname.
          append atab1.
          l_string = ''.
        endif.
        move itab1-tabname to atab1-tabname.
        frstrec = 1.
      endon.
      if frstrec = 1.
        concatenate l_string itab1-fieldname into l_string separated by
    space.
        lastrec = 1.
      endif.
    *write:/ itab1-tabname,40 itab1-fieldname.
    endloop.
    move l_string to atab1-cnt.
    append atab1.
    loop at atab1.
      write:/ atab1-tabname,5 atab1-cnt.
    endloop.

  • How to assign tables to field-symbols

    how can i assign tables to field-symbols

    Hi Raj,
    Declare a fields symbol of type table, see below syntax:
    FIELD-SYMBOLS <FS> [<type>|STRUCTURE <s> DEFAULT <wa>].
    and then create an internal table and write the below code;
    ASSIGN itab to <fs>.
    Refer below eg:
    TYPES: BEGIN OF line,
             col1 TYPE c,
             col2 TYPE c,
           END OF line.
    DATA: wa TYPE line,
          itab TYPE HASHED TABLE OF line WITH UNIQUE KEY col1,
          key(4) TYPE c VALUE 'COL1'.
    FIELD-SYMBOLS <fs> TYPE ANY TABLE.
    ASSIGN itab TO <fs>.
    also see below link:
    http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb387a358411d1829f0000e829fbfe/content.htm
    Regards,
    Sunil

Maybe you are looking for

  • Vendor Ledger Report

    Dear Experts I have to code a Vendor Ledger report. Can anyone help me what table i should use. Regards

  • Short dump in transfer dataset  help me out

    hi to all experts,   my requirement is to extract some records from z table.insert some records and download it in a text file and upload into the program and bring the file into application server using open dataset close and transfer dataset .here

  • What's the best way to move photo folders from internal to external HD using LR to track change?

    I am trying to move my photo folders from Pictures on an iMac running Mavericks to an external HD as my main photo storage and to do so with LR 5.6 keeping track of the folders. I have 20K plus photos in the Catalog in the iMac's HD and wouldn't want

  • Possible to put in harddrive from a macbook pro?

    Hi, I'm selling my macbook pro. I upgraded the harddrive in it to a 320 gb harddrive, and I was wondering if it would be possible to simply take that harddrive, as is, and place it into a macbook. Would it have the drivers, etc? Thanks!

  • Would like to reduce the size of Firefox header

    The header in firefox takes up a lot of room and I would like to reduce the size to its bare minimum. There are tabs such as "most visited", "getting started", and "latest headlines" that I never use. I want just my file, edit, view, history, etc bar