Application Development and Automation 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: 
Read only

Select query and join's

Former Member
0 Likes
830

Hi All,

I had to modify the current select query coz its taking a lot of database time, please suggest the best solution for the below.

SELECT msegbukrs mkpfbudat mkpf~bldat

msegebeln mkpfxblnr mseg~mblnr

msegmjahr msegzeile mseg~xauto

msegparent_id msegwerks mseg~umwrk

msegumlgo msegparent_id ekko~reswk

msegwerks mseglgort mseg~matnr

msegerfmg msegerfme mseg~shkzg

msegsjahr msegsmbln mseg~smblp

msegcharg ekkobedat

INTO TABLE g_tbl_main

FROM mkpf JOIN mseg

ON mkpfmandt = msegmandt AND

mkpfmblnr = msegmblnr AND

mkpfmjahr = msegmjahr

JOIN ekko ON msegmandt = ekkomandt AND

msegebeln = ekkoebeln

JOIN likp ON mkpfxblnr = likpvbeln

CLIENT specified

WHERE mkpf~mandt = sy-mandt AND

mkpf~budat IN s_budat AND

ekko~bedat IN s_bedat AND

mseg~ebeln IN s_ebeln AND

mkpf~xblnr IN s_vbeln AND

likp~vstel IN s_vstel AND

ekko~reswk IN s_reswk AND

mseg~werks IN r_werks AND

mseg~lgort IN s_lgort AND

mseg~matnr IN s_matnr AND

mseg~smbln = space AND

mseg~bwart IN s_bwart AND

mseg~kzzug = c_true.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
782

Yes, avinash said rightly.

there is another way bit diffict.

use the indexes properly as available in the mseg table and mkpf table even then it is diffcult

else try using BAPI.

some bapi will give the entire details of the MATERAIL DOCUMENT

go to BAPI explorer tcode BAPI.

where you can find the BAPI name like the 'GET_LIST'.

Try this.

hope this will serve your purpose.

Thanks and regards

Ramchander Rao.K

Yes, avinash said rightly.

there is another way bit diffict.

use the indexes properly as available in the mseg table and mkpf table even then it is diffcult

else try using BAPI.

some bapi will give the entire details of the MATERAIL DOCUMENT

go to BAPI explorer tcode BAPI.

where you can find the BAPI name like the 'GET_LIST'.

Try this.

hope this will serve your purpose.

Thanks and regards

Ramchander Rao.K

5 REPLIES 5
Read only

Former Member
0 Likes
782

Split the select query and use the for all entries..this will improve the preformence....

Read only

Former Member
0 Likes
783

Yes, avinash said rightly.

there is another way bit diffict.

use the indexes properly as available in the mseg table and mkpf table even then it is diffcult

else try using BAPI.

some bapi will give the entire details of the MATERAIL DOCUMENT

go to BAPI explorer tcode BAPI.

where you can find the BAPI name like the 'GET_LIST'.

Try this.

hope this will serve your purpose.

Thanks and regards

Ramchander Rao.K

Read only

Former Member
0 Likes
782

Hi,

Split of the query and then use the for all entries concept.

While using the for all entries concept be aware that you are using the proper indexes.

thanks & Regards

Read only

SujeetMishra
Active Contributor
0 Likes
782

Hi soyunee,

Please take seperate Internal table for each table. and select appropriate fields into same respective internal table.

then take one it_final, final internal table with all these fields for output.

and pass your all internal tables value to it_final in loop.

Regards,

sujeet

Read only

Former Member
0 Likes
782

Hi all,

I just want to make sure if i can join EKKO and LIKP ,