Generate and display excel file
Hi guys,
Is there a way to generate and display excel file in sapgui without the need of downloading the excel file to local directory first?
I found the following 2 ways of doing it, but both require me to download the generated xls file to local directory:
#1 way:
1. Generate the xls file using GUI_DOWNLOAD with the filename = 'c:\test.xls'.
2. Call fm SAP_STARTS_EXCEL and pass in the parameter i_filename = 'c:\test.xls'
#2 way:
1. Generate the xls file using GUI_DOWNLOAD with the filename = 'c:\test.xls'.
2. Upload it back using the below so that i can get it in xstring format.
CALL FUNCTION 'GUI_UPLOAD'
exporting
filetype = 'BIN'
filename = 'C:\test.xls'
tables
data_tab = itab.
3. Then pass it to the cl_gui_html_viewer to display it.
call method html_control->load_data
exporting
url = 'test.xls'
type = 'application'
subtype = 'vnd.ms-excel'
importing
assigned_url = l_url
changing
data_table = l_pdf_data
exceptions
others = 1.
I prefer the #2 way as my program will get wrapped thru ITS server, and it seems the #1 way will not work. So is there any way i can get the excel file to be generated in xstring format so that i can pass to cl_gui_html_viewer straight away to display without having to save to local directory first?
Any other suggestion apart from the above 2 ways are welcome as well.
Thanks guys.
Use function module ALV_XXL_CALL. It will solve ur prob immediately.
REPORT ZSKC_ALV_XXL.
TYPE-POOLS : KKBLO.
DATA : ITAB LIKE T100 OCCURS 0,
T_FCAT_LVC TYPE LVC_S_FCAT OCCURS 0 WITH HEADER LINE,
T_FCAT_KKB TYPE KKBLO_T_FIELDCAT.
START-OF-SELECTION.
* Get data.
SELECT * UP TO 20 ROWS
FROM T100
INTO TABLE ITAB
WHERE SPRSL = SY-LANGU.
CHECK SY-SUBRC EQ 0.
* Create the field catalog.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
I_STRUCTURE_NAME = 'T100'
CHANGING
CT_FIELDCAT = T_FCAT_LVC[]
EXCEPTIONS
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
OTHERS = 3.
CHECK SY-SUBRC EQ 0.
* make sure you pass the correct internal table name in the field catalog.
t_fcat_lvC-tabname = 'ITAB'.
MODIFY T_FCAT_LVC TRANSPORTING TABNAME WHERE TABNAME NE SPACE.
* Transfer to KKBLO format.
CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
EXPORTING
IT_FIELDCAT_LVC = T_FCAT_LVC[]
IMPORTING
ET_FIELDCAT_KKBLO = T_FCAT_KKB
EXCEPTIONS
IT_DATA_MISSING = 1
IT_FIELDCAT_LVC_MISSING = 2
OTHERS = 3.
CHECK SY-SUBRC EQ 0.
* Call XXL.
CALL FUNCTION 'ALV_XXL_CALL'
EXPORTING
I_TABNAME = 'ITAB'
IT_FIELDCAT = T_FCAT_KKB
TABLES
IT_OUTTAB = ITAB[]
EXCEPTIONS
FATAL_ERROR = 1
NO_DISPLAY_POSSIBLE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.
It will open the Excel in front of you and populate the cells from your internal table
with color for Key columns.
Cheers
SKC.
Similar Messages
-
Generate and disaply excel file as iview in ep6?
Hello, everybody.
I built a iView in EP5 that can generate and display excel file on the run-time. I used contecttype in httpservletresponse to set the content type to excel so the browser will see the data as excel.
But it looks like the setcontenttype for httpservletresponse does not work anymore in EP6, does anybody know how to make the broswer "sees" the data as an excel file in EP6?
I am using EP6 SP9Hi Gary,
you definitely can set the content type if you call an AbstractPortalComponent and set all things within method doOnNodeReady (search for both terms on SDN forums, you'll find a heap of hints).
In addition, I don't know if you create "real" Excel data or use the html trick. If you don't know the latter, see Export Portal data to Excel
Hope it helps
Detlev -
Display Excel File using OfficeControl
Hi,
My requirement is to display and Excel file for approval purpose which is generated by custom ABAP application. After each approval I need to again generate the Excel file with the approval name added and send for next approval.
Is it possible to download the Excel File to application server and display it on webdynpro screen.
Please let me know if they are other methods to achieve the same.
Thank you,
Ramu N.Hi Ramu,
Yes you can do this by using File upload and download methods. using this you can upload and download excel files.
Check this wiki..
http://wiki.sdn.sap.com/wiki/display/WDABAP/UploadandDownloadfilesinWebdynproABAP
http://wiki.sdn.sap.com/wiki/display/WDABAP/ExcelFileUploadAndDisplayDataUsingWebDynPro+ABAP
using office control...Check this...
How to use element FILE_UPLOAD with element OFFICE_CONTROL
http://help.sap.com/saphelp_nw2004s/helpdata/en/d1/af8841349e1909e10000000a155106/frameset.htm
Cheers,
Kris.
Edited by: kissnas on May 19, 2011 6:36 AM -
How to Generate and Display SVG Graphics in ABAP
Hi everybody,
I tried to complete the Tutorial "How to Generate and Display SVG Graphics in ABAP, Part 1" by Siarhei Ulasenka (https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/ad83a990-0201-0010-d680-a189f8bc20fa).
Unfortunately when I tried the example to display an SVG Drawing in an ABAP Report I get the error message "Es ist ein Laufzeitfehler aufgetreten, ungültiges Zeichen" (english should be something like "Runtime Error, unkown character"). But it works when I open the svgfile in a new IE Window (parameter in_place from cl_gui_html_viewer->show_url). Also when I open a svg file from the local disc it works fine.
The code:
CALL METHOD html_control->load_data
EXPORTING
url = 'chart.svg'
type = 'image'
subtype = 'svg+xml'
CHANGING
data_table = lt_svg
EXCEPTIONS
OTHERS = 1.
CALL METHOD html_control->show_url
EXPORTING
url = 'chart.svg'
in_place = 'X'
EXCEPTIONS
cntl_error = 1.
Has anyone a solution? Thanks in advance for your help!
Regards
KathrinHello Alex,
The Corel SVG viewer has problems loading and displaying the examples (see the list of limitations at their site). Try to use the Adobe viewer instead.
Regards,
Sergei Ulasenka -
Hi All,
I need code of How to open and save excel file in local system in Oracle forms.
With Regards,
Chandra ShekharHello Chandra,
Webutil can be used to achieve this functionality.
STEPS TO FOLLOW
================
1. Install and configure Webutil following instructions in the webutil manual
and the readme file.
2. Create a form with a block Eg. DEPT
3. Create a button, and in that button put the following code -
DECLARE
application Client_OLE2.Obj_Type;
workbooks Client_OLE2.Obj_Type;
workbook Client_OLE2.Obj_Type;
worksheets Client_OLE2.Obj_Type;
worksheet Client_OLE2.Obj_Type;
args Client_OLE2.List_Type;
cell ole2.Obj_Type;
j INTEGER;
k INTEGER;
BEGIN
application := Client_OLE2.create_obj('Excel.Application');
workbooks := Client_OLE2.Get_Obj_Property(application, 'Workbooks');
workbook := Client_OLE2.Invoke_Obj(workbooks, 'Add');
worksheets := Client_OLE2.Get_Obj_Property(workbook, 'Worksheets');
worksheet := Client_OLE2.Invoke_Obj(worksheets, 'Add');
go_block('dept');
first_record;
j:=1;
k:=1;
while :system.last_record = 'FALSE'
loop
for k in 1..3 /* DEPT has 3 columns */
loop
If not name_in(:system.cursor_item) is NULL Then
args:=Client_OLE2.create_arglist;
Client_OLE2.add_arg(args, j);
Client_OLE2.add_arg(args, k);
cell:=Client_OLE2.get_obj_property(worksheet, 'Cells', args);
Client_OLE2.destroy_arglist(args);
Client_OLE2.set_property(cell, 'Value', name_in(:system.cursor_item));
Client_OLE2.release_obj(cell);
End If;
next_item;
end loop;
j:=j+1;
next_record;
end loop;
/* For the last record */
for k in 1..3
loop
If not name_in(:system.cursor_item) is NULL Then
args:=Client_OLE2.create_arglist;
Client_OLE2.add_arg(args, j);
Client_OLE2.add_arg(args, k);
cell:=Client_OLE2.get_obj_property(worksheet, 'Cells', args);
Client_OLE2.destroy_arglist(args);
Client_OLE2.set_property(cell, 'Value', name_in(:system.cursor_item));
Client_OLE2.release_obj(cell);
End If;
next_item;
end loop;
Client_OLE2.Release_Obj(worksheet);
Client_OLE2.Release_Obj(worksheets);
/* Save the Excel file created */
args := Client_OLE2.Create_Arglist;
Client_OLE2.Add_Arg(args,'d:\test.xls');
Client_OLE2.Invoke(workbook, 'SaveAs', args);
Client_OLE2.Destroy_Arglist(args);
/* release workbook */
Client_OLE2.Release_Obj(workbook);
Client_OLE2.Release_Obj(workbooks);
/* Release application */
Client_OLE2.Invoke(application, 'Quit');
Client_OLE2.Release_Obj(application);
END;
4. Save the form and compile it.
5. Run the form.
6. Execute the query in the block.
7. Click on the button.
8. An excel file will be created in the d:\ directory by the name test.xls.
Kind regards,
Alex
If someone's answer is helpful or correct please mark it accordingly. -
Saving and using excel files in Numbers.
I have saved Numbers files as Excel files. and then saved them to Dropbox. They are .xls files.
My associate uses a PC and his Excel files are .xlsx files.
I can open his files.
How can he open mine?
We are sharing info on a file.no problem!
if you have an excel document on your mac or pc that you want to view only, email it to yourself from your desktop, open the email onyour iPad, and touch the attachment - it will open as a view only file so all the cell formulae etc are hidden, you just see the visible elements.
if you want something you can use to edit, i use an app called Office2 (that's a superscript "2" or 'Office squared'. I'm using the iPhone version on my iPhone and iPad, It's currently £3.49 on the iTunes app store. But I see there is now an iPad version (HD) available for a fiver.
Basically, you do exactly the same as above but when you touch the attachment in the email, if Office2 is installed there is an option at the top asking which app you want to open it in. Choose Office 2 then you can open, change, save, mail it back to yourself.
i don't use very large excel files, but it works for me!!
enjoy
paul -
Proble with displaying excel file on the PC?
Hello Friends,
I have another issue.
When the user presses push button in my application, I am displaying excel file with data. It is working fine. But... a dummy file is creating always in my desktop with DAT extension. Is there any possiblity not to store on the PC.
code I used for calling excel file.
CALL FUNCTION 'WS_EXCEL'
EXPORTING
FILENAME = ' '
SYNCHRON = ' '
TABLES
DATA = ITAB
EXCEPTIONS
OTHERS = 1.
Could you pls help me not to store the excel file on the desktop/ PC.
only temporary excel file should display.
Thanks in advance
RaghuWS_excel is obsolette now.
use MS_EXCEL_OLE_STANDARD_DAT.
REPORT ZEX_DATATOEXCEL .
Parameters: P_file like RLGRAP-FILENAME.
data : begin of int_head occurs 0,
Filed1(20) type c, " Header Data
end of int_head.
data : begin of int_data occurs 0,
Field1(20) type c, " Data
Field2(20) type c,
Field3(20) type c,
Field4(20) type c,
end of int_data.
int_head-Filed1 = 'Sales Ord'.
APPEND int_head.
CLEAR int_head.
int_head-Filed1 = 'Sold-to-Party'.
APPEND int_head.
CLEAR int_head.
int_head-Filed1 = 'Purchase Ord'.
APPEND int_head.
CLEAR int_head.
int_head-Filed1 = 'Ship-to-Party'.
APPEND int_head.
CLEAR int_head.
int_data-field1 = '1JOHN'.
int_data-field2 = '2TOM'.
int_data-field3 = '3BRAD'.
int_data-field4 = '4PETER'.
Append int_data.
Clear int_data.
CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
EXPORTING
file_name = p_file " path offile where u need to download
* CREATE_PIVOT = 0
* DATA_SHEET_NAME = ' '
* PIVOT_SHEET_NAME = ' '
* PASSWORD = ' '
* PASSWORD_OPTION = 0
TABLES
* PIVOT_FIELD_TAB =
data_tab = int_data "internal table with data
fieldnames = int_head "internal table with header
EXCEPTIONS
file_not_exist = 1
filename_expected = 2
communication_error = 3
ole_object_method_error = 4
ole_object_property_error = 5
invalid_filename = 6
invalid_pivot_fields = 7
download_problem = 8
OTHERS = 9
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
Finder can not find and display certain files. Why? Any fix,please?
I've discovered to my surprise that Finder can not find and display certain files. Computer is Mac book OS X (10.6.8)
No matter what Finder settings I use, there are files which it can not detect and display.
Here are just some examples of files sitting in the HD but Finder can not display them:
Located in preference panes :
fibre channel 1.7
Located in : /Library/StartupItems/BRESINKx86Monitoring
BRESINKx86Monitoring
FxLicenseManager
Located in /Library/StartupItems/FxLicenseManager
EAP8021X
Located in /System/Library/PrivateFrameworks/EAP8021X.framework
The questions:
What to make of this inability of Finder to ,well, find? (again - I tried all possible settings of Finder!)
Is there any way to fix it?
Thanks for any competent suggestion!Well, guys,
Interesting suggestions but the problem remains -Finder (aka Spotlight) is not capable to find certain files.Period.
I consider it as a fault of the system because in comparison, a search facility of a plain Windows based machine is capable to dig out and display any file, no matter now deeply hidden...
As far as the suggestion above by softwater goes , well, I've used the additional foptions extensively and nothing produced the result needed -that's why I created this discussion.
If someone still believes that using Finder with all its options is good enough, here is a test for you to perform on your own Mac:
-Open /Library/StartupItems/ and have a look inside - most likely you have a bunch of items. Write down the names of one or two of them. For this test I've chosen
FxLicenseManager located in /Library/StartupItems/. You can use any file you want grom this location...
- Then go to Finder and set it to display everything in Library of the HD. Remember - for this test you pretend you don't know any file name in this folders.
If the Finder works properly it shall display folders of Library >Startup items with all stuff inside, including the FxLicenseManager file I used for this test.
Finder displayed nothing. It is obvious that for Finder, certain locations are off limits. That's why I consider Finder as a faulty.
Of course if someone can set the Finder's options to do the above search and succeed, I'll be glad to try ...:-)
At this point, what I gather from this discussion is that :
1. Finder (Spotlight) feature is not to be trusted,despite number of fancy but rather useless options.
2. If you need to really find everything usually not displayed by Finder you better get real searching software. -
Generate and send Excel format file by mail in bakground.
Hi fellows, i have a requirement, which is to generate an excel file in background and send it attached by e-mail. This file have many characteristics like Freeze pane, Auto filters, and some other format characteristics, One of the ways for achieving this kind of characteristics is using OLE or Desktop Office Integration, but both run in foreground. Other way i found is formatting the excel using XML and then at the moment of sending it by mail, changing extension for xls, but the problem is that it occupies too much space, i imagine cause it is raw xml, for example for a file for 1,000 records and 14 columns generates a file of 1.6Mb which is not like generating the same file using OLE or DOI (24Kb).
I would like to know if there is a way to use an excel component or another way that takes less space for generating the file with format and also send it by e-mail in background??
Thanks.
Noe.is 1.6 MB the smallest size you can generate, did you remove every optional tag?
XLSX format is a compressed XML format valid since office 2007. Maybe you can try to generate it? (I don't exactly know which ZIP algorithm it requires, SAP can compress using the ZLIB Compression Library)
You may also attach a Windows server to SAP via RFC. You should create an RFC server. You may have a look at this [sdn article - Communication to Presentation Server in Background Mode|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2] for some clues about running an RFC server. I guess you could use a VB script on the server.
For sending emails, this is a separate question, you may have a look at wiki: sending mails - home page. -
Xml publisher generate huge size excel file
hi,
we use xml publisher to generate excel file.
the problem is:
when there are over 100,000 rows, the excel file size will be very very huge,and it will take very very long time to open it.
i open the excel file with UltraEdit and find it is filled with html sytax.
When that excel file is opened with excel and saved as .xls file, the size will be dramatically reduced.
anyone can help?Hello
I am getting the same problem, the EXCEL output file size is huge.
What I notice that it is stored as Web Pages *.htm; *.html (Save as Type) in Excel this is the reason it is huge.
If I save as Microsoft Office Excel Workbook *.xls it Reduce the size.
I don't know how to save as *.xls through XML Publlisher.
Any body knows? please Help..
Thanks. -
hi i am trying to read an excel file from a location on the app server and display it in the browser (ie). the excel file should open up and not display the open/save dialog.
following is the code that i am using. i am not able to get it to work. getting an illegalstateexception and also i am getting all garbage diplayed in the browser. no excel. kindly help.
<%@ page import="java.io.*" contentType="application/vnd.ms-excel"%>
<%@ taglib uri="/WEB-INF/tlds/sapphire.tld" prefix="sapphire" %>
<%@ taglib uri="/WEB-INF/tlds/c.tld" prefix="c" %>
<%
//response.reset();
//response.setHeader("Pragma", "no-cache");
//response.setHeader("Cache-Control", "no-cache");
//response.setDateHeader("Expires", 0L);
ServletOutputStream so = response.getOutputStream();
String filename = "C:\\example1.xls";
String mimetype = "application/vnd.ms-excel";
ByteArrayOutputStream output = new ByteArrayOutputStream();
InputStream in = new BufferedInputStream(new FileInputStream(filename));
byte bytebuff[] = new byte[500];
for(int lengthread = 0; (lengthread = in.read(bytebuff)) != -1;){
output.write(bytebuff, 0, lengthread);
byte data[] = output.toByteArray();
response.setContentType(mimetype);
so.write(data);
in.close();
so.close();
%>A JSP calls getWriter() by default.
Every time you have a carriage return outside <% %> it gets written to the writer.
The Illegal state exception would be because you are getting the outputStream after the writer.
This is better done in a servlet, but can be done in a JSP, try it with code like this:
<%@ page import="java.io.*" contentType="application/vnd.ms-excel"
%><%@ taglib uri="/WEB-INF/tlds/sapphire.tld" prefix="sapphire"
%><%@ taglib uri="/WEB-INF/tlds/c.tld" prefix="c"
%><%
%> Note that there is no text at all outside of the <% %> (not even carriage returns)
Also, why are you writing to a ByteArrayOutputStream (ie into a memory byte array), and then writing the byte array to the servletoutputstream?
Just put a buffer around the servlet outputstream and write directly to that.
ServletOutputStream so = response.getOutputStream();
BufferedOutputStream output = new ByteArrayOutputStream(so);
... -
How can I make waveform graph and/or excel file with two different dynamic DBL values?
As the question describes, I have two dbl sources from a load cell and linear actuator (from firgelli). I want to make a load/displacement curve from the force readings from the load cell and the displacement readings from the linear actuator. The load cell outputs an analog signal that can be acquired by a DAQ and the actuator comes in with a board and VI program to control the speed and measure the displacement of the actuator to a sample rate of my choosing. Is there a way that I can make a VI where it continues to collect data and construct the graph I'm looking for?
Solved!
Go to Solution.A couple points about your application:
1. Synchronization. Since you're ultimate goal is a stress/strain curve, it is vital that your force and displacement data be synchronized appropriately. If your sampling is beyond a few times a second, this is not really possible without some form of hardware synchronization via either a trigger and/or sample clock. Two NI DAQ boards can be synchronized this way easily, but it seems you're using 3rd party hardware for one of these processes. Would need to know more about that board to know what options you have. You could specify what your resolution is in distance, and how fast the article will be moving, to get an idea of how fast to acquire, and how well you'll need to synchronize the data. Another option, since it appears each data stream will be sampled on a hardware-timed sample clock, they will be offset in time, but not skewed during the acquisition. You may be able to identify a feature in the data set common to each and use that to remove the timing offset after the process is completed.
2. Display. To display data during the acquisition process, I usually recommend at least one display that plots vs. time. Much easier to spot irregularities with the acquisition process that way. However, if you'd like to also plot force vs. displacement, you can use an XY Graph to plot parametrically. For Example, in your case you would use the Displacement data as the X coordinates, and the Force data as the Y coordinates.
3. Saving data to file. I would recommend using the Save to Spreadsheet File.vi (File IO pallette) to save your data. If you use a comma as the delimiter, and save the file with a *.csv extension, you will have a file that is easily read into excel. The standard tab-delimited spreadsheet file is also fine, it will just require an extra step to read it into excel to specify to excel what the delimiter is.
4. Batch vs. Real-Time Recording (Data File). If your process is short (< 30 sec) you may be better off acquiring the data, Storing it locally to the VI (Array - usually maintained in a shift register), and then writing the file with a header (acquisition parameters, test article information, data column headers) and the data all at once in batch mode to the file after the process is finished. If, however, it is longer than that you would be better off starting a data file with a header and appending the data to the file as you go, so that if something happens during your test, you at least have data up to that point.
Hope this Helps,
Kurt -
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.!
JonDepends 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 -
When attempting to open .XLS files in Numbers, the format is not recognized. When the format is .XLSX, the format is recognized. Why is it this way? It's still much more common for folks to have the .XLS file format on their excel files. Why would Numbers not be backwards-compatible?
Additionally, to state in the benefits of this program that one can save to 'Excel' is a little misleading. You can't save to anything except .numbers. Sure, you can export to Excel (with file extension .XLS, I might add), but you can't save or save-as.
Does anyone else see the irony in being able to export to .XLS but not be able to open an .XLS?
There is something to be said for clarity.
You can't expect folks to have Numbers and Excel on their systems, so how else are they supposed to open .XLS files in Numbers?
And I don't need to see another advertisement for NeoOffice or OpenOffice here, thanks. I'd actually like Numbers to be a little more sensible.
That is all.When the advertisements were written, there was no Lion so we were able to Save As Excel.
At thiqs time there is no longer Save As command under Lion but the feature is always available.
When your editing task is ended, you are free to use this scheme:
File > Duplicate
File > Save and in the dialog you will have the option save as Excel.
Numbers isn't and I hope that it will not become an Excel editor.
Its resources contain a flag defining it this way.
I posted several times a script editing this resource.
This morning I'm not in a mood allowing me to do your duty.
Search by yourself in existing threads with a keystring like
viewer AND editor
Yvan KOENIG (VALLAURIS, France) jeudi 27 octobre 2011 09:40:23
iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
My iDisk is : <http://public.me.com/koenigyvan>
Please : Search for questions similar to your own before submitting them to the community -
Save and Close excel file opened through OLE
Hi,
I have opened an excel file on my desktop and edited it.Now I have to save this file and close it.
Right now , I am manually saving the file and closing it. So please give the steps to automate the process of saving and closing .
Please find the code below for opening a file and editing.
report zkntest2.
INCLUDE: <line>,
<icon>,
<symbol>,
ole2incl.
DATA: g_excel_app TYPE ole2_object,
g_excel_workbook TYPE ole2_object,
g_excel_worksheet TYPE ole2_object,
g_excel_usedrange TYPE ole2_object,
g_excel_cell TYPE ole2_object,
g_excel_return TYPE ole2_object.
data :H_MAPL TYPE OLE2_OBJECT, " list of workbooks
H_MAP TYPE OLE2_OBJECT, " workbook
H_ZL TYPE OLE2_OBJECT, " cell
H_F TYPE OLE2_OBJECT. " font
CONSTANTS:c_appl(17) TYPE c VALUE 'Excel.Application'.
SELECTION-SCREEN BEGIN OF BLOCK blk1 with frame title text-001.
PARAMETERS p_ofile LIKE rlgrap-filename default 'C:\layout.xls'.
SELECTION-SCREEN END OF BLOCK blk1.
CREATE OBJECT g_excel_app c_appl.
CALL METHOD OF g_excel_app 'Workbooks' = g_excel_workbook.
CALL METHOD OF g_excel_workbook 'Open'
EXPORTING #1 = p_ofile.
SET PROPERTY OF g_excel_app 'Visible' = 1.
CALL METHOD OF g_excel_app 'Workbooks' = H_MAPL.
PERFORM FILL_CELL USING 4 9 1 'Kiran'(001).
PERFORM FILL_CELL USING 5 9 1 'Ref#'(002).
PERFORM FILL_CELL USING 6 9 1 'Claim#'(003).
PERFORM FILL_CELL USING 7 9 1 'Location'(004).
FREE OBJECT g_excel_app.
FORM FILL_CELL USING I J BOLD VAL.
CALL METHOD OF g_excel_app 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
SET PROPERTY OF H_ZL 'Value' = VAL .
GET PROPERTY OF H_ZL 'Font' = H_F.
SET PROPERTY OF H_F 'Bold' = BOLD .
ENDFORM. "FILL_CELLTry add this code below.
CALL METHOD OF G_EXCEL_APP 'ActiveWorkbook' = G_EXCEL_WORKBOOK.
CALL METHOD OF G_EXCEL_WORKBOOK 'SaveAs' EXPORTING #1 = '1.xls'.
CALL METHOD OF G_EXCEL_WORKBOOK 'Close'.
CALL METHOD OF G_EXCEL_APP 'Quit'.
FREE G_EXCEL_APP.
Maybe you are looking for
-
Tax and Pension deducting is not happing for few months
Hi, My client facing with an issue. The issue is like this........ An employee has taken Maternity leave on November 2007 to May 2008. Here She was getting Maternity pay every month and pension and tax deducting.But when it comes to only for Jan 20
-
Hi, Hoping somebody on here can help before I pull all my hair out. Firstly, I have been having this issue since I moved into a rented house on 20th November 2012. Basically a LOT of noise on the line and a broadband connection of 0.13mb. After going
-
How to disable 'set filter' in alv list display
Hi Friends, I am working on alv report and I came across a requirement that I need to disable the 'set filter' to restrict the user from filtering records in output. please help on this. thanks in advance.
-
Is there any way to reinitialize the profileId after an anonymous profile places order. Basically, I need a different profile Id for every order in case of anonymous user.
-
FM06PF01_POS_ZUSATZDATEN Changed by which package in ECC 6.0
Dear all, Our system upgrades from 4.6C to ECC 6.0, and we have done some customized development for PO Print in 4.6C. After upgrading to ECC 6.0, the PO print doesn't work. Because the customized program uses the include FM06PF01_POS_ZUSATZDATEN, an