05-04-2009 10:58 AM
Hi Experts,
Can we upload data from .CSV file only? Is this a limitation in ABAP? What if i have an excel sheet with multiple worksheets and I want to pick data from one of the worksheet. Is this scenario possible?
Thanks and Regards,
Rohit
05-04-2009 11:07 AM
Dear Rohit,
Uploading excel sheet data using Webdynpro for ABAP is not possible only data from CSV or text file is possible. This is not the case when you upload the data in General ABAP Approach.
Regards,
Murthy.
05-04-2009 11:12 AM
Hi Murthy,
Thanks for your response. Actully I am using SAP CRM and other FMs for uploading data from excel like-ALSM_EXCEL_TO_INTERNAL_TABLE are not available in CRM. So my doubt was-is it a limitation that we can only use .csv files to upload data from excel in SAP CRM scenario?
Thanks and Regards,
Rohit
05-15-2009 9:53 PM
Hi Rohit.
In CRM , it works somewhat differently. Following code snippet will help u.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_infile.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = 'p_infile'
DEF_PATH = ' '
MASK = '*.txt'
MODE = '0'
TITLE = 'UPLOAD TAB DELIMITED FILE'(078)
IMPORTING
FILENAME = p_infile
* RC =
EXCEPTIONS
INV_WINSYS = 1
NO_BATCH = 2
SELECTION_CANCEL = 3
SELECTION_ERROR = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
************************************************************************
*START-OF-SELECTION
START-OF-SELECTION.
gd_file = p_infile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = gd_file
* FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
* 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_record
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.
write: 'Error' , sy-subrc .
skip.
ENDIF.
05-16-2009 3:37 PM