Quantcast
Channel: SCN : All Content - ABAP for SAP HANA
Viewing all articles
Browse latest Browse all 831

AMDP: Dynamic SELECT

$
0
0

Hi all,

 

I would like to know if it is possibile to use SELECT statements in an AMDP method where the table name and/or the table fields are not the actual values but variables that contain the values of the table/table fields.

 

Example:

 

Table name = 'table'

Variable = var_tb (var_tb = 'table')

 

query = select * from :var_tb;

 

********

 

Table field = 'col1'

Variable = var_col (var_col = 'col1')

 

query = select :var_col from :var_tab;

 

********

 

I found the Exec statement but I can't make it work:

 

exec 'select * from ' ||:var_tb;

 

This work but I have to put the data extracted by the select into an internal table, I mean I think it works since it doesn't dump but i don't know if the data extracted by the select it's ok.

 

Any suggestions?

 

Thanks,

Michele


Viewing all articles
Browse latest Browse all 831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>