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: 

RFC

Former Member
0 Kudos

Hi Experts,

I am using the FM :RFC_READ_TABLE inmy program.In this i am filling the options table for giving conditions(Where clause).i am giving condition to retrieve only one record.In the database also there is only one record which satisfies that condition.But after exicuting the FM when i see data in the data table it is retrieving all the rows in the table.Can anybody tell me what is the reason?

See this code:

&----


*& Report YTEST_RFC

*&

&----


*&

*&

&----


REPORT YTEST_RFC.

DATA: t_options LIKE rfc_db_opt OCCURS 0 WITH HEADER LINE,

t_fields LIKE rfc_db_fld OCCURS 0 WITH HEADER LINE,

t_data LIKE tab512 OCCURS 0 WITH HEADER LINE.

DATA: w_werks(4) type c value '0288'.

DATA:w_rfcdest LIKE zvxxparam_global-value.

MOVE 'MATNR' TO T_fields-fieldname.

APPEND t_fields.

CONCATENATE 'WERKS' 'EQ' INTO T_options-text SEPARATED BY space.

CONCATENATE t_options-text ' ''' w_werks '''' into t_options-text.

write:/ 'hjbkjnkn'.

CALL FUNCTION 'RFC_READ_TABLE'

DESTINATION w_rfcdest

EXPORTING

query_table = 'Z2SKU1'

  • DELIMITER = ' '

  • NO_DATA = ' '

  • ROWSKIPS = 0

  • ROWCOUNT = 0

tables

OPTIONS = T_OPTIONS

fields = T_FIELDS

data = T_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

.

IF sy-subrc <> 0.

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

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

ELSE.

LOOP AT T_DATA.

WRITE:/ T_DATA.

ENDLOOP.

ENDIF.

Regards

1 REPLY 1

Former Member
0 Kudos

Hi

Try the following

In the options

You should concatenate in such way, that it should like this

(WERKS = '0288').

Try the below code

DATA : WERKS_STR TYPE STRING.

CONCATENATE ''''

w_werks

''''

INTO WERKS_STR.

CONCATENATE '(WERKS = '

WERKS_STR

')'

INTO t_options-text .

append t_options.

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

Regards

MD