HANA Class 6 Code
HANA Class 6 Code
report zdec_oia_simple.
types: begin of ty_avg_days,
bp_id type snwd_bpa-bp_id,
open_days type int4,
inv_count type int4,
end of ty_avg_days,
begin of ty_amount,
bp_id type snwd_bpa-bp_id,
company_name type snwd_bpa-company_name,
gross_amount type snwd_so_inv_head-gross_amount,
currency_code type snwd_so_inv_head-currency_code,
end of ty_amount.
begin of ty_oia,
bp_id type snwd_bpa-bp_id,
avg_open_days type int4,
company_name type snwd_bpa-company_name,
gross_amount type snwd_so_inv_head-gross_amount,
currency_code type snwd_so_inv_head-currency_code,
tagging type c,
end of ty_oia.
data: lt_days type table of ty_avg_days,
ls_days type ty_avg_days,
lt_gross type table of ty_amount,
ls_gross type ty_amount,
lt_oia type table of ty_oia,
ls_oia type ty_oia.
data(lo_timer) = cl_abap_runtime=>create_hr_timer().
data(t1) = lo_timer->get_runtime().
select bp_id, head~changed_at
from snwd_so_inv_head as head
inner join snwd_bpa as bpa
on head~buyer_guid = bpa~node_key
where head~payment_status = ' '
into @data(ls_head).
*takt 2 developments.
select bp_id,company_name, item~gross_amount,
item~currency_code as currency_code
from snwd_so_inv_item as item inner join
snwd_so_inv_head as head
on item~parent_key = head~node_key
inner join snwd_bpa as bpa
on bpa~node_key = head~buyer_guid
where head~payment_status = ''
into @data(ls_amt).
call function 'convert_to_local_currency'
exporting
date = sy-datum
foreign_amount = ls_amt-gross_amount
foreign_currency = ls_amt-currency_code
local_currency = ls_threshold-currency_code
importing
local_amount = ls_gross-gross_amount.
ENDSELECT.
data(t2) = lo_timer->get_runtime().
data(times) = (t2-t1)/1000.
cl_demo_output=>write_text( text = |the total time taken is {times} ms|).
cl_demo_output=>display_data(
exporting
value = lt_oia
).