Passing data to excel file and sending as mail

Hello Everyone,
I am using FM SO_NEW_DOCUMENT_ATT_SEND_API1 to send an excel file as an attachment to a mail id.
But the issue is i have 4 fields in excel vendor, material, material descp and PO number.
The vendor field is of char 10 i need to show all the leading zeros in the excel file.
I.e  now i am getting vendor as 88058 in the excel file but i need to show it as 0000088058.
If anyone has come across such issue please provide some solution to it.
Thanks & Regards,
Ravi Aswani

Hi,
This is the code snippet I have used to generate the test file.
REPORT  ztest_download.
TYPES: BEGIN OF ty_data,      
vbeln TYPE vbeln,      
amt   TYPE dmbtr,      
long  TYPE char30,      
text  TYPE char20,      
END   OF ty_data.
DATA: it_data TYPE STANDARD TABLE OF ty_data,      wa_data TYPE ty_data.
START-OF-SELECTION.
  DO 5 TIMES.    wa_data-vbeln = sy-index.   
UNPACK wa_data-vbeln TO wa_data-vbeln.   
wa_data-amt   = '12345.67' * sy-index.   
wa_data-long  = '12345678901234567890'.   
wa_data-text  = sy-abcde.   
APPEND wa_data TO it_data.   
CLEAR  wa_data. 
ENDDO.
DATA: l_file TYPE string.
here we will pass the .txt instead of the .xls*
l_file = 'C:\temp\test_data.txt'.
In the Filetype, we still pass the DAT because we want* our output in the tabular format. 
CALL FUNCTION 'GUI_DOWNLOAD'   
EXPORTING    
filename                = l_file     
filetype                = 'DAT'  
TABLES     
data_tab                = it_data   
EXCEPTIONS     
file_write_error        = 1     
no_batch                = 2     
gui_refuse_filetransfer = 3     
invalid_type            = 4    
no_authority            = 5     
unknown_error           = 6     
header_not_allowed      = 7    
separator_not_allowed   = 8     
filesize_not_allowed    = 9     
header_too_long         = 10     
dp_error_create         = 11     
dp_error_send           = 12     
dp_error_write          = 13     
unknown_dp_error        = 14     
access_denied           = 15     
dp_out_of_memory        = 16     
disk_full               = 17     
dp_timeout              = 18     
file_not_found          = 19     
dataprovider_exception  = 20     
control_flush_error     = 21.
Moderator message: copy/paste without credit, do not repeat!
http://www.google.com/search?hl=en&q=%22ThisisthecodesnippetIhaveusedtogeneratethetestfile%22
Edited by: Thomas Zloch on Oct 15, 2010 4:27 PM

Similar Messages

  • How to read the data from Excel file and Store in XML file using java

    Hi All,
    I got a problem with Excel file.
    My problem is how to read the data from Excel file and Store in XML file using java excel api.
    For getting the data from Excel file what are all the steps i need to follow to get the correct result.
    Any body can send me the code (with java code ,Excel sheet) to this mail id : [email protected]
    Thanks & Regards,
    Sreenu,
    [email protected],
    india,

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • How to send other language data into excel file in attachment thru mail

    Hi - ,
    I have to send other language data (russian) into excel file and send as an attachment through e-mail.
    I had used F.M SO_NEW_DOCUMENT_ATT_SEND_API1 to send email.
    In internal table , it is in correct format, but when using SO_NEW_DOCUMENT_ATT_SEND_API1, the excel file sent has junk characters in it.
    Can u please help me on this?
    Thanks,
    Gyanaraj

    Hi ,
    Can anyone help me on this.
    Thanks,
    Gyanaraj

  • Attaching HTML file and sending through mail

    Hi
    My Requirement is
    I want to attach HTML File and send through mail id's.
    But there are number of html files
    user can select any  one file.
    it has to attach and send to the mail id.

    Hi V,
    check the link:
    http://wiki.sdn.sap.com/wiki/display/Snippets/SendEmailwithHTMLattachment.

  • Read data from Excel file and diaplay in Webdynpro

    Hi all,
    I need some help. I have a Excel file with set of  name, phonenumbers . I want to know how to display the data using Webdynpro. Could some one help me. help is appreciated and I promise to award points for right answer.
    Thank you
    Maruti

    <b>Hi
    i can explain you to read data from Excel file
    First You have to download the jxl.jar file. You can get this file from the Below site
    </b><a href="http://www.andykhan.com/jexcelapi/download.html">jexcelapi jar</a>
    It will be in Compressed Fromat So Unzip it to get the Contents
    After Unzipping The File You will get a Folder (jexcelapi/jxl.jar)
    Now in NWDS open web dynpro explorer, Right Click Your Project, a popup menu will appear and in that click Properties
    You will get window displaying your Project Properties
    On Left Side of the window You Will Find "Java Build Path"
    Click That "Java Build Path" and you will get 4 Tabs Showing ( Source,Projects,Libraries,Order and Export)
    Click Libraries Tab
    You will find options many options buttons
    In that click the Button "Add External Jars"
    You will get Window in order to fecth the jxl.jar file from the location you had stored
    After selecting the jxl.jar i will get displayed and click ok
    Now Open Navigator
    Open Your Project
    You will find Lib folder
    Copy the jxl.jar to that lib folder
    Note : You cannot Read the Content from the excel file directly
    First You Have to copy that file to the Server,
    And from the Server you can get the file absolute path
    With the absolute path you can read the contents of the Excel file
    You have to save the Excel file as .xls Format and Not as xlsx format i will not accept that...
    You have Upload the Excel file from the Server Using the File Upload UI Element
    This Coding will extract 3 columns from the Xls File
    Coding
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import jxl.Cell;
    import jxl.Sheet;
    import jxl.Workbook;
    import com.sap.fileupload.wdp.IPrivateFileUpload_View;
    import com.sap.tc.webdynpro.services.sal.datatransport.api.IWDResource;
    public void onActionUpload_File(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUpload_File(ServerEvent)
        IPrivateFileUpload_View.IContextElement element1 = wdContext.currentContextElement();
        IWDResource resource = element1.getFileResource();
        element1.setFileName(resource.getResourceName());
        element1.setFileExtension(resource.getResourceType().getFileExtension());
        //@@end
    public void onActionUpload_File_in_Server(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUpload_File_in_Server(ServerEvent)
        InputStream text=null;
        int temp=0;
        try
             File file = new File(wdContext.currentContextElement().getFileResource().getResourceName().toString());
             FileOutputStream op = new FileOutputStream(file);
             if(wdContext.currentContextElement().getFileResource()!=null)
                  text=wdContext.currentContextElement().getFileResource().read(false);
                  while((temp=text.read())!=-1)
                       op.write(temp);                                      
             op.flush();
             op.close();
             path = file.getAbsolutePath();
             wdComponentAPI.getMessageManager().reportSuccess(path);
        catch(Exception e)
             e.printStackTrace();
        //@@end
    public void onActionUpload_Data_into_Table(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionUpload_Data_into_Table(ServerEvent)
        try
              Workbook wb =Workbook.getWorkbook(new File(path));
              Sheet sh = wb.getSheet(0);
              //wdComponentAPI.getMessageManager().reportSuccess("Columns = "+sh.getColumns());
              //wdComponentAPI.getMessageManager().reportSuccess("Rows = "+sh.getRows());
              int columns = sh.getColumns();
              int rows = sh.getRows();
              int i=0;
             for(int j=1;j<=rows;j++)
                       ele=wdContext.nodeTable_Data().createTable_DataElement();
                       Cell c1 = sh.getCell(i,j);
                      ele.setTab_Name(c1.getContents());
                       Cell c2 = sh.getCell(i+1,j);
                       ele.setTab_Degree(c2.getContents());
                          Cell c3 = sh.getCell(i+2,j);
                       ele.setTab_Percentage(c3.getContents());
                       wdContext.nodeTable_Data().addElement(ele);
        catch(Exception ex)
             wdComponentAPI.getMessageManager().reportSuccess(ex.toString());
        //@@end
       * The following code section can be used for any Java code that is
       * not to be visible to other controllers/views or that contains constructs
       * currently not supported directly by Web Dynpro (such as inner classes or
       * member variables etc.). </p>
       * Note: The content of this section is in no way managed/controlled
       * by the Web Dynpro Designtime or the Web Dynpro Runtime.
      //@@begin others
      String path;
      IPrivateFileUpload_View.ITable_DataElement ele;
    //@@end
    Regards
    Chandran S

  • What is the best way to read and manipulate large data in excel files and show them in Sharepoint

    Hi ,
    I have a large excel file that has 700,000 records in it. The excel file has a few columns that change every day.
    What is the best way to read the data form the excel file in fastest and most efficient way.
    2 nd Problem,
    I have one excel file that has many rows each row contain some data that has certain keywords.
    What I want is  to segregate the data of rows into respective sheets(tabs ) in the workbook.
    for example in rows have following data 
    1. Alfa
    2beta
    3 gama
    4beta
    5gama
    6gama
    7alfa
    in excel
    I want there to be 3 tabs now with each of the key words alfa beta and gamma.

    Hi,
    I don't really see any better options for SharePoint. SharePoint use other production called 'Office Web App' to allow users to view/edit Microsoft Office documents (word, excel etc.). But the web version of excel doesn't support that much records as well
    as there's size limitations (probably the default max size is 10MB).
    Regarding second problem, I think you need some custom solutions (like a SharePoint timer job/webpart ) to read and present data.
    However, if you can reduce the excel file records to something near 16k (which is supported rows in web version of excel) then you can use SharePoint Excel service to refresh data automatically in the excel file in SharePoint from some external sources.
    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com

  • How to read the data from excel file and store into the table?

    Hi All,
    I have table with BLOB datatype contains a excel file. I have to read that data from excel and store into one table with all the fields in excel.
    All the excel fields and my table columns are same.
    Can you share with me how can acheive this using LOB's?
    Thanks

    Hi OraSuirya,
    you can try with external tables .
    syntax as follows
    create table ext_table_csv (
    i Number,
    n Varchar2(20),
    m Varchar2(20)
    organization external (
    type oracle_loader
    default directory ext_dir
    access parameters (
    records delimited by newline
    fields terminated by ','
    missing field values are null
    location ('file.csv')
    reject limit unlimited;
    For this you need to create directory
    Directory Creation syntax:
    create or replace directory ext_dir as 'D:\oracle\user_dir\ext_dir';
    grant read, write on directory ext_dir to <User>;
    please paste the excel file in the particular directory .
    I hope this will help you.
    Please correct me if I am wrong anywhere .
    Thanks,
    Tippu.

  • It is possible to get data from Excel file and put them in BusinessObject Entreprise?

    Hi everybody,
    How i can get the information (data table) from a excel file?
    I just want to open a file excel in BusinessObject Entreprise XI. It is possible?
    Thanks

    What is BI launch pad?
    BI platform includes BI launch pad, a web application that acts as a window to business information
    about your company. In BI launch pad, you can perform the following tasks:
    • Access Crystal reports, Web Intelligence documents, and other objects and organize them to suit
    your needs
    • View information in a web browser, export it to other business applications (such as Microsoft Excel
    and SAP StreamWork), and save it to a specified location
    9 2012-03-14
    Getting Started
    • Use analytic tools to explore the business information in detail
    The features of BI launch pad vary by content type, and various applications are available in BI launch
    pad, if you have the appropriate licenses. For information about the features in your BI platform
    deployment, contact your system administrator.
    plz download this file and u can get you answer
    http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CCMQFjAA&url=http%3A%2F%2Fhelp.sap.…

  • Regarding getting data from excel file and need to generate  inbound idoc

    Hi guys,
    Please can u give some example how to get excel file data and need to generate the inbound idoc my questation ? Is it possible to generate inbound idoc with the same logical system ( it seems to be not possible using same logic to generate idoc ) can u suggest me any posssibule way to generate idoc.) if possible give me some example.
    Regardng
    anil
    Edited by: anil kumar on Aug 8, 2008 1:35 PM

    If you want someone to do your work, please have the courtesy to provide payment.
    http://www.rentacoder.com

  • How to read an Excel File AND SEND TO GENERATOR

    Hi 
    I want send the datas from Exel file to my device, I have one part in mu code which can read my data from exel but I don t know how can I send this data to ny divice?
    I  really nead your suggestion, please.
    I attached my code also my Exel file.
    Attachments:
    DG5071.xlsx ‏1841 KB
    Rigol Generator.vi ‏52 KB

    Hello vsa,
    I checked the specifications of this Function Arbitrary Waveform Generator and I found that it is GPIB complaint. Instruments with GPIB protocol can be controlled using GPIB commands, but each instrument could have different GPIB commands. Despite this, most providers have "standard" commands among its products.
    I checked some documentation and found a help file that describes the GPIB commands used by this device, so the options are:
    1. Wait for someone to develop an Instrument Driver for this instrument.
    2. Check if you find any other Function Arbitrary Waveform Generator of the same brand that uses the same commands and for which there is already an instrument driver.
    3. Create your own instrument driver.
    If you choose option 3 I share with you the following links that you may find useful:
    Developing LabVIEW Plug and Play Instrument Drivers:
    http://www.ni.com/white-paper/3271/en/
    Connecting Instruments via GPIB:
    http://www.ni.com/getting-started/set-up-hardware/instrument-control/gpib-connect
    GPIB Instrument Control Tutorial:
    http://www.ni.com/white-paper/2761/en/
    Using IVI Drivers in LabVIEW:
    http://www.ni.com/white-paper/4556/en/
    Instrument Control in LabVIEW Tutorial:
    http://www.ni.com/white-paper/3511/en/
    Best regards.
    David P.
    National Instruments
    Applications Engineer
    www.ni.com/soporte
    Attachments:
    DG5000 Programming Guide.zip ‏907 KB

  • How to get data from pdf file and send contents  of the pdf file to R/3

    Hi, experts,
    Action:
    1. Make a pdf forms (interactive form) with inputfield named “A_inputfield” in the webdynpro application and run the webdynpro application.
    2. In the IE, click the save button in the pdf interactive form and save the pdf to local disk,ex: C disk. Close the IE browser.
    3. Open the pdf interactive form from the local C disk and type "aaa" to the “A_inputfield”.
    4. I want to save the "aaa" to the R/3 system using webdynpro or using other tools . How can I do it?
    First way:
    If I use webdynpro application to save the content of the pdf, I don't find a way mapping or binding the content to a context of a view. So I don't think this way is unadvisable.
    Second way:
    Adding a button "submit" in the pdf forms when create the pdf form. Runing the webdynpro application, save the pdf to local disk,ex: C disk.  Opening the pdf interactive form from the local c disk and typing "aaa" to the “A_inputfield”, click the  "submit" button to save the content. Of course, I need to finish the code for clicking "submit" button. But I don't know how  to write these codes and where to write these codes. Do you give me some advise ?
    Best regards,
    tao

    Hi, Abhimanyu L,
    Thanks a lot for your help. Your answer can give me large developmental.:)
    I find http://help.sap.com/saphelp_erp2005/helpdata/en/67/fae9421dd80121e10000000a155106/content through searching google for CL_WD_ADOBE_SERVICES class. But I don't find any exmples for the class. Do you give me some hint for some exmples for the class?
    Best regards,
    tao
    (You can reply back to me via e-mail if you think we should discuss this internally at [email protected] or [email protected])

  • Attaching Text file and sending mail

    Hi all,
              I am trying to attach a text file (ASCII file) and send using mail.
              I am not able to get proper data in attachement.Can anyone suggest me which type should i use
              to get the data in proper format.
              i was using RAW file. I found we dont have specific Text format.
             Its possible for XLS format, i need only text file to be attached.
    Thanks,
    Rajesh
    Edited by: rajesh pattnaik on Apr 16, 2009 3:03 PM

    Hi,
    After bringing your final alv data in the final internal table,
    go through this link , i also had an same requirement to send data after converting to excel file and
    send it as an attachment to mail id outside Sap,
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/to%252bsend%252b2%252bint%252btables%252bdata%252bas%252btwo%252battachments%252bto%252bmail%252bid%252boutside%252bsap%252bsystem
    I did this object and it was working fine using that function module.
    Hope it helps
    Regrds
    Mansi

  • How to convert SAPScript data to Excel file

    Hi Experts,
    Curenntly I am converting SAP Script data to PDF file and send an e-mail with attachment (PDF file).
    Same like this, is that possible to covert thda Script data to Excel file to send mail with attachment.???
    If, yes please sugget with respective Function Modules.
    Thanks In Advance.
    Best Regards.

    Hi,
    Thanks for response, Here providing more inforamation.
    Presently my report displaying Customer information. As per user requirement, coverting the Script data to PDF by using
    CALL FUNCTION 'CONVERT_OTF_MEMORY'
              EXPORTING
                format                = 'PDF'
                max_linewidth         = 132
              IMPORTING
                bin_filesize          = doc_size
              TABLES
                lines                 = htline.
    Now user want to add two radiobuttons on selection screen for PSF file & Excel file
    If user seleacts Excel fiel radio button, then I need to covert the SAP Script data to Excel file lik I have done for PDF.
    I'd like to know is that possible covert the Script data to Excel file. If yes, suggest with FMs or process.
    Best Regards.

  • Create a visual web part which get data from excel sheet and import it into sql server database in sharepoint 2010 (development)

    Hi,
    I want to create a visual webpart which will read data from excel sheet and import it in to sql server database.(using sharepoint development)
    I want to do it using visual webpart.
    Please help to solve the issue.
    Thanks in advance!
    Regards
    Rajni

    Hi  Rajni,
    Microsoft.Office.Interop.Excel assembly provides class to read excel file data, in your web part solution, reference the assembly, and following blog contains samples about how to read the excel file data,
    and import it to SQL  database.
    1.Create a Visual Web Part Project:Create
    Visual Web Parts in SharePoint 2010
    2.Read the excel workbook by using SPFile class:
    http://alancejacob.blogspot.in/2012/06/read-data-from-excel-file-and-insert-in.html
    http://stackoverflow.com/questions/14496608/read-excel-file-stored-in-sharepoint-document-library
    3.Export the excel workbook to SQL Server:
    http://www.c-sharpcorner.com/UploadFile/99bb20/import-excel-data-to-sql-server-in-Asp-Net/
    Best Regards,
    Eric
    Eric Tao
    TechNet Community Support

  • Import data from excel file - best practice in the CQ?

    Hi,
    I have question related to importing data from excel file and creates from those data a table in the CQ page. Is inside CQ some OOTB component which provides this kind of functionalities? Maybe somebody implement this kind of functionality or there is best practice to do this kind of functionalities?
    Thanks in advance for any answer,
    Regards
    kasq

    You can check a working example package [1] (use your Adobe ID to log in)
    After installing it, go to [2] for immediate example.
    Unfortunately it only supports the old OLE-2 Excel format (.xls and not .xlsx)
    [1] - http://dev.day.com/content/packageshare/packages/public/day/cq540/demo/xlstable.html
    [2] - http://localhost:4502/cf#/content/geometrixx/en/company/news/pressreleases/my_personal_bes ts.html

Maybe you are looking for