2009 Mar 25 3:25 PM
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
2009 Mar 25 3:57 PM
2009 Mar 25 3:54 PM
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®
2009 Mar 25 4:11 PM
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
2009 Mar 25 4:14 PM
Try it thru SE37 with same values u are passing thru program and check
a®
2009 Mar 25 4:20 PM
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 ?
2009 Mar 25 3:57 PM
2009 Mar 25 3:59 PM
Try to run your RFC FM, in standalone mode through SE37 and check why the data is not getting populated.
Kuntal