How to define "where" clause for RFC_READ_TABLE ?
Submitted by Anonymous (not verified) on Wed, 04/03/2013 - 23:48
Hello,
I'm trying to define a where clause for the RFC_READ_TABLE function like so:
RFC_READ_TABLE("KNA1", "tblKNA1", "KUNNR,KTOKD,NAME1")
Where KUNNR = "260*" and KTOKD In ("9026","9017").
Could you tell me please where can i define this inside the code ?
Also, is it possible to export the table generated into a text file ? (not to overload the database.)
Thank you.
Duration:
1 month
Comments
Where clause in RFC_READ_TABLE
This is a relatively simple step, but it took me a while to figure it out. In SE37 the
RFC_READ_TABLE
function has this line:I had to experiment with it and finally came to the conclusion that adding a single OPTION value to the RFC before calling it would populate the
WHERE
in the query. It is important to leave out the "WHERE" and the period; include only the condition of the where clause like so in your VBA code:Take note of the single quotes within the string encapsulating the customer number above. This "option" is effectively a short piece of ABAP code that is slipped into the
SELECT
statement when the RFC_READ_TABLE function is called.The usage of or and and statements will require a little experimentation. It appears they can be included in the single value in the OPTIONS array or potentially added as additional OPTIONS values.
I include a screen shot of the code in the VBA debugger and the successful results. A simple copy-past from the VBA snippet above keeps it simple.