on 07-14-2011 7:56 AM
Hi,
I want to upload data from multiple sheets of an excel file and get the data in different internal tables ( one internal table per ever sheet ).
I know how to read data from excel file with single sheet.
Any clue on how to do the same for a file with multiple sheets is highly appreciated.
Thanks,
Ajay
Hi.,
Check this wiki: http://wiki.sdn.sap.com/wiki/display/Snippets/ReadmultiplesheetsofanExcelfileintoSAPthroughABAP
hope this helps u.,
Thanks & Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi.,
GUI Front End Services are used for getting File Path., In Web Dynpro ABAP no need to use that You just use the File Upload UI., and it automatically give u the file path popup., You just use the logic there for getting data from multiple Sheets of excel
hope this helps u.,
Thanks & Regards,
Kiran
Hi Kiran,
I tried to simulate as per your wiki link.
I retrieved the file path from the File upload UI element.
I am getting a dump from
*CALLING THE CONTAINER TO SELECT THE EXCEL FILE
CALL METHOD C_OI_CONTAINER_CONTROL_CREATOR=>GET_CONTAINER_CONTROL
IMPORTING
CONTROL = IREF_CONTROL
ERROR = IREF_ERROR.
IF IREF_ERROR->HAS_FAILED = 'X'.
CALL METHOD IREF_ERROR->RAISE_MESSAGE
EXPORTING
TYPE = 'E'.
ENDIF.
as Get_container_control has code
CALL FUNCTION 'GUI_HAS_ACTIVEX'
IMPORTING
return = has_activex.
CALL FUNCTION 'GUI_HAS_JAVABEANS'
IMPORTING
return = has_javabean.
IF ( NOT has_activex IS INITIAL ) OR
( NOT has_javabean IS INITIAL ).
CREATE OBJECT olecontrolobj.
control = olecontrolobj.
retcode = c_oi_errors=>ret_ok.
ELSE.
retcode = c_oi_errors=>ret_error.
ENDIF.
and both has_activex and has_javabean are initial, its giving a dump.
Is it dependant on the GUI services again?
Any clue on this is highly appreciated.
If not this approach, do we have any other approach to read multiple sheets data from excel in webdynpro ?
Regards,Ajay
Hi Ajay,
You can use FILE_UPLOAD ui element. For multiple files use that may file upload ui elements.
DATA : conv TYPE REF TO CL_ABAP_CONV_IN_CE.
* Creates a Conversion Instance
CALL METHOD CL_ABAP_CONV_IN_CE=>CREATE
EXPORTING
INPUT = <variable having the xstring data>
ENCODING = 'UTF-8'
REPLACEMENT = '?'
IGNORE_CERR = ABAP_TRUE
RECEIVING
CONV = conv.
conv2->READ( importing data =<string data> ).
SPLIT <string data> AT CL_ABAP_CHAR_UTILITIES=>CR_LF INTO TABLE <int table>.
LOOP AT <int_table> ASSIGNING <WA_TABLE>.
* splits string on basis of tabs
SPLIT <wa_TABLE> AT ',' INTO
str_itab-field1 str_itab-field2 str_itab-field3.
APPEND STR_ITAB TO ITAB.
ENDLOOP. // now itab contains the data of csv file.
Cheers,
Kris.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.