2008 Nov 27 10:08 AM
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?
2008 Nov 27 11:47 AM
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".
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
2008 Nov 27 11:47 AM
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".
2008 Nov 27 11:59 AM
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.
2008 Dec 02 7:49 AM
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
2008 Dec 02 8:13 AM
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
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |