10-31-2007 12:21 PM
hi friends,
in internal table header entries are coming properly
but next time that entries are getting over written by
another entry and last record value is repeated in all
values.
what is the pboblem can any one give me solution.
thanks
10-31-2007 12:24 PM
if u loop at internal table everytime the loop is processed ...header will be populated with the current record.....that is index sy-tabix.
if itab has 5 records....
if u loop at itab....
first time ( sy-tabix = 1) header will be populated with 1 st record ....next with 2 and so on....
so header will be overwritten....
and finally at the end of loop......the last populated record..i.e last record will be stored in header....
Regards
vasu
10-31-2007 12:25 PM
10-31-2007 12:27 PM
itab[] = ibsis[].
sort itab by belnr.
DELETE ADJACENT DUPLICATES FROM itab COMPARING belnr.
DATA:indx LIKE sy-tabix.
LOOP AT itab.
indx = sy-tabix.
LOOP AT ibsis WHERE xblnr = itab-xblnr.
CASE ibsis-hkont.
WHEN '0030100244'.
MOVE ibsis-dmbtr TO itab-entr.
WHEN '0030100227'.
MOVE ibsis-dmbtr TO itab-load.
WHEN '0030100167'.
MOVE ibsis-dmbtr TO itab-ful.
WHEN '0030100200'.
MOVE ibsis-dmbtr TO itab-othr.
WHEN '0030100206'.
MOVE ibsis-dmbtr TO itab-park.
WHEN '0030100182'.
MOVE ibsis-dmbtr TO itab-kata.
WHEN '0030100221'.
MOVE ibsis-dmbtr TO itab-rto.
WHEN '0030100229'.
MOVE ibsis-dmbtr TO itab-spar.
WHEN '0030100266'.
MOVE ibsis-dmbtr TO itab-tyr.
WHEN '0030100199'.
MOVE ibsis-dmbtr TO itab-octr.
WHEN '0030100239'.
MOVE ibsis-dmbtr TO itab-toll.
WHEN '0030100165'.
MOVE ibsis-dmbtr TO itab-fret.
WHEN '0030100163'.
MOVE ibsis-dmbtr TO itab-cran.
WHEN '0030100250'.
MOVE ibsis-dmbtr TO itab-wegh.
ENDCASE.
MODIFY itab INDEX indx.
ENDLOOP.
CLEAR: itab,ibsis.
ENDLOOP.
DATA: index1 TYPE sy-tabix.
sort it_final by belnr.
LOOP AT it_final.
index1 = sy-tabix.
READ TABLE itab WITH KEY xblnr = it_final-xblnr.
MOVE itab-entr TO it_final-entr.
MOVE itab-load TO it_final-load.
MOVE itab-ful TO it_final-ful.
MOVE itab-othr TO it_final-othr.
MOVE itab-park TO it_final-park.
MOVE itab-kata TO it_final-kata.
MOVE itab-rto TO it_final-rto.
MOVE itab-spar TO it_final-spar.
MOVE itab-tyr TO it_final-tyr.
MOVE itab-octr TO it_final-octr.
MOVE itab-toll TO it_final-toll.
MOVE itab-fret TO it_final-fret.
MOVE itab-cran TO it_final-cran.
MOVE itab-wegh TO it_final-wegh.
MODIFY it_final INDEX index1.
it_final-rev = it_final-rev + it_final-entr + it_final-load +
it_final-ful + it_final-othr + it_final-park +
it_final-kata + it_final-spar + it_final-tyr +
it_final-octr + it_final-toll + it_final-rto +
it_final-fret + it_final-cran + it_final-wegh.
it_final-ptrf = it_final-tot - it_final-rev.
MODIFY it_final INDEX index1.
CLEAR: it_final.
ENDLOOP.
10-31-2007 12:30 PM
Sonu,
Clear Internal Table after every modify statement.
Reward if it helps,
Satish
10-31-2007 12:26 PM
10-31-2007 12:26 PM
Seee ur question is not clear
There are many chances...
From where u r getting values for that internal table,either u r getting from queries or hardcoding etc.,
May be the append will not be used properly in the code..Can u tell claerly means it will very effective
10-31-2007 12:31 PM
itab[] = ibsis[].
sort itab by belnr.
DELETE ADJACENT DUPLICATES FROM itab COMPARING belnr.
DATA:indx LIKE sy-tabix.
LOOP AT itab.
indx = sy-tabix.
LOOP AT ibsis WHERE xblnr = itab-xblnr.
CASE ibsis-hkont.
WHEN '0030100244'.
MOVE ibsis-dmbtr TO itab-entr.
WHEN '0030100227'.
MOVE ibsis-dmbtr TO itab-load.
WHEN '0030100167'.
MOVE ibsis-dmbtr TO itab-ful.
WHEN '0030100200'.
MOVE ibsis-dmbtr TO itab-othr.
WHEN '0030100206'.
MOVE ibsis-dmbtr TO itab-park.
WHEN '0030100182'.
MOVE ibsis-dmbtr TO itab-kata.
WHEN '0030100221'.
MOVE ibsis-dmbtr TO itab-rto.
WHEN '0030100229'.
MOVE ibsis-dmbtr TO itab-spar.
WHEN '0030100266'.
MOVE ibsis-dmbtr TO itab-tyr.
WHEN '0030100199'.
MOVE ibsis-dmbtr TO itab-octr.
WHEN '0030100239'.
MOVE ibsis-dmbtr TO itab-toll.
WHEN '0030100165'.
MOVE ibsis-dmbtr TO itab-fret.
WHEN '0030100163'.
MOVE ibsis-dmbtr TO itab-cran.
WHEN '0030100250'.
MOVE ibsis-dmbtr TO itab-wegh.
ENDCASE.
* MODIFY itab INDEX indx. " COmment this
ENDLOOP.
MODIFY itab INDEX indx. "Add this
CLEAR: itab,ibsis.
ENDLOOP.
DATA: index1 TYPE sy-tabix.
sort it_final by belnr.
LOOP AT it_final.
index1 = sy-tabix.
READ TABLE itab WITH KEY xblnr = it_final-xblnr.
MOVE itab-entr TO it_final-entr.
MOVE itab-load TO it_final-load.
MOVE itab-ful TO it_final-ful.
MOVE itab-othr TO it_final-othr.
MOVE itab-park TO it_final-park.
MOVE itab-kata TO it_final-kata.
MOVE itab-rto TO it_final-rto.
MOVE itab-spar TO it_final-spar.
MOVE itab-tyr TO it_final-tyr.
MOVE itab-octr TO it_final-octr.
MOVE itab-toll TO it_final-toll.
MOVE itab-fret TO it_final-fret.
MOVE itab-cran TO it_final-cran.
MOVE itab-wegh TO it_final-wegh.
* MODIFY it_final INDEX index1. " Comment this line
it_final-rev = it_final-rev + it_final-entr + it_final-load +
it_final-ful + it_final-othr + it_final-park +
it_final-kata + it_final-spar + it_final-tyr +
it_final-octr + it_final-toll + it_final-rto +
it_final-fret + it_final-cran + it_final-wegh.
it_final-ptrf = it_final-tot - it_final-rev.
MODIFY it_final INDEX index1.
CLEAR: it_final.
ENDLOOP.
10-31-2007 12:39 PM
hi prashant
now it is getting overwritten in header it self.
i have to use clear statement for that.
thanks
10-31-2007 12:43 PM
HI,
The data after u r inserting in the internal tables,it is not made clear..So only it remains with the same error it seems
10-31-2007 12:58 PM
Hi Sonu,
Please use<b> Clear</b> before endloop.
reward points if useful.
Regards,
SHilpi