ABAP – SELECT Statement with a variable table name

Home / SAP / ABAP Coding / ABAP – SELECT Statement with a variable table name

I just figured out a cool trick last night, and this may be old hat to a lot of you.  I was working on the latest piece of Proximity, and I wanted to be able to re-use my code, but each place would call it’s own custom transparent table.  The structures were the same, so it was an easy change.  Well, turns out it was a pretty easy trick.  You can create a Select statement with a variable table name.  Check it out the specific details below.


        select single * from (L_TABNAME) into z_wa
where field  = field.

That’s it.  Again, a trick I could’ve used a long time ago, but finally did the research last night to implement it.  Hope you find this handy.


As always, thanks for reading and don't forget to check out our SAP Service Management Products at my other company JaveLLin Solutions,

Leave a Reply

Your email address will not be published. Required fields are marked *