一个使用CDS VIEW 的demo
REPORT demo_cds_currency_conversion. CLASS demo DEFINITION.
PUBLIC SECTION.
CLASS-METHODS main.
PRIVATE SECTION.
CLASS-METHODS setup.
ENDCLASS. CLASS demo IMPLEMENTATION.
METHOD main.
DATA(out) = cl_demo_output=>new( ). DATA currency TYPE c LENGTH VALUE 'USD'.
cl_demo_input=>request( CHANGING field = currency ).
currency = to_upper( currency ).
setup( ). SELECT *
FROM demo_prices
ORDER BY id
INTO TABLE @DATA(original_prices). out->begin_section( `Original Prices`
)->write( original_prices
)->next_section( `Converted Prices` ). IF cl_abap_dbfeatures=>use_features(
EXPORTING
requested_features =
VALUE #( ( cl_abap_dbfeatures=>views_with_parameters ) ) ).
TRY.
SELECT *
FROM demo_cds_currency_conversion(
to_currency = @currency, exc_date = @sy-datlo )
ORDER BY id
INTO TABLE @DATA(converted_prices)
##db_feature_mode[views_with_parameters].
out->write( converted_prices ).
CATCH cx_sy_open_sql_db INTO DATA(exc).
out->write( exc->get_text( ) ).
ENDTRY.
ELSE.
out->write(
'Database system does not support views with parameters' ).
ENDIF. out->display( ).
ENDMETHOD.
METHOD setup.
DATA prices TYPE SORTED TABLE OF demo_prices
WITH UNIQUE KEY id.
prices = VALUE #(
( id = amount = '1.00' currency = 'EUR' )
( id = amount = '1.00' currency = 'GBP' )
( id = amount = '1.00' currency = 'JPY' )
( id = amount = '1.00' currency = 'USD' ) ). DELETE FROM demo_prices.
INSERT demo_prices FROM TABLE prices.
ENDMETHOD.
ENDCLASS. START-OF-SELECTION.
demo=>main( ).
----------------凑字数-------------------------
励志美文、《抉择》
人的一生常处于抉择之中,如:念哪一间大学?选哪一种职业?娶哪一种女子?……等等伤脑筋的事情。一个人抉择力的有无,可以显示其人格成熟与否。
倒是哪些胸无主见的人,不受抉择之苦。因为逢到需要决定的时候,他总是求询别人说:"嘿,你看怎么做?"
大凡能够成大功业的人,都是抉择力甚强的人。他知道事之成败,全在乎已没有人可以代劳,更没有人能代你决定。
在抉择的哪一刻,成败实已露出端倪。