2022 Feb 18 9:51 AM
HOW TO FETCH PREVIOUS RECORD FROM THE PREVIOUS DATE WHICH HAS RECORD
SUPPOSE THE 5/10/2020 HAS A RECORD AND 6/10/2020 , 7/10/2020 DOESNT HAVE ANY VALUE/RECORD
HOW TO PASS THE PREVIOS DATE RECORD INTO THE NEXT DAYS RECORDS IF THEY ARE EMPTY ?
2022 Feb 18 10:17 AM
Hi ramprakashs,
please try following:
field-symbols: <wa_last> type any.
select *
from yourtable
into @data(lt_data)
order by ...
loop at lt_data assigning field-symbol(<wa_data>)
if <wa_last> is not initial.
<wa_data>-last = <wa_last>-current.
endif.
assign <wa_data> to <wa_last>.
endloop.
In HANA sql, you can use also window functions
2022 Feb 18 10:06 AM
Don't write in upper case
Don't ask for someone doing your job
You could ask for help, but it meens you already have started a solution, and you could post this solution using the [code] button.
This is not so complex, I am pretty sure you could imagine a way of solving this issu
2022 Feb 18 10:17 AM
Hi ramprakashs,
please try following:
field-symbols: <wa_last> type any.
select *
from yourtable
into @data(lt_data)
order by ...
loop at lt_data assigning field-symbol(<wa_data>)
if <wa_last> is not initial.
<wa_data>-last = <wa_last>-current.
endif.
assign <wa_data> to <wa_last>.
endloop.
In HANA sql, you can use also window functions
2022 May 06 7:54 AM
2022 Feb 18 10:27 AM
Alternatively instead of looping afterwards you could do this in ABAP SQL directly:
select *
from yourtable
where keydate <= @iv_key_date
order by keydate descending
into @data(lt_data)
up to 1 rows.
endselect.
Depending on your other key fields in your table you might need a subquery.
2022 May 06 7:54 AM