Regarding reading a field symbols with a key

Hi
i have a scenario where i need to delete some duplicates from previous selection
i' m selecting some 1000 records from one table. now in my second selection i' m reading records from 1001 to 2000.
now i need to compare the last record(1000th) and compare the record with this second selection(1001 to 2000). in this scenario i' m using all feild symbols. here is the code
        SELECT * FROM (pa_tab)
               INTO TABLE <lt_dyntable>
               UP TO pa_ind ROWS
               WHERE (lt_conditions_temp).
initially <lt_dyntable> contains 1000 records
if lv_dbcnt GT 1000.
read table <lt_dyntable> assigning <ls_dyntable> with key
<ls_dyntable> = <ls_check>.-----ERROR
endif.
this i have written to get the last record.
      LOOP AT <lt_dyntable> assigning <ls_dyntable>.
      ENDLOOP.
i have stored the last record in this check. as the table <lt_dyntable> should be refreshed.
move <ls_dyntable> to <LS_CHECK>.
the code which i mentioned is giving me an error.
  <ls_dyntable> TYPE ANY,
  <ls_check> type any.
let me know where i' m doing the error.
Thanks & Regards,
T.Subhashini.

Hi,
I think it is looking for a field <ls_dyntable> in your internal table <lt_dyntable>
read table <lt_dyntable> assigning <ls_dyntable> with key
<b><ls_dyntable> = <ls_check>.-----</b>ERROR
Try this..
READ TABLE <lt_dyntable> assigning <ls_dyntable> INDEX 1.
IF <ls_dyntable> = <ls_check>.
ENDIF.
Thanks,
Naren

Similar Messages

  • Read Data from the dynamic Field Symbol with key ?

    Dear All,
    I've  2 dynamic internal tables in the form of field symbols.
    Now,I want to loop the item field symbol, read the header field symbol content and then move the corresponding into a final field symbol.
    How to read the field symbol with key ?
    When I'm trying to give the key clause in the paranthesis it's giving a syntax error.
    Any clues ?
    FYI .....
    * Get the Dynamic Field and Value for the Date/Year and convert it into Year value
      LOOP AT <fs_t_son> ASSIGNING <wa_son>.
        ASSIGN COMPONENT gwa_znrows_def-fieldname OF STRUCTURE <wa_son> TO <fs_year>.
        IF sy-subrc = 0.
          CLEAR gv_string.
          MOVE <fs_year> TO gv_string.
          CLEAR gv_year.
          gv_year = gv_string.
          <fs_year> = gv_year.
        ELSE.
    * When the Date/year Field is not in the Table then -->
    * Get the Dynamic Field and Value
          ASSIGN COMPONENT gwa_znrows_def-kfldname OF STRUCTURE <wa_rson> TO <fs_value>.
    * Populate field for Dynamic Where condition
          CLEAR gv_value.
          CONCATENATE '''' <fs_value> '''' INTO gv_value.
          CONCATENATE gwa_znrows_def-kfldname '=' gv_value INTO gt_where SEPARATED BY space.
          APPEND gt_where.
          CLEAR gt_where.
          READ TABLE <fs_t_rson> ASSIGNING <wa_rson> ( gt_where ).  "Key clause
        ENDIF.  " if sy-subrc = 0.  "Assign
      ENDLOOP.
    Thanks & regards,
    Deepu.K

    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>.
    READ TABLE <fs> WITH TABLE KEY (key) = 'X' INTO wa.
    The internal table itab is assigned to the generic field symbol <fs>, after which it is possible to address the table key of the field symbol dynamically. However, the static address
    READ TABLE <fs> WITH TABLE KEY col1 = 'X' INTO wa.
    is not possible syntactically, since the field symbol does not adopt the key of table itab until runtime. In the program, the type specification ANY TABLE only indicates that <fs> is a table. If the type had been ANY (or no type had been specified at all), even the specific internal table statement READ TABLE <fs>  would not have been possible from a syntax point of view.

  • Reading a field symbol whose structure is dynamic

    Hi Experts,
    I have used the concept of dynamic internal tables to select data from COSS/COSP for e.g.database tables.Field symbol of type " ANY TABLE" has been used to select data , as the dynamic structure is assigned directly to the field symbol.
    To calculate the values of various fields I need to read the this field symbol for diferent line items , but I get a compilation error saying " Key not Found ". I understand that I am not able to read the field symbol because its structure is of type 'ANY TABLE' .How do I read this field symbol ?
    The field symbol gets the structure of dynamic internal table as formed initially by using class concept.Is their any way in which I could get the structure of this field symbol or any other way to read it?
    Thanks in advance.
    Regards
    Reetwika

    Hi Ritwika,
    Even if u use the concept if dynamic internal table, u can read the each of the field of ur structure,
    if u know the name of the field.
    for example:
    MATNR being one of the field of internal table
    field-symbols : <fs> type any.
    loop at <fs_it> into <fs_wa>.
    ASSIGN COMPONENT 'MATNR' OF STRUCTURE <fs_wa> to <fs_matnr>.
    " in this case matnr field value will be assigned to the field symbol <fs_matnr>, so it can be used further.
    endloop.
    " do reply if still confused.
    Rohit G
    Edited by: Rohit Gaharwar on Aug 12, 2009 11:51 AM

  • Read Dynamic Field Symbol

    Hello ,
    I have a field symbol where i am not aware of fields (Column Name) , i mean column names are Dynamic.
    Problem is i need to read this field symbol value , how can i do it . It will always have 1 record
    Example
    Field Symbol looks something like this
    <FS> Column Name dynamic -
    >
    A B C
    Record
    1 2 3
    So now i have to refer to Second Column (i.e. is B in this case) , how should i do
    What i tried .
    1. <FS>-(Column Name in variable in brackets) - It doesnt work , Error Message unable to interpret the number B
    2. <FS>[1] - Error out.

    For a structured data object <s>, you can use the statement
    <b>
    ASSIGN COMPONENT <comp> OF STRUCTURE <s> TO <FS>.
    </b>
    to assign one of its components <comp> to the field symbol <FS>. You can specify the
    component <comp> either as a literal or a variable. If <comp> is of type C or a structure which
    has no internal tables as components, it specifies the name of the component. If <comp> has any
    other elementary data type, it is converted to type I and specifies the number of the component.
    In the assignment is successful, SY-SUBRC is set to 0. Otherwise, it returns 4.

  • 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

  • Dynamic Field Symbols with Structures

    Hello,
    I am stuck on a piece of code and looking for some help.  I am trying to figure out how to assign values in a structure of a dynamically defined field symbol to the structure inside another dynamically defined field symbol.  Here is my code and some comments.  Basically I am uploading data via a flatfile and placing it into a dynamically defined field symbol.
    DATA:   
    lr_area     TYPE REF TO cl_sem_planarea_attributes, 
    lr_t_data   TYPE REF TO data, 
    lr_s_data   TYPE REF TO data, 
    lr_s_chas   TYPE REF TO data, 
    lr_s_kyfs   TYPE REF TO data.
    FIELD-SYMBOLS:      
    <lt_data> TYPE STANDARD TABLE,    
    <ls_data> TYPE ANY,    
    <ls_chas> TYPE ANY,    
    <ls_kyfs> TYPE ANY.
    DATA: ls_chasel TYPE upc_ys_chasel,     
    ls_charng TYPE upc_ys_charng.
    FIELD-SYMBOLS:
    <f> TYPE ANY,              
    <chas> TYPE TABLE,              
    <kyfs> TYPE ANY. 
    CALL METHOD cl_sem_planarea_attributes=>get_instance   
    EXPORTING       i_area      = i_area   
    RECEIVING       er_instance = lr_area. 
    CHECK sy-subrc = 0. 
    CREATE DATA lr_s_data TYPE (lr_area->typename_s_data). 
    ASSIGN lr_s_data->*   TO <ls_data>. 
    CREATE DATA lr_t_data TYPE (lr_area->typename_t_data). 
    ASSIGN lr_t_data->*   TO <lt_data>. 
    CREATE DATA lr_s_chas TYPE (lr_area->typename_s_chas). 
    ASSIGN lr_s_chas->*   TO <ls_chas>. 
    CREATE DATA lr_s_kyfs TYPE (lr_area->typename_s_kyfs). 
    ASSIGN lr_s_kyfs->*   TO <ls_kyfs>. 
    LOOP AT gt_file INTO ls_file.   
    CLEAR <ls_data>.   
    MOVE-CORRESPONDING ls_file TO <ls_kyfs>. " Map key figures   
    MOVE-CORRESPONDING ls_file TO <ls_chas>. " Map chars
    *    MOVE-CORRESPONDING ls_file TO <ls_data>. " Map data
    *        ASSIGN COMPONENT 'ls_chas' OF STRUCTURE <ls_Data> TO <chas> .
    *        IF sy-subrc = 0.
    **          <chas> = <ls_chas>.
    *MOVE-CORRESPONDING <ls_chas> to <chas>.
    *        ENDIF.     
    <chas> = <ls_chas>.     
    LOOP AT <chas> INTO ls_chasel.     
    READ TABLE ls_chasel-t_charng INTO ls_charng INDEX 1.     
    IF sy-subrc = 0 AND ls_charng-option = 'EQ'.       
    ASSIGN COMPONENT ls_chasel-chanm OF STRUCTURE <ls_chas> TO <ls_data>.       
    IF sy-subrc = 0.         
    <ls_data> = ls_charng-low.       
    ENDIF.     
    ENDIF.   
    ENDLOOP.   
    COLLECT <ls_data> INTO <lt_data>. 
    ENDLOOP.
    Ls_chasel has 2 components:
    Chanm (a char 30 which contains the component’s name)
    T_CHARNG (a table with values for chanm)
    Ls_data has 2 components:
    S_chas (a structure with a list of components and values – same list as would have)
    S_kyfs (a structure with a list of components and values – same list as would have)
    Lt_data is a table of ls_data
    I need to get the data in ls_chas into the ls_chas structure of ls_data and the ls_kyfs data into the ls_kyfs structure of ls_chas and append ls_chas to lt_data.  Anything that is commented out is something I tried that didn't work.  RIght now I get a dump at the 'loop at <chas> into ls_chasel' that the field symbol is not assigned.
    Thanks for your help!

    It looks like the the original poster didn't completely understand all he was doing. (This is why I always recommend getting an ABAP programmer in for what is, essentially, advanced ABAP programming, rather than someone "kind of familiar" with ABAP trying it - we're often available at very reasonable rates ).
    It seems he's using ito_chasel to set the fixed values (which is in fact quite smart!). What isn't required, so far as I can tell without implementing, are any of the statements involving <ls_kyfs> or <ls_chas>.
    The following should be sufficient (with the necessary declarations etc. - but really: omit <ls_kyfs> and <ls_chas> - I'm sure they're not needed and they confuse things).
    " Go through the data from the flat file
    LOOP AT gt_file INTO ls_file.
      CLEAR <ls_data>.
      " Transfer the characteristics
      MOVE-CORRESPONDING ls_file TO <s_chas>.
      " Transfer the key figure
      MOVE-CORRESPONDING ls_file TO <s_kyfs>.
      " Go through the fixed characteristic selections from the package
      LOOP AT ito_chasel INTO ls_chasel.
        " We only care about the first value (if there is one).
        READ TABLE ls_chasel-s_charng INTO ls_charng INDEX 1.
        " Check there is a first value and that it is fixed
        CHECK sy-subrc IS INITIAL AND ls_charng EQ 'EQ'.
        " Get access to that characteristic
        FIELD-SYMBOLS <fixed_value> TYPE ANY.
        ASSIGN COMPONENT ls_chasel-chanm OF STRUCTURE <s_chas> TO <fixed_value>.
        " Make sure that it exists in the data structure
        CHECK sy-subrc IS INITIAL.
        " Set the value
        <fixed_value> = ls_charng-low.
      ENDLOOP.
      COLLECT <ls_data> INTO <lt_data>.
    ENDLOOP.

  • Read line + field symbol

    Hi expets.
    I have some doubt related to Read Line, iknow it's use but it fails when i m using field symbol.
    1->
    Do w_lines times.
    Read line sy-index field value <fs_customer>-name1.
    enddo
    Here it makes dump because i m using fied symbol. Its type is correct .
    But when i use int. table or structure it's wrks fine
    2-> when i try to hide a field sybmol it shows dump. what can i do?
      actually in a loop i_customer assigning <fs_customer>
      write: /<fs_customer>-name1..etc...
    hide : <fs_customer>-kunnr.
    here it makes dump when i hide
    3-> Problem is-
    I have two reports on same screen.1 for Customer and another for Vendor.
    both have check boxes.
    I want to read them from Screen output and for Customer name i have to get the Customer no. for the selected check box.
    Same is with the venodr report n same screen.
    wen slect Vendor name check box get vendor no.
    My issue is that how i should read two reports on same screen for check boxes.
    I mean i will make a DO ...ENDDO . and on it i will read for sy-line-1 times.
    then hw i will separate that whetehr this read is for Customer or Vendor.
    Do i need to set  some flag and then hide that flag.
    and supoose if Flag eq C at read then its custoer and as it will be V then its Vendor,
    All teh Vendor report is Below thw Customer.
    Please tell me the advantage of Field symbol over heaer lines of table./
    thanks in Advance.

    Loop to get the unselected checkbox
      DO l_line_lockbx TIMES.
      Read the lines on Screen -for LOCK BOX
        READ LINE sy-index FIELD VALUE g_check
                                                         <fs_lockbx>-name1 .
        IF  sy-subrc EQ 0 .
      If Check Box is not selected-Store in a separate table
        if g_check eq c_x.
        clear l_name_lockbx.
        move <fs_lockbx>-name1 to l_name_lockbx.
      Read table to get the Detail when ceck box not selected
        read table i_lockbx with key name1 = l_name_lockbx
                                    binary search
                                    assigning <fs_lockbx>.
          IF  sy-subrc EQ 0.
          MOVE : <fs_lockbx>-serial     TO <fs_rcvlad>-serial ,
                       <fs_lockbx>-rcvlad    TO <fs_rcvlad>-rcvlad ,
                       <fs_lockbx>-docnum TO <fs_rcvlad>-docnum .
          APPEND <fs_rcvlad> TO i_rcvlad.
          CLEAR :<fs_rcvlad>  ,
                       <fs_lockbx> ,
                         g_check     .
         endif.            " IF  sy-subrc EQ 0
        ENDIF.             " if g_check ne c_x.
      ENDDO.               " DO l_line_lockbx TIMES.

  • Problem  FIELD-SYMBOL with HASHED TABLE

    Hello gurus,
    I have a problem with the following code. It is called in method MB_DOCUMENT_BEFORE_UPDATE of badi MB_DOCUMENT_BADI. I need to read the serial numbers of all items. I tried to do it with a field symbol. The information I need is stored in the hased table (SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL->PT_GOSERIAL_KERNEL. The systems returns sy-subrc = 4 after the assign. Can anyone help me? Thanks!
    TYPES: BEGIN OF ty_s_goserial,
              selected TYPE xfeld,
              serialno TYPE    gernr,
            END OF ty_s_goserial,
            ty_t_goserial  TYPE STANDARD TABLE OF ty_s_goserial WITH
                                                     NON-UNIQUE DEFAULT KEY.
      TYPES: BEGIN OF ty_s_goserial_kernel,
                global_counter TYPE migo_global_counter,
                t_goserial TYPE ty_t_goserial,
            END OF ty_s_goserial_kernel.
    types: tyt_goserial TYPE HASHED   TABLE OF ty_s_goserial_kernel
                                     WITH UNIQUE KEY global_counter.
        fs_l_serialno = '(SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL->PT_GOSERIAL_KERNEL'.
        FIELD-SYMBOLS: <fs_serialno> type tyt_goserial.
        ASSIGN (fs_l_serialno) TO <fs_serialno>.
        IF sy-subrc = 4.
          WRITE: / 'Ouch...'.
        ENDIF.

    Hi,
    Try adding body operator..at the end as it is an internal table..
    (SAPLMIGO)LCL_MIGO_GLOBALS=>KERNEL->PT_GOSERIAL_KERNEL[]'.
    Thanks
    Naren

  • Using field-symbols with FOR ALL ENTRIES IN ...

    Hi all of you,
    Is it possible to use field symbol by the FOR ALL THE ENTRIES IN itab.
    Normally, isn't possible.
    So my problem is that I'm having duplicate code.
    I've something like this.
          IF ap_objcl EQ omaterial.
            SELECT objectid
            INTO TABLE i_cdpos
            FROM cdpos
            FOR ALL ENTRIES IN otf_materials
            WHERE objectclas = ap_objcl AND
                  tabname = otf_materials-tablename AND
                  fname = otf_materials-fieldname.
         ELSEIF ap_objcl EQ otf_documents...
    And I'm looking to use otf_materials and otf_documents
    So, instead to duplicate the code, I'm looking for a way to restrain the code by using maybe field symbols.
    Ideal :
    FIELD-SYMBOLS : <otf_mats_docs> LIKE OTF_TABLE.
    IF ap_objcl EQ omaterial
    ASSIGN local copy of otf_materials TO <otf_mats_docs> CASTING.
    ELSEIF ap_objcl EQ odocuments
    ASSIGN local copy of otf_documents TO <otf_mats_docs> CASTING.
    ENDIF.
            SELECT objectid
            INTO TABLE i_cdpos
            FROM cdpos
            FOR ALL ENTRIES IN <otf_mats_docs>
            WHERE objectclas = ap_objcl AND
                  tabname = <otf_mats_docs>-tablename AND
                  fname = <otf_mats_docs>-fieldname.
    IF ap_objcl EQ omaterials.
    *Do nothing
    ELSEIF ap_objcl EQ odocuments.
    *Do something with the date in otf_documents.
    ENDIF.
    Regards,
    Kais

    Hi,
    Ok, using forms is great things to deal with it.
    But, may be it'll slow down the program and I need a really rapid program.
    I tried using form.
    The problem by pushing the FOR ALL ENTRIES IN <structure>
    didn't works.
    It tells me that the structure that I pushed via "using" is not an internal table.
    The same structure work find in the global program.
    What should I do ?.
    The structure is given by as a parameters in Function Module.
    FORM data_search
      USING
        object_cl TYPE j_objnr
        table_data LIKE ****structure****
      CHANGING
        global_lst TYPE ANY TABLE.
          DATA : BEGIN OF otf_list OCCURS 0,
               objectid TYPE cdpos-objectid,
             END OF otf_list.
      DATA : ii_cdpos LIKE TABLE OF otf_list WITH HEADER LINE.
         IF table_data IS NOT INITIAL.
            SELECT objectid
            INTO TABLE ii_cdpos
            FROM cdpos
            FOR ALL ENTRIES IN table_data
            WHERE objectclas = object_cl AND
                  tabname = table_data-tablename AND
                  fname = table_data-fieldname.
          ELSE.
            SELECT objectid
            INTO TABLE i_cdpos
            FROM cdpos
            WHERE objectclas = ap_objcl.
          ENDIF.
          SELECT DISTINCT objectid
          INTO TABLE global_lst
          FROM cdhdr
          FOR ALL ENTRIES IN ii_cdpos
          WHERE ( ( udate GT from_date AND udate LT to_date ) OR
                  ( udate EQ from_date AND udate NE to_date AND utime GE from_time ) OR
    *              ( udate NE from_date AND udate EQ to_date AND utime LE to_time ) OR
    *              ( udate EQ from_date AND udate EQ to_date AND utime GE from_time AND utime LE to_time )
                  ( udate EQ to_date AND (
                                           udate NE from_date OR
                                           utime GE from_time
                                     AND utime LE to_time )
                ) AND
                objectclas = ap_objcl AND
                objectid = ii_cdpos-objectid.
    ENDFORM.

  • Field symbol with top of page in reuse_alv_list

    When using the top_of_page in REUSE_ALV_LIST_DISPLAY
    I had in the old programm reference to values in the outtab for the header in the new programm I use dynamic tables and I wonder how to add those values in a header.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
             EXPORTING
                  i_callback_program       = h_repid
                  i_callback_pf_status_set = 'SET_PF_STATUS'
                  i_callback_user_command  = 'USER_COMMAND'
    *            i_structure_name         = 'ZDOORBEL_ALV'
    *            IT_EVENTS                = TEVENTS
                  is_layout                = slayout
                  it_fieldcat              = it_fieldcat[]
                  it_sort                  = tsort[]
                  i_save                   = a_save
                  is_variant               = variant
             TABLES
                  t_outtab                 = <ta_output>
    in my top_of_page I try to read the current row of <ta_output> but I have no clue on how to do it. I gives the error that there is no workarea assigned to <ta_output>
    anybody knows how to read the current line of <ta_output>  in top_of_page ?
    kind regards
    arthur de smidt

    I have
    * fieldsymbols voor dynamische ALV tabel
    FIELD-SYMBOLS: <ta_output> TYPE table ,
                  <ta_color> TYPE table,
                  <l_line>  TYPE ANY,
                  <wa_output> type any,
                  <wa>  TYPE ANY,
                   <l_field> TYPE ANY,
                   <fs> TYPE ty_pernrs.
    FORM top_of_page.
      CREATE DATA new_line LIKE LINE OF <ta_output>.
      ASSIGN new_line->* TO <wa_output>.
      read table <ta_output> assigning <wa_output> index sy-tabix.
    if ra_pernr = 'X'.
      if <wa_output>-week = space or <wa_output>-pernr = '00000000'.
    but still it says that the
    The data object "<WA_OUTPUT>" has no structure and therefore no
    component called "WEEK" . .
    Edited by: A. de Smidt on Jun 26, 2008 11:07 AM

  • Read dynamic field symbol Work Area before append to dynamic table

    Hi experts:
    I have a dynamic work area but before doing an append to the dynamic table, I need to do some validation on some fields of the work area in order to decide to append it or not, but I don't know how...
    More or less this is the example
    loop at so_kschl.
        field = so_kschl-low.
        if <t_dyntable>-field = 0. "if the value of this field in dinamic table is 0.
    don't append
        else.
           APPEND <fs_dyntable> TO <t_dyntable>.  
        endif.
    endloop.
    Thank you very much for your help.
    Miriam

    Check this example, you read the component of the dynamic work area and assign it to a field-symbols. In this case, I validate that the entry is always 'a'.
    DATA: i_lvc TYPE lvc_t_fcat WITH HEADER LINE,
          i_table TYPE REF TO data,
          l_style TYPE lvc_fname,
          l_warea TYPE REF TO data,
          l_name(7) VALUE 'VARCHAR'..
    FIELD-SYMBOLS: <fs> TYPE table,
                  <fs2> TYPE ANY,
                  <fs3> TYPE ANY.
    PARAMETERS p_char TYPE c LOWER CASE.
    START-OF-SELECTION.
      i_lvc-fieldname = 'Varchar'.
      i_lvc-inttype = 'C'.
      i_lvc-intlen = 1.
      APPEND i_lvc.
      CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
      it_fieldcatalog = i_lvc[]
      IMPORTING
      ep_table = i_table
      e_style_fname = l_style.
      ASSIGN i_table->* TO <fs>.
      CREATE DATA l_warea LIKE LINE OF <fs>.
      ASSIGN l_warea->* TO <fs2>.
      <fs2> = p_char.
      ASSIGN COMPONENT l_name OF STRUCTURE <fs2> TO <fs3>.
      IF <fs3> = 'a'.
        WRITE: 'Component VARCHAR is a'.
    *  APPEND <fs2> TO <fs>.
      ELSE.
        WRITE: 'Component VARCHAR is not a'.
      ENDIF.

  • Problem With Insert statement using field symbols with unicode enabled

    I was writng a function module for dyanamic operations on the table. We are using the field symbols, function module is unicode enabled.
    Assign statements are working fine, with which we created work are <fs_wa_header> and internal table <fs_tb_item> dynamically based on the table name (IM_TB_HENAME) which we get as import parameter.
    we have query which is giving us dump.
    INSERT  (IM_TB_HENAME)  FROM <FS_WA_HEADER>.

    Hi
    INSERT (IM_TB_HENAME) FROM <FS_WA_HEADER> is good for inserting a line in the database, so IM_TB_HENAME has to have the name of dictionary table.
    U should write:
    INSERT  <FS_WA_HEADER> INTO (IM_TB_HENAME).
    But I believe you can't use the variable IM_TB_HENAME, you should use another field-symbols:
    ASSIGN (IM_TB_HNAME) TO <FS_TB_ITEM>.
    INSERT  <FS_WA_HEADER> INTO <FS_TB_ITEM>.
    Max

  • How to use FIELD-SYMBOLS with TYPE ANY?

    Hi!
    I need to write a function which gets an import string parameter containing a field name like MATNR. In this function I have to "map" this string to a real variable so that I can access the field which is represented by the string. I tried it like this but it does not work:
    FUNCTION ZTEST1.
    ""Lokale Schnittstelle:
    *"  IMPORTING
    *"     REFERENCE(I_MARA) TYPE  MARA
      DATA: FIELD_NAME(30) VALUE 'I_MARA'.
      FIELD-SYMBOLS : <FS_ANY> TYPE ANY.
      Assign (FIELD_NAME) to <FS_ANY>.
    Does not work (I guess because of 'type any')
      WRITE: <FS_ANY>-MATNR.
    ENDFUNCTION.
    How can I solve this problem?
    Thanks,
    Konrad

    This code is far from perfection...But at least it could help you to find the right track -;)
    REPORT ydummy_atg.
    DATA: w_mara TYPE STANDARD TABLE OF mara.
    START-OF-SELECTION.
      SELECT *
      INTO TABLE w_mara
      FROM mara.
      PERFORM test TABLES w_mara.
    *&      Form  test
    FORM test TABLES t_mara.
      DATA: field_name(30) VALUE 'T_MARA',
            new_line TYPE REF TO data,
            flag TYPE c,
            w_tabix TYPE sy-tabix.
      FIELD-SYMBOLS : <fs_any> TYPE ANY,
                      <l_line> TYPE ANY,
                      <l_field> TYPE ANY.
      ASSIGN (field_name) TO <fs_any>.
      CREATE DATA new_line LIKE LINE OF t_mara.
      ASSIGN new_line->* TO <l_line>.
      LOOP AT t_mara.
        MOVE t_mara TO <l_line>.
        ASSIGN COMPONENT 2 OF STRUCTURE <l_line> TO <l_field>.
        <l_field> = <l_line>.
        WRITE:/ <l_field>.
      ENDLOOP.
    ENDFORM.                    " test
    Greetings,
    Blag.

  • Read only fields clear with for actions

    Read only fields that are populated via lov mappings clear when any button is pressed on the page. This only happens when the field is read only or disabled. Is this intended and if it is what is the workaround???

    The button must be a submit button.
    Readonly fields or messageStyledTexts are not formElements, that they can post the value back to the ViewObject. Hence they just pass empty value to the underlying VO, when pressed formSubmit. The empty value refreshes the UI when the page refreshes after submit.
    Workaround for this is to have formValuebean that has the same VO attribute and the same LOV mapping as the readOnly field or MessageStyledText. It will act as mirror to submit the values.

  • How to use Field-symbol with dynamic select query

    Can anybody tell me, how to use field-symbols in the dynamic select query.

    FIELD-SYMBOLS <fs> { typing | STRUCTURE struc DEFAULT dobj }.
    1. ... typing
    2. ... STRUCTURE struc DEFAULT dobj
    The FIELD-SYMBOLS statement declares a field symbol <fs>. The name conventions apply to the name fs. The angle brackets of the field symbols indicate the difference to data objects and are obligatory. You can declare field symbols in any procedure and in the global declaration section of an ABAP program, but not in the declaration section of a class or an interface. You can use a field symbol in any operand position in which it is visible and which match the typing defined using typing.
    After its declaration, a field symbol is initial - that is, it does not reference a memory area. You have to assign a memory area to it (normally using the ASSIGN statement) before you can use it as an operand. Otherwise an exception will be triggered.
    eg.
    FIELD-SYMBOLS <fs> TYPE ANY.
    DATA: BEGIN OF line,
            string1(10) VALUE '0123456789',
            string2(10) VALUE 'abcdefghij',
          END OF line.
    WRITE / line-string1+5.
    ASSIGN line-string1+5(*) TO <fs>.
    WRITE / <fs>.
    output:
    56789
    56789
    reward if helpful
    anju

Maybe you are looking for