Accessing the variable in field symbol of nested internal table

Hi,
I am unable to access the variable in field symbol.
The data in field symbol has nested structure. We need to access a variable in nested structure.
Please find the code below:
      LOOP AT <i_fincorp> into <fs_fincorp>.
        l_madefor = <FS_FINCORP>-data_UI-ZZ0010.
      ENDLOOP.
datatype of <i_fincorp> is type any table and <fs_fincorp> is type any.
there is a structure 'data_ui' in <i_fincorp> and we need value of field 'ZZ0010' in data_ui structure.
But, we are getting syntax error for statement in loop stating "There is no component like 'data_ui' in <fs_fincorp>".
Can anyone please help me solving this issue.
Regards,
Santosh

So simply access it dynamically
data: nested_field type c length 50.
field-symbols <nested_field> type any.
"build the nested field name dynamically
concatenate
       'DATA_UI'    "first give structure name
       'ZZ0010'  "then give field name (all in uppercase!)
into nested_field
separated by '-'.  "now you have DATA_UI-ZZ0010
"so assing this nested field
LOOP AT <i_fincorp> into <fs_fincorp>.
   assign component (nested_field) of structure <fs_fincorp> into <nested_field>. 
ENDLOOP.
Regards
Marcin

Similar Messages

  • Are field symbols and Dynamic internal tables consistant?

    Hi,
    Are field symbols and Dynamic internal tables
    always consistent?
    In my program I m creating a dynamic itab and assignig values to it using <FS>, sometimes the program fails to execute assign <Fs> statement...
    this happens once in 3 to 4 runs
    any solution...
    I have proper clear and refresh statements in program.
    Thanks,
    Hardik

    Anurag,
    Thanks for a quick reply. Here I am sending a small piece of my code.
    MOVE-CORRESPONDING OUTTAB TO DYNTAB.
          CLEAR IT_UDATE.
          CLEAR : T_KBETR .
          READ TABLE IT_UDATE WITH KEY UDATE = OUTTAB-UDATE.
          CONCATENATE 'DYNTAB-KBETR' IT_UDATE-CO_POS INTO T_KBETR.
          ASSIGN (T_KBETR) TO <FS> .
          SUBRC5 = SY-SUBRC .
          IF SUBRC5 = 0 .
              <FS> =  OUTTAB-KBETR .
          ENDIF .
    read statement will always return CO_POS .
    while debuging this code a few times
    <b>ASSIGN (T_KBETR) TO <FS> .</b>
    returns sy-subrc = 4
    and that was leading the program to short dump earlier.
    now, as I have a check DYNTAB-KBETR holds no value on display.
    this happens very few times. (most of the times report is displaying desired output)
    Thanks,
    Hardik

  • Move Field symbol data to Internal table

    Dear All,
                     Please suggest how to move field symbol data to internal table. The requirement is I have dynamic data in Field symbol which to move to table parameter of a function module.
    Thanks in Advance
    Rams.

    Dear All,
                    In need to pass tabular data  i.e. multiple entries from field symbol to the table parameter of the custom function module.
    Field symbol is declared as below:
    FIELD-SYMBOLS: <FS_EXCEL_TAB> TYPE STANDARD TABLE,
                                 <FS_TABLE_HEADER> .
    DATA WA_PD LIKE PRICE_DOWNLOAD.
    APPEND <FS_TABLE_HEADER> TO <FS_EXCEL_TAB>.
    CLEAR <FS_TABLE_HEADER>.
      WA_PD-VKORG = <FS_EXCEL_TAB>-VKORG.u201D Problem while using this statement
      APPEND WA_PD TO PRICE_DOWNLOAD.
       CLEAR WA_PD.
    Field symbol <FS_EXCEL_TAB>  is populated like this.
    VKORG | KUNNR_SH | KUNNR_SP |
    0015      | 102105       | 102105       |
    Now I need to move this data to table in tables parameter of custom fucntion module.
    Thanks in advance,
    Rams

  • Data from field symbol into an internal table or workarea

    Hi Experts,
    I have field symbol in which i get the data. I want to get this data into an internal table of type any or into an work area. How is this possible.
    My declaration for field symbol is as follow:
    FIELD-SYMBOLS: <l_t_data> TYPE any.
    DATA l_r_data TYPE REF TO data.
        CREATE DATA l_r_data type STANDARD TABLE OF (l_local_tab).
        ASSIGN l_r_data->* TO <l_t_data>.
    I get the data in this field symbol <l_t_data>. by passing into a funtion module. and I get the data into it. Now i have to assign the values of this field symbol to any internal table or to a work are how do i do it. Please help.
    Regards,
    Prashant.

    Not exactly sure what you need here, but.....
    FIELD-SYMBOLS: <l_t_data> TYPE TABLE.   "<<-- Change this
    FIELD-SYMBOLS: <l_s_data> TYPE ANY.      "<<---Add This
    DATA l_r_data TYPE REF TO data.
    CREATE DATA l_r_data type STANDARD TABLE OF (l_local_tab).
    ASSIGN l_r_data->* TO <l_t_data>.
    Loop at <l_t_data> assigning <l_s_data>.
    * Do what ever using <l_s_data>
    Endloop.
    Regards,
    Rich Heilman
    Edited by: Rich Heilman on Feb 28, 2008 2:42 PM

  • How to Copy data from field symbol to Dynamic Internal Table

    Hi,
    I want to copy the data between two dynamic Internal tables . Following is the code were I have data in the field symbol wanted to transfer it to the other Internal table :
    REPORT  ztest.
    DATA:
           gd_dref          TYPE REF TO data,
           gd_dref1          TYPE REF TO data.
    FIELD-SYMBOLS:  <fs1>   TYPE any,
                               <fs_wa> TYPE any,
                                <field>    TYPE any,                  
                                <fs_wa1> TYPE ANY TABLE.  * Contains data from p_src
    *Copy data from p_src to p_dest*
    PARAMETERS: p_src LIKE dd02l-tabname .    * Name of Dynamic Internal table *
                             p_dest LIKE dd02l-tabname .  * Name of Dynamic Internal table*
    *DATA : lt_csks LIKE p_dest WITH HEADER LINE.
    START-OF-SELECTION.
      CREATE DATA gd_dref TYPE (p_src).
      CREATE DATA gd_dref1 TYPE TABLE OF (p_src).
       ASSIGN gd_dref->* TO <fs_wa>.
       ASSIGN gd_dref1->* TO <fs_wa1>.
       SELECT * FROM (p_src) INTO TABLE <fs_wa1>.
    *Write out data from FIELD SYMBOLS TO Table.
       loop at <fs_wa1> into <fs_wa>.
         do.
           assign component  sy-index
              of structure <fs_wa> to <field>.
           if sy-subrc <> 0.
           exit.
           endif.
           if sy-index = 1.
             write:/ <field>.
           else.
           write: / <field>.
           endif.
         enddo.
       endloop.
    *Need Logic To Copy the Data to p_dest table from <fs_wa1>.
    *p_dest is a table having a similar structure to table p_src .
    *Need Logic To Copy the Data to p_dest table from <fs_wa1>.
    EXIT.
    Thanks in Advance.

    try this...
    I have extended your source code and just used vbak/vbap as an example as they have some common fields like vbeln/erdat etc which corresponds with your requirement of 'similar structure' i.e. shared/common fields in both.
    Cheers...
    report  ztest.
    data:
      gd_dref type ref to data,
      gd_dref1 type ref to data,
      gd_dref_str type ref to data,
      gd_dref_tab type ref to data.
    field-symbols:
      <fs1> type any,
      <fs_wa> type any,
      <fs1_dest_str> type any,
      <fs_dest_tab> type any table,
      <field> type any,
      <fs_wa1> type any table.
    * contains data from p_src
    *Copy data from p_src to p_dest*
    parameters: p_src like dd02l-tabname default 'vbak',
    * name of dynamic internal table *
                p_dest like dd02l-tabname default 'vbap'.
    * name of dynamic internal table*
    *data : lt_csks like p_dest with header line.
    start-of-selection.
      create data gd_dref type (p_src).
      create data gd_dref1 type table of (p_src).
      assign gd_dref->* to <fs_wa>.
      assign gd_dref1->* to <fs_wa1>.
      select * from (p_src) into corresponding fields of table <fs_wa1>
      up to 3 rows
      where vbeln ne space.
      create data gd_dref_str type (p_dest).
      create data gd_dref_tab type standard table of (p_dest).
      assign gd_dref_str->* to <fs1_dest_str>.
      assign gd_dref_tab->* to <fs_dest_tab>.
    *write out data from field symbols to table.
      loop at <fs_wa1> into <fs_wa>.
        " break-point here - can see vbeln/waers/create date/ etc move over to new structure
        " the 'common' fields of your structures - the same will happen. if they not the same name you will have to do an
        " explicit move i.e. if fieldname = xyz ....move fieldxyz to new field123....after the move-corre
        break-point.
        move-corresponding <fs_wa> to <fs1_dest_str>.
        insert <fs1_dest_str> into table <fs_dest_tab>.
    **    do.
    **      assign component  sy-index
    **         of structure <fs_wa> to <field>.
    **      if sy-subrc <> 0.
    **        exit.
    **      endif.
    **      if sy-index = 1.
    **        write:/ <field>.
    **      else.
    **        write: / <field>.
    **      endif.
    **    enddo.
      endloop.
      " write out some dest data from the dest table build from previous loop
      loop at <fs_dest_tab> assigning <fs1_dest_str>.
        do.
          assign component sy-index of structure <fs_wa> to <field>.
          if sy-subrc <> 0.
            exit.
          endif.
          if sy-index = 1.
            write:/ <field>.
          else.
            write: / <field>.
          endif.
        enddo.
      endloop.

  • Field symbols and delete internal table.

    Hi,
    I wish to implement <fs> in this case:
    LOOP AT intable ASSIGNING <fs> WHERE condition
    IF condition1.
        DELETE intable
    ANDLOOP
    I know that if the condition1 is verified, the <fs> will be unassigned but in this case I lose the loop.
    Any Idea? ... Or is it impossible to handle?
    Thanks in advance.
    Regards,
         Giovanni

    If you know the standard table name in the start routine , then you can create a dynamic structure after adding a field flag, then you can use that as 
      call function 'LVC_FIELDCATALOG_MERGE'
        exporting
          i_structure_name = p_table
        changing
          ct_fieldcat      = i_fcat
        exceptions
          others           = 1.
      if sy-subrc = 0.
        loop at i_fcat assigning <fcat>.
          <fcat>-tabname = p_table.
          <fcat>-fieldname = 'FLAG'
          ....  " after giving other attributes for the flag field
         append <fcat> to i_fcat.  
        endloop.
        call function 'LVC_FIELDCAT_COMPLETE'
          changing
            ct_fieldcat = i_fcat
          exceptions
            others      = 1.
      endif.
      call method cl_alv_table_create=>create_dynamic_table
        exporting
          it_fieldcatalog = i_fcat
        importing
          ep_table        = i_content.
      if sy-subrc = 0.
        assign i_content->* to <fs>.
      endif.

  • How to create dynamic nested internal table

    Hi Experts,
    Pleae tell me or give sample code, how to create dynamic nested internal table ?
    I have seen threads saying creation of dynamic internal tables using some table structure only. But now the requirement is to create dynamic nested internal table.
    For example the internal table contains two fields viz., one is field1 of dynamic internal table and other is normal field2 and values as shown below:
    Nested internal table:
    field1                     |     field2 ...
    <table content1>     |     value2..
    <table content1>     |     value2..
    Here the [table content] should also a dynamic internal table.
    Let me know if you need any other info.
    regards
    Saravanan R

    see the complete code..i am currently working in ECC6.0 EHP4. just check which version you are using..
    REPORT  yst_test_000.
    DATA:
          lt_comptab         TYPE cl_abap_structdescr=>component_table,
          ls_comp            LIKE LINE OF lt_comptab,
          lref_newstr        TYPE REF TO cl_abap_structdescr,
          lref_tab_type      TYPE REF TO cl_abap_tabledescr,
          lt_fcat            TYPE lvc_t_fcat,
          ls_fcat            TYPE lvc_s_fcat,
          ls_dd03p           TYPE dd03p,
          lt_data            type ref to data.
    field-symbols: <fs_table> type standard table.
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
      EXPORTING
        i_structure_name       = 'SCARR'
      CHANGING
        ct_fieldcat            = lt_fcat
      EXCEPTIONS
        inconsistent_interface = 1
        program_error          = 2
        OTHERS                 = 3.
    IF sy-subrc NE 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    LOOP AT lt_fcat INTO ls_fcat.
      IF ls_fcat-ref_table IS NOT INITIAL.
        CLEAR ls_dd03p.
        CALL FUNCTION 'BUS_DDFIELD_GET'
          EXPORTING
            i_tabnm         = ls_fcat-ref_table
            i_fldnm         = ls_fcat-fieldname
          IMPORTING
            e_dd03p         = ls_dd03p
          EXCEPTIONS
            field_not_found = 1
            OTHERS          = 2.
        IF sy-subrc EQ 0.
          ls_comp-name = ls_fcat-fieldname.
          ls_comp-type ?= cl_abap_datadescr=>describe_by_name( ls_dd03p-rollname ).
          APPEND ls_comp TO lt_comptab.
          CLEAR ls_comp.
        ENDIF.
      ELSE.
        ls_comp-name = ls_fcat-fieldname.
        ls_comp-type ?= cl_abap_datadescr=>describe_by_name( ls_fcat-rollname ).
        APPEND ls_comp TO lt_comptab.
        CLEAR ls_comp.
      ENDIF.
    ENDLOOP.
    *Now for the Field which you want deep table then you can do like this
    ls_fcat-fieldname  = 'NESTED_TABLE'.
    ls_fcat-inttype    = 'C'.
    ls_fcat-intlen     = '000006'.
    ls_fcat-rollname   = 'SFLIGHT_TAB1'. "For SFLIGHT
    APPEND ls_fcat TO lt_fcat.
    ls_comp-name = ls_fcat-fieldname.
    ls_comp-type ?= cl_abap_datadescr=>describe_by_name( ls_fcat-rollname ).
    APPEND ls_comp TO lt_comptab.
    CLEAR ls_comp.
    lref_newstr = cl_abap_structdescr=>create( lt_comptab ).
    lref_tab_type = cl_abap_tabledescr=>create( lref_newstr ).
    create data lt_data type handle lref_tab_type.
    assign lt_data->* to <fs_table>.
    break-point.
    Edited by: Vijay Babu Dudla on Apr 28, 2009 8:05 AM

  • 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

  • Reading the data from field symbol internal table //

    Hi,
    There are 2 internal tables defined as Fieldsymbols (type any) and I need to retrive data from second internal table based on a field value in first internal table.
    Let's assue the name internal table 1 is <it_itab1>, 2nd internal table name is <it_itab2> and the work areas are <wa_itab1> and <wa_itab2>.
    The existing logic :
    LOOP at <it_itab1> ASSIGNING <wa_itab1>.
      ASSIGN COMPONENT 'XYZ' OF STRUCTURE <wa_itab1> TO l_field6.
      LOOP AT <it_itab2> ASSIGNING <wa_itab2>.
        ASSIGN COMPONENT 'XYZ' OF STRUCTURE <wa_itab2> TO <p_field7>.
        IF <p_field7> = l_field6.
    do the required business.
        ELSE.
          *     do the required business.
        ENDIF.
      ENDLOOP.
    ENDLOOP.
    The requirement of reading second internal table was achieved by putting loop on the internal table but its giving considerable effect on performance !!
    Is there any way to use READ statement in my case OR any way of putting WHERE condition on loop statement of second internal table ??
    Thank you !!

    Use the below Logic.
    Loop at Itab1 into wa_itab1.
        Loop at itab2 into wa_itab2 where p_field7 = wa_itab1-xyz or I_field6.
    do the required business.
        endloop.
        Loop at itab2 into wa_itab2 where p_field7 <> wa_itab1-xyz or I_field6.
    do the required business.
        endloop.
    endloop.
    Hope it is useful...

  • Field Symbols and dinamicaly selecting tables

    I want to be able to select dinamicaly witch table to print.
    their structure is the very similar but not equal (the order of the elements change)
    so far im getting a "The data object "<WA_T>" has no structure and therefore no component ..." error
    how can give it a structure?
    FIELD-SYMBOLS: <t> TYPE STANDARD TABLE,
                       <wa_t> TYPE ANY.
        IF r1 = 'X'.
          ASSIGN ('TABI') TO <t>.
          ASSIGN ('WA_TABI') TO <wa_t>.
        ELSEIF r2 = 'X'.
          ASSIGN ('TABI2') TO <t>.
          ASSIGN ('WA_TABI2') TO <wa_t>.
        ELSEIF r3 = 'X'.
          ASSIGN ('TABI3') TO <t>.
          ASSIGN ('WA_TABI3') TO <wa_t>.
        ENDIF.
        LOOP AT <t> INTO <wa_t>.
          WRITE:/ <wa_t>-vkorg,
                  <wa_t>-name1,
                  <wa_t>-vbeln,
                  <wa_t>-audat,
                  <wa_t>-vbeln_d,
                  <wa_t>-wadat_ist,
                  <wa_t>-vbeln_b,
                  <wa_t>-fkdat,
                  <wa_t>-gbstk.
        ENDLOOP.
    Edited by: RagnaRock on Apr 8, 2010 12:18 PM

    The fields to be printed can not be directly referred in the field symbol. Use 'ASSIGN COMPONENT' statement to access the fileds.
    Modified the above program as per your requirements....
    FIELD-SYMBOLS: <t> TYPE STANDARD TABLE,
                                <wa_t> TYPE ANY,
                                <field> TYPE ANY.
    TYPES : BEGIN OF ty_tab,
             vbeln TYPE vbeln,
             erdat TYPE erdat,
            END OF ty_tab.
    DATA : tabi TYPE STANDARD TABLE OF ty_tab,
           wa_tabi TYPE ty_tab.
    SELECT vbeln erdat FROM vbak
      INTO TABLE tabi
      UP TO 10 ROWS.
    ASSIGN ('TABI') TO <t>.
    ASSIGN ('WA_TABI') TO <wa_t>.
    LOOP AT <t> ASSIGNING <wa_t>.
      ASSIGN COMPONENT 'VBELN' OF STRUCTURE <wa_t> TO <field>.  "Refer a particular field
      WRITE:/ <field>.
    ENDLOOP.
    Edited by: Satyajit on Apr 8, 2010 4:21 PM

  • FIELD-SYMBOLS validation with MARA Table values

    Hi,
    FIELD-SYMBOLS: <itab> TYPE STANDARD TABLE.
    I want to validate mara-matnr with <itab>. The values in <itab> is coming at runtime, so i want to validate first field values in <itab> for all the records with mara-matnr.
    The values which are coming at runtime in <itab> is matnr, bukrs, lgort. I want to validate only matnr with mara-matnr.
    I don't know about field-symbols validations?
    anybody has an idea?
    Thanks in advance,
    Fractal

    Hi,
    use ASSIGN COMPONENT OF STRUCTURE.
    Example.
    LOOP AT <FS> ASSIGNING <FS_STRUCT>.
    <b>  ASSIGN COMPONENT 'MATNR' OF STRUCTURE <FS_STRUCT>
                    TO <FS_RESULT>.</b>
      IF SY-SUBRC = 0.
        SELECT SINGLE * FROM MARA WHERE MATNR = <FS_RESULT>.
        CHECK SY-SUBRC = 0.
      ENDIF.
    ENDLOOP.
    Thanks,
    Naren

  • How to modify field symbol of type Index Table with other field symbol of type any.

    Hello Experts,
    How is it possible to update an filed symbol table of type Index table with other filed symbol table.
    e.g.
    Field symbol :  <lt_table1> type Index table.
    Field symbol : <lt_table2> type Index table.
    after some code...at run time these table filled like following.
    <lt_tabel1 > has  value fore column  like c11 , c12 , c13 
    <lt_table2> has value for column like C11     , C12 , C13 , C14 , C15 . some extra  values from <lt_table1>
    Now I want to be modify <table1> one entires like C12 with <table2 > col C12.
    how I can achieve this.
    Regards,
    Chetan.

    Hi,
    did you try  ASSIGN COMPONENT xx OF STRUCTURE <IT_TABEL1> TO <IT_TABLE2>.
    xx will contain the number of the column
    or maybe, if you have the description with a field catalog or other, that will be easier ..
    regards
    Fred

  • Which system variable is reset at the exit of a loop of an internal table

    which system variable is reset at the exit of a loop of an internal table
    a)sy-loop b)sy-index c)sy-dbcnt d)sy-tabix

    You might want to revist your threads from Friday, and award points and mark as "Answered" or "Solved".
    Regards,
    Rich Heilman

  • How to get the field name of an internal table during runtime?

    How to get the field name of an internal table during runtime?

    Hi  Sudhir,
    Declare and Use Get Cursor Field in Your Prm to get the field Name of the Intenal Table
    Example Code:
        <b>  DATA: v_field(60).                        " Insert this code.
         GET CURSOR FIELD v_field.        " Insert this code.</b>
         <b>CHECK v_field = 'ITAB-KUNNR'.    " Insert this code. (or)
    Write: v_field.</b>
    Regards,
    Ramganesan K.

  • How to use FIELD-SYMBOLS to declare a table

    How to use FIELD-SYMBOLS to declare a table?

    hi yong,
    this will be very general:
    FIELD-SYMBOLS : <gf_table> TYPE ANY TABLE.
    or
    to do like a specific table from your program
    FIELD-SYMBOLS : <gf_table> TYPE itab.
    itab is of course your internal table from your program.
    ec

Maybe you are looking for

  • Can SAP take scrap into account with determining open production order qty?

    SAP appears to completely ignore scrap on production orders.  This isn't working for us.  What we would like is something like this: If the production order is for 20, we've confirmed scrap of 2, and confirmed 10 good, then the open quantity should b

  • How to control the pricing condition in billing document?

    Hello Experts, Greetings! We are using two pricing condition.One is PR00 another one is VA00.PR00 is a mandetory condition & prices comes from condition record only.Users are not allowed to enter pr00 manually. Now we have created one more condition

  • How to make a simple JPEG flash light to dark on PDF?

    Hello all. Thank you for reading this. Please have a look at this online magazine: http://viewer.zmags.com/publication/1d272263#/1d272263/1 Notice how the "Click Here To Read" is flashing? Well I'm wondering how do I create that effect? I'm sure it c

  • Streaming Video in IE

    Hi, I'm evaluating the Flash Streaming Server product for an upcoming website I'm working on, and so far it's working! However, I can't seem to explain why streamed videos viewed in Internet Explorer are skippy. The audio stream is fine. If a user pl

  • Shifting data from PostgreSQL database to Oracle database

    hello folks, as i want to have an environment of many database servers of PostgreSQL databases on linux redhat 8.0 and one main database server of Oracle 8.1.7.0.0 on linux redhat 8.0;so that transections may go on PostgreSQL databases and Oracle dat