07-10-2009 11:47 AM
HI,
The for all entries is not retrieving duplicates.I need to include all selections.Any other way to do this other than including then select in loop or giving all pkeys....
Kind Rgards,
Shital
07-10-2009 1:19 PM
Hi,
I think you can do in one other way. Once you have obtained the records of the first table, collect all the field values which you will be requiring in ranges and then use this ranges to select from the 2nd table. i.e if you are using two fields of the 1st table in the where clause of the 2nd table, then collect all the values of these two fields in two range tables and then use it for selection from 2nd table.
Hope this will solve your issue.
Regards,
Susanta
07-10-2009 11:49 AM
HI,
For all entries won't give any duplicate entries.....Use inner join..
Regards,
Nagaraj
07-10-2009 11:52 AM
For all entries will only fetch details for distinct entries.
You have to put a loop at original internal table and use read to modify it with the fetched entries.
For example;
Select .....
into corresponding fields of table itab1
....
where....
Select ...
into table itab2
for all entries in itab1
where field1 = itab1-field1....
Loop at itab1.
Read table itab2 where field1 = itab1-field1.
If sy-subrc = 0.
itab1-field5 = itab2-field2.
itab1-field6 = itab2-field3.
.........
........
Modify itab1.
endif.
endloop
Try like this, it will solve your problem.
Regards
Karthik D
07-10-2009 11:55 AM
hi,
Can you plese paste your code here ...Also do check in database first
For all entries checks records obtained in the first table and gives records based on your select statmenet's WHERE clause...
thanks
07-10-2009 1:19 PM
Hi,
I think you can do in one other way. Once you have obtained the records of the first table, collect all the field values which you will be requiring in ranges and then use this ranges to select from the 2nd table. i.e if you are using two fields of the 1st table in the where clause of the 2nd table, then collect all the values of these two fields in two range tables and then use it for selection from 2nd table.
Hope this will solve your issue.
Regards,
Susanta
07-10-2009 1:22 PM
one more solution is to include in your selection an additional field, so that the rows become distinct.
preferably, select all the primary keys in your select statement..
thanks,
bikash
07-10-2009 1:58 PM
If your original code is like this:
SELECT ...
... INTO TABLE2
FOR ALL ENTRIES IN TABLE1...
Use left outer join instead. The left table should be your current table2 and the right table should be your current table1. This should bring out duplicates...
SELECT ...
... FROM DBTAB2 LEFT OUTER JOIN DBTAB1...
07-10-2009 2:15 PM
hi all,
thanks for your response!
I will try the solutions and get back to you.Cheers.
Shital