Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to use reference parameters (BAPI Import Parameters) in SQL statements

Former Member
0 Likes
412

Dear SAP gurus

I have a question on using parameters passed in a custom BAPI in SQL statements.

I am sending 2 parameters TABLENAME, COLUMNNAME into a custom bapi.

In the BAPI I need to give an sql command some thing like

select * from TABLENAME where COLUMNNAME = '100'.

Where TABLENAME and COLUMNAME may vary depend on what parameters are sent while calling this BAPI.

Even defining an internal table that has the structure of TABLENAME is not working.

I used the following statement 'data: ls_TABLENAME type TABLENAME', which generates error message saying TABLENAME is unknons.

Any feedback will be highly appreciated.

Thanks

Ram

1 REPLY 1
Read only

Former Member
0 Likes
342

As far as I know you can not give parameter to a select query like that. You should describe the tablename and the columnname as string type. Then assign the values to them you want to use in query.

data: str_table type string.

data: str_column type string.

select * from (str_table) into <g_t_table> where (str_column) = '100'.

If the table name is not determined until runtime, you must specify an output area with INTO .