$(function () { pageContext.i18n.modTalk = 'moderation talk'; pageContext.i18n.replyToComment = 'Reply'; pageContext.i18n.modTalkEmpty = 'moderation talk is empty'; pageContext.url.getModTalk = "/comments/%25ID%25/listModTalk.json"; pageContext.url.possibleCommentRecipients = "/comments/%ID%/possibleRecipients.json"; pageContext.url.commentEdit = '/comments/%25ID%25/edit.html'; pageContext.url.commentView = '/comments/%ID%/view.html'; pageContext.i18n.commentVisibility = { 'full': 'Viewable by all users', 'op': 'Viewable by the original poster', 'mod': 'Viewable by moderators', 'opAndMod': 'Viewable by moderators and the original poster', 'other': 'Advanced visibility', 'dialogTitle': 'Comment visibility', 'selectGroups': 'Visible to groups', 'selectOther': 'Other recipients', 'selectOriginalPoster': 'Original poster', 'selectModerators': 'Moderators', 'selectAssignees': 'Asked to answer users' }; pageContext.i18n.commentMenuLabels = { 'comment-edit': 'comments.menu.edit', 'comment-delete': 'comments.menu.delete', 'comment-convert': 'comments.menu.convert' };pageContext.i18n.answer= { bestAnswer: 'Best Answer', controlBar : { accept: 'Accept', unaccept: 'Unaccept', acceptCommand: 'Accept this answer as correct', cancelAcceptedCommand: 'Remove this answers accepted status' } }; window.croles = { u: false, op: false, m: false, og: false, as: false, ag: false, dc: false, doc: false, eo: false, ea: false }; tools.init({ q: { e: false, ew: false, eo: false, r: false, ro: false, d: false, dow: false, fv: false, c: false, co: false, p: false, tm: false , ms: false, mos: false }, n: { f: false, vf: false, vfo: false, vr: true, vro: true, c: false, co: false, vu: false, vd: false, w: false, wo: false, l: false }, c: { e: false, eo: false, d: false, dow: false, ta: false, tao: false, l: false }, a: { e: false, ew: false, eo: false, d: false, dow: false, a: false, aoq: false, ao: false, tc: false, tco: false, p: false, tm: false }, pc: croles }, { tc: true, nsc: true }); commandUtils.initializeLabels(); }); Skip to Content
avatar image
Former Member

How to select from a table dynamically passed by user input parameter in SAP HANA native SQL Script

/********* Begin Procedure Script ************/ 
declare l_table varchar (30); 
l_table = SELECT '"'||"SCHEMA_NAME"||'"."'||"TABLE_NAME"||'"'
                   FROM "SYS"."M_TABLES" where "TABLE_NAME"='CE1'||:Table_IP; 
var_out = select "KAUFN" , "KDPOS" , "WW_CL", "WWDEL" 
                      from :l_table; 
END /********* End Procedure Script ************/

Hello Everyone!

I have a requirement in a Calculation View where user has to enter an input say 'Operating Concern' from a list of values in TKEB table.

List of values could be: '1000', 'E_B1', 'S001', 'S_AL', 'S_CP', 'S_GO',' T011'

This input gets concatenated with 'CE1' & becomes a table name & used to fetch few fields for output.

For example, If the user enters '1000', the new table name becomes 'CE11000' & used to fetch data. If he/she enters 'T011', the 'CE1T011' table is used to fetch data.. & so on...

I have created Script based CV as shown below but it is throwing some Scalar type error:

--Table_IP is the input parameter based on TKEB list

--Code attached above

Error: Repository: Encountered an error in repository runtime extension;Model inconsistency. Deploy Calculation View: SQL: scalar type is not allowed: L_TABLE: line 13 col 1 (at pos 480)

If the above logic is not correct, could you please let me know how to fetch data from a table dynamically passed by input parameter?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Dec 21, 2016 at 10:50 PM

    Hi Gaurav,

    It can be achieved through Graphical CV as well; you may use Union with Constant - value of which is based on the IP with Static List of Values.


    In your case, you may use Static List of Values with CE1*;


    Prasad A V

    Add comment
    10|10000 characters needed characters exceeded