04-23-2007 7:20 AM
Hi,
I am using RFC_READ_TABLE function module to retrive table data in other server .
Here my issues how to use <i><b>WHERE</b></i> condition for selection criteria.
In this function module there is a table for where condition <i><b>OPTIONS</b></i>.
Could you please send sample code for using where condition for this function module.
Thanks in advance.
shyla
04-23-2007 7:28 AM
Hi
just populate the select statement where conditions into table options.
example:
options = 'MATNR in SEL_MATNR and ERSDA = SY-DATUM'.
append options.
or the other procedure is..
get all the data. once the data is retreived, you can delete the data you dont need.
but, the first one is suggestable.
thx
pavan
*pls mark for helpful answers
04-23-2007 7:28 AM
Hi
just populate the select statement where conditions into table options.
example:
options = 'MATNR in SEL_MATNR and ERSDA = SY-DATUM'.
append options.
or the other procedure is..
get all the data. once the data is retreived, you can delete the data you dont need.
but, the first one is suggestable.
thx
pavan
*pls mark for helpful answers
04-23-2007 7:40 AM
Hi Pavan,
If i am retrieving all material numbers in the mara table which are in my internal table it_output.Then how can write where condition i.e.
options = 'MATNR IN IT_OUTPUT-MATNR' is it will works
Thanks and regards,
shyla
04-23-2007 7:54 AM
shyla,
data: line like line .
data: stmp_dokhl like dokhl occurs 100000 with header line.
data: options1 like rfc_db_opt occurs 10 with header line.
data: nametab1 like rfc_db_fld occurs 10 with header line.
data: sel_tab like sel_stat occurs 10 with header line.
data: nametab like bdi_mfgrp occurs 10 with header line.
data: begin of i_langobj occurs 20,
id like dokil-id ,
end of i_langobj .
select distinct id from dokil into table i_langobj .
sort: i_langobj.
loop at i_langobj.
clear: options1[] .
clear: options1 .
concatenate 'LANGU = '''
language
''''
into line.
move: line to options1 .
append options1 .
clear: options1 .
concatenate 'AND ID = ''' i_langobj-id '''' into line .
move: line to options1 .
append options1 .
call function 'TABLE_ENTRIES_GET_VIA_RFC'
destination rfc_sys
exporting
langu = sy-langu
only = ' '
tabname = 'DOKIL'
tables
sel_tab = sel_tab
nametab = nametab
tabentry = stmp_dokhl
exceptions
internal_error = 1
table_has_no_fields = 2
table_not_activ = 3
not_authorized = 4
others = 5 .
clear: stmp_dokhl[] .
call function 'RFC_READ_TABLE'
destination rfc_sys
exporting
query_table = 'DOKHL'
DELIMITER = ' '
NO_DATA = ' '
ROWSKIPS = 0
ROWCOUNT = 0
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 .
if sy-subrc <> 0.
message e008 with i_langobj 'failed'. "#EC NOTEXT
endif.
append lines of stmp_dokhl to old_dokhl.
Don't forget to reward if useful...