Skip to Content

looping at a dynamic table .

I am trying to modify contents of an internal table (certain calculations). This table is dynamic internal table.

This is what I ideally want to do.


loop at <gt_tabletotal> assigning <l_linetotal>.


if  <l_linetotal>-PERIOD = 'Prior'.

read table <gt_tabletotal> with key pmnux = <l_linetotal>-pmnux  wenux = <l_linetotal>-wenux period = <l_linetotal>-period = 'Current' .

if sy-subrc eq 0.
 <l_linetotal>-PCNT = <l_linetotal>-TOTAL / <gt_tabletotal>-total * 100 .
endif.

endif.


endloop.

But this results in a syntax error - saying <l_linetotal> has no structure. How can i fix it ? .In the debug more, I do see the struture and am able to modify it in debugger.

Edited by: Shareen Hegde on Apr 9, 2008 12:56 AM

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Apr 08, 2008 at 10:58 PM

    Try this

    field-symbols : <wa> type any.
    data: new_line type ref to data. 
    
    CREATE DATA new_line LIKE LINE OF <gt_tabletotal>. 
    ASSIGN new_line->* TO <wa>. 
    
    loop at <gt_tabletotal> assigning <wa>.
     
    if <wa>-PERIOD = 'Prior'.
     
    read table <gt_tabletotal> with key pmnux = <l_linetotal>-pmnux  wenux = <l_linetotal>-wenux period = <l_linetotal>-period = 'Current' .
     
    if sy-subrc eq 0.
    <wa>-PCNT = <wa>-TOTAL / <gt_tabletotal>-total * 100 .
    endif.
     
    endif.
    endloop.
    
    

    Add a comment
    10|10000 characters needed characters exceeded

    • Ramiro,

      still same error <workarea> has no structure and therefore no component called period.

      field-symbols : <wa> type any.
      data: new_line type ref to data.
      
      CREATE DATA new_line LIKE LINE OF <gt_tabletotal>.
      ASSIGN new_line->* TO <wa>.
      
      loop at <gt_tabletotal> assigning <wa>.
      
      if <wa>-PERIOD = 'Prior'.
      
      read table <gt_tabletotal> with key pmnux = <l_linetotal>-pmnux  wenux = <l_linetotal>-wenux period = <l_linetotal>-period = 'Current' .
      
      if sy-subrc eq 0.
      <wa>-PCNT = <wa>-TOTAL / <gt_tabletotal>-total * 100 .
      endif.
      
      endif.
      endloop.
      

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.