Skip to Content
author's profile photo Former Member
Former Member

How to write a join for KNA1 and KNVH.

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>

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 16, 2005 at 04: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.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Feb 16, 2005 at 04:18 PM

    If you know that knvh-hityp is ALWAYS = 'A' . Then I would say yes, looks ok to me.

    Regards,

    Rich Heilman

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 16, 2005 at 04: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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.