09-17-2008 5:48 AM
Hi,
want to know the steps to do this requirement.
Fetching the values from table usr05 from 4.7cc system
and downloading it to an excel and then uploading the same excel in ecc6.0 and update usr05 table.
09-17-2008 5:53 AM
hi,
using select statement u can get data from usr05 table.
to upload and download files use GUI_UPLOAD and GUI_DOWNLOAD func modules.
after uploading file into internal table use insert statement to upload data into database.
09-17-2008 5:59 AM
09-17-2008 6:16 AM
Hi Bhagya,
First download the data into an excel file from 4.7 by using function module GUI_DOWNLOAD. Then to upload the excel file in intyernal table in ecc 6.0, use function module GUI_UPLOAD.
Check this link for GUI_UPLOAD example
Now internal table should have same structure as your database table.
What you can do. Declare a variable lets say w_line of type i.
which will store the number of records in you internal table. then do like this
DESCRIBE TABLE t_tab LINES w_line.
then according to number of records in internal table
use insert statement to populate data in database table
Regards
Abhijeet
09-17-2008 6:20 AM
hi,
first you retrieve the data from USR05 into one internal table,then down load that data into flatfile
by using GUI_DOWNLOAD.
now the data is there in flatfile,do the recording for the transaction code prepare a BDC program for that
and upload the data by using GUI_UPLOAD.
09-17-2008 6:24 AM
hi,
CALL FUNCTION 'GUI_DOWNLOAD'
for download ,,
and for upload in exl format.. follow this..
FORM UPLOAD .
if itab-d_filename is not initial.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_tab_raw_data = wa_rawdata
i_filename = itab-d_filename
tables
i_tab_converted_data = gi_upload[].
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
else.
message 'Give the file path ' type 'I'.
endif.
09-17-2008 6:47 AM
Hi
First create the Program in 4.7 t odownload the data from the USR05 table .the create another upload program in ECC 6.0 to upload the data in USR05 table .
to download the data to Excel file.
REPORT ZDN_DOWNLOAD_UPLOAD_01.
tables: USR05.
data: it_usr05 type standard table of usr05.
data: wa_usr05 type usr05.
start-of-selection.
select * from usr05 into table it_usr05
where BNAME ne space.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = 'D:\first.xls'
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
SHOW_TRANSFER_STATUS = ABAP_TRUE
IMPORTING
FILELENGTH =
tables
data_tab = it_usr05
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
OTHERS = 22
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Create the porgram in ECC6.0 to Upload the data from Excel file .
REPORT ZDN_UPLOAD_USR05_ECC60_01.
data: it_usr05 type standard table of usr05.
data: wa_usr05 type usr05.
start-of-selection.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'D:\first.xls'
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 = it_usr05
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.
*Update usr05 from it_usr05.
loop at it_usr05 into wa_usr05.
write:/ wa_usr05-BNAME , wa_usr05-PARID , wa_usr05-PARVA.
modify usr05 from wa_usr05.
endloop.
Thanks,
Nelson
09-17-2008 6:53 AM