Search code examples
inner-joinabapsaprfcopensql

Select inner join with RFC


Is there any chance to execute an inner join select over RFC on some(in this case 2) database tables?

Basically, I wanna translate this command into something that works with RFC.

SELECT DISTINCT t2~field
    FROM table1 AS t1
    INNER JOIN table2 AS t2
    ON t1~id = t2~id
    INTO TABLE lt
    WHERE (lv_where).

I am aware of RFC_READ_TABLE. The only problem is that it can only read from one table. I could also read from both tables and merge them together and check my stuff, but I wanna prevent that.


Solution

  • It's a good idea not to perform the join operation manually. The easiest way to do this would be to create your own function module that performs exactly the selection you need. It's not hard, just give it a try. If this is not an option, you could try to get someone assemble a database view and use that in your call to RFC_READ_TABLE. There might be other module-specific querying options that I'm not aware of.