Hi
DATA T_DATA TYPE STANDARD TABLE OF TAB512.
CALL FUNCTION 'RFC_READ_TABLE' destination 'destination'
EXPORTING
QUERY_TABLE = 'KNB5'
TABLES
* OPTIONS = ???
* 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.
The query result is stored in the internal table T_DATA.
U need to transfer OPTIONS only if u need to create a filter in order to select certain records, u need to transfer FIELDS only if u need to extract the data of certain fields of KNB5
See this sample:
DATA: T_OPTIONS TYPE TABLE OF RFC_DB_OPT WITH HEADER LINE.
DATA: T_FIELDS TYPE TABLE OF RFC_DB_FLD WITH HEADER LINE.
DATA: T_DATA TYPE TABLE OF TAB512 WITH HEADER LINE.
PERFORM FILL_OPTIONS USING: 'KUNNR' '0000000001' 'AND',
'BUKRS' 'MAAB' SPACE.
PERFORM FILL_FIELDS USING: 'KUNNR', 'BUKRS', 'MAHNA'.
CALL FUNCTION 'RFC_READ_TABLE'
EXPORTING
QUERY_TABLE = 'KNB5'
* DELIMITER = ' '
* NO_DATA = ' '
* ROWSKIPS = 0
* ROWCOUNT = 0
TABLES
OPTIONS = T_OPTIONS
FIELDS = T_FIELDS
DATA = T_DATA.
LOOP