Skip to Content
0

Execute the unload from HANA memory script for a list of BW info cubes

Aug 21, 2017 at 07:42 AM

87

avatar image
Former Member

Hi,

We have a requirement to execute the HANA unload from memory script from ABAP. To test this we have implemented in ABAP a simple one line code to unload a table (BW cube) from the memory. Getting the below errors in ADT. Is it possible to execute the HANA unload script from ABAP through an AMDP procedure. If yes, please help with inputs to resolve the below errors. Thanks.

error.jpg (74.1 kB)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Matthew Billingham
Aug 21, 2017 at 08:05 AM
0

Yes it's possible to call the unload script. The method is the same as for any other AMDP. You can search for examples and modify them to your needs, but for a simple unload, I suggest you use cl_sql_statement from your ABAP, with method execute_query.

First you need to go to SQL console and get your SQL correct. Obviously it doesn't like you specifying the schema. Use this FM to get the schema name you should probably be using.

    CALL FUNCTION 'RSAN_SYSTEM_PARAMETER_READ'
      EXPORTING
        i_name     = CONV pfeparname( |dbs/hdb/schema| )
      IMPORTING
        e_value    = _schema_name
      EXCEPTIONS
        read_error = 1
        OTHERS     = 2.
Share
10 |10000 characters needed characters left characters exceeded
Guy Biscoe Sep 07, 2017 at 03:13 PM
0

If you refer to a database table in your SQL script you have to add the table name after the USING keyword in the METHOD statement.

E.g.,

METHOD OFFLOAD BY DATABASE PROCEDURE FOR HDB LANGUAGE SQLSCRIPT
          USING  /BIC/FZA1_AL301. 

But because you might not know which table it is until runtime then you've hit a limitation of AMDP and you have to use the ADBC class as Matthew mentioned instead.

It is useful to have a program to manage it, to find the list of cubes/dsos and convert their object names to table names and generate the SQL string as you'd use in the console: unload schema."tablename"

Instantiate the class and execute your SQL :

lo_connection = new cl_sql_statement( con_ref = cl_sql_connection=>get_connection( ) ).
lo_connection->execute_ddl( yourSQLstring ).    

It's a good idea to catch cx_sql_exception to check db_error, sql_code and sql_message.

Share
10 |10000 characters needed characters left characters exceeded