Skip to Content
1
Former Member
Apr 19, 2017 at 03:54 PM

Inline-declared table holding results of a SQL Query. Can it be used inside subroutines?

1028 Views

Hello experts,

I have been enjoying the features of ABAP 7.40 very much when it comes to making SQL queries without having to worry about time-consuming type declarations.

It's great to be able to do things like this (an example from Horst Keller's blog entry on host expressions):

SELECT carrid, connid, cityfrom, cityto
FROM spfli
WHERE carrid =
@( VALUE spfli-carrid( carriers[ KEY name
carrname = name ]-carrid
OPTIONAL ) )
INTO TABLE @DATA(result).

My question is, let's say I make this SQL, and then I want to use the newly-created internal table result as a parameter for a subroutine. The problem is, this table has been created inline without a type. Is there a way to pass it to a subroutine in a way that I can loop it, access the fields directly, etc?

Thanks a lot guys