-
-
Save ilyakaznacheev/34cfa7599ec4b5fc69a5a6344d51335f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@AbapCatalog.sqlViewName: 'ZTESTFL_TURN' | |
@AbapCatalog.compiler.compareFilter: true | |
@AccessControl.authorizationCheck: #CHECK | |
@EndUserText.label: 'Flight turnover test' | |
define view ZTest_Flight_Turnover | |
with parameters | |
p_from : abap.dats, | |
p_to : abap.dats, | |
p_curr : abap.cuky(5) | |
as select from S_Flights | |
{ | |
key CarrierId, | |
key ConnectionId, | |
@EndUserText.quickInfo: 'Оборот за выбранный промежуток' | |
@EndUserText.label: 'Оборот' | |
sum(case | |
when currencyCode = $parameters.p_curr | |
then price | |
else currency_conversion( | |
amount => price, | |
source_currency => currencyCode, | |
target_currency => $parameters.p_curr, | |
exchange_rate_date => FlightDate | |
) | |
end) as Turnover | |
} | |
where | |
FlightDate >= $parameters.p_from | |
and FlightDate <= $parameters.p_to | |
group by | |
CarrierId, | |
ConnectionId |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REPORT ztest_flignt_turnover. | |
DATA: | |
gv_date TYPE dats, | |
gv_connid TYPE spfli-connid. | |
PARAMETERS: | |
p_curr TYPE scurx-currkey OBLIGATORY. | |
SELECT-OPTIONS: | |
s_date FOR gv_date NO-EXTENSION OBLIGATORY. | |
SELECTION-SCREEN ULINE. | |
PARAMETERS: | |
p_carr TYPE spfli-carrid. | |
SELECT-OPTIONS: | |
s_conn FOR gv_connid. | |
START-OF-SELECTION. | |
DATA(lo_table) = cl_salv_gui_table_ida=>create_for_cds_view( | |
iv_cds_view_name = 'ZTEST_FLIGHT_TURNOVER' | |
). | |
* set parameters of CDS View | |
lo_table->set_view_parameters( | |
VALUE #( | |
( | |
name = 'P_FROM' | |
value = s_date-low | |
) | |
( | |
name = 'P_TO' | |
value = s_date-high | |
) | |
( | |
name = 'P_CURR' | |
value = p_curr | |
) | |
) | |
). | |
* set search criteria | |
DATA(lo_conn_f) = lo_table->condition_factory( ). | |
DATA(lo_condition) = lo_conn_f->in_range( | |
name = 'CONNECTIONID' | |
t_ranges = s_conn[] | |
). | |
IF p_carr IS NOT INITIAL. | |
lo_condition = lo_condition->and( | |
other_condition = lo_conn_f->equals( | |
name = 'CARRIERID' | |
value = p_carr | |
) | |
). | |
ENDIF. | |
lo_table->set_select_options( | |
io_condition = lo_condition | |
). | |
* display | |
TRY. | |
lo_table->fullscreen( )->display( ). | |
CATCH | |
cx_salv_int_no_check | |
cx_salv_ida_dynamic | |
INTO DATA(lo_error). | |
MESSAGE lo_error TYPE 'E'. | |
ENDTRY. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment