Create an XLS file, ZIP it and Email

Hi All,
we have a requirement where in we have to create an XLS file from internal table. This xls file then has to be zipped and mailed.
The problem is we dont have GUI object. We will be executing this in batch.
If anyone knows how to create an xls file and zip it in with out having GUI Component please let us know. It will be of great help. Also please let us know if it possible with out using OPEN, CLOSE DATA SET etc,
Thanks,
Anand

You could try using SAP Desktop Office Integration. Within the interfaces i_oi_document_proxy and i_oi_spreadsheet there is a method save_to _url. With that method you can save your generated excel file to the appserver.
The next challenge is to get the excel file and zip it with the help of class cl_abap_gzip.
The last challenge is to mail the file. The class cl_bcs could be of help to you.
Hope it helps you,
Bert

Similar Messages

  • Creating an XLS file and Zip it

    Hi All,
    we have a requirement where in we have to create an XLS file from internal table. This xls file then has to be zipped and mailed.
    If anyone knows how to create an xls file and zip it in WebDynpro, without using OPEN, CLOSE DATA SET etc, Please let us know. It will be of great help.
    Thanks,
    Anand

    >2) Convert the STRING format to XSTRING format by using the FM SCMS_STRING_TO_XSTRING.
    Actually you should use CL_BCS_CONVERT=>STRING_TO_XSTRING now.
    >3) Use the method COMPRESS_BINARY of class CL_ABAP_GZIP to compress the XSTRING file.
    You probably want to use CL_ABAP_ZIP instead of CL_ABAP_GZIP.  CL_ABAP_GZIP only does compression, which is fine for storing a single packet of data in the database.  However CL_ABAP_ZIP is better suited for mult-part zip (multiple inner files).
    >4) Use the method SEND_WEB_MAIL of class CL_HRRCF_SERVICES_MAIL to mail across the zipped contents.
    This seems to be an HR specific class. Better to use the cross application, NetWeaver provided functionality for sending mail - CL_BCS.

  • How to create a xls file from String [ ][ ]

    Hi, I have a java class where I can read the content of files xls and store this information in a String [][].
    But now, I have to do the opposite.
    I have a String[][] where the information is. And I have to guard this information in a file xls.
    My code when I read xls to String[][] is:
    import java.io.*;
    import java.io.File;
    import jxl.Workbook;
    import jxl.Sheet;
    import jxl.Cell;
    import jxl.*;
    public class ReadfichExcel
        private static int numCols;
        private static int numRows;
    public static String[] dimensionFile(String pathFolder, String file){
        String [] dimension = new String[2];
        try{
            Workbook libro = Workbook.getWorkbook(new File(pathFolder+"/"+file));
            Sheet hoja = libro.getSheet(0);
            numRows = hoja.getRows();
            numCols = hoja.getColumns();
        catch (Exception e)
            e.printStackTrace();
            return null;
        dimension[0] = String.valueOf(numRows);
        dimension[1] = String.valueOf(numCols);
        return dimension;
    }How can I do to create a file xls with the information of a String [] []?
    Thanks very much

    I have solved the problem:
    http://www.andykhan.com/jexcelapi/tutorial.html#writing
    What do you want to do then? Do you want to read the contents of the Excel file into the array?I only wanted to create a xls file with the information I have in a String[][]. The code I posted before is the code I ussually use to read a xls file.
    Next to create and write a xls file I'd do:
    public static int CreateTemp (File folderUser, String file, String [][] table)
        int exito = 0;
        int rows = table.length;
        int cols = table[0].length;          
        if (!folderUser.exists())
            folderUser.mkdir();
        try
            WritableWorkbook libro = Workbook.createWorkbook(new File(folderUser+"/"+file));
            WritableSheet hoja = libro.createSheet("First Sheet",0);
            // BEGIN TO WRITE
            for (int i=0;i<rows;i++)
                for (int j=0; j<cols;j++)
                    Label label = new Label(j, i, table[i][j]);
                    hoja.addCell(label);
            }// FOR
            // All sheets and cells added. Now write out the workbook
            libro.write();
            libro.close();
            exito = 1;
        } catch (Exception e)
                e.printStackTrace();
                return 0;
        return exito;
    }Another question. As I want to copy into the xls file the information in the String[][], Is right to do this using as follow:
    Label label = new Label(j, i, table[i][j]);
    hoja.addCell(label); (there will be characters and numbers in the cells)
    Thanks for your response.

  • I'm so confused!! I just want to create interactive pdf files (with video and flash files), but this free trial version is confusing!! help!?!

    i'm so confused!! I just want to create interactive pdf files (with video and flash files), but this free trial version is confusing!! help!?!

    Thanks for your suggestions. I checked to see if the options you suggested were set incorrectly but they were set to sync all. This led me to think the problem was actually in the iphone. I re-initialized the iphone and did not allow the system to restore any of the previous settings. In essence, I forced the phone to reset to factory settings. Then my video podcasts started syncing. All is well now. I did notice that I had seven podcasts selected that were "HD" presentations, and as such, are not compatible with the iphone. I don't know if this had anything to do with my earlier situation, but now I'm getting the video podcasts automatically. I'm happy. It wasn't much fun forcing the iphone to forget all of my preferences and I'm still customizing the phone now several days later. I think I have everything working and back to normal except I haven't identified any of my email accounts as of yet. Thanks for your help.

  • How Do I create Windows Form file in VS and add the form to my VS project?

    C#, How Do I create Windows Form file in VS and add the form file to my VS project by using C# code?
    I like to create a Windows Form file into my VS Win Form project by using C#. I have the path and the file name.
    I need a Win Form with FileName.cs, FileName.Designer.cs, FileName.resx, and FileName (as you see it VS by adding a Win Form manually by using VS)
    Rune Brattas

    You cannot create a Form from code at run time. 
    For one thing, the user running your application will, almost certainly, not have  a copy of Visual Studio to hand with which to build anything.  (Not that you actually need 'Studio at all; Notepad and csc.exe are all you actually
    need), but that's another story).
    You can do this with an awful lot of pain, using the innards of the compiler from iside your own program, compiling the new Form's source code on the fly and then executing the resulting assembly within your application.  IMHO, that's a simply terrifying
    prospect especially as the code you will be compiling will be on someone else's machine and over which you will have absolutely no control.  If you're lucky, they'll spell something wrong and it won't compile.
    The "usual" way to do this sort of thing is to create additional, "plug-in" forms as library assemblies and have your program load and execute these at run-time. 
    Regards, Phill W.

  • I created a PDF file from InDesign and the printing company wants me to convert to curves...

    ... I don't have Illustrator, so I don't see how I can convert the file to curves and I really don't understand why I should have to. The file prints fine from my printer and when they proofed in on their printer there were no errors. So, why would they want me change it to an Illustrator file and convert to curves? This seems like the technology is going backwards instead of forward to me. Does anybody have any answers besides telling me to buy Illustrator (or subscribe to it) or telling me to recreate the document (which I don't have time to do? Thanks.
    JB

    You should never convert font to outlines in InDesign, because:
    You loose automatic numbers and bullets,
    you loose paragraph rules,
    you loose underline and strikethroug
    you loose automatic follow up numbers
    you loose text frames stroke and color.
    Outlining is not possible with objects from the master without overriding, overiding will change the result in many cases, outlining on the master will either delete text or outline placeholders.
    Outlining will be a huge problem with threads as you cannot outline the whole thread in one single step.
    Peters method will not work without problems as such a preset had to be created in CS4 or earlier, it will not work with CS5 or later.
    The only working method is to educate your printer.
    Ask him why he wants to outline the text? How does he open your PDF? The only program he is allowed to open it is Acrobat or Reader.

  • How to create an exe file using labview and arduino?

    I bought Arduino Mega 2560. I have installed Arduino IDE 1.7.3. I am using Windows 7 64bit version and Labview 2012. I started working after the compilation of LIFA_Base File with Arduino IDE and with labview.
    My application is: I have connected my arduino to my PC via USB for read input/output pins. I have to read all the time an analogue input from arduino and I have to draw the graphical representation of the input. I would like to know if I can create an exe file of this application. I would like to use the created exe file to another PC without labview installation. 
    Please help me to resolve the problem.
    Regards

    Yup you sure can.  With Application Builder, that is bundled with several LabVIEW packages you can make an EXE, and then make an installer that can include the LabVIEW Run-Time engine (free) and you'll also need the VISA run-time for talking to serial devices like your Arduino.
    Then you should be able to run that installer on any normal Windows PC and without the development environment be able to run your program.
    Note that currently Student, and Home versions of LabVIEW do not have the application builder since it is intended for learning, and hobbyist, not for distributions.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • Applet failed to open xls file with Firefox and Office 2010 installed (o.s: Windows 7). It works with Office 2007.

    I load a signed applet in a web application.
    The applet open a xls file when I press the finalize button.
    It works correctly in Firefox, IE, Chrome and Safari. I have installed Office 2007.
    But when I test it in a new pc with Office 2010 installed, it does not work in Firefox browser (it works in IE, Chrome and Safari)
    This is the console java error:
    java.io.FileNotFoundException: my_file.xls (Access is denied)
    The plugin for Microsoft Office 2010 is installed.
    Java Plug-in is 1.6.0_27.
    Firefox version: 3.6 and latest version: 7
    O.S.: Windows 7
    I search in Bugzilla but not found anything about this.
    I test it with Firefox Beta - Aurora and the behaviour is the same.
    Is there any bug for Office 2010 in Mozilla Firefox?
    Any suggestion?

    Rectify the post:
    It works with Firefox 3.6, but it does not work with Firefox 7.
    Is there any bug in Firefox 7 with excel?

  • Why the files my program create are created twice each file double ? And why sometimes the files size are too small ?

    My program is using Queue of type Uri to create Queue of urls and then i'm using webbrowser to navigate each Uri from the Queue in it's turn and get the url(html) source content and save it to the hard disk.
    The problem is sometimes the text files on the hard disk are small like 90KB or 60KB and sometimes they are as they are suppose to be 300KB or 200KB.
    This is a button click event where i'm calling two methods:
    private void toolStripButton3_Click(object sender, EventArgs e)
    GetHtmls();
    CheckQueue();
    This is the GetHtmls method code:
    private Queue<Uri> myUrls = new Queue<Uri>();
    private bool isBusy = false;
    private void GetHtmls()
    for (int i = 1; i < 49; i++)
    adrBarTextBox.Text = sourceUrl + i;
    targetHtmls = (combinedHtmlsDir + "\\Html" + i + ".txt");
    Uri targetUri = new Uri(sourceUrl + i);
    myUrls.Enqueue(targetUri);
    sourceUrl contain website address: http://www.tapuz.co.il/forums2008/forumpage.aspx?forumid=393&pagenumber=
    And i'm adding to it the numbers and create the pages.
    And add them to the Queue.
    THen the CheckQueue method:
    Uri uri;
    private void CheckQueue()
    if (isBusy)
    return; // We're downloading some page right now, don't disturb
    isBusy = true; // OK, let's get started
    if (myUrls.Count == 0) // No more pages to download, we're done
    isBusy = false;
    return;
    uri = myUrls.Dequeue(); // Get one URL from queue
    getCurrentBrowser().Navigate(uri);
    It suppose to Navigate to each Uri(html address) in the Queue.
    And the browser document completed event:
    private void Form1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    // If page loaded completly then do something
    int urlnumber = uri.ToString().IndexOf("pagenumber=");
    string number = uri.ToString().Substring(urlnumber + 11);
    int num = Int32.Parse(number);
    targetHtmls = (combinedHtmlsDir + "\\Html" + num + ".txt");
    StreamWriter writer = File.CreateText(targetHtmls);
    writer.Write(getCurrentBrowser().DocumentText);
    writer.Close();
    isBusy = false; // We're done
    CheckQueue(); // Check next page in queue
    In the completed event i'm getting the page number and build the string for the text file then write the html source content to the text file.
    In the end i have on my hard disk 48 text files.
    The problems are:
    1. Sometimes it seems like it's not finishing navigating to the current uri or maybe some other reason maybe server side problem and creating small size files with source content inside but not all the source content. Sometimes the text files size are each
    file 99KB or 70KB and sometimes the size of them are about 300KB and 200KB and this is the right sizes 300KB 200KB.
    2. The text files on my hard disk suppose to be 48 different files each file should contain the source if the html page of the 48 pages. But on my hard disk the 48 text files are duplicated for some reason.
    This is the file on my hard disk:
    Some of the files are 205KB 350KB 175KB and some of the files sizes are 85KB 94KB 35KB 
    Why some of the files it didn't navigated to the end or maybe didn't got all the source ?
    And why it's making each second file the same like the one before ? It suppose to create 48 different files but i'm getting two identical files each navigation.

    I solved it now.
    This is what i did:
    It's a bit slow process since i'm waiting for each page to be loaded into the webbrowser but it does the work.
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Collections;
    using System.IO;
    using System.Net;
    namespace WindowsFormsApplication1
    public partial class Form1 : Form
    private string sourceUrl = "http://test.test";
    private string htmlsTargetDirectory = "Test Htmls";
    private string appDir = Path.GetDirectoryName(@"C:\Users\chocolade1972\AppData\Local\Test_Images\Test Images\Test Htmls");
    private string combinedHtmlsDir;
    private String targetHtmls;
    private int counter = 1;
    private StreamWriter w;
    private string uri;
    private bool htmlloaded = false;
    public Form1()
    InitializeComponent();
    webBrowser1.ScriptErrorsSuppressed = true;
    combinedHtmlsDir = Path.Combine(appDir, htmlsTargetDirectory);
    if (!Directory.Exists(combinedHtmlsDir))
    Directory.CreateDirectory(combinedHtmlsDir);
    private void Form1_Load(object sender, EventArgs e)
    GetHtmls();
    timer1.Enabled = true;
    private void GetHtmls()
    uri = sourceUrl + counter;
    targetHtmls = (combinedHtmlsDir + "\\Html" + counter + ".txt");
    webBrowser1.Navigate(uri);
    private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
    if (e.Url.ToString() == uri)
    targetHtmls = (combinedHtmlsDir + "\\Html" + counter + ".txt");
    htmlloaded = true;
    StreamWriter writer = File.CreateText(targetHtmls);
    writer.Write(webBrowser1.DocumentText);
    writer.Close();
    FileInfo fi = new FileInfo(targetHtmls);
    var size = fi.Length;
    w = new StreamWriter(combinedHtmlsDir + "\\test.txt", true);
    w.WriteLine("File Size " + size);
    w.Close();
    private void timer1_Tick(object sender, EventArgs e)
    if (htmlloaded == true)
    uri = sourceUrl + counter;
    myurls.Add(uri);
    webBrowser1.Navigate(uri);
    htmlloaded = false;
    counter += 1;

  • How to write LOGO(SE78 CREATE) TO XLS FILE(USING OLE2 METHOD!

    HI
    FYI!
    i put a logo into sap!
    and i will download this logo into XLS file !
    how to do it!
    please give some demo code!
    thank you very much!

    Hi,
    Do you know the Bapi for qp02 .I am working on uploading changing inspection plan using bdc .I am only updating last screen details like Decimals and measurement and lower value and high value .
    I saw your post in sdn before 3 month .I think you have solution . Can you please give suggestion to me .
    How can we prepare flat file .
    Regards
    Nandan.

  • Create a text file in KM and add the structure of a node

    Hello Everybody,
    could some one please advise on how do I write the data stored in my node (elements) as string into a text file? How can i create a text file and add the structure of my node to it? I can just walk through my node recursively.
    Any help would be highly appreciated.
    Thanks in advance.
    Regards,
    Seed

    Are you referring to a org.w3c.dom.Node?
    In that case, the simplest approach would be to use KM's XML serializer (http://help.sap.com/javadocs/NW04s/current/km/com/sapportals/wcm/util/xml/SimpleSerializer.html)
    BR, Julian

  • How do you create a jar file with txt and classes?

    Hey, I'm trying to create code to create a jar file with a text file, but I can't figure out how to add the text file. Here is what I have so far:
    try {
                // Name of jar file to write
                String archiveFile = "test.jar";
                Manifest jman = new Manifest();
                try {
                    // Create a manifest from a file
                    //InputStream fis = new FileInputStream("manifestfile");
                    //Manifest manifest = new Manifest(fis);
                    // Construct a string version of a manifest
                    StringBuffer sbuf = new StringBuffer();
                    sbuf.append("Manifest-Version: 1.0\n");
                    sbuf.append("Ant-Version: Apache Ant 1.7.1\n");
                    sbuf.append("Created-By: 1.5.0_19-137 (Apple Inc.)\n");
                    sbuf.append("Main-Class: Main\n");
                    sbuf.append("Class-Path: lib/swing-layout-1.0.3.jar\n");
                    sbuf.append("X-COMMENT: Main-Class will be added automatically by build\n");
                    // Convert the string to a input stream
                    InputStream is = new ByteArrayInputStream(sbuf.toString().getBytes("UTF-8"));
                    // Create the manifest
                    jman = new Manifest(is);
                } catch (IOException e) {
                FileOutputStream stream = new FileOutputStream(archiveFile, true);// archive file is jar file name
                JarOutputStream out = new JarOutputStream(stream, jman);
                out.putNextEntry(new JarEntry("test.txt"));
                out.closeEntry();
                out.close();
            } catch (Exception ex) {
            }It creates the .jar file with the correct manifest but I can't get it to write the test.txt or anything else into the jar file.
    -Gandolf
    Edited by: GanMatt on Jun 18, 2009 8:18 AM
    Edited by: GanMatt on Jun 18, 2009 8:19 AM

    Alright, my question has changed. Here's the code:
    try {
                // Name of jar file to write
                String archiveFile = "test.jar";
                Manifest jman = new Manifest();
                try {
                    // Create a manifest from a file
                    //InputStream fis = new FileInputStream("manifestfile");
                    //Manifest manifest = new Manifest(fis);
                    // Construct a string version of a manifest
                    StringBuffer sbuf = new StringBuffer();
                    sbuf.append("Manifest-Version: 1.0\n");
                    sbuf.append("Ant-Version: Apache Ant 1.7.1\n");
                    sbuf.append("Created-By: 1.5.0_19-137 (Apple Inc.)\n");
                    sbuf.append("Main-Class: Main\n");
                    sbuf.append("Class-Path: lib/swing-layout-1.0.3.jar\n");
                    sbuf.append("X-COMMENT: Main-Class will be added automatically by build\n");
                    // Convert the string to a input stream
                    InputStream is = new ByteArrayInputStream(sbuf.toString().getBytes("UTF-8"));
                    // Create the manifest
                    jman = new Manifest(is);
                } catch (IOException e) {
                FileOutputStream stream = new FileOutputStream(archiveFile, true);// archive file is jar file name
                JarOutputStream out = new JarOutputStream(stream, jman);
                out.putNextEntry(new JarEntry("test.txt"));
                out.write("Hi".getBytes());
                out.flush();
                out.closeEntry();
                out.close();
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this,ex.toString(),"BUG!",JOptionPane.INFORMATION_MESSAGE);
            }It creates the jar file with the txt file inside it, but I can't write "Hi" inside of the text file. Any ideas?
    -Gandolf

  • ALV report output to excel file, zip it and send to email

    my requirement is to run a report then the result will be sent to email. Attachment is an excel file that is zipped since file size is about 25MB
    I've search several forums and found a sap template in sending email with excel file attachment, it is BCS_EXAMPLE_7
    but it should be zipped, what i found is this CL_ABAP_ZIP, but with my understanding, the file needs to be in PDF format to be able to zip
    has anyone had the same requirement before?
    Would be thankful to your input guys, thanks!

    any ideas guys?

  • Can I create an ipd file? I have email info on desktop and would like to copy (restore) it to my BB Curve

    Hello:
    My wife recently had her data erased by Rogers in an effort to fix a problem with her BB Curve.
    Unfortunately we don't have a backup of the email info, but we do have a Gmail account on her laptop.
    Is it possible to copy/transfer the laptop into to the BB? Seems all the BB is looking for is an .ipd file.
    Thanks to all who might be able to help.
    Doug

    Hi DCMinNS,
    Welcome to the BlackBerry Support Community.
    Sorry to hear about your wife's missing data.
    Any information that isn't already contained in a backup file will not be able to be imported into a backup. Are you trying to add contact and calendar information from the Gmail account? If so, what you can do is to add the account to Email Setup and enable contact and calendar synchronization. 
    The following KB articles may be helpful with this.
    "What is calendar synchronization with Gmail?" http://bbry.lv/Hv63Rt
    ""What is Google Mail contact synchronization" http://bbry.lv/NA07IK
    If you do happen to have any backup files containing any of her missing data, you can restore it from the backup file by following the steps in this article. "How to use BlackBerry Desktop Software to restore data to a BlackBerry smartphone from a backup file" http://bbry.lv/GHOzQA
    Let me know if you need any further help with this.
    -FS
    Come follow your BlackBerry Technical Team on Twitter! @BlackBerryHelp
    Be sure to click Kudos! for those who have helped you.
    Click Solution? for posts that have solved your issue(s)!

  • I have created a .m4v file from iPhoto and would like to share it with someone else knowing that the file is quiet large (86 Mo), i used to share file with mobileme, how Can I do that with iCloud ? or another way....

    In iphoto, I have create a diaporama which I exported to itunes as a m4v file. I would like to share this file with someone but it is too big to send it via email (84 Mo). This file is now in my films in itunes. Is there a way to share it via icloud.
    I used to share files using mobileme which I cannot use anymore.
    Thanks for your help,
    Eric

    How recently did you switch?  If it's less than 60 days, then Verizon simply reinstates your previous account.  The fact that you were on the EDGE plan and mailed the devices back, and they apparently are somewhere in the system, could cause complications, and it might just work out that you just go back on the same plan and they set you up with the same devices.  I'm not sure how it will go - but since you are still being billed for the devices... 

Maybe you are looking for

  • AZR (Access Zone Router) in SSG

    My customer wants to run the AZR in the SSG router itself. Is it possible ? Anyone running a system with AZRs to give me more design details ? The auth used is EAP-SIM. Tks

  • Codebase run RMI server .NoClassDefFoundError:

    If I run the folllowing from the solaris command line java -cp /junk/jdev+/jdev/src -Djava.rmi.server.logCalls=true -Djava.rmi.server.codebase=file:////junk/jdev+/jdev/src/ -Djava.security.policy=/junk/jdev+/jdev/src/jdev/server/policy jdev.server.RM

  • Xperia Z2 screen flickers white color white screen is on after receiving notification

    I would like to bring to your notice that i bought new xperia z2 on 14 june 2015, the next day onwards i faced display problem ( screen flickers), i recorded that as evidence and submitted for DOA request after many follow ups i got approval. Yesterd

  • Digitizer tablet for Whiteboarding in Adobe Connect

    Hello, We have a number of users at my company who are interested in a stylus/tablet for use with the whiteboard features in connect, apparently they have tried the bamboo on their own and they were less than thrilled with the performance. Was wonder

  • G/L a/c Balance

    Is there any Fm to get G/L A/c balance for the credentials below Company code : G/L A/c No : date  :