2022 Jan 04 1:59 PM
I would like to convert this low performant ABAP code into a performant CDS view.
Actually the SQL-Query below is running in a loop for each partner/contract.
I would like to replace it by a CDS view but fail on the "if not this, try next" part. The view should have one line for each partner/contract from the first where condition that works. Any idea? We are running on non-Hana 7.50.
* laufende ZMOD Stundung oder Mindestbeitrag suchen
select single *
from zcd_zmod
into ls_zmod
where insobject eq i_vtref and
partner eq i_partner and
zzzmod_zeitr_von le sy-datum and
zzzmod_zeitr_bis ge sy-datum and
( zzzmod_stat eq 'B' or
zzzmod_stat eq 'E' ).
if sy-subrc ne 0.
* zukünftig anlaufende ZMOD suchen
select single *
from zcd_zmod
into ls_zmod
where insobject eq i_vtref and
partner eq i_partner and
zzzmod_zeitr_von ge sy-datum and
zzzmod_zeitr_bis ge sy-datum and
zzzmod_stat eq 'B'.
if sy-subrc ne 0.
* Angebot suchen
select *
from zcd_zmod
into ls_zmod
where insobject eq i_vtref and
partner eq i_partner and
zzzmod_zeitr_bis ge sy-datum and
zzzmod_stat eq 'A'
order by zzzmod_zeitr_bis descending.
exit.
endselect.
endif.
endif.
I would like to convert this low performant ABAP code into a performant CDS view.
Actually the SQL-Query below is running in a loop for each partner/contract.
I would like to replace it by a CDS view but fail on the "if not this, try next" part. The view should have one line for each partner/contract from the first where condition that works. Any idea? We are running on non-Hana 7.50.
* laufende ZMOD Stundung oder Mindestbeitrag suchen
select single *
from zcd_zmod
into ls_zmod
where insobject eq i_vtref and
partner eq i_partner and
zzzmod_zeitr_von le sy-datum and
zzzmod_zeitr_bis ge sy-datum and
( zzzmod_stat eq 'B' or
zzzmod_stat eq 'E' ).
if sy-subrc ne 0.
* zukünftig anlaufende ZMOD suchen
select single *
from zcd_zmod
into ls_zmod
where insobject eq i_vtref and
partner eq i_partner and
zzzmod_zeitr_von ge sy-datum and
zzzmod_zeitr_bis ge sy-datum and
zzzmod_stat eq 'B'.
if sy-subrc ne 0.
* Angebot suchen
select *
from zcd_zmod
into ls_zmod
where insobject eq i_vtref and
partner eq i_partner and
zzzmod_zeitr_bis ge sy-datum and
zzzmod_stat eq 'A'
order by zzzmod_zeitr_bis descending.
exit.
endselect.
endif.
endif.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |