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

alternative way for double inner join statement

Former Member
0 Likes
668

SELECT SINGLE ALNUM INTO P_ITAB-ALNUM_AL FROM MAEX

JOIN MARC ON MARCMATNR = MAEXMATNR

JOIN T001W ON T001WWERKS = MARCWERKS

WHERE MAEX~MATNR = P_VBPLP-MATNR

AND MARC~WERKS = T_VBDPL-WERKS

AND MAEXALAND = T001WLAND1

AND MAEX~GEGRU = 'DE'.

can any one suugest the best way to modify the above statement to improve the performence.

Thanks,

khasim.

1 ACCEPTED SOLUTION
Read only

jayesh_gupta
Active Participant
0 Likes
625

Hi,

SELECT SINGLE ALNUM INTO P_ITAB-ALNUM_AL FROM MAEX
JOIN MARC ON MAEX~MATNR = MARC~MATNR
JOIN T001W ON MAEX~ALAND = T001W~LAND1
WHERE MAEX~MATNR = P_VBPLP-MATNR
AND MAEX~GEGRU = 'DE'.
AND MARC~WERKS = T_VBDPL-WERKS
AND T001W-WERKS = T_VBDPL-WERKS.

I have made the WHERE clause free from the comparison of two table fields and changed the second JOIN. The selection criteria, however is same as the SELECT query provided by you.

Try this query and positively let me know about its performance.

Regards,

Jayesh

SELECT SINGLE ALNUM INTO P_ITAB-ALNUM_AL FROM MAEX

JOIN MARC ON MARCMATNR = MAEXMATNR

JOIN T001W ON T001WWERKS = MARCWERKS

WHERE MAEX~MATNR = P_VBPLP-MATNR

AND MARC~WERKS = T_VBDPL-WERKS

AND MAEXALAND = T001WLAND1

AND MAEX~GEGRU = 'DE'.

can any one suugest the best way to modify the above statement to improve the performence.

Thanks,

khasim.

3 REPLIES 3
Read only

Former Member
0 Likes
625

Hi,

you´re extracting information from MAEX only, so why do you read from MARC and above all from T001W ?? No wonder you have performance problems.

Select single ALNUM 
   into p_itab-alnum
  from MAEX
  where MATNR = P_VBPLP-MATNR
  and ALAND = 'DE'
  and GEGRU = 'DE'.

You still have to explain where you get the information about the departure country for ALAND.

Read only

jayesh_gupta
Active Participant
0 Likes
626

Hi,

SELECT SINGLE ALNUM INTO P_ITAB-ALNUM_AL FROM MAEX
JOIN MARC ON MAEX~MATNR = MARC~MATNR
JOIN T001W ON MAEX~ALAND = T001W~LAND1
WHERE MAEX~MATNR = P_VBPLP-MATNR
AND MAEX~GEGRU = 'DE'.
AND MARC~WERKS = T_VBDPL-WERKS
AND T001W-WERKS = T_VBDPL-WERKS.

I have made the WHERE clause free from the comparison of two table fields and changed the second JOIN. The selection criteria, however is same as the SELECT query provided by you.

Try this query and positively let me know about its performance.

Regards,

Jayesh

Read only

Former Member
0 Likes
625

This message was moderated.