Uploading data from an Excel to a temporal table
Hey everyone,
I have found the information about ODI really interesting and I would like to confirm something.
I am trying to upload some info from an excel file to ODI, and after that to make ODI check if there is any update on that file and upload it.
Can I do this with ODI?
I am using this blog as reference http://blogs.oracle.com/dataintegration/entry/connecting_to_microsoft_excel but i am having some issues when creating a Data Server in Topology Manager. Because when I open up thetopology manager > physical architecture and right on the microsoft mxcel technology I am not able to see the "Insert Data Server" option.
One last question could i do some scheduling with ODI too?, I will explain myself a bit more, I want ODI to check a folder and see if there will be a new file and if there is one, I would like to updated it for me. Would it be possible?
I do really appreciate your help and guidance as I am new to this tech.
Best regards.
Jaison
Hey I have already solved it, It was due to some right issues! :-)
Similar Messages
-
Uploading data from an excel to internal table.
Hi All,
I have a small problem when uploading data from an excel sheet to internal table using the function "GUI_UPLOAD".
Some garbage value is getting stored in the internal table after the upload. If i change the format of the file to ".txt" then its working fine. Pls help me out to upload the data frm Excel to Internal Table.
Thanks.
Sirisha.hi
good
pls check this code , this might help you to solve your problem
Multiple excel sheets generation in a workbook
CREATE OBJECT EXCEL 'EXCEL.SHEET'.
GET PROPERTY OF EXCEL 'Application' = APPLICATION.
SET PROPERTY OF APPLICATION 'Visible' = 1.
CALL METHOD OF APPLICATION 'Workbooks' = BOOKS.
CALL METHOD OF BOOKS 'Add' = BOOK.
CALL METHOD OF BOOK 'WORKSHEETS' = SHEET.
CALL METHOD OF SHEET 'ADD'.
Fill all the sheets with relavant data
PERFORM SHEET1 TABLES ITAB1.
PERFORM SHEET2 TABLES ITAB2.
PERFORM SHEET3 TABLES ITAB3.
PERFORM SHEET4 TABLES ITAB4.
Quit the excel after use
CALL METHOD OF EXCEL 'QUIT'.
FREE OBJECT: COLUMN,SHEET,BOOK,BOOKS,APPLICATION,EXCEL. "NO FLUSH.
CLEAR V_SHEET.
FORM FILL_CELL USING ROW COL VAL.
CALL METHOD OF SHEET 'cells' = CELL NO FLUSH
EXPORTING #1 = ROW #2 = COL.
SET PROPERTY OF CELL 'value' = VAL.
FREE OBJECT CELL NO FLUSH.
ENDFORM. " FILL_CELL
FORM SHEET1 TABLES ITAB1 STRUCTURE ITAB1.
V_SHEET = Sheet Name.
V_NO = V_NO + 1.
CALL METHOD OF BOOK 'worksheets' = SHEET NO FLUSH EXPORTING #1 = V_NO.
SET PROPERTY OF SHEET 'Name' = V_SHEET NO FLUSH.
PERFORM FILL_SHEET1 TABLES ITAB1 USING V_NO V_SHEET.
CALL METHOD OF SHEET 'Columns' = COLUMN.
FREE OBJECT SHEET.
CALL METHOD OF COLUMN 'Autofit'.
FREE OBJECT COLUMN.
ENDFORM.
Repeat above procedure for all sheets you want to add
FORM FILL_SHEET1
TABLES ITAB1 STRUCTURE ITAB1
USING V_NO V_SHEET.
ROW = 1.
PERFORM FILL_CELL USING ROW 1 'Column1 Name'.
PERFORM FILL_CELL USING ROW 2 'Column2 Name'.
PERFORM FILL_CELL USING ROW 3 'Column3 Name'.
ROW = ROW + 1.
LOOP AT ITAB1.
PERFORM FILL_CELL USING ROW 1 ITAB1-Column1.
PERFORM FILL_CELL USING ROW 2 ITAB1-Column2.
PERFORM FILL_CELL USING ROW 3 ITAB1-Column3.
ROW = ROW + 1.
ENDLOOP.
ENDFORM.
Repeat above procedure for all sheets you want to add
Try this also
TYPE-POOLS: truxs.
DATA: it_raw TYPE truxs_t_text_data.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
field_name = 'P_FILE'
IMPORTING
file_name = p_file.
Upload Excel file
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = p_file
TABLES
i_tab_converted_data = i_XCEL[]
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.
Thanks®ds,
Sree.
Edited by: Sree on Mar 17, 2008 8:07 AM -
Loading data from an excel file to Oracle Tables
Hi Everyone,
Once again I will have to bring some data from some excel file, which I have already done and "know" how to do and I would like to confirm with you all something first.
What I shall do is the following:
From one excel workbook file which has a lot of info just in one spread sheet feed some tables with the data coming from it.
So what I have though is create mane name ranges (Define names on excel) as I need and work with them, but I will be facing with headers on the rows and columns. There is where I doubt if it will be possible. So far, I will not be able to modify the Excel’s file structure.
Something more or less like this:
Country1 Country 2
Sales1 9999999 9999999
Sales2 9999999 9999999
Sales3 9999999 9999999
Total123 9999999 9999999
Sales4 9999999 9999999
Sales5 9999999 9999999
Sales6 9999999 9999999
Total456 9999999 9999999
Best regards.
JaisonHi SH,
First of all, I do really appreciate your time, patience and guidance.
Ok, let me get this straight.
You will need to create a data server for each Excel Work book
That means that as I will just work with one excel sheet, I will just have one data server and within it, there will be the spread sheets (excel tabs) and therefore the different named ranges.
Each of your named ranges will be a data store beneath the data server which can be used as a source model in your ODI interfaces. Therefore if you have a single workbook with 12 sheets for the months, each covered by a single named range, you would have a single data server withe 12 data stores.
This means that I will have something like this:
+ “My_Workbook.xls” server name (Just one)
- Spread sheet 1 (1 or several named ranges)
- Spread sheet 2 (1 or several named ranges)
- Spread sheet 3 (1 or several named ranges)
- Spread sheet n (1 or several named ranges)
I do think that if my statement above is correct, I think I got the idea. Is it like that?
I have gotten another question; let’s say for example that in any spread sheet I will have three different named ranges. The difference between spread sheet and spread sheet will be the month within and of course the information. Would it be accurate to bring it like that? That means that so far for twelve month I will bring 36 named ranges.
Well I think I had explained myself. Please do not hesitate to contact me if any further detail is required.
Best regards.
J -
Uploading data from an excel file to ztable
Hi,
I tried to upload an excel file to ztable using fm 'ALSM_EXCEL_TO_INTERNAL_TABLE'.In the o/p I can see only 3 rows and all the date and time fields are not properly displayed in the o/p.What would be the reason?Can anyone give me a suggestion?
Regards,
HemaHi,
pls check my code.
Data Definitions *
Internal Tables
DATA : t_zrb_hdr TYPE STANDARD TABLE OF ZRB_HDR WITH HEADER LINE,
t_field_catalog TYPE slis_t_fieldcat_alv.
Declaration of the Internal Table with Header Line comprising of the uploaded data.
DATA: BEGIN OF t_file_upload OCCURS 0.
INCLUDE STRUCTURE ALSMEX_TABLINE. " Rows for Table with Excel Data
DATA: END OF t_file_upload.
form UPLOAD_EXCEL_FILE .
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = '1'
i_begin_row = '2'
i_end_col = '10'
i_end_row = '250'
tables
intern = t_file_upload
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. -
Uploading data from MS-Excel to form
To upload from Microsoft Excel files (.xls) to display in the form the following need to be done.
Create two blocks in the first block create three fields in which the first is text item. Name it as TXT_FILE_NAME. The other two items are buttons. Name it BTN_BROWSE and BTN_UPLOAD respectively.
In the second block, make it a multi-record block. Create 15 text items inside the second block with naming such as OUTPUT1 to OUTPUT15.
Now do the following:
1. The following is the code inside BTN_BROWSE
DECLARE
filename VARCHAR2(256);
BEGIN
filename := GET_FILE_NAME(File_Filter=> 'Excel Files
(*.xls)|*.xls|');
if filename is not null then
:txt_file_name := filename;
end if;
go_item('txt_file_name');
END;
2. In the BTN_UPLOAD code do the following
DECLARE
AppID PLS_INTEGER;
ConvID PLS_INTEGER;
Buffer VARCHAR2(240);
ROWCOL VARCHAR2(20);
CNT NUMBER;
BEGIN
AppID := DDE.App_Begin(<complete-path-of-excel-executable>||:TXT_FILE_NAME, DDE.App_Mode_Minimized);
ConvID := DDE.Initiate('EXCEL', :TXT_FILE_NAME);
GO_BLOCK('BLOCK2');
FIRST_RECORD;
FOR I IN 5 .. 500 LOOP
CNT := 0;
FOR J IN 1 ..6 LOOP
BUFFER := '';
CNT := CNT + 1;
DDE.Request (ConvID, 'R'||I||'C'||J, Buffer, DDE.Cf_Text, 240);
BUFFER := RTRIM(LTRIM(BUFFER));
BUFFER := SUBSTR(BUFFER,0,LENGTH(BUFFER)-2);
IF BUFFER IS NULL THEN
EXIT;
END IF;
COPY(BUFFER,'BLOCK2.OUTPUT'||TO_CHAR(CNT));
END LOOP;
IF BUFFER IS NULL THEN
EXIT;
END IF;
CREATE_RECORD;
END LOOP;
DDE.Terminate(ConvID);
DDE.App_End(AppID);
FIRST_RECORD;
END;
=====================================================
Author : Anantha Narayanan
email : [email protected]
=====================================================First link explains all about your question, Refer second one for more ideas.
Reading Excel Sheet from Java without using any Framework
Enhanced File Upload - Uploading and Processing Excel Sheets
Regards
Vinod -
Import data from different Excel sheets to different tables
I have an Excel file which has different sheets(S1,S2,S3) .The columns in the sheet are different. I want to import the data from different sheets to different tables(T1,T2,T3).
S1 ---> T1
S2 ---> T2
S3 ---> T3
I want only one Excel data source in my SSIS package.You need to have different DFT flows for that as the metadata is different. You need to map each sheets to corresponding destination tables and then it would work fine
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Changes in BDC program to upload data from text/excel file
Hi friends i have obtained the BDc program after recording :
start-of-selection.
perform open_group.
perform bdc_dynpro using 'SAPLCOIH' '0100'.
perform bdc_field using 'BDC_CURSOR'
'CAUFVD-GSBER'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'AUFPAR-PM_AUFART'
'PM01'.
perform bdc_field using 'CAUFVD-IWERK'
'460a'.
perform bdc_field using 'CAUFVD-GSBER'
'2460'.
perform bdc_field using 'CAUFVD-EQUNR'
'10000009'.
perform bdc_dynpro using 'SAPLCOIH' '3000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'CAUFVD-KTEXT'
'abc'.
perform bdc_field using 'CAUFVD-INGPR'
'GM'.
perform bdc_field using 'CAUFVD-VAPLZ'
'RTN_VELR'.
perform bdc_field using 'CAUFVD-VAWRK'
'460A'.
perform bdc_field using 'BDC_CURSOR'
'CAUFVD-GLTRP'.
perform bdc_field using 'CAUFVD-GSTRP'
'1.8.2010'.
perform bdc_field using 'CAUFVD-GLTRP'
'1.8.2010'.
perform bdc_field using 'CAUFVD-TPLNR'
'RTNP-HIG'.
perform bdc_field using 'CAUFVD-EQUNR'
'10000009'.
perform bdc_field using 'AFVGD-INDET'
'1'.
perform bdc_field using 'AFVGD-WERKS'
'460A'.
perform bdc_field using 'AFVGD-STEUS'
'PMIN'.
perform bdc_field using 'AFVGD-ARBEH'
'H'.
perform bdc_field using 'AFVGD-DAUNE'
'H'.
perform bdc_dynpro using 'SAPLCOIH' '3000'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
perform bdc_field using 'BDC_CURSOR'
'CAUFVD-KTEXT'.
perform bdc_field using 'CAUFVD-KTEXT'
'abc'.
perform bdc_field using 'CAUFVD-INGPR'
'GM'.
perform bdc_field using 'CAUFVD-VAPLZ'
'RTN_VELR'.
perform bdc_field using 'CAUFVD-VAWRK'
'460A'.
perform bdc_field using 'CAUFVD-GSTRP'
'01.08.2010'.
perform bdc_field using 'CAUFVD-GLTRP'
'01.08.2010'.
perform bdc_field using 'CAUFVD-TPLNR'
'RTNP-HIG'.
perform bdc_field using 'CAUFVD-EQUNR'
'10000009'.
perform bdc_field using 'AFVGD-LTXA1'
'abc'.
perform bdc_field using 'AFVGD-INDET'
'1'.
perform bdc_field using 'AFVGD-ARBPL'
'RTN_VELR'.
perform bdc_field using 'AFVGD-WERKS'
'460A'.
perform bdc_field using 'AFVGD-STEUS'
'PMIN'.
perform bdc_field using 'AFVGD-ARBEH'
'H'.
perform bdc_field using 'AFVGD-DAUNE'
'H'.
perform bdc_transaction using 'IW31'.
perform close_group.
after executing it has two options.one is for call transactioin and other is for with session.Now i want to do the uploading from text file.Please guide me how to achieve that and what should be the order of fields in the text file.I am just a beginner.I know how to do that with LSMW bt trying BDc first time for creating PM ordersYou can use class "cl_gui_frontend_services". First you must select file with "file_open_dialog" method and the you can upload file with "gui_upload" method into internal table. Here is a sample: (I didn't try the code but I'm sure you can get it working, there are lots of sample codes about that. You can also search FM "GUI_UPLOAD").
REPORT zreport.
DATA:
gv_subrc TYPE sysubrc,
gv_result TYPE abap_bool,
gt_data_tab type table of zstruc.
PARAMETERS: p_fname LIKE rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fname.
PERFORM file_open_dialog USING space space space space
CHANGING p_fname gv_action gv_subrc.
START-OF-SELECTION.
PERFORM gui_upload TABLES gt_data_tab
USING p_fname CHANGING gv_subrc.
*** FORMS ***
FORM file_open_dialog USING pv_window_title
pv_default_extension
pv_default_filename
pv_initial_directory
CHANGING pv_filename
pv_user_action
pv_subrc.
DATA:
lt_file_table TYPE filetable,
lv_rc TYPE i,
lv_initial_directory TYPE string.
IF pv_initial_directory IS INITIAL.
PERFORM get_desktop_directory CHANGING lv_initial_directory.
ELSE.
lv_initial_directory = pv_initial_directory.
ENDIF.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = pv_window_title
default_extension = pv_default_extension
default_filename = pv_default_filename
* file_filter =
* with_encoding =
initial_directory = lv_initial_directory
* multiselection =
CHANGING
file_table = lt_file_table
rc = lv_rc
user_action = pv_user_action
* file_encoding =
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5
pv_subrc = sy-subrc.
IF pv_subrc EQ 0.
READ TABLE lt_file_table INTO pv_filename INDEX 1.
ENDIF.
ENDFORM.
FORM gui_upload TABLES pt_data_tab
USING pv_filename
CHANGING pv_subrc TYPE sysubrc.
DATA:
lt_data_tab TYPE TABLE OF string,
lv_filename TYPE string.
lv_filename = pv_filename.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = lv_filename
filetype = 'ASC'
has_field_separator = 'X'
* header_length = 0
* read_by_line = 'X'
* dat_mode = SPACE
* codepage = SPACE
* ignore_cerr = ABAP_TRUE
* replacement = '#'
* virus_scan_profile =
* show_transfer_status = 'X'
* IMPORTING
* filelength =
* header =
CHANGING
data_tab = lt_data_tab
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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19
pv_subrc = sy-subrc.
IF pv_subrc EQ 0.
pt_data_tab[] = lt_data_tab[].
ENDIF.
ENDFORM. -
Uploading Data from MS Excel(CSV)
I know how upload a CSV file into my root directory of Apache server but i now want to load that file into my oracle Database
I know how to use SQL Loader but i want that process to be automatically done on server.
I am using JSP .
Is there any way that i can put any script or file in my root directory so that sqlldr run automatically and find that control file.
Any suggestionYou can also use the idea behind this method:
http://www.oracle.com/technology/products/database/application_express/packaged_apps/sample_code.html
It's for APEX, so you'll have to modify it slightly for java. The principle is the same though.
If you do use it, provide the author feedback on this thread:
New External Table Sample Code posted
chet -
Upload data from Excel.
Hello Experts,
I gotta a question regarding upload data from the excel to the sap. Does anybody know how do i have to procede ??? I was trying through transactions KP65 and KP34 but i got really confuse.
A documentation step by step will be very helpful !
Thank´s in advance!Hi,
If you don't want to program, you can either use LSMW or you can use CATT.
Regards
Mark -
Uploading data from a particular column of a particular sheet from an excel file into internal table
Hi,
I have to upload data in the first coulmn of 7th sheet of an excel file.
Can anyone please help me on this.
This link works perfectly fine for excel files without Macros.
Read multiple sheets of an Excel file into SAP through ABAP - Code Gallery - SCN Wiki
But my excel file has some macros.
And after the macro enable/disable popup is cleared, the system freezes.
Can someone pease help me on this abd tell me an approach different from the one in the above link?Welcome to SCN
Please search before you post next time:BDC, upload data from multi excel sheets -
Uploading data from excel file to a dynamically created internal table
Hi,
I have a requirement where i have to upload data from an excel file into a database table. I would be able to determine the structure of the table only at runtime based on the user input.. so i have created an internal table dynamically.
Could you please tell me if its possible to upload data from an excel file to the dynamically created internal table using any function modules?
I thought of doing this by declaring a generic internal table of one field and then uploading the *.csv file into it and then splitting it based on "," and then assigning it to the field symbol referencing the internal table.. but my file length exceeds 132 characters and i'm only able to get data of lenght 132 char's in my internal table ( generic one).
Could anyone please show me a way around this.
Thanks in advance,
HarshaSure, check this out.
report zrich_0002.
type-pools: slis.
field-symbols: <dyn_table> type standard table,
<dyn_wa>,
<dyn_field>.
data: it_fldcat type lvc_t_fcat,
wa_it_fldcat type lvc_s_fcat.
type-pools : abap.
data: new_table type ref to data,
new_line type ref to data.
data: iflat type table of string.
data: xflat type string.
data: irec type table of string with header line.
data: tabix type sy-tabix.
data: file type string.
selection-screen begin of block b1 with frame title text .
parameters: p_file type rlgrap-filename default 'c:Test.csv'.
parameters: p_flds type i.
selection-screen end of block b1.
start-of-selection.
* Add X number of fields to the dynamic itab cataelog
do p_flds times.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = sy-index.
wa_it_fldcat-datatype = 'C'.
wa_it_fldcat-inttype = 'C'.
wa_it_fldcat-intlen = 10.
append wa_it_fldcat to it_fldcat .
enddo.
* Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = new_table.
assign new_table->* to <dyn_table>.
* Create dynamic work area and assign to FS
create data new_line like line of <dyn_table>.
assign new_line->* to <dyn_wa>.
file = p_file.
call method cl_gui_frontend_services=>gui_upload
exporting
filename = file
changing
data_tab = iflat
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.
loop at iflat into xflat.
clear irec. refresh irec.
split xflat at ',' into table irec.
loop at irec.
tabix = sy-tabix.
assign component tabix of structure <dyn_wa> to <dyn_field>.
<dyn_field> = irec.
endloop.
append <dyn_wa> to <dyn_table>.
endloop.
* Write out data from table.
loop at <dyn_table> into <dyn_wa>.
do.
assign component sy-index of structure <dyn_wa> to <dyn_field>.
if sy-subrc <> 0.
exit.
endif.
if sy-index = 1.
write:/ <dyn_field>.
else.
write: <dyn_field>.
endif.
enddo.
endloop.
Regards,
Rich Heilman -
Getting error while uploading data using the EXCEL( GUI_upload)
Dear Freinds,
I am uploading data from my excel sheet to my Custom table . I am using the below code
call function 'GUI_UPLOAD'
exporting
filename = l_fn
filetype = 'BIN' "'ASC'
has_field_separator = 'X'
tables
data_tab = p_i_ins_db
exceptions
others = 17.
i can see in my internal P_i_ins_db ...all the data is coming in encrypted format.
The flat given to me is the .CSV file .
Could any one please let me know how i can upload the data which is there in .csv file.
regards
syamalaHi Syamala,
Before using the GUI_UPLOAD to upload the data from the excel file to the internal table,you can try usng the Function Module 'SAP_CONVERT_TO_TEX_FORMAT' or 'SAP_CONVERT_TO_CSV_FORMAT' as it helps n formatting the data.
In case you have any further clarifications,do let me know.
Regards,
Puneet Jhari. -
FM to upload data / Attribute in EXCEL File in SRM7.0
Hi Experts,
We had used FM BBP_UPDATE_ATTRIBUTE to upload Storage Location( LAG) attribute in SRM ORG Structure and other data in other case ...... Currently we arranged to upload the .TXT file.
But we want to upload from MS EXCEL File.
Can anyone please suggest, which FM we can need to use to upload data from MS EXCEL File.
Thnaks
NAPHi Narenrda,
Normally in ECC we can use the FM "ALSM_EXCEL_TO_INTERNAL_TABLE" to convert excel to internal table but this FM is not there in SRM 7.0 .
I copied the above mentioned FM along with global data and includes of the function group from ECC and it works fine in SRM.
You can use the FM "BBPU_FILENAME_HELP" to show an F4 help for the input field for selecting a file from desktop.
Thanks,
Anubhav -
Upload data from excel to Ztable with statistics
Hi,
I have a requirement to upload data from excel sheet to ztable .
Here i need tp provide the user with the execution statistics like
1.Number of records read from the Excel spread-sheet
2. Number records processed successfully
3. Number records with Error
4. Name and location of Error Log-file (text-file format)
5. Name and location of the file containing error records (Excel spread-sheet format)
I would appreciate if any of you have code written for the sameSee the below example code to upload from xl file to sap
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
Reward Points if it is helpful
Thanks
Seshu -
Upload data from excel to screen
Hi
I have created one Table Maintanence Generator with only one screen (Table control ). Here i have to upload data from excel to table control. How to upload data from excel to table control.Hi,
Use this code to get data from excel to internal table. Later put the logic in PBO of the screen to fill the table control from internal table.
PARAMETERS: po_file TYPE rlgrap-filename DEFAULT 'E:test.xls'.
TYPES: BEGIN OF t_final,
empno(10) TYPE c,
name(30) TYPE c,
state(25) TYPE c,
END OF t_final.
PARAMETERS: po_file TYPE rlgrap-filename.
DATA: i_tab TYPE STANDARD TABLE OF alsmex_tabline,
i_final TYPE STANDARD TABLE OF t_final,
wa_tab TYPE alsmex_tabline,
wa_final TYPE t_final.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR po_file.
PERFORM open_folder.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = po_file
i_begin_col = 1
i_begin_row = 1
i_end_col = 3
i_end_row = 65256
TABLES
intern = i_tab
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
CHECK NOT i_tab[] IS INITIAL.
LOOP AT i_tab INTO wa_tab.
CASE wa_tab-col.
WHEN 1.
wa_final-empno = wa_tab-value.
WHEN 2.
wa_final-name = wa_tab-value.
WHEN 3.
wa_final-state = wa_tab-value.
ENDCASE.
AT END OF row.
APPEND wa_final TO i_final.
CLEAR wa_final.
ENDAT.
ENDLOOP.
FORM open_folder .
DATA: li_file TYPE TABLE OF sdokpath,
lwa_file TYPE sdokpath.
CLEAR: p_fname, lwa_file.
REFRESH li_file[].
CALL FUNCTION 'TMP_GUI_FILE_OPEN_DIALOG'
TABLES
file_table = li_file
EXCEPTIONS
cntl_error = 1
OTHERS = 2.
IF sy-subrc IS INITIAL.
READ TABLE li_file INTO lwa_file INDEX 1.
IF sy-subrc IS INITIAL.
p_fname = lwa_file-pathname.
ENDIF.
ENDIF.
ENDFORM. " open_folder
Thanks,
Vinod.
Edited by: Vinod Reddy Vemuru on Jul 28, 2008 4:50 PM
Maybe you are looking for
-
HT201210 After updating my iphone. Only the logo and connect to itunes on the screen.
After updating and system restore my iphone wont open. only the logo and connect to itunes on the screen.
-
Payment Received Notification by email
Dear All Please let me know if any one has an experience of sending email notification of payment receipt to concerned user. Our requirement is that we will maintain a Z table where users email address will be maintained by profit center. As soon as
-
Formatted Text Edit & SAP Script Text
I'm working through a business requirement to input some long text, and then update an existing SAP script text object (attached to a sales order). I'm using a formatted text editor to allow the users to enter the text - however I can't find a utlity
-
How do i download the new B2B Document Editor tool
How do i download the new B2B Document Editor tool?
-
PSE 8 R6034 Runtime Error Question...?
Hello, when I double click on my PSE 8 Desktop Icon it starts to load and then a couple seconds later the R6034 Runtime Error message below pops up. I have tried uninstalling the whole program and re-installing it several times but it just keeps givi