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

help in the query

hi folks,

i need help in this query.

select fbuda vavtyp aubel breite_s HOEHE_S from zzjhtfp INNER JOIN jhamot ON zzjhtfpaubel = jhamotavm_nr INTO table BDATA WHERE zzjhtfp~kunnr = p_custid.

How can I change the query to get one more field(wrshb - field name) from table mhnd(table) which has the common field with zzjhtfp(view) as kunnr.

but mhnd is a cluster table so I cannot use join statements.

thanks in advance.

santhosh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Jun 03, 2005 at 04:27 AM

    Hi Santhosh,

    • Better use tablename~fieldname

    • Since I amnot sure about the fields in table,I am simply using fieldname

    select <b>zzjhtfpkunnr</b> fbuda vavtyp aubel breite_s HOEHE_S from zzjhtfp INNER JOIN jhamot ON zzjhtfpaubel = jhamotavm_nr INTO corresponding fields of table BDATA WHERE zzjhtfpkunnr = p_custid.

    if sy-subrc eq 0.

    select kunnr wrshb from mhnd into table internal for all entries in bdata where kunnr = bdata-kunnr.

    endif.

    • Assumed: bdata and internal are internal tables with workareas

    loop at bdata.

    read table internal with key kunnr = bdata-kunnr.

    if sy-subrc eq 0.

    bdata-wrshb = internal-wrshd.

    modify table bdata transporting wrshb where kunnr = internal-kunnr.

    endif.

    endloop.

    Hope this helps.

    Your previous problem solved?

    /community [original link is broken]?threadID=43077&messageID=427909#427909

    Regards,

    J.Jayanthi

    Add a comment
    10|10000 characters needed characters exceeded

    • To check if table accountdata really contains data inside your smartform you can put 'code line' node in your form right before your loop node.

      Than put a 'break username' statement in code node and run the print program.

      The program will stop in debug mode inside your form. You can see there if table accountdata really contains data before loop.

      By the way in your piece of code:

      if sy-subrc = 0.

      append accitab.

      endif.

      you don't have to sourround 'append accitab.' with if-endif

  • Posted on Jun 02, 2005 at 08:42 PM

    You can loop over internal table and select proper data from table mhnd for each row.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 02, 2005 at 09:24 PM

    Hi Santhosh,

    You are pretty much stuck when it comes to cluster tables. They can't be in SQL joins, and they can't be in views.

    So, you prettty much are left with the option of selecting the data into an internal table and performing the joins yourself. If you can manage a tight set of data to be selected from mhnd (based on kunnr) then you can work with two internal tables:

    BDATA with your zzjhftp and jhamot data and another one for mhnd. Then when looping at BDATA you can READ the mhnd internal table to access the required data.

    Probably not the answer you wanted to hear, but I think it should work well for you.

    Cheers,

    Brad

    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.