How to export data from webdynpro to Excel and start a Excel macro

Hello All
I want to export data displayed in the Web dynpro ALV into Excel. I have tried the ALV export function but my problem with it is when it does export to excel the data loses formatting and I have long text in columns which display with wrapping in ALV but when exported to excel it loses formatting.
So I want to define a custom button and when user presses on this button the excel export is called with a macro. Can you kindly share ideas how I can do this from a webdynpro.
Thanks
Karen

Hi friends!
I have followed the following:
http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417300)ID1487994050DB10407586481486749551End?blog=/pub/wlg/5522
...in order to create standard ALV with Export to Excel.
However what is exported into excel is awful. It does not contain my data in nice columns... Instead it shows a lot of meta-data.
Please let me know what to do to kick the standard Export button in the correct direction.. that is...to have my nice table in same way in Excel, because that is my intention with "Export to excel"
Best reg
Henrik

Similar Messages

  • How to Export data from webdynpro using Jecxcel

    Hi ,
    Can anyone help me how to export data from web dynpro using Jexcel. kindly send me the related links.
    Thanks

    Hi Sandeep,
    Have you refered in the blogs?
    U can find may more document related to this.the below blog helps u in
    Exporting Data from Web Dynpro in Different Formats Using Open Source (POI, JExcel, iText) APIu2019s.
    https://www.sdn.sap.com/irj/sdn/index?rid=/library/uuid/b030e7fb-2662-2b10-0dab-c4aa52c3550b
    Regards
    Supraja

  • How to Export Data from a table in database directly to Excel.

    Hi,
    I have some sqls that i need to run on a daily basis.My client wants them to be scheduled through a job and the result output of the query should be in the form of Excel.
    Now i am no sure how to do this.Is there any in-built function in the DBMS package that can export data drectly from table to Excel. ?
    Please Help me !!

    SQL> spool exlfile.cvs
    SQL> set colsep ','
    SQL> set lines 300
    SQL> set pages  9999
    SQL> set trimspool on
    SQL>
    SQL> select * from DEPARTMENTS
      2  /
    DEPARTMENT_ID,DEPARTMENT_NAME               ,MANAGER_ID,LOCATION_ID
               10,Administration                ,       200,       1700
               20,Marketing                     ,       201,       1800
               30,Purchasing                    ,       114,       1700
               40,Human Resources               ,       203,       2400
               50,Shipping                      ,       121,       1500
               60,IT                            ,       103,       1400
               70,Public Relations              ,       204,       2700
               80,Sales                         ,       145,       2500
               90,Executive                     ,       100,       1700
              100,Finance                       ,       108,       1700
              110,Accounting                    ,       205,       1700
              120,Treasury                      ,          ,       1700
              130,Corporate Tax                 ,          ,       1700
              140,Control And Credit            ,          ,       1700
              150,Shareholder Services          ,          ,       1700
              160,Benefits                      ,          ,       1700
              170,Manufacturing                 ,          ,       1700
              180,Construction                  ,          ,       1700
              190,Contracting                   ,          ,       1700
              200,Operations                    ,          ,       1700
              210,IT Support                    ,          ,       1700
              220,NOC                           ,          ,       1700
              230,IT Helpdesk                   ,          ,       1700
              240,Government Sales              ,          ,       1700
              250,Retail Sales                  ,          ,       1700
              260,Recruiting                    ,          ,       1700
              270,Payroll                       ,          ,       1700

  • How to read data from a file that was formatted by excel?

    Hi everyone, I'm familiar with java.io and the ability to read from files, can anyone tell me how to read data from a file that was formatted by excel? Or at least give me some web references so that I can learn about it?

    http://jakarta.apache.org/poi/hssf/index.html
    HSSF stands for Horrible Spreadsheet Format, but it still works!

  • How to export data from a Oracle table to a delimited file?

    I know how to load delimited file into a table, but how to export
    data from a Oracle table to a delimited file?
    Thanks in advance.

    Try looking at this link, it's long but there's three different solutions discussed in it. If you look at Barbara Boehmer's
    solution in her posts in the link below you'll see that she's addressed your concerns with spool files.
    Re: utl_smtp and triggers

  • How to export data from a spread sheet which has multiple work sheets?

    How to export data from a spread sheet which has multiple work sheets to a single text file with fixed length fields?

    Hello s1,
    saving them as CSV will not give a fixed legth output but, as the naming says, a Character Separated Value file.
    Regards
    Marcus

  • How to store data from textfile to vector and delete a selected row.

    Can someone teach me how to store data from textfile to vector and delete a selected row. And after deleting, i want to write the changes in my textfile.
    Do someone has an idea? :)

    nemesisjava wrote:
    Can someone teach me how to store data from textfile to vector and delete a selected row. And after deleting, i want to write the changes in my textfile.
    Do someone has an idea? :)What's the problem? What have you done so far? What failed?
    What you described should be pretty easy to do.

  • How to extract data from SAP 4.7 and upload data to SAP ECC 6.0

    Hi,
        How to extract data from SAP 4.7 and upload data to SAP ECC 6.0? Can i use BDC,BAPI,LSMW? Help me please.

    hi
    good
    both works not possible simultaneously.
    If you want to do it in two separate task than you can use the GUI_UPLOAD function module to fulfill your requirement.
    thanks
    mrutyun^

  • How to export data from a Dynpro table to Excel file?

    Hi
    Here I go again. I read the post <b>Looking for example to export data from a DynPro table to Excel file</b> and put the code lines into a Web Dynpro Project where we need to export a dynpro table to Excel file but exactly at line 23 it doesn't recognize <b>workBook = new HSSFWorkbook();</b>
    1     //Declare this in the end between the Begin others block.
    2     
    3     private FileOutputStream out = null;
    4     private HSSFWorkbook workBook = null;
    5     private HSSFSheet hsSheet = null;
    6     private HSSFRow row = null;
    7     private HSSFCell cell = null;
    8     private HSSFCellStyle cs = null;
    9     private HSSFCellStyle cs1 = null;
    10     private HSSFCellStyle cs2 = null;
    11     private HSSFDataFormat dataFormat = null;
    12     private HSSFFont f = null;
    13     private HSSFFont f1 = null;
    14     
    15     //Code to create the Excel.
    16     
    17     public void onActionExportToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
    18     {
    19     //@@begin onActionExportToExcel(ServerEvent)
    20     try
    21     {
    22     out = new FileOutputStream("C:/mydirectory/myfiles/testexcel.xls");
    23     workBook = new HSSFWorkbook();
    24     hsSheet = workBook.createSheet("My Sheet");
    25     cs = workBook.createCellStyle();
    26     cs1 = workBook.createCellStyle();
    27     cs2 = workBook.createCellStyle();
    28     dataFormat = workBook.createDataFormat();
    29     f = workBook.createFont();
    30     f1 = workBook.createFont();
    31     f.setFontHeightInPoints((short) 12);
    32     // make it blue
    33     f.setColor( (short)HSSFFont.COLOR_NORMAL );
    34     // make it bold
    35     // arial is the default font
    36     f.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    37     
    38     // set font 2 to 10 point type
    39     f1.setFontHeightInPoints((short) 10);
    40     // make it red
    41     f1.setColor( (short)HSSFFont.COLOR_RED );
    42     // make it bold
    43     f1.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    44     f1.setStrikeout(true);
    45     cs.setFont(f);
    46     cs.setDataFormat(dataFormat.getFormat("#,##0.0"));
    47     
    48     // set a thick border
    49     cs2.setBorderBottom(cs2.BORDER_THICK);
    50     
    51     // fill w fg fill color
    52     cs2.setFillPattern((short) HSSFCellStyle.SOLID_FOREGROUND);
    53     cs2.setFillBackgroundColor((short)HSSFCellStyle.SOLID_FOREGROUND);
    54     // set the cell format to text see HSSFDataFormat for a full list
    55     cs2.setDataFormat(HSSFDataFormat.getBuiltinFormat("text"));
    56     cs2.setFont(f1);
    57     cs2.setLocked(true);
    58     cs2.setWrapText(true);
    59     row = hsSheet.createRow(0);
    60     hsSheet.createFreezePane(0,1,1,1);
    61     for(int i=1; i<10;i++)
    62     {
    63     cell = row.createCell((short)i);
    64     cell.setCellValue("Excel Column "+i);
    65     cell.setCellStyle(cs2);
    66     }
    67     workBook.write(out);
    68     out.close();
    69     
    70     //Read the file that was created.
    71     
    72     FileInputStream fin = new FileInputStream("C:/mydirectory/myfiles/testexcel.xls");
    73     byte b[] = new byte[fin.available()];
    74     fin.read(b,0,b.length);
    75     fin.close();
    76     
    77     wdContext.currentContextElement().setDataContent(b);
    78     }
    79     catch(Exception e)
    80     {
    81     wdComponentAPI.getComponent().getMessageManager().reportException("Exception while reading file "+e,true);
    82     }
    83     //@@end
    84     }
    I don't know why this happen? Any information I will appreciate it.
    Thanks in advance!!!
    Tokio Franco Chang

    After test the code lines appears this error stacktrace:
    [code]
    java.lang.NoClassDefFoundError: org/apache/poi/hssf/usermodel/HSSFWorkbook
         at com.sap.tc.webdynpro.progmodel.api.iwdcustomevent.ExportToExcel.onActionAct1(ExportToExcel.java:232)
         at com.sap.tc.webdynpro.progmodel.api.iwdcustomevent.wdp.InternalExportToExcel.wdInvokeEventHandler(InternalExportToExcel.java:147)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.invokeEventHandler(DelegatingView.java:87)
         at com.sap.tc.webdynpro.progmodel.controller.Action.fire(Action.java:67)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleAction(WebDynproMainTask.java:101)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.handleActionEvent(WebDynproMainTask.java:304)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:649)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
         at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:252)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:55)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:392)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:159)
    Thanks in advance!!!
    Tokio Franco Chang
    [/code]

  • How to Export data from a Table to Excel using PL/SQL Code

    Hi,
    I need to export data from a table to the excel sheet using PL/SQL script.
    could you pls provide with custom codes or sample procedures.
    Bobby

    http://asktom.oracle.com/pls/ask/f?p=4950:8:7947129213057862756::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:728625409049

  • Exporting Data from WebDynpro to a Word-file

    Hello,
    I'm looking for a way to export data from a WebDynpro to a MS Word-file. I have already a template of the word-document, so the data should be transfered to a specific area of the file.
    I already checked the Jakarta project, but the Word sub-project seems not mature yet. I also read about the possibility to do this using XML. But because I'm not familiar with XML, I don't know if it is possible to fill an already existing file. Are there some free APIs which can be used for this purpose?
    Thanks for any hint!
    Regards,
    Martin

    Hi Martin,
                    Check this..u have to explore more for this issue but i think it can help u a bit
    <a href="/people/anilkumar.vippagunta2/blog/2007/02/01/office-control-in-webdynpro--i:///people/anilkumar.vippagunta2/blog/2007/02/01/office-control-in-webdynpro--i
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/3483789514b748b6fe1f145e9685ab/content.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/ef/3483789514b748b6fe1f145e9685ab/content.htm</a>
    regards
    Sumit

  • How to export database from oracle 9.2 and 10g

    Hi,
    I want export the database from oracle 9i and 10g.
    i tried like....... start button--->run--->exp--->
    then it asked password. I have no password to my local database only scott/tiger. i given this, but in one attempt window has closed.
    pls guide me how to export data.
    Thanks and regards,
    Venkat.

    I have no password to my local database only scott/tigerThen use OS authentication :
    C:\>set ORACLE_SID=<your SID>
    C:\>exp \"/ as sysdba\" <options>or change passwords, e.g.
    C:\>set ORACLE_SID=<your SID>
    C:\>sqlplus "/ as sysdba"
    SQL> alter user system identified by <new password>;

  • How to export photos from iMac to iPad and iPhone

    How to export photos from iphoto to my iPad and iPhone the easiest way.

    There are a number of methods including:
    Via iTunes and USB cable: iTunes: Syncing photos - Apple Support
    Via Photo Stream: http://support.apple.com/en-us/HT201317
    Via 3rd party app: http://www.photosync-app.com
    Via 3rd party cloud services such as Dropbox

  • How to export data from report to excel using report 10g

    Hi,
    usnig report 10g, can we export the data from report to excel.
    Regards
    Randhir

    Hi,
    have a look at metalink note 209770.1: Getting Reports Ouput to MS Excel - Techniques and References
    Regards
    Rainer

  • How to get Data from SAP B1 through Journal Entries objects (Excel VBA)

    Hi Genius
    i had try to login SAB B1 thorugh MS Excel VBA code and it worked well. but i need some questions regards getting the data from after login. that means i want the Posting date, Transaction No, account code, debit and credit amount from Journal entries posted in a particular day through MS excel VBA into excel sheets 1 cell A1:E1
    how i get it if any possible ways to do that
    here my code to login
    Public Sub login()
        Sheets("Login").Select  'access the login tab
        Worksheets("Login").Range("B1").Activate 'put focus on cell B1 (manager)
        B1UserID = Trim(ActiveCell.Value2) 'set Businsss One user
        ActiveCell.Offset(1, 0).Activate
        B1Password = Trim(ActiveCell.Value2) 'set Business One password
        ActiveCell.Offset(1, 0).Activate
        sqluser = Trim(ActiveCell.Value2) 'set SQL user
        ActiveCell.Offset(1, 0).Activate
        sqlpass = Trim(ActiveCell.Value2) 'set SQL password
        ActiveCell.Offset(1, 0).Activate
        Db = Trim(ActiveCell.Value2)      'set Database name
        ActiveCell.Offset(1, 0).Activate
        Server = Trim(ActiveCell.Value2)  'set Server name
        Set company1 = New SAPbobsCOM.Company  'initialate DI company object
        company1.DbServerType = dst_MSSQL2005
        company1.Server = Server
        company1.DbUserName = sqluser
        company1.DbPassword = sqlpass
        company1.CompanyDB = Db
        company1.UserName = B1UserID
        company1.Password = B1Password
        'connect to the database
         lRetCode = company1.Connect
            If lRetCode <> 0 Then
                sErrMsg = company1.GetLastErrorDescription
                MsgBox (sErrMsg)
            Else
                MsgBox ("Connected to: " & company1.CompanyName)
            End If
    End Sub
    pls help me
    advance thanks to solvers

    Gordons way is the easiest - just query the OJDT table for journal entry headers and JDT1 for journal entry lines if needed.
    But if you want to work with the business objects:
    'Journal entry
       Dim oJE As SAPbobsCOM.JournalEntries
       Set oJE = company1.GetBusinessObject(oJournalEntries)
       oJE.GetByKey(1234)
       Dim postingDate as String
       postingDate = oJE.DueDate
    'etc etc

Maybe you are looking for

  • JDeveloper 12.1.3.0 - Can't associate role to user

    Hello, I'm not able to associate WebLogic users to roles in JDeveloper. In a BPM project I created some roles in the current organization and I want to associate users to them. By double-clicking on one role I'm opening the Edit Role dialog. Here I s

  • Why can't I open a blank tab?

    I cannot open a blank tab, when click on the '+' sign next to opened tab(s), a blank tab should open, but for me simply nothing happens, so what do I do to fix this?

  • New serial numbers in SAP for new equipment

    Hi Experts, I recently ordered new machines & receipted machines prior to creating serial numbers. The serial numbers created are not showing as being in new stock location XXXX. Later, unreceipted the PO & tried to create serial numbers first before

  • How to manage my own playlist?

    how can i erase the songs in the playlist? i want to make my own playlist? thank you guys! have a good day and Godbless..Ü   Windows XP  

  • Creating RESTful Web Service for BLOB retrieval

    Hi, Just got RESTful web services working in Apex 4.2.1 with new Listener 2.1. I have now been asked to create a RESTful web service by which photos in BLOB column can be retrieved upon providing the ID for that photo. Can this be done using the Crea