‎2008 Nov 12 4:59 AM
hai abapers,
iam selecting some data base tables.
create some internal tables with their batabase tables.
all tables select quires completed by using for all entries condition.
problem is ?
some tables contains multiple records and some tables contains single records. so in this case
move into final table , i can take multiple records tables by using loop stament and single record tables
by using read stament.
but single record table fields repeted by same value along with multiple fields table.
how can i rectify this problem ?
my requirement is single field value only comes once , but not repeated.
‎2008 Nov 12 5:05 AM
Hi,
use delete adjacent duplicates comparing the fields which you want to show only once in the repor
Regards
Lalit
‎2008 Nov 12 5:05 AM
Hi,
Trt to select the data based on key fields from the table.
Thanks.
‎2008 Nov 12 5:12 AM
Hi Raja,
if you donot want this happen,
do it like this.
***note : if you want this internal table data for further processing move the whole data into another similar internal table
itab2[] = itab1[].
take care of sy-tabix as it changes once after the loop statement and once per the read statement.
loop at itab.
read table itab1 with key f1 = itab-f1.
if sy-subrc is initial.
move-corresponding itab1 to i_final.
****now you delete the record from the itab1
delete itab1 index sy-tabix.
endif.
hope this will meet your purpose.
regards
Ramchander Rao.Krishnamraju
endloop.
or you can try this.
you can use the control break statements as follows.
in this case you dont need the delete the record of the internal table
please note here all the character fields become stars from right of the key field.
only numeric fields are available.
sort itab by f1.
loop at itab.
at new itab-f1.
read table itab1 with key f1 = itab-f1.
if sy-subrc is initial.
endif.
endat.
endloop.
Edited by: ramchander krishnamraju on Nov 12, 2008 6:13 AM
Edited by: ramchander krishnamraju on Nov 12, 2008 6:18 AM
‎2008 Nov 12 5:12 AM
Jus try this...If u hv 2 internal tables, one wid multiple records and the other wid single records, then use 'loop' for single records table and 'read' for multiple records table....
‎2008 Nov 12 5:15 AM
hi,
if you loop the single record internal table you might end up in not processing the entire records.
as the case like this.
loop at i_vbak.
read table i_vbap.
endloop.
normally vbap contains more line items for a record in vbak.
then loop runs only single time.
regards
Ramchander Rao.K
‎2008 Nov 12 6:09 AM
In ur final internal table if some data is rapeating , jst sort the internal table based upon the comparing fields and use delete adjacent dupilcate comparing <fields> .