Skip to Content
0
Former Member
Mar 23, 2009 at 08:23 AM

Internal table on Start Routine

50 Views

Hello

I have 5 key figures. They have an standard routine with a select statement. Basically they have to read an external DSO and get some fields values.

As all of them have the same SELECT statement I think it would be better to replace this with a select in the Start Routine, in order to improve performance. But unfortunatelly I'm not an abap programmer.

How could this be replaced in the Start routine ?

select single EXRATEXACC DOC_CURRCY NETVAL_INV

into (h_rate, h_dcurr, h_inv)

from /bic/azsdbiio100

where BILL_NUM eq SOURCE_FIELDS-/BIC/ZREFDOC

and BILL_ITEM eq SOURCE_FIELDS-/BIC/ZREFDOCLN

and COMP_CODE eq SOURCE_FIELDS-COMP_CODE.

if sy-subrc ne 0. " Not found

select single EXRATEXACC DOC_CURRCY NETVAL_INV

into (h_rate, h_dcurr, h_inv)

from /bic/azsdbiio100

where DOC_NUMBER eq SOURCE_FIELDS-DOC_NUMBER

and S_ORD_ITEM eq SOURCE_FIELDS-S_ORD_ITEM

and COMP_CODE eq SOURCE_FIELDS-COMP_CODE.

if sy-subrc eq 0.

h_flag = 'X'. " Document found

endif.

else.

h_flag = 'X'. "Document found.

endif.

if h_flag = 'X'.

if h_dcurr ne SOURCE_FIELDS-CURRENCY.

if h_rate lt 0.

h_rate = h_rate * ( -1 ).

clear h_amount.

if h_inv ne 0.

h_amount = h_inv.

else.

h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104 * h_rate.

endif.

elseif h_rate gt 0.

if h_inv ne 0.

h_amount = h_inv.

else.

h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104 / h_rate.

endif.

else.

h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104.

endif.

else.

h_amount = SOURCE_FIELDS-/BIC/ZG_AVV104.

endif.

RESULT = h_amount.

CURRENCY = h_dcurr.

endif.

endif.