09-15-2006 6:07 PM
Hi,
I am trying to upload excel sheet thru GUI_UPLOAD ... this excel sheet has a header line and 3 line of data. Even if I remove the header line then also the internal while debugging is showing 28 lines of entries with "#" "squares" in some columns ... while in others where data should be there shows all Zeros....
The excel sheet has the following info
Rate Type Valid From Date From Currency To Currency Indirect Quote Direct Quote
M 29.09.2006 SGD USD 1.6932
M 29.09.2006 USD SGD 1.6932
M 29.09.2006 SGD MYR 2.19653
KURST GDATU FCURR TCURR INUKURS DUKURS
###ࡱ |########|#####|### #| 0.00000 |0.00000 |
##29 |00000000| | | 0.00000 |0.00000 |
o#d# |00000000| | | 0.00000 |0.00000 |
The code that I am writing is as follows:-
&----
*& INTERNAL TABLES
&----
DATA : BEGIN OF T_INPUT occurs 0,
KURST LIKE TCURV-KURST, " Exchange rate type
GDATU LIKE SY-DATUM, " Date from which rate is effective
FCURR LIKE TCURC-WAERS, " From currency
TCURR LIKE TCURC-WAERS, " To currency
INUKURS LIKE TCURR-UKURS, " Indirect Quote
DUKURS LIKE TCURR-UKURS, " Direct Quote
END OF T_INPUT.
----
S T A R T - O F - S E L E C T I O N *
----
START-OF-SELECTION.
Perform to upload the excel file.
PERFORM UPLOAD_EXCEL_FILE.
FORM UPLOAD_EXCEL_FILE .
DATA: L_FILENM TYPE STRING.
L_FILENM = P_FILENM.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = L_FILENM
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = T_INPUT
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.
09-15-2006 7:05 PM
Hi,
I_FIELD_SEPERATOR is an optional parameter .
I_LINE_HEADER is an optional parameter. If you have 'X' it will ignore the header..
I_TAB_RAW_DATA - Pass a dummy internal table as mentioned below..
type-pools: TRUXS.
data: t_raw TYPE TRUXS_T_TEXT_DATA.
Hope this helps..
Thanks,
Naren
09-15-2006 6:11 PM
Hi,
Try to use the FM TEXT_CONVERT_XLS_TO_SAP for uploading EXCEL file.
Thanks
Naren
09-15-2006 6:51 PM
And what /how the parameters need to be passed ??
for e.g what should be filled in for :-
I_FIELD_SEPERATOR =
I_LINE_HEADER =
I_TAB_RAW_DATA =
09-15-2006 7:05 PM
Hi,
I_FIELD_SEPERATOR is an optional parameter .
I_LINE_HEADER is an optional parameter. If you have 'X' it will ignore the header..
I_TAB_RAW_DATA - Pass a dummy internal table as mentioned below..
type-pools: TRUXS.
data: t_raw TYPE TRUXS_T_TEXT_DATA.
Hope this helps..
Thanks,
Naren
09-15-2006 8:52 PM
Thanx Naren... But still the internal table is not getting uploaded ... it gives an error msg "Enter a valid date (e.g. 01.01.1996)...
any guess why this error is ocurring ??
09-15-2006 9:00 PM
Hi Naren,
Thanx... I am able to upload the excel file to the internal table ... what I did was I changed my date declation in the internal table... previously it was like sy-datum ... now I said GDATU(10).... that's it ... thanx once again
09-15-2006 9:03 PM
Hi SB,
pls change the data type declared for 'valid from date'
from
DATA : BEGIN OF T_INPUT occurs 0,
KURST LIKE TCURV-KURST, " Exchange rate type
<b>GDATU LIKE SY-DATUM,</b> " Date from which rate is effective
FCURR LIKE TCURC-WAERS, " From currency
TCURR LIKE TCURC-WAERS, " To currency
INUKURS LIKE TCURR-UKURS, " Indirect Quote
DUKURS LIKE TCURR-UKURS, " Direct Quote
END OF T_INPUT.
to
DATA : BEGIN OF T_INPUT occurs 0,
KURST LIKE TCURV-KURST, " Exchange rate type
GDATU(10) type c, " Date from which rate is effective
FCURR LIKE TCURC-WAERS, " From currency
TCURR LIKE TCURC-WAERS, " To currency
INUKURS LIKE TCURR-UKURS, " Indirect Quote
DUKURS LIKE TCURR-UKURS, " Direct Quote
END OF T_INPUT.
Cheers,
Vikram
Please reward for helpful replies!!