Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

select problem

Hi,

i do this select with while loop.

the logic is that the select is running until i get in ukurs data ,

otherwise it add 1 to datecur and and try to find ukurs.

the problem is that in prod it run to long there is a way to improve this performance?

Regards

ukurs = ''.

WHILE ukurs = ''.

SELECT SINGLE ukurs

FROM tcurr

INTO ukurs

WHERE kurst = '1002' AND

fcurr = wa_dp-currency AND

tcurr = 'USD0' AND

gdatu = datecur.

datecur = datecur + 1.

ENDWHILE.

Former Member
replied

sorry, what i wrote aboe is not correct, it still selects all lines. I think you have to go for array select:

SELECT gdatu ukurs
FROM tcurr
INTO TABLE ...
WHERE ... gdatu GE decdate

this will select all possible entries in one go

SORT itab BY gdatu.
READ TABLE itab INTO ... INDEX 1.

internal table will be sorted with date, which means, the first line is what you'll finally need.

hope this helps (finally)

ec

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question