How to initialize a field-symbols?

I have field-symbols structure <wa1>, <wa2>.
1. Supposed <wa1> has been assined value already, how can I copy content of <wa1> to <wa2>?
2. How to initialize <wa2>?
Thanks!

Hi,
Check this example..
field-symbols: <fs1>, <fs2>.
data: v_var1(10), v_var2(10).
v_var1 = 'ABC'.
v_var2 = 'DEF'.
assign v_var1 to <fs1>.
assign v_var2 to <fs2>.
write: / 'BEFORE...'.
write: / '<FS1> - ', <FS1>.
write: / '<FS2> - ', <FS2>.
<FS1> = <FS2>.
write: / 'AFTER...'.
write: / '<FS1> - ', <FS1>.
write: / '<FS2> - ', <FS2>.
CLEAR: <FS2>.
write: / 'AFTER CLEAR...'.
write: / '<FS1> - ', <FS1>.
write: / '<FS2> - ', <FS2>.
Thanks,
Naren

Similar Messages

  • How to change the Field Symbol, so Adobe Forms takes it as a Table?

    Hi guys,
    I created an Field Symbol, in a Interface which I use for Adobe Forms. The type of the Field Symbol is STANDARD TABLE, and this field symbol I fill with data from another program.
    But the problem is that in adobe forms, this Field Symbol is taken as TEXT FIELD and not as Table... and this shows me a Dump because it can't convert Internal Table to type C (the dump is like that).
    What I need, is how to change the Field Symbol, so Adobe Forms takes it as a Table?
    I looked at Adobe Form, and found this:
    The Type Category of the Field Symbol is DICTIONARY TYPE and I think I need to change it to Internal Table as shown in the right picture.
    Does someone have any idea?

    Hello Taly,
    To what i understand your requirement, you need to pass data from Field symbol to internal table in Adobe form.
    You have done it correct partially. I have replicated your scenario and steps are below -
    1) Create a Z structure
    2) Create Z Table Type
    3) Create Adobe Interface with Table & Field Symbol. Also do coding as shown to assign the internal table populated in driver program to filed symbol.
    4) Design Form as -
    5) Code driver as -
    *& Report  ZR_AF_FS_1
    REPORT  zr_af_fs_1.
    DATA: fm_name           TYPE rs38l_fnam,
           fp_docparams      TYPE sfpdocparams,
           fp_outputparams   TYPE sfpoutputparams,
           it_kna1           TYPE ztt_fs_1.
    * Sets the output parameters and opens the spool job
    CALL FUNCTION 'FP_JOB_OPEN'                   "& Form Processing: Call Form
       CHANGING
         ie_outputparams = fp_outputparams
       EXCEPTIONS
         cancel          = 1
         usage_error     = 2
         system_error    = 3
         internal_error  = 4
         OTHERS          = 5.
    IF sy-subrc <> 0.
    *            <error handling>
    ENDIF.
    *&---- Get the name of the generated function module
    CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'           "& Form Processing Generation
       EXPORTING
         i_name     = 'ZAF_FS_1'
       IMPORTING
         e_funcname = fm_name.
    IF sy-subrc <> 0.
    *  <error handling>
    ENDIF.
    *-- Fetch the Data and store it in the Internal Table
    SELECT kunnr name1 name2 adrnr FROM kna1 INTO TABLE it_kna1 UP TO 15 ROWS.
    * Language and country setting (here US as an example)
    fp_docparams-langu   = 'E'.
    fp_docparams-country = 'US'.
    *&--- Call the generated function module
    CALL FUNCTION fm_name
       EXPORTING
         /1bcdwb/docparams        = fp_docparams
          it_data                   = it_kna1
    *    IMPORTING
    *     /1BCDWB/FORMOUTPUT       =
       EXCEPTIONS
         usage_error           = 1
         system_error          = 2
         internal_error           = 3.
    IF sy-subrc <> 0.
    *  <error handling>
    ENDIF.
    *&---- Close the spool job
    CALL FUNCTION 'FP_JOB_CLOSE'
    *    IMPORTING
    *     E_RESULT             =
       EXCEPTIONS
         usage_error           = 1
         system_error          = 2
         internal_error        = 3
         OTHERS               = 4.
    IF sy-subrc <> 0.
    *            <error handling>
    ENDIF.
    6) Output -
    BR.

  • HOW CAN I SEND FIELD SYMBOL TO SUBROUTINE

    HAI,
             HOW CAN I SEND FIELD SYMBOL TO SUBROUTINE
             HOW CAN I COME BACK FROM 5TH INTERACTIVE REROT TO 2ND
    INTERACTIVE REPORT.
    THANK YOU.
    ASHOK

    Hi
    Write some code in the program to come to 2nd list from 5th list
    if sy-lsind = 5.
       sy-lsind = 2.
    endif.
    for field symbols see the doc
    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

  • How to modify the field symbol

    Hello Every1,
    I have a internal table and field symbol with the below structure.
    Data : begin of itab occurs 0,
               matnr like mara-matnr,
               ersda like mara-ersda,
           End   of itab.
    FIELD-SYMBOLS: <Matnr>    TYPE STANDARD TABLE.
    I have the field symbol with 10 records similar to the structure of itab. (Only matnr is populated and date as initial). Now I need to transfer the date value from itab to the field symbol for the matching matnr.
    Please let me know how to do it.
    Thanks,
    Siva.

    Sivaprakash,
    To my knowledge, a field-symbol cannot hold values on its own. It refers to a field or a table and work directly with the values.
    Your scenario cannot be achieved unless there is another internal table besides itab.
    Create a field-symbol of type itab2 and compare matnr with itab-matnr.
    If a record is found then move the date field to <fs>.
    Your code may look like this.
    loop at itab2 assigning <fs>.
       read table itab into wa_itab with key matnr = <fs>-matnr.
    if sy-subrc = 0.
      <fs>-date = wa_itab-date.
    endif.
    endloop
    Thanks,

  • How check variable in field-symbol?

    Hi
    I have in my report following code:
    data: l_auth_pai type zps_auth_pai,
             name(20)   type c.
       field-symbols: <rep_var>  type any.
           CONCATENATE 'pai_' l_auth_pai-stru_name into name.
            assign (name) TO <rep_var>.
    Could You suggest me a way, in which I can check:
    1. if in report a variable with name "name' exist/is declared
    2.if variable with name "name" is an internal table or a line
    Thx in advance
    J.S.
    Edited by: John Smith on Oct 17, 2008 12:46 PM

    Hi,
    data: l_auth_pai type zps_auth_pai,
             name(20)   type c.
       field-symbols: <rep_var>  type any.
           CONCATENATE 'pai_' l_auth_pai-stru_name into name.
            assign (name) TO <rep_var>.
    assume that there is a variable pai_matnr and its value is 'TEST'
    in your case I assume that l_auth_pai-stru_name contains value 'MATNR'
    then statement
    assign (name) TO <rep_var>
    will cause field-symbol <rep_var> to reference variable pai_matnr
    it could be structure or internal table depends on how it is declared.
    Regards,
    Vishal

  • How to read dynamic field symbol

    hi all,
       ASSIGN (tabname) TO <fs_tab>.
       in above code i am passing dynamic table to fs_tab
      can anyone tell me how can i read this field symbol........
      in other words i want to read dynamic field symbols

    Hi,
    you could do without the field-symbols:
    select from variable table
    grtz,
    Koen

  • How to use different field symbols to append data in a loop

    Hi experts!
    I have to loop over a itab and I want to save different  into one table.
    See my code below:
    DATA: l_hours        TYPE i,
          grfk_ok_code    TYPE sy-ucomm,
          grfk_values     TYPE TABLE OF GPRVAL WITH HEADER LINE,
          grfk_coltxt     TYPE TABLE OF GPRTXT WITH HEADER LINE,
          wa_ztab         TYPE zqm_chq_prueflos,
          l_index      TYPE n,
          l_field      TYPE string,
          l_line_check TYPE string
    FIELD-SYMBOLS:
          <fs_0102>   TYPE ANY,
          <fs_0304>   TYPE ANY,
          <fs_0506>   TYPE ANY,
          <fs_grenze> TYPE ANY
    REFRESH: grfk_values.
    CLEAR:   l_hours.
      LOOP AT ztab INTO wa_ztab.
      AT NEW qase_serialnr.
        CLEAR: l_line_check.
        IF wa_ztab-qase_serialnr CS '-01'
        OR wa_ztab-qase_serialnr CS '-02'.
            grfk_values-rowtxt = 'gelötet'.
            l_line_check = '0102'.
        ELSEIF wa_ztab-qase_serialnr CS '-03'
        OR     wa_ztab-qase_serialnr CS '-04'.
            grfk_values-rowtxt = 'geglüht'.
            l_line_check = '0304'.
        ELSEIF wa_ztab-qase_serialnr CS '-05'
        OR     wa_ztab-qase_serialnr CS '-06'.
            grfk_values-rowtxt = 'unbehandelt'.
            l_line_check = '0506'.
        ELSE.
          grfk_values-rowtxt = 'serialnr_wrong'.
        ENDIF.
      ENDAT.
    ***---------------------------------------------------->
      AT NEW qapp_usern1.
    *   X-axis: values are:0,50,100,...,400
        grfk_coltxt-coltxt = wa_ztab-qapp_usern1.
        SHIFT grfk_coltxt-coltxt LEFT DELETING LEADING '0'.
        APPEND grfk_coltxt.
        UNASSIGN <fs_grenze>.
        CLEAR: l_index, l_field.
        l_index = sy-tabix.
        CONCATENATE 'grfk_values-val' l_index INTO l_field.
        ASSIGN (l_field) TO <fs_grenze>.
        IF sy-subrc <> 0.
          EXIT.
        ENDIF.
        <fs_grenze> = 10.
        APPEND grfk_values.
      ENDAT.
      IF l_line_check = '0102'.
          UNASSIGN <fs_0102>.
          CLEAR: l_index, l_field.
          l_index = sy-tabix.
          CONCATENATE 'grfk_values-val' l_index INTO l_field.
          ASSIGN (l_field) TO <fs_0102>.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          <fs_0102> = wa_ztab-cf_dgp.
      ELSEIF l_line_check = '0304'.
          UNASSIGN <fs_0304>.
          CLEAR: l_index, l_field.
          l_index = sy-tabix.
          CONCATENATE 'grfk_values-val' l_index INTO l_field.
          ASSIGN (l_field) TO <fs_0304>.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          <fs_0304> = wa_ztab-cf_dgp.
      ELSEIF l_line_check = '0506'.
          UNASSIGN <fs_0506>.
          CLEAR: l_index, l_field.
          l_index = sy-tabix.
          CONCATENATE 'grfk_values-val' l_index INTO l_field.
          ASSIGN (l_field) TO <fs_0506>.
          IF sy-subrc <> 0.
            EXIT.
          ENDIF.
          <fs_0506> = wa_ztab-cf_dgp.
      ENDIF.
    ENDLOOP.
    My goal should be to fill the graphic with 4 Lines:
    1 is boarderline.
    2-3 are the lines with the looped values in "ztab"
    Do I have to use references to write the values in  into different rows of internal table "grfk_values"????
    With this code I want to fill the itab which I need for the GFW_PRES_SHOW function.
    The table I have to commit has the following structure:
    -rowtxt
    -val1
    -val2
    -val31
    EDIT:
    My current output are 2 lines the first has value 0 for each point and the second shows the correct values... The boarder which always should have value 10 is completly not shown.

    hopen this will help
    report zrich_0001 .
    data: begin of itab1 occurs 0,
          fld1(10) type c,
          fld2(10) type c,
          fld3(10) type c,
          end of itab1.
    data: begin of itab2 occurs 0,
        flda(10) type c,
        fldb(10) type c,
        fldc(10) type c,
        end of itab2.
    field-symbols: <fs_table> type table,
                   <fs_wa>,
                   <fs>.
    data: mod_field(10) type c.
    itab1-fld1 = '1'. itab1-fld2 = '2'. itab1-fld3 = '3'. append itab1.
    itab1-fld1 = '4'. itab1-fld2 = '5'. itab1-fld3 = '6'. append itab1.
    itab2-flda = 'A'. itab2-fldb = 'B'. itab2-fldc = 'C'. append itab2.
    itab2-flda = 'D'. itab2-fldb = 'E'. itab2-fldc = 'F'. append itab2.
    assign itab1[] to <fs_table>.
    assign itab1 to <fs_wa>.
    mod_field = 'FLD2'.
    perform modify_table.
    perform write_table.
    assign itab2[] to <fs_table>.
    assign itab2 to <fs_wa>.
    mod_field = 'FLDC'.
    perform modify_table.
    perform write_table.
          FORM modify_table                                             *
    form modify_table.
      loop at <fs_table> into <fs_wa>.
        assign component mod_field of structure <fs_wa> to <fs>.
        <fs> = 'Modified'.
        modify <fs_table> from <fs_wa>.
      endloop.
    endform.
          FORM write_table                                             *
    form write_table.
      loop at <fs_table> into <fs_wa>.
        do.
          assign component sy-index of structure <fs_wa> to <fs>.
          if sy-subrc <> 0.
            exit.
          endif.
          if sy-index = 1.
            write:/ <fs>.
          else.
            write: <fs>.
          endif.
        enddo.
      endloop.
    endform.
    regards
    navjot
    reward points if helpfull

  • How to move field symbol internal table to internal table with header line?

    Dear all,
    hi...hereby i would like to ask how i can move field symbol internal table to a internal table?
    as i know field symbol internal table is without header line..
    so, may i know how to do this....to move field symbol internal table to internal table which consist of header line and field and record will same as field symbol internal table...in additional, my field symbol internal table is dynamic table mean everytime will have flexible columns..?
    Please advise...
    Thanks
    Regard,
    ToToRo.
    Edited by: @ToToRo@ on Aug 20, 2009 6:16 AM

    Hello,
    Try this way:
    If both the type of internal tables are same then you can directly assign dynamic internal table to static internal table.
    itab = <itab>.
    Suppose you have field symbol internal table <itab> which is different in structure from ITAB.
    Now, you can create <wa> as follow:
    FIELD-SYMBOLS <wa>.
    DATA wa TYPE REF TO DATA.
    CREATE DATA wa TYPE LINE OF <itab>.
    ASSIGN wa->* to <wa>.
    This way your work area is read.
    Using [ASSIGN COMPONENT|http://help.sap.com/saphelp_nw04/helpdata/EN/fc/eb3923358411d1829f0000e829fbfe/content.htm] syntax you can read required component of <wa>.
    Finally you can use that value to load static internal table.
    You can also refer to my thread on [Dynamic table|Re: Creating Dynamic table].
    Hope this helps!
    Thanks,
    Augustin.
    Edited by: Augustarian on Aug 20, 2009 10:06 AM

  • Passing field-symbols to a function module

    Hey experts.
    In this scenario I am in the need to pass two buffer fieldsymbols (one contains a string, the other one a table) from my main programm to a function module.
    The main programm handles the user input and double-loops the function call with changing parameters. I cannot initialize the field-symbols within a loop since I'd loose the data. So I need to declare them BEFORE the function call proceeds, get them transfered over to the function module AND I need them saved from one call to the next one.
    Any suggestions ?
    How can I set global parameters available in my main programm and my function module?

    Hi Paul,
    Field symbols never contain data but refer to some existing data objects, so what you need is to copy the latter (string and internal table in your case), and you can define to which data objects the field symbols refer to, at any time. To duplicate a data object, it will depend if they are defined statically or dynamically?
    How can I set global parameters available in my main programm and my function module?
    It's difficult to give you one answer, it may depend on your scenario, you have lots of possibilities, interface work area, global data that is written and read using dedicated procedures, export/import to memory...
    A little excerpt of your code would help.
    BR
    Sandra

  • Better alternative to header lines, use of logical database, field-symbols

    Hello experts,
    I am wondering if theres a better and faster alternative than declaring a header line for an itab. are work areas faster?
    What is the use of logical database? can you please give me an example on how to use it in reports.
    how do I use field-symbols? I am confused on how it works.
    P.S. I recently installed SAP netweaver preview abap edition
    in my home PC and I am wondering if I could practice BDC, user exits, etc. If so, how?
    Again, thanks for all your help since I'm kinda new to ABAP.

    I always use this...It uses header lines, but at least is smaller -:)
    <b>DATA: BEGIN OF MY_TAB TYPE STANDARD TABLE OF BKPF WITH HEADER LINE.</b>
    For logical databases, you can check my blog...I always use LDB for HR programs -:)
    <a href="/people/alvaro.tejadagalindo/blog/2006/02/19/how-to-deal-with-hr-payroll-reports:///people/alvaro.tejadagalindo/blog/2006/02/19/how-to-deal-with-hr-payroll-reports
    LDB's provides a lot of information, because they gather it from a lot of different tables...
    A Field-Symbols is like a pointer in C++, like an alias for a variable...Here's a small example...
    REPORT Z_ATG_DUMMY.
    FIELD-SYMBOLS: <F1>, <F2> TYPE I.
    DATA: TEXT(20) TYPE C VALUE 'Hello, how are you?',
          NUM TYPE I VALUE 5,
          BEGIN OF LINE1,
          COL1 TYPE F VALUE '1.1e+10',
          COL2 TYPE I VALUE '1234',
          END OF LINE1,
          LINE2 LIKE LINE1.
    ASSIGN TEXT TO <F1>.
    ASSIGN NUM TO <F2>.
    DESCRIBE FIELD <F1> LENGTH <F2>.
    TEXT = 'CHAU'.
    WRITE: / <F1>, 'has length', NUM.
    WRITE: / TEXT, 'has length', NUM.
    ASSIGN LINE1 TO <F1>.
    ASSIGN LINE2-COL2 TO <F2>.
    MOVE <F1> TO LINE2.
    ASSIGN 'LINE2-COL2 =' TO <F1>.
    I just can't install SAPNWSP...I only got MiniSap...But I got all the development enviorment...Don't know about the User-Exits...Actually I don't think so...Because those "mini" systems doesn't come with any functional module.
    Greetings,
    Blag.

  • 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

  • Using Field-Symbols in a user exit to change the importing parameter

    Please don't ask why but I need to use a user exit, changing the importing parameter.  I decided that I could do this using field-symbols.
    Please excuse my ignorance but I have never used field symbols for something such as this.
    Here is my goal:  Loop through an internal table (im_document-item).  When I find what I need I want to make a change to this line (not so hard if I am looping into a field symbol) and also append a line to the end of the table im_document-item.
    I have the following so far:
      DATA: wa_item TYPE accit,
            wa_item_out type ACCIT_SUB.
    FIELD-SYMBOLS: <document> type acc_document,
                   <accit> TYPE ACCIT.
    LOOP AT im_document-item ASSIGNING <accit> where saknr = '0000211000'.
    * Modify the curent line
    wa_item = <accit>
    * Append a new line into table im_document-item.
    ENDLOOP.
    How can I use field-symbols to append a line to this table?  Please note that the table in question (im_document-item) is an importing only parameter.
    Regards,
    Davis

    that will allow me to append an initial line with <accit> pointing to the line. Therefore I just have to modify <accit> and the new line will then have my changes?
    Yep, that is exactly it.    So after the APPEND statement, simply fill the fields of the <accit>.
    append initial line to im_document-item ASSIGNING <accit>.
    <accit>-field1 = 'Blah'.
    <accit>-field2 = 'Blah'.
    Regards,
    Rich Heilman

  • Difference between Field symbols and work area for Internal tables

    Hi,
    In ECC versions we all know that we need to declare the internal tables without headerline, and for handling the internal tables we need to use exclusive work areas.
    Currently i have an issue that we have been asked to use field symbols instead of work areas...can any one help me how to use the field symbols and also let me know how it will improve the performance of the program..
    Thanks and Regards,
    Kathir

    Hi
    DATA: WA TYPE ITAB.
    LOOP AT ITAB INTO WA.
    IF WA-FIELD = .....
    ENDIF.
    ENDLOOP.[(code]
    FIELD-SYMBOLS <WA> TYPE ANY.
    LOOP AT ITAB ASSIGNING <WA>.
    ENDLOOP.
    Now the problem is you can't know the name of the fields of the table at runtime, so you can't write:
    IF <WA>-FIELD = .....
    ENDIF.
    Anyway you can create a field-symbols strcturated like the table:
    [code]FIELD-SYMBOLS <WA> TYPE ITAB.
    LOOP AT ITAB ASSIGNING <WA>.
      IF <WA>-FIELD = .....
      ENDIF.
    ENDLOOP.
    I don't know which are the differences for the performance between to use a field-symbol and to use a structure as work-area.
    The differnce between the field-symbols and work-area is the field-symbol is assigned directly to the record, so u don't need to do a MODIFY statament to change something:
    LOOP AT ITAB INTO WA.
      WA-FIELD =
      MODIFY ITAB FROM WA.
    ENDLOOP.
    LOOP AT ITAB ASSIGNING <WA>.
      <WA>-FIELD =
    ENDLOOP.
    These two pieces of abap code do the same action, so probably the field-symbol improve the performance because it do an access directly to the record without to use an external structure as workarea.
    Max

  • Field symbols to Z tables

    I have uploaded the table data from a file into a field symbol.
    But I am unable to insert the data present in the field symbol into a custom table.
    I am getting a dump.
    Could any one please suggest.

    Hi,
    You can find how to assgin the field symbol to custome table in the  bellow code
    LOOP AT gt_prps ASSIGNING <fs_prps> WHERE stufe = 1.
        gv_line_count = gv_line_count + 1.
        READ TABLE gt_pa0001 INTO gs_pa0001 WITH KEY pernr = <fs_prps>-zzmattermanager
         BINARY SEARCH.
        READ TABLE gt_proj ASSIGNING
        <fs_proj> WITH KEY pspnr = <fs_prps>-psphi  BINARY SEARCH.
        READ TABLE gt_zzwip WITH KEY rv_wtgbtr1 = <fs_prps>-wip ASSIGNING
        <fs_zzwip> BINARY SEARCH.
        READ TABLE gt_bsid WITH KEY dmbtr = <fs_prps>-client ASSIGNING
         <fs_bsid> BINARY SEARCH.
        gs_final-pspnr = <fs_proj>-pspnr.
        gs_final-post1 = <fs_proj>-post1.
        gs_final-ename = gs_pa0001-ename.
        gs_final-kunnr = <fs_proj>-kunnr.
        gs_final-name1 = <fs_proj>-name1.
        gs_final-wip = <fs_prps>-wip.
        gs_final-unpaid = '0'.
        gs_final-client = <fs_prps>-client.
        APPEND gs_final TO gt_final.

  • 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

Maybe you are looking for

  • TS1424 My iPod wont connect to the iTunes Store when I am about to buy an app what do I do?

    My iPod wont connect to the iTunes Store when I am about to get an app when I go to enter my password it says it can't connect to iTunes Store. What do I do?

  • How to use constant in expression language

    I have class Constant which contains public static final (constant fields). I want to use those constants in expression language in jsp ${requestScope.result eq with some constant} <c:if test="${requestScope.result eq '<%= Constants.MODE %>'}">      

  • SAP NetWeaver 7.01 ABAP Trial Version System Requirements:

    Hi, I have downloaded the SAP NetWeaver 7.01 ABAP Trial Version I am about to instal in my system, this system already has the SAPGUI installed. now my question is about one ofhte system requirement ""The SAP system requires serveral ports for commun

  • C2-00: Can't watch online videos

    Why i cant watch online videos in c2-00 Moderator's note: We have amended the title of this post as this was moved from another thread.

  • Trouble with opening Photoshop

    Hi, I've just paid to update my subscription for Photoshop online, all went through well. I have restarted my computer and waited an hour but when I launch Photoshop it opens a dialogue box asking me to renew my subscription. I need to finish a proje