Skip to Content

In my blog series about Decision Management with HANA and R I gave some examples about analytical and predictive rules with HANA and R. I covered use cases like time series forecast and (integer) optimization of linear functions with linear constraints. Before I continue with more examples I want to discuss technical difficulties implementing those scenarios.

Missing Links: Integration between ABAP and R

At the moment AMDP doesn’t support R procedures. For me it was not possible to create R procedures using ADBC in ABAP, so I had to create HANA content that is called via ABAP. This is easily done but software logistics of HANA artifacts is not trivial because the activation of ABAP objects depends on the HANA content. Luckily SAP created HTA as successor of HTC (HANA Transport Container). In case you don’t know HTA I give some links to the documentation:

  1. presentation about HTA: http://go.sap.com/documents/2016/05/80f9d984-737c-0010-82c7-eda71af511fa.html
  2. central note: HTA https://launchpad.support.sap.com/#/notes/0001990798
  3. HTA documentation: http://help.sap.com/saphelp_nw74/helpdata/de/ff/7652bd542849b18b218efe8d2f2373/frameset.htm
  4. HTA Troubleshooting: https://launchpad.support.sap.com/#/notes/2321486

I asked my colleagues who work very often with HTA about their experience. They said that working is possible but it is not easy. So this is the workflow for export and import of HANA artifacts using SAP transport system:

    1. collect all HANA artifacts using transaction SCTS_HTA and synchronize it with transports
    2. then assign those objects to a transport request using this transaction
    3. This is easy. You only have to take care that you synchronize the HANA artifacts after a Change. Here HTA behaves like HTC: the transport contains the versions of at the time of synchronization and not of the release time. There is also the possibility to tale influence on the activiation time but this requires more work:

      1. collect all HANA artifacts using transaction SCTS_HTA and synchronize it with transports
      2. then assign those objects to a transport request using this transaction
      3. use “SUPRESS SYNTAX ERRORS” in the signature of the ADMP
      4. collect all HANA artifacts using transaction SCTS_HTA and synchronize it with transports
      5. then assign those objects to a transport request using this transaction
      6. set deployment mode in this transaction to “P” in the menu via utilities -> deployment mode, metadata will be added to the transport request
      7. you can release and transport the transport request
      8. in the target system you maintain transparent table CTS_HOT_PREWORK with the package to import – don’t set the flag “Prework Done” to true!
      9. then start transaction SCTS_HTA and run it with the name of the package
      10. then mark all deployable objects, type in DEPLOY and press enter to start the deployment

Even if you can avoid prework activities which should be possible in most cases I consider it still to too complex especially for business rules. SAP supports flexible deployment of decision services using SAP Decision Service Management.

So my message is easy: ABAP should support not only SQLscript procedures but also R. I don’t expect a full blown editor with supporting syntax highlighting – only the basic functions. It would also be interesting to integrate R in SAP Decision Service Management but this is a different topic that requires much more conceptual work.

Missing Documentation

If I read the SAP HANA and R integration guide I get the feeling that it is written by administrators. It covers many integration aspects: http://help.sap.com/hana/SAP_HANA_R_Integration_Guide_en.pdf
There is also a complex scenario contained in the documentation. Unfortunately something is missing: a description how HANA and R type systems fit together.

From my experience this is the most important information for hybrid programming (i.e. programming with two or more programming languages). I developed my own best practices for interfaces between SQLscript and R, for dealing with types like DECIMAL and so on but I am not sure whether they are true. It would be very useful to have a document describing the most important facts:

      • Which HANA data types correspond to which R data types?
      • Are there special things to consider f.e. conversions?
      • What about capital letters?
      • What are typical pitfalls?
      • What kind of “complex types” are possible for an interface? Is only data.frame but also data.table? What else is possible?

These are the typical questions of a beginner but also for people who mastered the first steps.
I am sure that SAP has this information since SAP created the HANA-R integration. So I would appreciate if SAP would publish it perhaps as non-normative documentation on SCN.

Summary

In my opinion the combination of operational analytics, prediction and business rules is an outstanding feature of SAP technology. The problem is software logistics. Compared to the HANA Transport Container, HTA is much better but not complex and cumbersome in the world of business rules. ADMP supporting R would be the perfect solution.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

  1. Lars Breddemann

    Hi Tobias

    thanks for your views on this matter. I cannot agree more about the state of documentation.
    In my view, there’s quite a gap between the available documentation (mostly covering the existence of functions/features and how to invoke those) and what is required to productively leverage those features.
    Book titles like “Efficient Application Development with SAP HANA” are just not available (maybe an idea for SAP Press Kelly ?)  and the books I’ve seen so far, merely scratch the how-to usage of tools a bit more, but ignoring the “when to use what and why” and the concepts behind certain features.

    I see your point for a better integration of R into the ABAP workflow. And if R would the exclusive means to work with predictive capabilities in SAP HANA I would fully back it.
    But, as mentioned in my comments to your other blog posts, SAP HANA comes with it’s built-in predictive, optimisation and business functions which are aimed at providing more integrated development and operations experience.
    These integrated tools can leverage the SAP HANA hardware and are able to perform a lot better (including the avoidance of type system conversions). In any HANA-R integration setup, you end up with yet another logical system with one or more servers to maintain an integrate. This is probably only rectified when the specific algorithms or flexibility of R provide features otherwise unavailable.

    But let’s see what happens with HANA 2.0 and other future developments. Seeing that other DBMS vendors went for a full-in-process-integration of an R version might indicate that “R-Integration” becomes a new “tick-box-feature” that just has to be there. And I guess, in that case, HANA would adopt that as well.

    BTW, this one of the most interesting series of HANA blogs I’ve read in a whole while. Thanks, tor that! Personally, I’ve grown tired of reading blogs that explain how a certain modelling feature in SAP HANA Studio or the WebUI works and what to do with common ABAP modelling techniques on DB level all told in a screenshot collage.

    Looking forward to reading more about your experiences

    Cheers,

    Lars

    (1) 
    1. Tobias Trapp Post author

      Hi Lars,

      I am glad that you like the blog series and I will continue it.

      You are absolutely right: HANA comes with built-in Features for prediction and we plan to use them. I should asl my collegues – maybe there are already completed.

      And yes, an SAP Press book would be great. But this has to be written and will probably describe new exciting poossibilities. But what do we do in the mean time? I can make a suggestion: if there is SAP internal documentation about type system I could transform it to an SCN document by replacing screenshots, changing the texts if necessary and so on.

      Best Regards,
      Tobias

      (0) 
  2. Harald Stevens

    Hi Tobias,

    thanks a lot for your Feedback on using HTA. Maybe we could discuss this use case in Detail, because there is an Option to do an automatic second deployment of HANA artifacts after the after Import methods (originally intended for combined Transports of BW and HANA artifacts). That could potentially help here as well…

    Kind regards
    Harald 

    (1) 

Leave a Reply