‎2007 Jun 14 8:07 AM
HI All.
I need to pass local value (L_count1) to filed of internal table (It_report1-Old_total_line_item) as follows.
Loop at it_report1.
Clear L_count1.
At end of Old_ebeln.
L_count1 = L_count1 + 1.
It_report1-Old_total_line_item = L_count1.
Append it_report1.
endloop.
here Append is needed or not?
please advice me.
Thanks.
jay
‎2007 Jun 14 8:09 AM
‎2007 Jun 14 8:09 AM
Hi
Use Modify instead of Append with index
also sort the Itab first before loop.
sort it_report1 by old_vbeln.
Loop at it_report1.
Clear L_count1.
At end of Old_ebeln.
L_count1 = L_count1 + 1.
It_report1-Old_total_line_item = L_count1.
modify it_report1.
endloop.
Reward points for useful Answers
Regards
Anji
‎2007 Jun 14 8:10 AM
Hi,
yes append is needed to put he data in table.
this code is correct.
regards,
Ruchika
reward if useful........
‎2007 Jun 14 8:10 AM
Hi,
Do not write the APPEND statment, you need to write the Modify Statment
Loop at it_report1.
Clear L_count1.
At end of Old_ebeln.
L_count1 = L_count1 + 1.
It_report1-Old_total_line_item = L_count1.
Modify it_report1 index sy-tabix.
endloop.Regards
Sudheer
‎2007 Jun 14 10:07 AM
Hi
I think it's wrong
-missing an ENDAT and you
-don't append or modify between at end of/endat
-the table must be sorted with at end of
-Old_ebeln must the first field of the table
I would write like this:
REPORT ztest.
DATA : BEGIN OF it_report1 OCCURS 0,
old_ebeln LIKE ekko-ebeln,
old_total_line_item TYPE i,
END OF it_report1.
DATA l_count1 TYPE i.
SORT it_report1 BY old_ebeln.
it_report1-old_total_line_item = 1.
MODIFY it_report1 TRANSPORTING old_total_line_item.
LOOP AT it_report1.
AT NEW old_ebeln.
SUM.
l_count1 = it_report1-old_total_line_item.
ENDAT.
it_report1-old_total_line_item = l_count1.
MODIFY it_report1.
ENDLOOP.
i hope it's help you,
Regards