02-16-2005 4:13 PM
Howdy,
Is it possible to write a join for KNA1 and KNVH?
Would this be okay:
<b>select *
into table itab
from knvh inner join kna1
on knvhkunnr = kna1kunnr
for all entries in cust_tab
where knvh~hityp = 'A'
and knvh~kunnr = cust_tab-kunnr
and knvh~vkorg = p_vkorg
and knvh~vtweg = p_vtweg
and knvh~spart = p_spart
and knvh~datab le sy-datum
and knvh~datbi ge sy-datum
and knvhhzuor ne kna1hzuor.</b>
02-16-2005 4:23 PM
It is actually based on what you need and not based on query.
a) Check whether you want <b>multiple</b> entries from <i>KNA1</i> table for every single entry in <i>KNVH</i>
b) Check whether you want <b>single</b> entry from <i>KNA1</i> table for every single entry in <i>KNVH</i>
Make sure, when using, FOR ALL ENTRIES, you do :
if not cust_tab[] is initial.
...
endif.
Regards,
Subramanian V.
02-16-2005 4:18 PM
02-16-2005 4:18 PM
Should work okay. Are you having a problem? I prefer to use the dictionary for inner joins whenever possible. Never know when you will need to share the defintion. If you are getting an error, please post.
02-16-2005 4:23 PM
It is actually based on what you need and not based on query.
a) Check whether you want <b>multiple</b> entries from <i>KNA1</i> table for every single entry in <i>KNVH</i>
b) Check whether you want <b>single</b> entry from <i>KNA1</i> table for every single entry in <i>KNVH</i>
Make sure, when using, FOR ALL ENTRIES, you do :
if not cust_tab[] is initial.
...
endif.
Regards,
Subramanian V.