05-18-2009 9:22 AM
Hi,
I have got a requirement to extract data from an Oracle table to SAP Table. Now the question is that how many ways are there to extract? I dont want to use DB Connect as I dont have knowledge on BI System and only from one table in Oracle I need to fetch data at a certain time using ABAP.
Thanks
Usman Malik
05-18-2009 11:03 AM
Hi Usman ,
Suppose the table ora_dbtable is in the oracle database and using ABAP code
you want to fetch the records.
Write a program in the ABAP editor with the following code and execute it - -
DATA : t_itab LIKE TABLE OF ora_dbtable. " ora_dbtable is the Oracle DB table
SELECT * FROM ora_dbtable INTO TABLE t_itab.
All the records wiil come to the internal table t_itab.
Now you can download the contents of the internal table in the local PC.
DATA : t_spfli TYPE TABLE OF spfli.
SELECT * FROM spfli INTO TABLE t_spfli.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
filename = 'C:\DOWNLOD\FILE.TXT'
* FILETYPE = 'ASC'
* APPEND = ' '
write_field_separator = 'X' " For Delimition
TABLES
data_tab = t_itab
* FIELDNAMES =
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
.
Regards
Pinaki
05-19-2009 7:07 AM
Hi Pinaki,
I want to retrieve this data from external oracle database. For this what do I need to do in ABAP to connect and fetch table data?
Regards,
Usman Malik
05-19-2009 7:16 AM
Hi,
Retrieve the data from the oracle system to a notepad in the presentation server.
Then use the data of that notepad in the your ABAP program to upload in the required table.
Regards
Pinaki