Hello Danesh,
you can use below Code:-
DATA : lt_fld TYPE TABLE OF rfc_db_fld,
ls_fld LIKE LINE OF lt_fld,
lt_opt TYPE TABLE OF rfc_db_opt,
lt_data TYPE TABLE OF tab512.
DATA : obj_data TYPE REF TO data.
FIELD-SYMBOLS : <fs_table> TYPE STANDARD TABLE,
<fs_wa> TYPE any.
CALL FUNCTION 'RFC_READ_TABLE'
EXPORTING
query_table = 'SBOOK'
delimiter = '#'
* NO_DATA = ' '
* ROWSKIPS = 0
* ROWCOUNT = 0
TABLES
options = lt_opt
fields = lt_fld
data = lt_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.
* Implement suitable error handling here
ENDIF.
IF lt_data[] IS NOT INITIAL.
DATA : p_inp(10) TYPE c.
p_inp = 'SBOOK'.
CREATE DATA obj_data TYPE TABLE OF (p_inp).
ASSIGN obj_data->* TO <fs_table>.
FREE : obj_data.
CREATE DATA obj_data TYPE (p_inp).
ASSIGN obj_data->* TO <fs_wa>.
DATA :wa_data LIKE LINE OF lt_data.
FIELD-SYMBOLS : <lv_field> TYPE any.
FIELD-SYMBOLS : <fs> TYPE tab512.
DATA : lc_cnt TYPE sy-tfill.
DESCRIBE TABLE lt_data LINES sy-tfill.
IF sy-subrc IS INITIAL.
lc_cnt = sy-tfill.
ENDIF.
LOOP AT lt_data INTO wa_data.
DO lc_cnt TIMES.
READ TABLE lt_fld INTO ls_fld INDEX sy-index.
IF sy-subrc IS INITIAL.
ASSIGN COMPONENT ls_fld-fieldname OF STRUCTURE <fs_wa> TO <lv_field>.
IF <lv_field> IS ASSIGNED AND sy-subrc IS INITIAL.
MOVE : wa_data-wa+ls_fld-offset(ls_fld-length) TO <lv_field>.
ENDIF.
ENDIF.
ENDDO.
APPEND : <fs_wa> TO <fs_table>.
CLEAR : wa_data-wa.
ENDLOOP.
ENDIF.
IF <fs_table>[] IS NOT INITIAL.
break abaper.
ENDIF.
********************************************************************************************
Alternativly you can also use FM's:-
1)TABLE_ENTRIES_GET_VIA_RFC
2) RFC_GET_TABLE_ENTRIES
With these FM's we can transfer atmost 40 fields of the table with unlimited data in table.
Regards,
Hitesh Gavande