Steps to prepare and upload excel files data to r/3?
Hi abap experts,
We have brand new installed ECC system somehow configured but with no master or transaction data loaded .It is new empty system....We also have some legacy data in excel files...We want to start loading some data into the SAP sandbox step by step and to see how they work...test some transactions see if the loaded data are good etc initial tests.
Few questions here are raised:
-Can someone tell me what is the process of loading this data into SAP system?
-Should this excel file must me reworked prepared somehow(fields, columns etc) in order to be ready for upload to SAP??
-Users asked me how to prepared their legacy excel files so they can be ready in SAP format for upload.?Is this an abaper job or it is a functional guy job?
-Or should the excel files be converted to .txt files and then imported to SAP?Does it really make some difference if files are in excel or .txt format?
-Should the Abaper determine the structure of those excel file(to be ready for upload ) and if yes, what are the technical rules here ?
-What tools should be used for this initial data loads? CATT , Lsmw , batch input or something else?
-At which point we should test the data?I guess after the initial load?
-What tools are used in all steps before...
-If someone can provide me with step by step scenario or guide of loading some kind of initial master data - from .xls file alignment to the real upload - this will be great..
You can email me some upload guide or some excel/txt file examples and screenshots documents to excersize....Email: [email protected]
Your help is appreciated it.!
Jon
Depends on data we upload the data from file to R/3 .
If it is regular updation then we used to get the data from application server files to R/3 since local file updation we can not set up background processing..
If it is master data upload and that to one time upload then we use presenation server files to SAP R/3..
See the simple example to upload the data to on master custom table from XLS File
Program : ZLWMI151_UPLOAD(Data load to ZBATCH_CROSS_REF Table)
Type : Upload program
Author : Seshu Maramreddy
Date : 05/16/2005
Transport : DV3K919574
Transaction: None
Description: This program will get the data from XLS File
and it upload to ZBATCH_CROSS_REF Table
REPORT ZLWMI151_UPLOAD no standard page heading
line-size 100 line-count 60.
*tables : zbatch_cross_ref.
data : begin of t_text occurs 0,
werks(4) type c,
cmatnr(15) type c,
srlno(12) type n,
matnr(7) type n,
charg(10) type n,
end of t_text.
data: begin of t_zbatch occurs 0,
werks like zbatch_cross_ref-werks,
cmatnr like zbatch_cross_ref-cmatnr,
srlno like zbatch_cross_ref-srlno,
matnr like zbatch_cross_ref-matnr,
charg like zbatch_cross_ref-charg,
end of t_zbatch.
data : g_repid like sy-repid,
g_line like sy-index,
g_line1 like sy-index,
$v_start_col type i value '1',
$v_start_row type i value '2',
$v_end_col type i value '256',
$v_end_row type i value '65536',
gd_currentrow type i.
data: itab like alsmex_tabline occurs 0 with header line.
data : t_final like zbatch_cross_ref occurs 0 with header line.
selection-screen : begin of block blk with frame title text.
parameters : p_file like rlgrap-filename obligatory.
selection-screen : end of block blk.
initialization.
g_repid = sy-repid.
at selection-screen on value-request for p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = g_repid
IMPORTING
FILE_NAME = p_file.
start-of-selection.
Uploading the data into Internal Table
perform upload_data.
perform modify_table.
top-of-page.
CALL FUNCTION 'Z_HEADER'
EXPORTING
FLEX_TEXT1 =
FLEX_TEXT2 =
FLEX_TEXT3 =
*& Form upload_data
text
FORM upload_data.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = $v_start_col
I_BEGIN_ROW = $v_start_row
I_END_COL = $v_end_col
I_END_ROW = $v_end_row
TABLES
INTERN = itab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
write:/10 'File '.
ENDIF.
if sy-subrc eq 0.
read table itab index 1.
gd_currentrow = itab-row.
loop at itab.
if itab-row ne gd_currentrow.
append t_text.
clear t_text.
gd_currentrow = itab-row.
endif.
case itab-col.
when '0001'.
t_text-werks = itab-value.
when '0002'.
t_text-cmatnr = itab-value.
when '0003'.
t_text-srlno = itab-value.
when '0004'.
t_text-matnr = itab-value.
when '0005'.
t_text-charg = itab-value.
endcase.
endloop.
endif.
append t_text.
ENDFORM. " upload_data
*& Form modify_table
Modify the table ZBATCH_CROSS_REF
FORM modify_table.
loop at t_text.
t_final-werks = t_text-werks.
t_final-cmatnr = t_text-cmatnr.
t_final-srlno = t_text-srlno.
t_final-matnr = t_text-matnr.
t_final-charg = t_text-charg.
t_final-erdat = sy-datum.
t_final-erzet = sy-uzeit.
t_final-ernam = sy-uname.
t_final-rstat = 'U'.
append t_final.
clear t_final.
endloop.
delete t_final where werks = ''.
describe table t_final lines g_line.
sort t_final by werks cmatnr srlno.
Deleting the Duplicate Records
perform select_data.
describe table t_final lines g_line1.
modify zbatch_cross_ref from table t_final.
if sy-subrc ne 0.
write:/ 'Updation failed'.
else.
Skip 1.
Write:/12 'Updation has been Completed Sucessfully'.
skip 1.
Write:/12 'Records in file ',42 g_line .
write:/12 'Updated records in Table',42 g_line1.
endif.
delete from zbatch_cross_ref where werks = ''.
ENDFORM. " modify_table
*& Form select_data
Deleting the duplicate records
FORM select_data.
select werks
cmatnr
srlno from zbatch_cross_ref
into table t_zbatch for all entries in t_final
where werks = t_final-werks
and cmatnr = t_final-cmatnr
and srlno = t_final-srlno.
sort t_zbatch by werks cmatnr srlno.
loop at t_zbatch.
read table t_final with key werks = t_zbatch-werks
cmatnr = t_zbatch-cmatnr
srlno = t_zbatch-srlno.
if sy-subrc eq 0.
delete table t_final .
endif.
clear: t_zbatch,
t_final.
endloop.
ENDFORM. " select_data
and also you can use .txt file upload using Function module - GUI_UPLOAD
if it is application server then use open datset command.
Thanks
Seshu
Similar Messages
-
Steps to prepare and upload legacy master data excel files into SAP?
Hi abap experts,
We have brand new installed ECC system somehow configured but with no master or transaction data loaded .It is new empty system....We also have some legacy data in excel files...We want to start loading some data into the SAP sandbox step by step and to see how they work...test some transactions see if the loaded data are good etc initial tests.
Few questions here are raised:
-Can someone tell me what is the process of loading this data into SAP system?
-Should this excel file must me reworked prepared somehow(fields, columns etc) in order to be ready for upload to SAP??
-Users asked me how to prepared their legacy excel files so they can be ready in SAP format for upload.?Is this an abaper job or it is a functional guy job?
-Or should the excel files be converted to .txt files and then imported to SAP?Does it really make some difference if files are in excel or .txt format?
-Should the Abaper determine the structure of those excel file(to be ready for upload ) and if yes, what are the technical rules here ?
-What tools should be used for this initial data loads? CATT , Lsmw , batch input or something else?
-At which point we should test the data?I guess after the initial load?
-What tools are used in all steps before...
-If someone can provide me with step by step scenario or guide of loading some kind of initial master data - from .xls file alignment to the real upload - this will be great..
You can email me some upload guide or some excel/txt file examples and screenshots documents to excersize....
Your help is appreciated it.!
Jonhi,
excel sheet uploading:
http://www.sap-img.com/abap/upload-direct-excel.htm
http://www.sap-img.com/abap/excel_upload_alternative-kcd-excel-ole-to-int-convert.htm
http://www.sapdevelopment.co.uk/file/file_upexcel.htm
http://www.sapdevelopment.co.uk/ms/mshome.htm -
What is the function module which uploads excel file data into tcodes
Hi,
i want to upload data in cs01 tcode.
but data is excel sheet while i am trying to use gui_upload it is not being possible for me to upload data.
can any one tell me what is the function module?
can any send me the steps how to uplaod data if it is in excelsheet?
thanks & regards
naveen
Moderator message: FAQ, please search for available information before asking.
locked by: Thomas Zloch on Aug 18, 2010 1:46 PMHi,
Try the below sample code u ll get an idea of uploading using 'TEXT_CONVERT_XLS_TO_SAP'.
REPORT zupload_excel_to_itab.
TYPE-POOLS: truxs.
PARAMETERS: p_file TYPE rlgrap-filename.
TYPES: BEGIN OF t_datatab,
col1(30) TYPE c,
col2(30) TYPE c,
col3(30) TYPE c,
END OF t_datatab.
DATA: it_datatab type standard table of t_datatab,
wa_datatab type t_datatab.
DATA: it_raw TYPE truxs_t_text_data.
At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
*START-OF-SELECTION.
START-OF-SELECTION.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = p_file
TABLES
i_tab_converted_data = it_datatab[] "ACTUAL DATA
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
END-OF-SELECTION.
END-OF-SELECTION.
LOOP AT it_datatab INTO wa_datatab.
WRITE:/ wa_datatab-col1,
wa_datatab-col2,
wa_datatab-col3.
ENDLOOP.
Thanks & Regrads,
Neela. -
Uploading Excel sheet data into internal table
Hi All,
I want to upload Excel file data into internal table. My problem is that my excel file having more than one sheets. I want to upload the data of particula Excel sheet..
Please suggest me how can I upload particulat Excel sheet data .
Thanks and regards
Praveencheck this link
Uploading multiple excel sheets
You can check Satish's answer in the above link
Re: uploading data from excel sheets through BDC's into sap system
<b>Award points if found helpful</b> -
Uploading Excel File and Reading Data from that File
<b>Hi
Can anyone Please tell me how to upload an Excel File in to the Web Dynpro Application and After that i want to read the data from that uploaded excel file in the Web Dynpro Application to the Web Dynpro table.
Plz help me to solve this.......
Regards
Chandran</b>Hi,
Upload Excel file using File Upload UI
1)Add jxl jar folder in the lib folder of ur project.
2)Go to properties of ur project and add jar to ur project.
3)Using the File upload ui ,browse and upload the file.
4)Write the read file in to ur server location using fileoutput stream.
5)then using code u can read the excelfile from the server location itself.
Here is the code:
IWDAttributeInfo attInfo =wdContext.getNodeInfo().getAttribute("upload");
/** get the name of excel file and storing it in the server with the same name and extention****/
binaryType=IWDModifiableBinaryTypeattInfo.getModifiableSimpleType();
fileuploaded = binaryType.getFileName();
byte b[] = wdContext.currentContextElement().getUpload();
File filename =new File("
<Server name>
<folde name>
" + fileuploaded);
try {
FileOutputStream out = new FileOutputStream(filename);
out.write(b);
out.close();
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
/**Readind from the server**/
int iRows = 0;
try { Workbook wb = null;
Sheet sheet = null;
wb = Workbook.getWorkbook(filename);
sheet = wb.getSheet(0);
int iColumns = sheet.getColumns();
iRows = sheet.getRows();
int i = 0;
//get Cell contents by (COLUMN, ROW);
for (int r = 0; r < iRows; r++) {
for (int c = 0; c < iColumns; c++) {
Cell cell = sheet.getCell(c, r);
characterarray<i> = cell.getContents();
//wdComponentAPI.getMessageManager().reportSuccess("Row"r characterarray<i>);
i++;
wb.close();
Declare Globally
//@@begin others
String fileuploaded;
IWDModifiableBinaryType binaryType;
String characterarray[] = new String[1000];
//@@end
Also look at this blog too /people/perumal.kanthan/blog/2005/03/21/reading-excel-data-from-java-using-hssf-api
Thanks and Regards,
Arun -
Upload excel file and display content in sapui5 table
hi:all
how to upload excel files and display its contents in the view of sapui5 table ,then 'create ' these data into the abap database using odataservice.
Do you have any solutions ? I appreciate for your help.Two possible way come to mind.
1. ADF DI (desktop integration): sorry, don't know enough about it to give a how to :-(
2. POI (http://poi.apache.org/) : open source project to read and write excel file with java. Using POI you can open the .xsl file, read it's contents and display it as af:table. For this you need to read the xsl into a data structure (this can be a temporary db table or a list of POJOs) and build a data control out of it. This you can drop on a page as table.
Timo
Edited by: Timo Hahn on 15.02.2010 13:59 -
Create BDC group per uploading excel file to fill data in Tcode FB01l
hi experts,
i'm using BDC to run T-code FB01L . for this i'm uploading excel file for input data. my requiremenr=t is as follows : "
only one BDC group should be created per uploading file." But At this moment BDC group is created per document. For user it is not possible to handle, say 1000 BDC groups.
please suggest.
Thanks
DeepikaThe answer is simple and you should be able to work it out yourself but I am feeling generous today.
I am assuming that each line in your excel spreadsheet is a document. The easiest way to do this is simply build up youd BDC table first then create the group.
<- build your bdc table before opening the group ->
call function 'BDC_OPEN_GROUP'
exporting
group = p_group
keep = p_keep
user = p_uname.
call function 'BDC_INSERT'
exporting
tcode = 'FB01'
tables
dynprotab = gt_bdcdata
exceptions
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
others = 7.
call function 'BDC_CLOSE_GROUP'
In the future please do a search on SDN. I have also moved this thread to the ABAP General forum as this is not related to ABAP OO. -
Read and write excel sheet data from uploded file in sharepoint site programmatically 2013
hi team,
I am working on sharepoint 2013.I want to read and write data in excel sheet (micrsoft excel) from stored file in shrepoint docoumnt library .please suggest me
vijayHi
Vijay,
check those links
http://www.sharepointwithattitude.com/archives/61
https://social.technet.microsoft.com/Forums/en-US/e760051b-a92f-473c-9ec9-0f0c36c99e40/read-and-write-excel-sheet-data-from-uploded-file-in-sharepoint-site-programmatically-2013?forum=sharepointdevelopment
Kind Regards, John Naguib Technical Consultant/Architect MCITP, MCPD, MCTS, MCT, TOGAF 9 Foundation. Please remember to mark the reply as answer if it helps. -
SharePoint 2013 Foundation error when uploading Excel files
Hello
I have a specific problem. I have an xlsx file that I cannot upload in SharePoint. Normally our SharePoint can upload Excel files and other file formats normally but this one has data with nearly 5000 rows. The size of the file is less then 500 KB. The error
message is: "The URL is invalid. Perhaps it refers to a nonexistent file or folder, or it refers to a valid file or folder in the current Web." When I am uploading this file I am getting the same error message in every library. When I save
the file as a 97-2003 compatible xls then it works. Sometimes even Excel files with Macros won't upload.
Kind regards
ivicapro1987Hi,
This issue occurs when the Version column is configured as an Indexed Column.
To work around this issue, remove the Version column from the list of Indexed Columns for the list that has this issue. To do this, follow these steps:
Browse to the list where the issue exists.
In the ribbon, click the Library tab, and then click
Library Settings.
In the fields list, click Indexed Columns.
In the Indexed Columns list, click Version.
Click Delete, and then click OK.
Upload any files that you previously experienced the issue with.
Reference:
https://support.microsoft.com/kb/2796640?wa=wsignin1.0
Best Regards,
Eric
Eric Tao
TechNet Community Support -
Uploading excel file in Web Dynpro for ABAP
Hello Gurus,
I need to upload a excel file in my Web Dynpro (ABAP) program. Can anyone please tell me how do i do this. Kindly help.
Regards,
Aditya.Hi Aditya,
Please search the forum...
Please check this link
Uploading Data from Excel File To Dynpro
Excel Upload via Web dynpro ABAP
Upload and Reading Excel File in Web Dynpro
Best regards,
raam -
Uploading Excel file using 'ALSM_EXCEL_TO_INTERNAL_TABLE'
Hi,
I am uploading excel file into an internal table using 'ALSM_EXCEL_TO_INTERNAL_TABLE' FM.
but I'm getting a popup with the message
'There is a large amount of the information on the clipboard. Do you want to be able to paste this information into another programme later.' and there are three buttons in the popup 'YES', 'CANCEL' and 'NO'. but for any choice there is no data in the internal table.
the progrsm is working in other systems but giving problem in customer laptop, can you please tell me is there any settings need to set for EXCEL or SAP.
system details are as below
OS: windows 7
MS-Office - 2007
SAP : ECC06Looks like there was an intention to clear the clipboard in the code, but this does not seem to work.
I copied the function module to my own version and added the following code, which seems to work :
* clear clipboard
refresh excel_tab.
call method cl_gui_frontend_services=>clipboard_export
importing
data = excel_tab
changing
rc = ld_rc
exceptions
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
others = 4
* Copy only one cell to prevent the clipboard data message.
call method of worksheet 'Cells' = h_cell
exporting #1 = 1 #2 = 1.
m_message.
call method of worksheet 'Cells' = h_cell1
exporting #1 = 1 #2 = 1.
m_message.
call method of worksheet 'RANGE' = range
exporting #1 = h_cell #2 = h_cell1.
m_message.
call method of range 'SELECT'.
m_message.
* copy marked area (whole spread sheet) into Clippboard
call method of range 'COPY'.
m_message.
* quit Excel and free ABAP Object - unfortunately, this does not kill
* the Excel process
call method of application 'QUIT'.
m_message. -
Hi Friends,
Iam trying to Upload Excel file into SAP using the FM
ALSM_EXCEL_TO_INTERNAL_TABLE. But it is going to dump n the error is
The call to the function module "ALSM_EXCEL_TO_INTERNAL_TABLE" is incorrect:
In the function module interface, you can specify only
fields of a specific type and length under "INTERN".
Although the currently specified field
"ITAB" is the correct type, its length is incorrect.
I have attached the code also.
Please let me know where iam getting the error.
Code :
Tables : mara,
ztable.
parameters : p_infile like rlgrap-filename.
data : begin of itab occurs 0,
matnr like mara-matnr,
mbrsh like mara-mbrsh,
matkl like mara-matkl,
end of itab.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_infile
I_BEGIN_COL = 1
I_BEGIN_ROW = 1
I_END_COL = 100
I_END_ROW = 100
TABLES
INTERN = itab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
sort itab by matnr.
loop at itab.
write:/ itab.
*modify ztable from table itab.
endloop.hi check this code:
DATA : BEGIN OF TYP_INPUT ,
MATNR LIKE MARA-MATNR,
WERKS LIKE MARC-WERKS,
LGORT LIKE MARD-LGORT,
LGNUM LIKE MLGN-LGNUM,
LGTYP LIKE MLGT-LGTYP,
LTKZA LIKE MLGN-LTKZA,
LTKZE LIKE MLGN-LTKZE,
LGBKZ LIKE MLGN-LGBKZ,
LGPLA LIKE MLGT-LGPLA,
END OF TYP_INPUT.
*Input File Data
DATA : IT_FILE LIKE TYP_INPUT OCCURS 0 WITH HEADER LINE.
*"INTERNAL TAB TO TAKE EXCEL SHEET.
DATA : IT_EXCEL LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = P_PFILE
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = 9
I_END_ROW = 6000
TABLES
INTERN = IT_EXCEL
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
* IT_EXCEL CONTAINS DATA IN THE FORM OF ROW, COL, VALUE *
* CONVERTING THAT INTERNAL TABLE TO FORMAT THAT OF EXCEL SHEET *
IF NOT IT_EXCEL[] IS INITIAL.
SORT IT_EXCEL BY ROW COL.
LOOP AT IT_EXCEL.
CASE IT_EXCEL-COL.
WHEN 1.
IT_FILE-MATNR = IT_EXCEL-VALUE.
WHEN 2.
IT_FILE-WERKS = IT_EXCEL-VALUE.
WHEN 3.
IT_FILE-LGORT = IT_EXCEL-VALUE.
WHEN 4.
IT_FILE-LGNUM = IT_EXCEL-VALUE.
WHEN 5.
IT_FILE-LGTYP = IT_EXCEL-VALUE.
WHEN 6.
IT_FILE-LTKZA = IT_EXCEL-VALUE.
WHEN 7.
IT_FILE-LTKZE = IT_EXCEL-VALUE.
WHEN 8.
IT_FILE-LGBKZ = IT_EXCEL-VALUE.
WHEN 9.
IT_FILE-LGPLA = IT_EXCEL-VALUE.
ENDCASE.
AT END OF ROW.
APPEND IT_FILE.
CLEAR IT_FILE.
ENDAT.
ENDLOOP.
ELSE.
MESSAGE I000 WITH 'The input file is empty'.
STOP.
ENDIF. -
Upload excel sheet data through sqlloader into oracle tables
hi everyone,
i am working with excel sheet with following records
8501 Jacob Marshall 15000 21/10/2009 Finance
8502 Chris Campell 50000 13/06/2008 R&D
8503 Simon Dough 50000 3/07/2008 Engineering
8504 Mark Haggai 75000 9/3/2006 Product Management
8505 Verica Beverley 45000 7/2/2008 HR
and i saved it in emp_details.csv
after that when i write following code to make control file
load data
infile 'C:\Documents and Settings\prashant_dabral\Desktop\a.txt'
into table tmp
field terminated by','optionally enclosed by" "
(emp_no,emp_name,salary,doj,dept_name)
after this pl\sqldev returning me error message that ORA-00900:invalid sql statement
can anybody tell me how to resolve issue
or
another method to Upload excel sheet data through sqlloader into oracle tablesA control file is a file located on the operating system, not some SQL or PL/SQL code you try and execute.
Create the control file as a file and then use that to load your data with SQL*Loader from the command line.
http://www.morganslibrary.org/reference/sqlloader.html
Or better still, create it as an external table and then you don't need a seperate control file or need to use sql loader from the command line...
http://www.morganslibrary.org/reference/externaltab.html -
Hi... maybe someone of you have been reading about how to upload excel files to an internal table using function module ALSM_EXCEL_TO_INTERNAL_TABLE.
The problem that I found with this technique is that it is not possible to use this FM with the SAP WAS because it gives a runtime dump (it only works if the file is on the client machine and if the function module is called from SAPGUI.
Then I have found the topic
Re: BSP and Excel
And one guy puts something interesting like this:
1. In the application use file upload to upload the file.
2. caputure the content and length
DATA: data TYPE REF TO CL_HTMLB_FILEUPLOAD.
data ?= CL_HTMLB_MANAGER=>GET_DATA(
request = runtime->server->request
name = 'fileUpload'
id = 'xx').
name = data->file_name.
content = data->file_content.
length = data->file_length.
content_type = data->file_content_type.
3. Then read the data using the class
DATA: conv TYPE REF TO CL_ABAP_CONV_IN_CE.
conv = CL_ABAP_CONV_IN_CE=>CREATE( input = CONTENT ).
conv->READ( importing data = Variable len = length ).
Now... has anyone continued with this sample? has anyone put the contents into an internal table (with the READ method)...
If someone did it please show me how to..
Thanks
ArielHi Craig,
Ok, I was reading the Thomas's Blog and the thread about excel. The blog talks about encoding and the thread is about how to "download" the table. I want to upload the excel to an internal table.
So, I am almost finishing the code.. But I have a problem (named DUMP) when I create the "conv" object (check the code) the problem is because I dont know how to call the create method indicating 'UFT-16' as encoding.
I show you my "OnInputProcessing" code:
IF button_event->id = 'btnUpload'.
fileUpload ?= CL_HTMLB_MANAGER=>GET_DATA(
request = request
id = 'txtFile'
name = 'fileUpload' ).
IF ( fileUpload->file_name NE '' ) AND
( fileUpload->file_length GT 0 ).
IF fileUpload->file_content_type
= 'application/vnd.ms-excel'.
DATA: content TYPE ZMTVEMAT,
conv TYPE REF TO CL_ABAP_CONV_IN_CE,
viewoff TYPE REF TO CL_ABAP_VIEW_OFFLEN,
it_off TYPE ABAPOFFLENTAB,
wa_off TYPE ABAPOFFLEN,
dd_fields TYPE DDFIELDS,
wa_fields TYPE DFIES,
len TYPE I.
conv = CL_ABAP_CONV_IN_CE=>CREATE(
encoding = 'UTF-16'
endian = 'L'
input = fileUpload->file_content ).
CALL FUNCTION 'TR_NAMETAB_GET'
EXPORTING
IV_TABNAME = 'ZMTVMAT'
IV_GET_LENGTHS_IN_CHARMODE = 'X'
IV_GET_TEXTS = ' '
IMPORTING
ET_DFIES = dd_fields.
LOOP AT dd_fields INTO wa_fields.
MOVE wa_fields-offset TO wa_off-ioff.
MOVE wa_fields-intlen TO wa_off-ilen.
APPEND wa_off TO it_off.
ENDLOOP.
viewoff = CL_ABAP_VIEW_OFFLEN=>CREATE( tab = it_off ).
conv->READ(
exporting
view = viewoff
importing
data = content
len = len ).
This is the DUMP
Runtime Errors CONVT_CODEPAGE_INIT
Exception CX_SY_CODEPAGE_CONVERTER_INIT
Occurred on 30.11.2004 at 13:20:47
The conversion of some code pages is not supported.
What happened?
The conversion of texts in code page 'UTF-' to code page '1100' is not
supported.
Thanks
Ariel -
Upload excel file to internal table in web dynpro program
Hi friend's
In web dynpro program how to upload excel file into internal table and finally data will be save Y table.hi,
See the properties of File Upload UI element..
Link: [http://help.sap.com/saphelp_nw70ehp1/helpdata/en/48/732f0510d83ff6e10000000a42189c/frameset.htm]
Goto References -> User Interface Elements -> Integration Category -> File upload..
After creating the 'FILE UPLOAD' element in a view.. Bind a datasource(a context attribute with STRING) with the data property..
Double click on ONACTION_UPLOAD method. Write a code as given below.
METHOD onactionon_upload .
TYPES : BEGIN OF str_itab,
name(10) TYPE c,
age(10) TYPE c,
END OF str_itab. DATA : t_table1 TYPE STANDARD TABLE OF str_itab,
i_data TYPE STANDARD TABLE OF string,
l_string TYPE string,
fs_table TYPE str_itab,
l_xstring TYPE xstring,
fields TYPE string_table,
lv_field TYPE string.
DATA : t_table TYPE if_main=>elements_data_tab,
data_table TYPE if_main=>elements_data_tab.
* get single attribute
wd_context->get_attribute(
EXPORTING
name = `DATASOURCE`
IMPORTING
value = l_xstring ).
CALL FUNCTION 'HR_KR_XSTRING_TO_STRING'
EXPORTING
in_xstring = l_xstring
IMPORTING
out_string = l_string.
SPLIT l_string AT cl_abap_char_utilities=>newline INTO TABLE i_data.
* Bind With table Element.
LOOP AT i_data INTO l_string.
SPLIT l_string AT cl_abap_char_utilities=>horizontal_tab INTO TABLE fields.
READ TABLE fields INTO lv_field INDEX 1.
fs_table-name = lv_field.
READ TABLE fields INTO lv_field INDEX 2.
fs_table-age = lv_field.
APPEND fs_table TO t_table1. "Append to the internal table
ENDLOOP.
Edited by: Rameshkumar Raamasamy on Feb 9, 2010 9:39 AM
Maybe you are looking for
-
USB Mouse Draining Too Much Power
I have a 22" Cinema Display and I keep my USB Power Mac Mouse attached to the USB port in the back, but now both ports give the error message that the "USB Device" requires too much power. I can plug it into the keyboard and it works fine, does anyon
-
Cant down load itunes on windows 7
cant download itunes after trying to update i have cleared all temp files and when i try to download it just says thanks with no option to save or warning
-
If I buy Pages, will I be able I upload pdf and word files to websites?
If I buy Pages, will I be able I upload pdf and word files to websites?
-
Hi All, While inserting a the datas from an internal table to a customized Table we are getting a Syntax error: "<b>The type of the database table and work area (or internal table)are not Unicode convertible. Unicode convertible</b>". Is t
-
Hi All, Searched same type of problem i am facing, but got no solution. Plesae reply. In our SAP scinario we are moving employees from one company code say 1000 to 2000. Now when in transaction PR05(Travel expense manger) we try to create claims for