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: 

Combining queries.

Former Member
0 Kudos
114

Hi,

Is there a code when we can combine the following three queries in one and imprrove performance

DATA: XAUFPL LIKE AFKO-AUFPL,

XARBPL LIKE CRHD-ARBPL,

XARBID LIKE V_QAPO-ARBID.

SELECT SINGLE AUFPL FROM AFKO INTO XAUFPL WHERE AUFNR = '007200000059'.

SELECT SINGLE ARBID FROM V_QAPO INTO XARBID WHERE AUFPL = XAUFPL AND VORNR = '0020'.

SELECT SINGLE ARBPL FROM CRHD INTO XARBPL WHERE OBJID = XARBID.

WRITE: / XARBPL.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
43

you can try this:

SELECT SINGLE CRHD~ARBPL

FROM AFKO

INNER JOIN V_QAPO ON V_QAPOAUFPL = AFKOAUFPL

INNER JOIN CRHD ON CRHDOBJID = V_QAPOARBID

INTO XARBPL

WHERE AFKO~AUFNR = '007200000059'

AND V_QAPO~VORNR = '0020'.

WRITE: / XARBPL.

Hope it will be helpful

Thanks

1 REPLY 1

Former Member
0 Kudos
44

you can try this:

SELECT SINGLE CRHD~ARBPL

FROM AFKO

INNER JOIN V_QAPO ON V_QAPOAUFPL = AFKOAUFPL

INNER JOIN CRHD ON CRHDOBJID = V_QAPOARBID

INTO XARBPL

WHERE AFKO~AUFNR = '007200000059'

AND V_QAPO~VORNR = '0020'.

WRITE: / XARBPL.

Hope it will be helpful

Thanks