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_READ_DATA OPTIONS problems

Former Member
0 Likes
489

Hi,

I am using the FM RFC_READ_DATA to remotely access data from another system.

I have a problem with OPTIONS. What are its limits? How many entries can it have?

Below is an example.

Best regards,

Emilia

e.g.:

I need the data from table VBUK.

I tried to do an equivalent of the FOR ALL ENTRIES OF TABLE gt where vbeln = gt-vbeln.

So I loop the table gt and add each info line to the OPTIONS table (gt_rfc_opt)

It works just fine with a limited number of lines in gt.

But for much larger number the FM simply won't work.

It returns the exception OTHERS = 7.

I know that this is a problem with the OPTIONS since I have tried in both small number of entries and large.

Is there anything else I could use to get a better runtime?

*get vbuk table

CLEAR: lin, count.
      DESCRIBE TABLE gt LINES lin.
     REFRESH: gt_rfc_opt, gt_rfc_fld, gt_data.

     CLEAR:gt_rfc_opt, gt_rfc_fld, gt_data.

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


      READ TABLE gt  INTO ls  INDEX 1.

      gt_rfc_opt-text = 'VBELN = '''.

      CONCATENATE gt_rfc_opt-text ls-vbeln '''' INTO gt_rfc_opt-text.
      APPEND gt_rfc_opt.

      LOOP AT gt  INTO ls.

        IF count EQ 0.
          ADD 1 TO count.  
        ELSE..
          gt_rfc_opt-text = '  OR  VBELN = '''.

          CONCATENATE gt_rfc_opt-text ls-vbeln  '''' INTO gt_rfc_opt-text.
          APPEND gt_rfc_opt.

        ENDIF.
      ENDLOOP.

*******************************************************
      gt_rfc_fld-fieldname = 'VBELN'.
      APPEND gt_rfc_fld.
      gt_rfc_fld-fieldname = 'GBSTK'.
      APPEND gt_rfc_fld.


  CALL FUNCTION 'RFC_READ_TABLE'
    DESTINATION gc_rfcdest
    EXPORTING
      query_table          = VBUK
      delimiter                = ';'
    TABLES
      OPTIONS              = gt_rfc_opt
      fields                    = gt_rfc_fld
      data                     = gt_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 gt_data INTO gs_data.
          CONDENSE gs_data.
          SPLIT gs_data AT ';' INTO ls2-vbeln ls2-gbstk gs_data.
          APPEND ls2 TO gt2.
        ENDLOOP.
 ENDIF

1 REPLY 1
Read only

Former Member
0 Likes
419

hi,

i changed a little bit the report

this change solves the issue with the OPTIONS.

i search for data within the limits of the table GT.

but now there is the issue with the large amount of data that needs to be imported.

it imports all the lines that are between these limits and the amount of data is very large.

is there any other way to use these function's OPTION in order to retreive the smallest amount of data posible?

READ TABLE gt  INTO ls  INDEX 1.
      gt_rfc_opt-text = 'VBELN GE '''.
      CONCATENATE gt_rfc_opt-text ls-vbeln '''' INTO gt_rfc_opt-text.
      APPEND gt_rfc_opt.

     READ TABLE gt  INTO ls  INDEX lin.
      gt_rfc_opt-text = ' AND VBELN LE '''.
      CONCATENATE gt_rfc_opt-text  ls-vbeln'''' INTO gt_rfc_opt-text.
      APPEND gt_rfc_opt.

best regards,

Emilia