Saturday, 12 August 2017

Call HANA Orion API from ABAP

The SAP HANA Repository is a key feature of the HANA native development environment.  It is the design time archive for all development objects from database tables all the way up through user interface artifacts. However up until now we’ve not had a supported API which would allow application developers or 3rd party tools developers to access the Repository.  With the advent of the Web-based development tooling, SAP needed to create a REST-based service interface for these development tools.  These two requirements come together in SPS 09 in the form of the newly released SAP HANA REST API.

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP

Clicking save will call the API and the code is saved on HANA.

SAP ABAP Tutorials and Materials, SAP ABAP Certifications, SAP ABAP

I’ll not recommend using the ABAP editor for XSJS development, as it is just a simple text editor that doesn’t know about javascript.

The following example shows how a file can be created from ABAP using the API,

DATA(lo_factory) = NEW zcl_orion_factory( iv_url      = p_url

                                          iv_user     = p_user

                                          iv_password = p_passw ).

DATA(lo_file) = lo_factory->file( ).

lo_file->file_create( iv_path = ‘foobar/’

                      iv_name = ‘asdf.txt’ ) ##NO_TEXT.

lo_file->file_update( iv_path = ‘foobar/asdf.txt’

                      iv_data = ‘Hello’ ) ##NO_TEXT.

The code doesn’t work with HCP, I haven’t had any luck getting past the SAML authentication from ABAP.

No comments:

Post a Comment