09-18-2008 12:49 PM
Dear Experts,
I am facing a problem while working on the FM RFC_READ_TABLE, in which there is a tables parameter options which is of table type, to which I am passing the condition of selection. In the debugg mode I found the select quiry in the source code of function module is not executing the condition passed in the options parameter.
My actual requirement is to fetch all the custom programs in a remote server, the code I have written is below.
TYPES :
BEGIN OF ty_tadir,
pgmid TYPE pgmid,
object TYPE trobjtype,
obj_name TYPE sobj_name,
END OF ty_tadir.
DATA : it_tadir TYPE STANDARD TABLE OF ty_tadir,
wa_tadir TYPE ty_tadir.
data: stmp_dokhl like TAB512 occurs 100000 with header line.
data: options1 like rfc_db_opt occurs 10 with header line.
data: wa_options1 like line of options1.
data: nametab1 like rfc_db_fld occurs 10 with header line.
START-OF-SELECTION.
DATA : W_VALUE(5) TYPE C,
W_VALUE1(20) TYPE C.
W_VALUE1 = 'OBJ_NAME like'.
W_VALUE = 'z*'.
CONCATENATE 'OBJ_NAME LIKE' ' ''' W_VALUE '''' INTO OPTIONS1-TEXT.
CONCATENATE W_VALUE1 W_VALUE INTO wa_OPTIONS1-TEXT SEPARATED BY SPACE.
APPEND wa_OPTIONS1 to OPTIONS1.
CLEAR wa_OPTIONS1.
call function 'RFC_READ_TABLE'
destination 'zard'
exporting
query_table = 'TADIR' "'ZBANK_GUARANTEE'
tables
options = options1
fields = nametab1
data = stmp_dokhl
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 .
Please give me some inputs on this,
With warm regards,
Murthy.
Edited by: pr murthy on Sep 18, 2008 1:49 PM
Edited by: pr murthy on Sep 18, 2008 2:14 PM
09-18-2008 1:45 PM
Hi
I have tried this and with small change this is working fine.
TYPES :
BEGIN OF ty_tadir,
pgmid TYPE pgmid,
object TYPE trobjtype,
obj_name TYPE sobj_name,
END OF ty_tadir.
DATA : it_tadir TYPE STANDARD TABLE OF ty_tadir,
wa_tadir TYPE ty_tadir.
data: stmp_dokhl like TAB512 occurs 100000 with header line.
data: options1 like rfc_db_opt occurs 10 with header line.
data: wa_options1 like line of options1.
data: nametab1 like rfc_db_fld occurs 10 with header line.
START-OF-SELECTION.
DATA : W_VALUE(5) TYPE C,
W_VALUE1(20) TYPE C.
W_VALUE1 = 'OBJ_NAME LIKE ''Z%'''.
wa_options1-text = w_value1.
APPEND wa_OPTIONS1 to OPTIONS1.
CLEAR wa_OPTIONS1.
call function 'RFC_READ_TABLE'
*destination 'zard'
exporting
query_table = 'TADIR' "'ZBANK_GUARANTEE'
tables
options = options1
fields = nametab1
data = stmp_dokhl
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 .
09-18-2008 1:45 PM
Hi
I have tried this and with small change this is working fine.
TYPES :
BEGIN OF ty_tadir,
pgmid TYPE pgmid,
object TYPE trobjtype,
obj_name TYPE sobj_name,
END OF ty_tadir.
DATA : it_tadir TYPE STANDARD TABLE OF ty_tadir,
wa_tadir TYPE ty_tadir.
data: stmp_dokhl like TAB512 occurs 100000 with header line.
data: options1 like rfc_db_opt occurs 10 with header line.
data: wa_options1 like line of options1.
data: nametab1 like rfc_db_fld occurs 10 with header line.
START-OF-SELECTION.
DATA : W_VALUE(5) TYPE C,
W_VALUE1(20) TYPE C.
W_VALUE1 = 'OBJ_NAME LIKE ''Z%'''.
wa_options1-text = w_value1.
APPEND wa_OPTIONS1 to OPTIONS1.
CLEAR wa_OPTIONS1.
call function 'RFC_READ_TABLE'
*destination 'zard'
exporting
query_table = 'TADIR' "'ZBANK_GUARANTEE'
tables
options = options1
fields = nametab1
data = stmp_dokhl
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 .
09-18-2008 2:10 PM
Modifed code..
TYPES :
BEGIN OF TY_TADIR,
PGMID TYPE PGMID,
OBJECT TYPE TROBJTYPE,
OBJ_NAME TYPE SOBJ_NAME,
END OF TY_TADIR.
DATA : IT_TADIR TYPE STANDARD TABLE OF TY_TADIR,
WA_TADIR TYPE TY_TADIR.
DATA: STMP_DOKHL LIKE TAB512 OCCURS 100000 WITH HEADER LINE.
DATA: OPTIONS1 LIKE RFC_DB_OPT OCCURS 10 WITH HEADER LINE.
DATA: WA_OPTIONS1 LIKE LINE OF OPTIONS1.
DATA: NAMETAB1 LIKE RFC_DB_FLD OCCURS 10 WITH HEADER LINE.
START-OF-SELECTION.
DATA : W_VALUE(5) TYPE C,
W_VALUE1(20) TYPE C.
W_VALUE1 = 'OBJ_NAME like'.
W_VALUE = '''Z%'''.
CONCATENATE 'OBJ_NAME LIKE' ` ` W_VALUE ` ` INTO WA_OPTIONS1-TEXT.
* CONCATENATE W_VALUE1 W_VALUE INTO WA_OPTIONS1-TEXT SEPARATED BY SPACE.
APPEND WA_OPTIONS1 TO OPTIONS1.
CLEAR WA_OPTIONS1.
CALL FUNCTION 'RFC_READ_TABLE'
EXPORTING
QUERY_TABLE = 'TADIR' "'ZBANK_GUARANTEE'
TABLES
OPTIONS = OPTIONS1
FIELDS = NAMETAB1
DATA = STMP_DOKHL
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.
BREAK-POINT.
09-19-2008 5:49 AM
Thank you Jyothy and Vijay, thank you for taking your valuable time to correct my code.
Regards,
Murthy