Skip to Content

SAP BW on Hana - complex logic using AMDP

Hello,

I've read several interesting BW on Hana transformation blogs by several authors, but I could not find any blog that performs complex transformation

We've complex routines in the END routine that use source_package, transform and create result packages.

I'm looking for some sample code that uses loop and loop, if else conditions, field symbols etc. Can anyone share piece of code that uses complex code that reads intTAB and produce outTab? Thank you for your help.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    Apr 10 at 10:38 AM

    Hi William,

    there are several examples of usage of loops, cursors, if/endif etc. in the SQLScript reference on SAP Help Portal. But it is clearly pointed out, that you have to avoid using imperative logic as far as possible. The reason: imperative logic cannot be parallelized as functional.

    As you can see in SAP Tutorials (e.g. https://www.sap.com/developer/tutorials/xsa-sqlscript-anonymous.html ) SQLScript can be used to solve quite difficult tasks.

    In ABAP you normally do one “heavy” select in the beginning of your program and then process the data locally using variables and internal tables.

    In AMDP Transformation/Stored procedure you have to use SELECT as more as possible.You use SELECT to select data from database table, and then you use SELECT to do some transformation with data retrieved from database (e.g. format strings using string functions https://sapstudent.com/hana/sql-string-functions-in-sap-hana ), and then you might aggregate the data still using SELECT statement. You are building some sort of pipeline.

    Regards,

    Nikolay

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 14 at 08:22 AM

    Hi,

    Any help please

    regards

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 14 at 12:54 AM

    Hi Nikolay,

    Your answer truly helped . I'm going to read up on that.

    Thank you kindly,

    William.

    Add comment
    10|10000 characters needed characters exceeded

  • Apr 22 at 11:34 AM

    Hi Nikolay,

    Your information indeed helped !. I've a follow up question for you. In SQLSript, Select command can use both SAP provided and custom created functions.

    Can I develop custom function (table,scalar) in HANA Studio and call in select command? Do you advise to NOT do this for performance reason?

    If you say yes to create custom Function, then could you please outline some steps that needs to be taken to implement the function and to transport to QA->Prod. AMDP can be transported via transport system. But I suspect we need to import and export the functions separately and provide access rights!

    Thank you kindly for your generous help. Much appreciated!.

    Regards,

    William

    Add comment
    10|10000 characters needed characters exceeded