Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Select from the database using RFC

shwetha_hs
Employee
Employee
0 Kudos

Subject modified by moderator. Please try to make it meaningful in future

Hi,

Say there are 2 system A and B, connected through RFC. From A, I want to query a table of B. How do I do it? Can I do it through the direct Select statement?

Thanks for your answers.

Edited by: Matt on Dec 15, 2008 2:06 PM - changed subject

6 REPLIES 6

Former Member
0 Kudos

Hi,

Create an RFC function module with the required select querry.

Regards,

Vartika

0 Kudos

Thnaks for your answer. But this would require 2 steps. One is to create a FM in one system(A), other is to execute the report in another system(B). So i want to know if it can be done from the report alone, in only one system(B).

0 Kudos

hi,

check this function module.

RFC_READ_TABLE.

Former Member
0 Kudos

Make a FM in system A and call it like this. Put your select query in it for DB of system B

CALL FUNCTION 'XYZ' DESTINATION B

Former Member
0 Kudos

hi...

you have to Create a function module with RFC enable .

and A and B are different server

then you have to use key word DESTINATION

here is the sample code i used in my program .

CASE sy-sysid.

WHEN 'DVH'.

CONCATENATE 'DVC' 'CLNT' '025' INTO wf_dest.

WHEN 'QAH'.

CONCATENATE 'QAC' 'CLNT' '129' INTO wf_dest.

WHEN 'SUH'.

CONCATENATE 'SUC' 'CLNT' '222' INTO wf_dest.

WHEN 'PRH'.

CONCATENATE 'PRC' 'CLNT' '222' INTO wf_dest.

WHEN OTHERS.

ENDCASE.

CLEAR fs_actemp.

LOOP AT int_actemp INTO fs_actemp WHERE vdsk1 <> ''.

CLEAR int_lfa1_inp[].

CLEAR fs_lfa1_inp.

fs_lfa1_inp-lifnr = fs_actemp-vdsk1.

APPEND fs_lfa1_inp TO int_lfa1_inp.

CALL FUNCTION 'ZSMP_GET_VENDOR_NAME' DESTINATION wf_dest

TABLES

tlfa1 = int_lfa1_inp.

CLEAR fs_lfa1_inp.

READ TABLE int_lfa1_inp INTO fs_lfa1_inp INDEX 1.

fs_actemp-name1 = fs_lfa1_inp-name1.

MODIFY int_actemp FROM fs_actemp TRANSPORTING name1 WHERE vdsk1 = fs_actemp-vdsk1.

CLEAR fs_actemp.

ENDLOOP.

regards,

chinnaiya

Former Member
0 Kudos

Hello Shweta,

you can use Function module RFC_READ_TABLE. You need to know the IP of your target sytem.

Regards

Arindam