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

performance issue

Former Member
0 Likes
657

SELECT vbeln kunnr

FROM vakpa

INTO CORRESPONDING FIELDS OF TABLE t_vbak4

FOR ALL ENTRIES IN t_likp

WHERE kunde = t_likp-kunnr " Bill to

AND parvw = 'AG'

AND vkorg = p_vkorg

AND trvog = '4' " contracts

AND auart IN r_doc_type1 " doc type range

AND datbi GT sy-datum. " Valid-to date

IF NOT t_vbak4[] IS INITIAL.

SELECT vbeln kunnr vgbel auart

FROM vbak

INTO CORRESPONDING FIELDS OF TABLE t_vbak4

FOR ALL ENTRIES IN t_vbak4

WHERE

vbeln = t_vbak4-vbeln.

There is a performance issue with the second select statement.It is passing vaues into the same internal table t_vbak4 which is already appended by the 1st select statement.

How can this cause a performance issue?

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
621

It is filling additional fields into t_vbak4 which were not selected in the first query. Personally I would solve this with a join of vakpa and vbak to read all desired colums in one go and probably have a slight performance gain compared to the approach presented here.

Thomas

P.S. Please use more meaningful subjects, imagine all questions in this forum would be titled "performance issue".

4 REPLIES 4
Read only

ThomasZloch
Active Contributor
0 Likes
622

It is filling additional fields into t_vbak4 which were not selected in the first query. Personally I would solve this with a join of vakpa and vbak to read all desired colums in one go and probably have a slight performance gain compared to the approach presented here.

Thomas

P.S. Please use more meaningful subjects, imagine all questions in this forum would be titled "performance issue".

Read only

Former Member
0 Likes
621

Hi,

either take 2 different internal table and avoid using INTO CORRESPONDING FIELDS and populate the data into a 3rd that is a final internal table or use a join to populate a single internal table. Like:

SELECT vbeln kunnr
FROM vakpa
INTO TABLE t_vbak1
FOR ALL ENTRIES IN t_likp
WHERE kunde = t_likp-kunnr " Bill to
AND parvw = 'AG'
AND vkorg = p_vkorg
AND trvog = '4' " contracts
AND auart IN r_doc_type1 " doc type range
AND datbi GT sy-datum. " Valid-to date

IF NOT t_vbak4[] IS INITIAL.
SELECT vbeln kunnr vgbel auart
FROM vbak
INTO TABLE t_vbak2
FOR ALL ENTRIES IN t_vbak1
WHERE
vbeln = t_vbak4-vbeln.

now populate the final internal table using LOOP and READ statements.

With luck,

Pritam.

Read only

Former Member
0 Likes
621

Hi,

Take out CORRESPONDING keyword.Rest of the thing should be same.

use READ statement with BINARY SEARCH.

U will get much more improved performance.

Best Regards,

Flavya

Read only

Former Member
0 Likes
621

Hi,

You cannot use same table in FOR ALL ENTRIES and INTO CORRESPONDING FIELDS OF TABLE.

Use another intermediate table for getting data of second querry and than append it to t_vbak4.

Regards,

Mohaiyuddin