Skip to Content
avatar image
Former Member

Internal Table referenced by field symbol

Hello Experts ,

I have a ABAP OO problem at hand. The issue is this:

I have a table ET_SCREEN_STRUCTURE TYPE ANY.

At runtime, the ET_SCREEN_STRUCTURE assumes the structure of a DDIC structure CRMT_BSP_ACT_DETAIL_IL which has 2 components : 1) OBJECTIVE 2) COUNTRY. Multiple instances of CRMT_BSP_ACT_DETAIL_IL are populated in the pointer referenced table

First Question :

Requirement is to loop through the ET_SCREEN_STRUCTURE , access one single record in the pointer table and then change the values of the components .

How to achive this ? The READ and SELECT does not work as ET_SCREEN_STRUCTURE is a pointer. Please advise the code.

Thanks and regards,

Sudipta

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Sep 12, 2008 at 10:22 AM

    Do this...

    READ TABLE itab ASSIGNING <fs_wa>.

    Or

    LOOP AT itab ASSIGNING <fs_wa>.

    here <fs_wa> is field symbol of type any..

    Rest I leave it for you to explore 😊

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 12, 2008 at 10:32 AM

    I'm not sure if I got it all but check this code. You cannot loop a pointer, but you can read it:

    FIELD-SYMBOLS: <fs1>  TYPE TABLE,
                   <fs2>  TYPE ANY.
    name1 = 'ITAB1'.
    name2 = 'WA1'.
    ASSIGN (name1) TO <fs1>.
    ASSIGN (name2) TO <fs2>.
    DO n TIMES.
      ADD 1 TO line.
      READ TABLE <fs1> INTO <fs2> INDEX line.
      wa2-vbeln = <fs2>-vbeln. 
      APPEND wa2 TO itab2.  
    ENDDO.
    

    Regards,

    Valter Oliveira.

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 12, 2008 at 10:41 AM

    There are no pointers in ABAP.

    FIELD-SYMBOLS: <ls_wa> TYPE ANY,
                   <l_objective> TYPE objective_type,
                   <l_country>   TYPE country_type.
    
    DATA: lr_data TYPE REF TO DATA.
    
    CREATE DATA lr_data LIKE LINE OF et_screen_structure.
    ASSIGN lr_data->* TO <ls_wa>.
    
    ASSIGN COMPONENT 'OBJECTIVE' OF STRUCTURE <ls_wa> TO <l_objective>.
    
    LOOP AT ET_SCREEN_STRUCTURE INTO <ls_wa>.
    " do stuff with <l_objective> and <l_country>.
    ENDLOOP.

    Note, this gives better performance than using LOOP AT ASSINGING, and doing the ASSIGN COMPONENT inside the loop.

    matt

    Add comment
    10|10000 characters needed characters exceeded