Hi
You use this Z FM which overcome RFC_READ_TABLE limitations
FUNCTION yrfc_read_table. |
*"---------------------------------------------------------------------- |
*"*"Local Interface: |
*" IMPORTING |
*" VALUE(QUERY_TABLE) LIKE DD02L-TABNAME |
*" VALUE(DELIMITER) LIKE SONV-FLAG DEFAULT SPACE |
*" VALUE(NO_DATA) LIKE SONV-FLAG DEFAULT SPACE |
*" VALUE(ROWSKIPS) LIKE SOID-ACCNT DEFAULT 0 |
*" VALUE(ROWCOUNT) LIKE SOID-ACCNT DEFAULT 0 |
*" TABLES |
*" OPTIONS STRUCTURE RFC_DB_OPT |
*" FIELDS STRUCTURE RFC_DB_FLD |
*" DATA STRUCTURE BPCHAR2000 |
*" EXCEPTIONS |
*" TABLE_NOT_AVAILABLE |
*" TABLE_WITHOUT_DATA |
*" OPTION_NOT_VALID |
*" FIELD_NOT_VALID |
*" NOT_AUTHORIZED |
*" DATA_BUFFER_EXCEEDED |
*"---------------------------------------------------------------------- |
DATA BEGIN OF table_structure OCCURS 10. |
INCLUDE STRUCTURE dfies. |
DATA END OF table_structure. |
DATA: table_type TYPE dd02v-tabclass, |
number_of_fields TYPE i, |
line_cursor TYPE i. |
DATA: BEGIN OF fields_int OCCURS 10, |
fieldname LIKE table_structure-fieldname, |
type LIKE table_structure-inttype, |
decimals LIKE table_structure-decimals, |
length_src LIKE table_structure-intlen, |
length_dst LIKE table_structure-leng, |
offset_src LIKE table_structure-offset, |
offset_dst LIKE table_structure-offset, |
END OF fields_int. |
DATA: dref TYPE REF TO data. |
FIELD-SYMBOLS <d>. |
CALL FUNCTION 'DDIF_FIELDINFO_GET' |
EXPORTING |
tabname = query_table |
IMPORTING |
ddobjtype = table_type |
TABLES |
dfies_tab = table_structure |
EXCEPTIONS |
not_found = 1 |
internal_error = 2 |
OTHERS = 3. |
IF sy-subrc <> 0. |
RAISE table_not_available. |
ENDIF. |
IF table_type = 'INTTAB'. |
RAISE table_without_data. |
ENDIF. |
ASSIGN COMPONENT 0 OF STRUCTURE data TO <d>. |
DESCRIBE TABLE fields LINES number_of_fields. |
IF number_of_fields = 0. |
LOOP AT table_structure. |
MOVE table_structure-fieldname TO fields-fieldname. |
APPEND fields. |
ENDLOOP. |
ENDIF. |
line_cursor = 0. |
LOOP AT fields. |
READ TABLE table_structure WITH KEY fieldname = fields-fieldname. |
IF sy-subrc NE 0. |
RAISE field_not_valid. |
ENDIF. |
IF line_cursor <> 0. |
IF no_data EQ space AND delimiter NE space. |
MOVE delimiter TO data+line_cursor. |
ENDIF. |
line_cursor = line_cursor + STRLEN( delimiter ). |
ENDIF. |
fields_int-fieldname = table_structure-fieldname. |
fields_int-length_src = table_structure-intlen. |
fields_int-length_dst = table_structure-leng. |
fields_int-offset_src = table_structure-offset. |
fields_int-offset_dst = line_cursor. |
fields_int-type = table_structure-inttype. |
fields_int-decimals = table_structure-decimals. |
line_cursor = line_cursor + table_structure-leng. |
APPEND fields_int. |
fields-fieldtext = table_structure-fieldtext. |
fields-type = table_structure-inttype. |
fields-length = fields_int-length_dst. |
fields-offset = fields_int-offset_dst. |
MODIFY fields. |
ENDLOOP. |
IF no_data EQ space. |
FIELD-SYMBOLS: <wa> TYPE ANY, <comp> TYPE ANY. |
CREATE DATA dref TYPE (query_table). |
ASSIGN dref->* TO <wa>. |
SELECT * INTO CORRESPONDING FIELDS OF <wa> |
FROM (query_table) |
WHERE (options). |
IF sy-dbcnt GT rowskips. |
LOOP AT fields_int. |
* IF fields_int-type = 'P'. |
* ASSIGN COMPONENT fields_int-fieldname |
* OF STRUCTURE <wa> TO <comp> |
* TYPE fields_int-type |
* DECIMALS fields_int-decimals. |
* ELSE. |
ASSIGN COMPONENT fields_int-fieldname |
OF STRUCTURE <wa> TO <comp> |
TYPE fields_int-type. |
* ENDIF. |
MOVE <comp> TO |
<d>+fields_int-offset_dst(fields_int-length_dst). |
ENDLOOP. |
APPEND data. |
IF rowcount > 0 AND sy-dbcnt GE rowcount. EXIT. ENDIF. |
ENDIF. |
ENDSELECT. |
ENDIF. |
ENDFUNCTION. hopes this helps. BR |