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

RFC Function Module

Former Member
0 Likes
804

Hello,

I am trying to get the records using RFC FM in IT_DATA[] using the following. But I am not getting any records in it. it_data is declared as (DATA: it_data TYPE tab512 OCCURS 0 WITH HEADER LINE.)

LOOP AT it_rseg_data.

it_options-text = 'BELNR = '.

CONCATENATE ' '' ' it_rseg_data-belnr ''' AND ' INTO objid.

CONDENSE objid NO-GAPS.

CONCATENATE it_options-text objid INTO it_options-text

SEPARATED BY space.

APPEND it_options.

ENDLOOP.

******************************************************************************

IT_OPTIONS gets built with different values of BELNR from it_rseg_data table.

For Ex. BELNR = 1234

BELNR = 5678

*******************************************************************************

PERFORM read_rbkp_belnr_details USING p_logsys bldat bldat_to.

********************************************************************************

FORM read_rbkp_belnr_details USING p_logsys LIKE rfcdes-rfcdest bldat bldat_to.

DATA: l_errflg TYPE char1. CLEAR: it_data. REFRESH: it_data.

CHECK NOT vt_fields[] IS INITIAL.

  • read data from backend

PERFORM read_table_rbkp_for_belnr USING 'RBKP'

p_logsys bldat bldat_to

CHANGING l_errflg.

ENDFORM.

***********************************************************************************

FORM read_table_rbkp_for_belnr USING pi_tabname LIKE dd02l-tabname

pi_logsys bldat bldat_to

CHANGING pc_errflg.

REFRESH it_data. CLEAR it_data.

CALL FUNCTION 'RFC_READ_TABLE'

DESTINATION PI_LOGSYS

EXPORTING

query_table = 'RBKP'

TABLES

OPTIONS = it_options

fields = vt_fields

data = it_data

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.

it_rbkp_data [] = it_data [].

Shall appreciate if anyone can tell me where I am doing wrong and how do I correct it.

Thks,

Hemal

Edited by: hemalgandhi on Mar 25, 2009 4:25 PM

Edited by: hemalgandhi on Mar 25, 2009 4:26 PM

Edited by: hemalgandhi on Mar 25, 2009 4:26 PM

1 ACCEPTED SOLUTION
Read only

Manohar2u
Active Contributor
0 Likes
768

Also makesure rfc destination 'pi_logsys' is case sensitive.

6 REPLIES 6
Read only

former_member194669
Active Contributor
0 Likes
768

I think problem is while creating the options internal table


LOOP AT it_rseg_data.
it_options-text = 'BELNR = '.
CONCATENATE ' '' ' it_rseg_data-belnr ''' AND ' INTO objid.
CONDENSE objid NO-GAPS.
CONCATENATE it_options-text objid INTO it_options-text
SEPARATED BY space.
APPEND it_options.
ENDLOOP.

Say for example if you are inserting for BELNR 1000 then after your loop

it looks like


BELNR = '1000' AND.

I think you need to remove the AND from the last record

a®

Read only

0 Likes
768

Thanks for the response. Even though I remove AND, it does not fill it_data. Is there any other thing I can do so that the RFC FM sends it to the backend table (RBKP.)

Rgds,

Hemal

Read only

0 Likes
768

Try it thru SE37 with same values u are passing thru program and check

a®

Read only

0 Likes
768

This FM looks like taking one value at a time. Is there any other FM that would take multiple different entries and retrieve the respective records ?

Read only

Manohar2u
Active Contributor
0 Likes
769

Also makesure rfc destination 'pi_logsys' is case sensitive.

Read only

former_member376453
Contributor
0 Likes
768

Try to run your RFC FM, in standalone mode through SE37 and check why the data is not getting populated.

Kuntal