04-08-2008 11:52 PM
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
04-08-2008 11: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.
04-09-2008 12:06 AM
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.