Application Development and Automation 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: 
Read only

Reading table from r/3 using rfc ?

0 Likes
720

Hi all,

how can i read tables from another r/3-system within an abap report ? what are the steps necessary ? can you provide me with some sample code/instructions, please ?

Thank you!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
631

YOu can use the RFC fm RFC_READ Table.

For advanced requirements, you can have a look at this blog.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f50dcd4e-0501-0010-3596-b686a7b5...

sample usage:

fld-fieldname = 'OBJ_NAME'.

APPEND fld.

CONCATENATE 'Object = ' '''FORM''' INTO str.

opt-text = str.

APPEND opt.

CALL FUNCTION 'RFC_READ_TABLE'

destination TDEST "Create a destination in sm59 for the other system

EXPORTING

query_table = 'TADIR'

TABLES

OPTIONS = opt

fields = fld

data = dat

EXCEPTIONS

table_not_available = 1

table_without_data = 2

option_not_valid = 3

field_not_valid = 4

not_authorized = 5

data_buffer_exceeded = 6

OTHERS = 7.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Message was edited by:

Ravi Kanth Talagana

4 REPLIES 4
Read only

Former Member
0 Likes
632

YOu can use the RFC fm RFC_READ Table.

For advanced requirements, you can have a look at this blog.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f50dcd4e-0501-0010-3596-b686a7b5...

sample usage:

fld-fieldname = 'OBJ_NAME'.

APPEND fld.

CONCATENATE 'Object = ' '''FORM''' INTO str.

opt-text = str.

APPEND opt.

CALL FUNCTION 'RFC_READ_TABLE'

destination TDEST "Create a destination in sm59 for the other system

EXPORTING

query_table = 'TADIR'

TABLES

OPTIONS = opt

fields = fld

data = dat

EXCEPTIONS

table_not_available = 1

table_without_data = 2

option_not_valid = 3

field_not_valid = 4

not_authorized = 5

data_buffer_exceeded = 6

OTHERS = 7.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Message was edited by:

Ravi Kanth Talagana

Read only

0 Likes
631

thank you, but i am on 4.6c! how about that ?

Read only

0 Likes
631

Is that FM not available in 4.6c??

Read only

Laxmana_Appana_
Active Contributor
0 Likes
631

Hi,

Create an RFC enabled function module in destination system and call it from source system with RFC destination.

Like :


  CALL FUNCTION 'READ_DEST_TABLE'
    destination DEST 
TABLES
  X_TABLE LIKE SPFLI.

Function code like:

   select * from spfli
         into table x_spfli.

Regards

L Appana