CDS view approach is maybe the safest approach while connecting to a secondary HANA database. If there is a safer approach it would be using directly OpenSQL. However there are cases where OpenSQL is not enough to cover all the states. So CDS technique becomes the only option to connect secondary HANA.
If you are familiar with CDS , you will see that it brings many facilities including expressions,authorizations, annotations etc. Moreover CDS seems the most powerful tool to use HANA capabilities. Finally usage of CDS with HANA is same as OpenSQL usage: you just have to add a connection string to your SQL statement. The difference of CDS could be development environment as of now SAP GUI does not support CDS usage but the only way is using Eclipse. Below i am sharing a very simple CDS with a HANA connection string.
Eclipse
1 2 3 4 5 6 7 8 9 10 11 |
@AbapCatalog.sqlViewName: 'Zya_sql_Cds1' @AbapCatalog.compiler.CompareFilter: true @AccessControl.authorizationCheck: #CHECK @EndUserText.label: 'cds1' define view Zya_Cds1 as select from eabl { key ablbelnr , adat, atim } |
Eclipse/SAP GUI
1 2 3 4 5 6 7 8 9 10 11 |
report zya_cds_select. start-of-selection. * select select * from ZYA_CDS1 into table @data(lt_cds1) connection ('{HANA Connection Name}') up to 1000 rows. write : lines( lt_cds1 ). |