Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

modification in the query

Former Member
0 Kudos
145

hi folks,

I need help in writing this query.This is what I have been working...

select kposn kschl krech kawrt kbetr kwert from

konv INNER JOIN jhak on konvknumv = jhakknumv inner join jhaga on jhakavm_nr = jhagaavm_nr into table cdata where jhaga~inserent = p_custid.

I need to extract data from table 'konv'(cluster table)and the way you link the fields has to be this way.<b>I know using cluster table I cannot use JOIN statements</b> but the data i want is stored in cluster table while the selection field is located is 'jhaga' (transparent table)

Can anyone help me in modifying this query without changing the where condition?

thanks

Santhosh

4 REPLIES 4

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos
67

I'm not really sure if this will work for you or not. I don't have those 2 tables(jhak and jhaga) in my system.



report zrich_0001.

data: begin of cdata occurs 0,
      kposn type konv-kposn,
      kschl type konv-kschl,
      krech type konv-krech,
      kawrt type konv-kawrt,
      kbetr type konv-kbetr,
      kwert type konv-kwert,
      end of cdata.

  data: begin of ijha occurs 0,
         knumv    type konv-knumv,
         inserent type jhaga-inserent,
        end of ijha.

parameters: p_custid type kna1-kunnr.

start-of-selection.

  select * into corresponding fields of table ijha
        inner join jhak
           on konv~knumv = jhak~knumv
        inner join jhaga
           on jhak~avm_nr = jhaga~avm_nr
                  where jhaga~inserent = p_custid.

  select  kposn kschl krech kawrt kbetr kwert
        from konv
             into table cdata
                  for all entries in ijha
                             where konv~knumv = ijha-knumv.

Regards,

Rich Heilman

0 Kudos
67

it is throwing an error

"FROM..." "CONNECTION..." "BYPASSING BUFFER" "UP... TO...ROWS" expected after ijha.

Santhosh

0 Kudos
67

oh...sorry. This is what happens when you can't do a syntax check because you don't have the tables in your system. Use this select statment in place of the other select to jhak/jhaga.



  select * into corresponding fields of table ijha
        from jhak
           inner join jhaga
             on jhak~avm_nr = jhaga~avm_nr
                  where jhaga~inserent = p_custid.

Regards,

Rich Heilman

0 Kudos
67

thanks Rich, I shall award six points to you because my problem is not solved. I will get back to you on that tomorrow. probably I need to rephrase the query, not sure.

Anyway thanks a lot for your help.

santhosh