02-09-2009 7:33 AM
Hi All,
I have the data of tables SXNODES, SXROUTE and SXSERV in internal table. Can anyone tell me dat is there any FM in which by passing this internal table, data get uploaded in these Database table?
Also, we cant make BDC.
please help me out
02-09-2009 7:35 AM
Hi Jatin,
You can use Funtion Module.The name of the function module is 'GUI_UPLOAD'.
DATA: <TABLE> LIKE STANDARD TABLE OF <DB_TABLE>.
DATA: <FS_STRING> LIKE SPFLI.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'FILEADD/NAME.TXT'
FILETYPE = 'ASC'
* HAS_FIELD_SEPARATOR = ' '
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* CHECK_BOM = ' '
* VIRUS_SCAN_PROFILE =
* NO_AUTH_CHECK = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
tables
data_tab = <TABLE>
* EXCEPTIONS
* FILE_OPEN_ERROR = 1
* FILE_READ_ERROR = 2
* NO_BATCH = 3
* GUI_REFUSE_FILETRANSFER = 4
* INVALID_TYPE = 5
* NO_AUTHORITY = 6
* UNKNOWN_ERROR = 7
* BAD_DATA_FORMAT = 8
* HEADER_NOT_ALLOWED = 9
* SEPARATOR_NOT_ALLOWED = 10
* HEADER_TOO_LONG = 11
* UNKNOWN_DP_ERROR = 12
* ACCESS_DENIED = 13
* DP_OUT_OF_MEMORY = 14
* DISK_FULL = 15
* DP_TIMEOUT = 16
* OTHERS = 17
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT <TABLE> INTO <FS_STRING>.
INSERT INTO <DBTABLE> VALUES <FS_STRING>.
ENDLOOP.
You may face the error in the format of the data.For that please check the documentation of the function module.
Hope you will resolve the query.
Have a best day ahead.
02-09-2009 7:41 AM
Hi,
Create the same structure of internal table,
and using the GUI_UPLOAD upload the data into an internal table and
using INSERT command
INSERT TABLE dbtable from itab.
upload it in db table