‎2012 Jan 17 12:20 PM
Hi Experts,
I am writing a select query in a rfc function module who's tablename is decided at runtime.After the selection i want to pass those entries from where the FM is being called.
I have wriiten the select query.To send the retrieved entries, I dont know how to declare a dynamic table in rfc FM. i.e in the TABLES parameter.
Could any one guide me how to do that please.
‎2012 Jan 17 12:31 PM
you cannot use generic type in RFC FM so here is what you can do:
create an exporting parameter of type XSTRING.
apply transformation on you internal table in FM after you fetch data:
* Convert the dynamic data into XML format to be sent to RFC FM
CALL TRANSFORMATION id_indent
SOURCE itab = pv_table
RESULT XML lv_xstring.
in the calling program do reverse transformation:
* Convert xstring back into XML
CALL TRANSFORMATION id_indent
SOURCE XML i_xstring
RESULT itab = <lt_table>.
‎2012 Jan 17 12:30 PM
check this FM
RFC_READ_TABLE
this reads data from any table + with RFC connection + works with where clause as well
‎2012 Jan 17 12:30 PM
Hi,
Use the following link for Dynamic SQL
<<linkfarm removed>>
Edited by: kishan P on Jan 17, 2012 6:29 PM
‎2012 Jan 17 12:31 PM
you cannot use generic type in RFC FM so here is what you can do:
create an exporting parameter of type XSTRING.
apply transformation on you internal table in FM after you fetch data:
* Convert the dynamic data into XML format to be sent to RFC FM
CALL TRANSFORMATION id_indent
SOURCE itab = pv_table
RESULT XML lv_xstring.
in the calling program do reverse transformation:
* Convert xstring back into XML
CALL TRANSFORMATION id_indent
SOURCE XML i_xstring
RESULT itab = <lt_table>.
‎2012 Jan 17 12:50 PM
Hi,
Thanks a lot for your reply. I also want to pass a dynamic table with entries to the rfc Fm how can i do that. Is there any way. Please guide on.
‎2012 Jan 17 12:58 PM
vadiv_maha wrote:
"Thanks a lot for your reply. I also want to pass a dynamic table with entries to the rfc Fm how can i do that. Is there any way. Please guide on."
I have given the steps in my previous post do you have any specific question on it?
‎2012 Jan 17 1:06 PM
Those steps are very clear.
But how do i pass a dynamic table entry to rfc Fm with entries. Could you help me on that please.
‎2012 Jan 17 1:21 PM
It cannot be passed as table you need to convert table data into XML and store the result in XSTRING format. to transform you dynamic table data in XML use call transformation, assume you data is in table pv_table:
* Convert the dynamic data into XML format to be sent to RFC FM
CALL TRANSFORMATION id_indent
SOURCE itab = pv_table
RESULT XML lv_xstring.
once this tranformation is executed your data will reside in XSTRING type variable lv_xstring and you can pass it as you pass any other normal exporting parameter. parameter type should be given as XSTRING.
Edited by: Gaurav B. on Jan 17, 2012 2:22 PM
‎2012 Jan 17 1:34 PM
‎2012 Jan 17 1:16 PM
This case is One difficult. I also received this requirement a week ago. After the search I found , you can refer FM HR_READ_INFOTYPE in that they have used dynamic table you can refer to that.
And I found one good code sample the link is below. You need to pass it as XML to achieve.
‎2012 Jan 17 1:22 PM