* ab V6.10 verfügbar
* DEMO_ADBC_DDL_DML
* DEMO_ADBC_DDL_DML_BINDING
* DEMO_ADBC_DDL_DML_BULK_ACCESS
* DEMO_ADBC_PREPARED_STATEMENT
* DEMO_ADBC_QUERY
* DEMO_ADBC_STORED_PROCEDURE
DATA: o_salv TYPE REF TO cl_salv_table. " Anzeigeobjekt SALV Grid
DATA: it_cols TYPE adbc_column_tab. " Selektierte Spalten
DATA: it_tsp01 TYPE STANDARD TABLE OF tsp01. " Ausgabetabelle
DATA: par TYPE i VALUE 2000. " Parameter für Selektion
START-OF-SELECTION.
* zu verarbeitende Spalten
it_cols = VALUE #( ( 'RQIDENT' )
( 'RQDEST' )
( 'RQPAPER' )
( 'RQO1NAME' ) ).
* Spaltennnamen durch Komma trennen
DATA(cols) = to_lower( concat_lines_of( table = it_cols sep = ',' ) ).
* Spaltennamen und Parameter in SQL einfügen
DATA(lv_query) = |SELECT { cols } FROM tsp01 WHERE rqident > '{ par }'|.
TRY.
* SQL-Connection öffnen
DATA(o_sql_connection) = NEW cl_sql_connection( ).
IF abap_true <> o_sql_connection->is_closed( ).
* SQL-Statement erzeugen
DATA(o_sql) = NEW cl_sql_statement( con_ref = o_sql_connection ).
* Query ausführen
DATA(o_result) = o_sql->execute_query( lv_query ).
* Ergebnismenge soll in interne Tabelle it_tsp01 und nur die Spalten, welche in it_cols stehen
o_result->set_param_table( itab_ref = REF #( it_tsp01 )
corresponding_fields = it_cols ).
* Ergebnismenge in interne Tabelle lesen
* cnt enthält die Anzahl der gelesenen Datensätze
DATA(cnt) = o_result->next_package( ).
* Ergebnismenge schließen
o_result->close( ).
* SQL-Connection schließen
o_sql_connection->close( ).
IF cnt > 0.
cl_salv_table=>factory( IMPORTING
r_salv_table = o_salv
CHANGING
t_table = it_tsp01 ).
o_salv->get_display_settings( )->set_list_header( |DBMS: { o_sql_connection->get_dbms( ) }| ).
o_salv->get_functions( )->set_all( abap_true ).
o_salv->get_display_settings( )->set_striped_pattern( abap_true ).
o_salv->display( ).
ENDIF.
ENDIF.
CATCH cx_root INTO DATA(e_text).
WRITE: / e_text->get_text( ).
ENDTRY.
Links