Skip to Content
author's profile photo Former Member
Former Member

Passing schema name through input parameter


We are working on packaging industry specific product on HANA.

Wanted to check if anyone tried passing schema name through the input parameter of the procedure to identify the procedure run-time.


Question is if we can call : CALL "VAR SCHEMA"."PROCEDURE NAME"(IN,OUT)

I appreciate your valued suggestion or direction in advance.



Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Jul 26, 2016 at 04:16 AM

    You're getting the schema concept wrong here.

    Schemas are not meant to serve as a multi-client implementation basis, while code is still shared.

    You have one single database, that's what you develop against.

    If you like to separate different "data bearing" schemas but share the same code, then you will have to operate with dynamic SQL with all the negative side effects this brings.

    SQL is a static typed language and so is SQL Script. Upon compilation any object name referenced gets resolved to what is current at that point in time.

    While this can be seen as a limitation, it actually makes sense as you define the operations on your data together with your data and not in an somewhat abstract level 'above' the actual data definition.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Lars Breddemann

      Yes Lars.

      Its about calling the Standard Procedure delivered by SAP.

      Now point is without creating any clone or copy of this standard procedure in product schema, can we call this dynamically by just passing customer's ERP schema (as it always will be different).

  • Posted on Jul 26, 2016 at 04:47 AM

    Hi Utpal Dhar,

    As Lars said we need to use dynamic SQL to achieve this, This below code is working fine for me,

    Instead of that static variables I used in the above piece of code, you can use input parameters of your procedure.

    2.PNG (4.7 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 26, 2016 at 06:45 AM

    But say you need to provide the output structure or table type that has been defined in the beginning which also is part of the procedure sitting in different schema and you dont wish to define it in your own schema rather wish to resolve it on the fly.

    Above mentioned scenario occurs even before you execute the string operation.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member HARIKRISHNAN S

      Nope it doesnt as we've multiple output table.

      However what we assessed that, this approach does not work in our case.

      As its not only a simple call statement, rather high dependencies on input/output structures and procedural changes that SAP does in different releases (which should not have impact due to SAP upgrade).

      We are planning for an alternative approach.

      Thanks for your reply.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.