OUTPUT IN EXCEL FORMAT

hi i've an urjent req as follows.theres 1 selection screen which has 2 par and 2 selectoptions and 2 radio buttons named display and excel.if i click on 'excel',the o/p shud be displayed in excel format to the user and if click 'display'..the o/p shud be a normal list output.i can do the selection criteria..help me with the o/p logic and sample code pls...will be rewarded ...thank u

Hi Kiran,
Please check the link below:
<a href="http://">help.sap.com/saphelp_erp2004/helpdata/en/e3/41a138c4397a42e10000009b38f842/frameset.htm</a>
What it shows u is how to convert the ALV grid output into excel display by the click of a button.
However as far as I understand, you want to display ALV grid OR excel as soon as output appears based on radiobutton. What you can then do it if the excel is clicked then download the ALV grid on to the presentation server in EXCEL format using the CL_GUI_FRONTEND_SERVICES class method of DOWNLOAD and then read the same file and open for display. This way not only will u have a file downloaded onto the presentation server but will achieve the functionality of displaying the document.
Hope this helps.
Regards,
Aditya

Similar Messages

  • Are You All Able to get the Output In EXCEL Format

    Hi All,
    I have one question. Are You All Able to get the Output In EXCEL Format?? I am working on Oracle Apllication 11.5.10.2 and my XML builder is 5.0.1. Problem which i m facing is this...... Whenever i am submitting a concurrent program with format type different from PDF i could not able to view the ouput in desired format. When i am pressing view output it gives me a file in XML and when i save that file with extention 'xls' or 'rtf' then i could able to see the saved file in desired format.
    Can anyone tell me where is the problem??? Is it a bug?
    I am using microsoft world 2000 sp-3.
    Please give your valuable comments. May be your comments can solve my problem..
    Thanks
    Ravi

    Hi I got Same issue
    When I change Format to EXCEL from
    Submit request>> Option>> Format = EXCEL
    In window I am getting something HTML code and
    when I try to copy it to Browser from Tools>> Copy File in to Browser I am getting following message
    The XML page cannot be displayed
    Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
    End tag 'p' does not match the start tag 'a'. Error processing resource 'http://our url.com:8000/OA_CGI...
    <p class="c0"><a name="Text4" id="Text4"><a name="Text1_1" id="Text1_1"><span class="c1">Dept No <...
    But I can see the output when Format is PDF
    Pls suggest solution ,I am using EBS 11.5.10.2.
    Thanks
    Rahul
    Message was edited by: Rahul
    user576181

  • XML Publisher report default output in Excel format.

    Hi,
    We have defined one concurrent program whose output format is text, this concurrent program executable is PL/SQL and in this PL/SQL program we are generating XML data and displaying XML using below fnd_request.
    l_conc_id := FND_REQUEST.SUBMIT_REQUEST('GMP','GMPPDROP','', '',FALSE,
         p_sequence_num,chr(0),'','','','','','','','','','','',
    We have also defined template for this.
    Using below fnd_request we are choosing template and data is getting generated in PDF format. Now our requirement is to display the output by default in Excel format.
    FND_REQUEST.SUBMIT_REQUEST('XDO','XDOREPPB','', '',FALSE,'',
    l_conc_id,554,G_comb_pdr_temp,
    G_comb_pdr_locale,'Y','RTF','',scale_report,'','','','','',
    When i saw XML Report Publisher concurrent program, there is one parameter for Output Format and i tried passing 'Excel'/EXCEL/excel to this parameter but output is still coming in PDF format.
    FND_REQUEST.SUBMIT_REQUEST('XDO','XDOREPPB','', '',FALSE,'',
    l_conc_id,554,G_comb_pdr_temp,
    G_comb_pdr_locale,'Y','RTF','Excel',scale_report,'','','','','',
    I have also tried giving Default Output to EXCEL in template definition but this is also not working.
    Your valuable suggestions highly appreciated.
    Thanks
    Vijay

    Hi;
    What is EBS version? Please see below which could be helpful for your issue:
    Changing Output Format to RTF or Excel in XML Publisher Request Does Not Display Output Correctly [ID 404512.1]
    Cannot View BI Publisher (formerly XML Publisher) Report Output In Excel Format or XHTML [ID 359875.1
    How is Default Output Type Determined for Reports Submitted Using XML [ID 888972.1]
    Also see:
    XML PUBLISHER report in Excel out put problem
    XML PUBLISHER report in Excel out put problem
    Regard
    Helios

  • Xml report output in excel format without using options tab in EBS

    How to get xml publisher report output in excel format without using options tab in EBS?
    I am getting XML Publisher report output in excel format by using options tab while submitting the concurrent request .
    But i want to get excel output automatically.
    Can anyone give idea to get XML publisher Report output in excel without selecting options tab.
    Thanks in advance
    Sandeep V

    Hey Sandeep,
    I am working on a similar format for a report and if possible can you please give me some guidelines. I have initially created reports using XML Publisher, but for those , the output preview format was PDF. So, if I select the preview format as EXCEL will it give me output in Excel and for this to happen, how do I define the rtf template. I believe the working will be same as for PDF, create a rdf report, get output in XML and apply the template to get the data in Excel or there is something different to this.
    Thanks,
    Sunil

  • Output in Excel Format Issue

    Hi all,
    I am not able to view the output in EXCEL format after registered the RTF file in the XML Publisher Administrator to run as a concurrent program.
    I am wokring in XMLP 5.6.2 and Microsoft Office 2003.
    When i preview the output as EXCEL in the options before run the conc. program, i have the following error msg and also when i view the output,it shows the output in some htm tags format not in EXCEL Format.
    java.sql.SQLException: No corresponding LOB data found : SELECT FILE_DATA, DBMS_LOB.GETLENGTH(FILE_DATA), FILE_NAME, LAST_UPDATE_DATE FROM XDO_LOBS WHERE LOB_TYPE = :1 AND APPLICATION_SHORT_NAME = :2 AND LOB_CODE = :3 AND LANGUAGE = :4 AND TERRITORY = :5 at oracle.apps.xdo.oa.schema.server.XdoLobsInputStream.<init>(XdoLobsInputStream.java:108) at oracle.apps.xdo.oa.schema.server.LobHelper.getLob(LobHelper.java:877) at oracle.apps.xdo.oa.schema.server.LobHelper.getBlobDomain(LobHelper.java:912) at oracle.apps.xdo.oa.template.server.TemplatesAMImpl.processTemplate(TemplatesAMImpl.java:2053) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:189) at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:152) at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:721) at oracle.apps.xdo.oa.template.webui.TemplateGeneralCO.previewTemplate(TemplateGeneralCO.java:741) at oracle.apps.xdo.oa.template.webui.TemplateGeneralCO.processRequest(TemplateGeneralCO.java:158) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:581) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247) at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1095) at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247) at oracle.apps.fnd.framework.webui.beans.form.OAFormBean.processRequest(OAFormBean.java:385) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:932) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:899) at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:640) at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247) at oracle.apps.fnd.framework.webui.beans.OABodyBean.processRequest(OABodyBean.java:353) at oracle.apps.fnd.framework.webui.OAPageBean.processRequest(OAPageBean.java:2298) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1711) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:497) at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:418) at oa_html._OA._jspService(_OA.java:88) at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119) at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417) at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267) at oracle.jsp.JspServlet.internalService(JspServlet.java:186) at oracle.jsp.JspServlet.service(JspServlet.java:156) at javax.servlet.http.HttpServlet.service(HttpServlet.java:588) at oracle.jsp.provider.Jsp20RequestDispatcher.forward(Jsp20RequestDispatcher.java:162) at oracle.jsp.runtime.OraclePageContext.forward(OraclePageContext.java:187) at oa_html._RF._jspService(_RF.java:102) at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:119) at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java:417) at oracle.jsp.JspServlet.doDispatch(JspServlet.java:267) at oracle.jsp.JspServlet.internalService(JspServlet.java:186) at oracle.jsp.JspServlet.service(JspServlet.java:156) at javax.servlet.http.HttpServlet.service(HttpServlet.java:588) at org.apache.jserv.JServConnection.processRequest(JServConnection.java:456) at org.apache.jserv.JServConnection.run(JServConnection.java:294) at java.lang.Thread.run(Thread.java:534).
    please post your comments to solve this issue.
    Regards
    Prabu

    Prabhu
    adding to above post
    first fix -- No corresponding LOB data found
    then follow the steps in below post for excel output
    Excel output in EBS?

  • Report output to excel format

    Hi Experts,
    My requriement is I have to send a mail with report output in excel format as an attachment.
    I wrote the below subroutine for building excel sheet but I am getting output in the single row.  I am using version 4.6
    Please  help me regarding this. ASAP
    FORM BUILD_XLS_DATA .
      CONSTANTS: CON_CRET TYPE STRING VALUE '0D', "OK for non Unicode
      CON_TAB TYPE STRING VALUE '09'. "OK for non Unicode
      CONCATENATE 'Vendor' 'Country' 'Name'
      INTO IATTACH SEPARATED BY CON_TAB.
      CONCATENATE CON_CRET IATTACH INTO IATTACH.
      APPEND IATTACH.
      LOOP AT IT_lfa1.
       CONCATENATE IT_lfa1-lifnr IT_lfa1-land1 IT_lfa1-name1      INTO IATTACH
            SEPARATED BY CON_TAB.
        CONCATENATE CON_CRET IATTACH INTO IATTACH.
        APPEND IATTACH.
      ENDLOOP.
    ENDFORM.                    "build_xls_data
    Thanx,
    Sudha

    Hi Sudha,
    I am sending the standard format of sending a mail along with an attachment in .xls format.
    Try this code.
    form sendmail.
      CLEAR GV_DELIMIT.
      GV_DELIMIT = CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
      TEMPREAD = LV_LNCNT1.
      REFRESH OBJTXT.
      CONCATENATE 'The no. of error records are : ' TEMPREAD
      INTO OBJTXT-LINE.
      APPEND OBJTXT.
      CLEAR OBJPACK. REFRESH OBJPACK.
      CONCATENATE   C_CODE     
                    C_CMMT  
                    C_COMMENT1
                    INTO OBJTXT-LINE  SEPARATED BY GV_DELIMIT.
      APPEND OBJTXT.
      LOOP AT IT_DATA INTO WA_DATA.
        CONCATENATE   WA_DATA-ZCODE
                      WA_DATA-ZCOMMENT
                      WA_DATA-ZREASON
                      INTO OBJTXT-LINE  SEPARATED BY GV_DELIMIT.
        APPEND OBJTXT.
      ENDLOOP.
      CLEAR GV_DELIMIT.
      CLEAR OBJPACK. REFRESH OBJPACK.
      CLEAR DOC_CHNG.
      TAB_LINES = 0.
      OBJHEAD = REJFILE. APPEND OBJHEAD.
      DESCRIBE TABLE OBJTXT LINES TAB_LINES.
      READ TABLE OBJTXT INDEX TAB_LINES.
      DOC_CHNG-OBJ_NAME = REJFILE.
      MOVE TEXT-006 TO
      DOC_CHNG-OBJ_DESCR.
      DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
      CLEAR OBJPACK-TRANSF_BIN.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = 1.   " 3.
      OBJPACK-DOC_TYPE = 'RAW'.
      APPEND OBJPACK.
      FOR ASCII TO BINARY OBJECT FUNCTION
      TOTLINEXFER = 0.
      TOTXFER = 0.
      BINMAXLEN = 255.
      REFRESH OBJBIN.
      LV_CR = CL_ABAP_CHAR_UTILITIES=>CR_LF.
      TGTMAXLEN = BINMAXLEN.
      TGTLEN = 0.
      LOOP AT OBJTXT FROM 2.
        IF NOT OBJTXT-LINE CP 'The no. of records are '." AND
          CONCATENATE OBJTXT-LINE LV_CR INTO BUFFER.
          SRCOBJLEN = STRLEN( BUFFER ).
          SRCOBJPTR = 0.
          WHILE SRCOBJLEN > 0 .
            XFERLEN = TGTMAXLEN - TGTLEN.
            IF XFERLEN > SRCOBJLEN.
              XFERLEN = SRCOBJLEN.
              MOVE BUFFERSRCOBJPTR TO OBJBIN-LINETGTLEN.
              TGTLEN = TGTLEN + SRCOBJLEN.
              SRCOBJLEN = 0.
              CLEAR BUFFER.
            ELSE.
              MOVE BUFFER+SRCOBJPTR(XFERLEN) TO
              OBJBIN-LINE+TGTLEN(XFERLEN).
              APPEND OBJBIN.
              CLEAR OBJBIN-LINE.
              TGTLEN = 0.
              SRCOBJLEN = SRCOBJLEN - XFERLEN.
              SRCOBJPTR = SRCOBJPTR + XFERLEN.
              TOTLINEXFER = TOTLINEXFER + 1.
            ENDIF.
            TOTXFER = TOTXFER + XFERLEN.
          ENDWHILE.
        ENDIF.
      ENDLOOP.
      IF TGTLEN > 0.
        APPEND OBJBIN.
        TOTLINEXFER = TOTLINEXFER + 1.
      ENDIF.
      CLEAR OBJPACK-TRANSF_BIN.
      OBJPACK-TRANSF_BIN = 'X'.
      OBJPACK-HEAD_START = 1.
      OBJPACK-HEAD_NUM = 0.
      OBJPACK-BODY_START = 1.
      OBJPACK-BODY_NUM = TOTLINEXFER.
      OBJPACK-DOC_TYPE = 'XLS'.
      OBJPACK-OBJ_NAME = REJFILE.
      OBJPACK-OBJ_DESCR = 'Rejected Entries File'.
      OBJPACK-DOC_SIZE = TOTXFER.
      APPEND OBJPACK.
      REFRESH RECLIST.
      MAIL1 =   Recepient Mail Id
      RECLIST-RECEIVER = MAIL1.
      RECLIST-REC_TYPE = 'U'.
      APPEND RECLIST.
      CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
        EXPORTING
          DOCUMENT_DATA = DOC_CHNG
          PUT_IN_OUTBOX = 'X'
          COMMIT_WORK   = 'X'
        TABLES
          PACKING_LIST  = OBJPACK
          OBJECT_HEADER = OBJHEAD
          CONTENTS_BIN  = OBJBIN
          CONTENTS_TXT  = OBJTXT
          RECEIVERS     = RECLIST.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endform.
    Hope this is helpful to you. If you need further information, revert back.
    Reward all the helpful answers.
    Regards
    Nagaraj T

  • Transaction CJI3 AND  - batch job and output in excel format

    We are trying to schedule a batch job and would like to have the output in an excel file.  Is there a way to enhance CJI3 and FMEDDW to have the output in a excel file.  I've looked at the Layout for creating the disvariant and I know you can have the output in excel format in the foreground, but I'm looking to put an excel file on the SAP DIRECTORY.
    Has anyone done this?
    Thank you.
    Linda

    Talking about Enhancement Options, I believe you can achieve it using Enhancement Implementation. There must be one towards the end of the program just before the ALV is displayed. You can create an implementation of the implicit enhacement spot and output the file to a location maintained in some VAR (to keep the output location dynamic as we don't have it on the select screen).
    My reply is not to the point but I hope you find a way using enhancement spots.
    Should you need any help with enhancement implementation, following blog is good enough:
    Blog - [Enhancement Framework|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417800%29ID1759109750DB10206591421434314571End?blog=/pub/wlg/3595]
    or you can ask back here.
    regards,
    Aabhas
    Edited by: Aabhas K Vishnoi on Sep 24, 2009 10:40 AM

  • Oracle reports output in excel format does not display the graphs

    Oracle reports output in excel format does not display the graphs: "linked image cannot be displayed".
    The output file in PDF format the graph is supported.

    Do you have any header and footer on your template?
    If you have any header and footer then try to adjust it as of to display full page.
    Thanks
    Yasar

  • Displaying the report output in excel format

    Please help me in getting the report output in excel format.
    thnks

    I ran into a BIG problem after passing from 6i rep server to 9i rep server.
    On 6i rep server I used to set DESFORMAT='DELIMITED', and that produced reasonable tab-delimited output for reports that did not have group above (all the query groups were from left to right, not a single group having fields displayed above some other group). When deployed on rep server 9i, the same reports produced some unexplainable output: some of the rows were duplicated, but I couldn't figure out any rule.
    So, the best thing to get the reports into something that fits in .xls would be to have the output in .xml, that may be imported in Excel.

  • XML Output in Excel Format

    Hi,
    I have created a rdf, concurrent program with output as "XML".
    When i created the template i updated the "Preview Option as Excel".
    But when i run the con program the output shows as PDF.
    Can i have solution as to get the output in EXCEL format.
    (I dont want to change the option from PDFto EXCEL when i submit the request to run the program as the user is not comfortable doing so)
    Thanks in advance.

    Check this note.
    Note: 401328.1 - Default Layout Format for XML Publisher Concurrent Request Is Always PDF
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=401328.1

  • ALV Report output in Excel format

    Hi ,
    I am facing a different behaviour in two computers , while trying to take an Excel format of an ALV report output. After generating the ALV output ,in one , when I click on the Excel Format button - the Excel spreadsheet opens with the output data. In the second computed , under the same action , a blank Excel sheet opens .
    Could someone tell me a solution . What aspect is responsible for this ?
    Regards ,
    Sujata

    Reduce the MACRO security settings in the Excel to Medium.
    Open an execl sheet, Chose from menu Tootls->Macro->Security.
    Chose the radio-buton medium. Close the file and all excel applications.Then try downloading again.
    Regards,
    Ravi

  • Report is executing in background and need data(output) in excel format

    Report is executing in background and need data(output) to get downloaded in excel format in my PC from an internal table;;in any drive i.e. C: or D: .When executing in backround it prompt to user with which location excel file to be saved and the name of file.How to download in background in excel format?
    Edited by: PRASHANT BHATNAGAR on Aug 26, 2008 6:24 AM

    Hi
    Download a report to excel with format (border, color cell, etc)
    Try this program...it may help you to change the font ..etc.
    Code:
    REPORT ZSIRI NO STANDARD PAGE HEADING.
    this report demonstrates how to send some ABAP data to an
    EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          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
    TABLES: SPFLI.
    DATA  H TYPE I.
    table of flights
    DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
    *&   Event START-OF-SELECTION
    START-OF-SELECTION.
    read flights
      SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
    display header
      ULINE (61).
      WRITE: /     SY-VLINE NO-GAP,
              (3)  'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (4)  'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
              (8)  'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
      ULINE /(61).
    display flights
      LOOP AT IT_SPFLI.
      WRITE: / SY-VLINE NO-GAP,
               IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
               IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
      ENDLOOP.
      ULINE /(61).
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-007
           EXCEPTIONS
                OTHERS     = 1.
    start Excel
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
    PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
    CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 = 'c:\kis_excel.xls'
    PERFORM ERR_HDL.
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-008
           EXCEPTIONS
                OTHERS     = 1.
    get list of workbooks, initially empty
      CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP.
      PERFORM ERR_HDL.
    tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - start
    CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
      CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    add a new workbook
      CALL METHOD OF H_MAPL 'Add' = H_MAP  EXPORTING #1 = 2.
      PERFORM ERR_HDL.
    tell user what is going on
      SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
              PERCENTAGE = 0
               TEXT       = TEXT-009
           EXCEPTIONS
                OTHERS     = 1.
    output column headings to active Excel sheet
      PERFORM FILL_CELL USING 1 1 1 'Flug'(001).
      PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
      PERFORM FILL_CELL USING 1 3 1 'Von'(003).
      PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
      PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
      LOOP AT IT_SPFLI.
    copy flights to active EXCEL sheet
        H = SY-TABIX + 1.
        PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
        PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
        PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
        PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
        PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
      ENDLOOP.
    changes by Kishore  - end
    disconnect from Excel
         CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING  #1 = 'C:\SKV.XLS'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
          FORM FILL_CELL                                                *
          sets cell at coordinates i,j to value val boldtype bold       *
    FORM FILL_CELL USING I J BOLD VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_ZL EXPORTING #1 = I #2 = J.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_ZL 'Value' = VAL .
      PERFORM ERR_HDL.
      GET PROPERTY OF H_ZL 'Font' = H_F.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_F 'Bold' = BOLD .
      PERFORM ERR_HDL.
    ENDFORM.
    *&      Form  ERR_HDL
          outputs OLE error if any                                       *
    -->  p1        text
    <--  p2        text
    FORM ERR_HDL.
    IF SY-SUBRC <> 0.
      WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
      STOP.
    ENDIF.
    ENDFORM.                    " ERR_HDL
    Regards
    Murali Papana

  • Error while downloading output in excel format using FM Gui_download

    Hello All,
    <removed by moderator>
    While downloading the necessary output of a Ztransaction in excel format the excel file only shows one 1 record whereas in the output there were 88 records.
    When I am downloading it in other formats like Rich text etc. the data is getting downloaded correctly as per the output.
    Now this problem is occuring in Production & Quality whereas in Development the excel file is downloading data correctly.
    I have compared the code in the different clients as well as debugged it but the code is the same in each case.
    There is no data corruption in the final internal table as well.
    So what else can be done?....
    The data needs to be downloaded as it is in the output in the excel format.
    Kindly give me some suggestion and help me out in this regard.
    Edited by: Thomas Zloch on Nov 1, 2011 10:04 AM

    Hi,
    Did you the use the GUO_download using the following values:
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename         = fullpath
        filetype         = 'ASC'
        codepage         = space
        write_bom        = 'X'
      TABLES

  • Query output in EXCEL format

    Hi,
    How do I redirect the output of the SQL query to EXCEL format.
    If i say select * from emp with the spooling file name as c:\emp.xls and once I open emp.xls the excel file should be available
    with each column of the table in separate column automatically.
    Please help me to achieve this requirement.
    Thanks

    Hi
    Please find below script...Longback blushadow provided to me...!! Credit goes to his account only.
    Thanks blushadow once again.
    ** This will help you a lot. do the following steps with out fail.
    Now open tab.xls with excel ....
    As sys user:
    CREATE OR REPLACE DIRECTORY TEST_DIR AS 'c:\myfiles'     /* directory on the Oracle database server */
    GRANT READ, WRITE ON DIRECTORY TEST_DIR TO myuser
    As myuser:
    DECLARE
      v_fh        UTL_FILE.FILE_TYPE;
      v_dir       VARCHAR2(30) := 'TEST_DIR';
      v_file      VARCHAR2(30) := 'myfile.xls';
      PROCEDURE run_query(p_sql IN VARCHAR2) IS
        v_v_val     VARCHAR2(4000);
        v_n_val     NUMBER;
        v_d_val     DATE;
        v_ret       NUMBER;
        c           NUMBER;
        d           NUMBER;
        col_cnt     INTEGER;
        f           BOOLEAN;
        rec_tab     DBMS_SQL.DESC_TAB;
        col_num     NUMBER;
      BEGIN
        c := DBMS_SQL.OPEN_CURSOR;
        -- parse the SQL statement
        DBMS_SQL.PARSE(c, p_sql, DBMS_SQL.NATIVE);
        -- start execution of the SQL statement
        d := DBMS_SQL.EXECUTE(c);
        -- get a description of the returned columns
        DBMS_SQL.DESCRIBE_COLUMNS(c, col_cnt, rec_tab);
        -- bind variables to columns
        FOR j in 1..col_cnt
        LOOP
          CASE rec_tab(j).col_type
            WHEN 1 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,4000);
            WHEN 2 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_n_val);
            WHEN 12 THEN DBMS_SQL.DEFINE_COLUMN(c,j,v_d_val);
          ELSE
            DBMS_SQL.DEFINE_COLUMN(c,j,v_v_val,4000);
          END CASE;
        END LOOP;
        -- Output the column headers
        UTL_FILE.PUT_LINE(v_fh,'<ss:Row>');
        FOR j in 1..col_cnt
        LOOP
          UTL_FILE.PUT_LINE(v_fh,'<ss:Cell>');
          UTL_FILE.PUT_LINE(v_fh,'<ss:Data ss:Type="String">'||rec_tab(j).col_name||'</ss:Data>');
          UTL_FILE.PUT_LINE(v_fh,'</ss:Cell>');
        END LOOP;
        UTL_FILE.PUT_LINE(v_fh,'</ss:Row>');
        -- Output the data
        LOOP
          v_ret := DBMS_SQL.FETCH_ROWS(c);
          EXIT WHEN v_ret = 0;
          UTL_FILE.PUT_LINE(v_fh,'<ss:Row>');
          FOR j in 1..col_cnt
          LOOP
            CASE rec_tab(j).col_type
              WHEN 1 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
                          UTL_FILE.PUT_LINE(v_fh,'<ss:Cell>');
                          UTL_FILE.PUT_LINE(v_fh,'<ss:Data ss:Type="String">'||v_v_val||'</ss:Data>');
                          UTL_FILE.PUT_LINE(v_fh,'</ss:Cell>');
              WHEN 2 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_n_val);
                          UTL_FILE.PUT_LINE(v_fh,'<ss:Cell>');
                          UTL_FILE.PUT_LINE(v_fh,'<ss:Data ss:Type="Number">'||to_char(v_n_val)||'</ss:Data>');
                          UTL_FILE.PUT_LINE(v_fh,'</ss:Cell>');
              WHEN 12 THEN DBMS_SQL.COLUMN_VALUE(c,j,v_d_val);
                          UTL_FILE.PUT_LINE(v_fh,'<ss:Cell ss:StyleID="OracleDate">');
                          UTL_FILE.PUT_LINE(v_fh,'<ss:Data ss:Type="DateTime">'||to_char(v_d_val,'YYYY-MM-DD"T"HH24:MI:SS')||'</ss:Data>');
                          UTL_FILE.PUT_LINE(v_fh,'</ss:Cell>');
            ELSE
              DBMS_SQL.COLUMN_VALUE(c,j,v_v_val);
              UTL_FILE.PUT_LINE(v_fh,'<ss:Cell>');
              UTL_FILE.PUT_LINE(v_fh,'<ss:Data ss:Type="String">'||v_v_val||'</ss:Data>');
              UTL_FILE.PUT_LINE(v_fh,'</ss:Cell>');
            END CASE;
          END LOOP;
          UTL_FILE.PUT_LINE(v_fh,'</ss:Row>');
        END LOOP;
        DBMS_SQL.CLOSE_CURSOR(c);
      END;
      PROCEDURE start_workbook IS
      BEGIN
        UTL_FILE.PUT_LINE(v_fh,'<?xml version="1.0"?>');
        UTL_FILE.PUT_LINE(v_fh,'<ss:Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">');
      END;
      PROCEDURE end_workbook IS
      BEGIN
        UTL_FILE.PUT_LINE(v_fh,'</ss:Workbook>');
      END;
      PROCEDURE start_worksheet(p_sheetname IN VARCHAR2) IS
      BEGIN
        UTL_FILE.PUT_LINE(v_fh,'<ss:Worksheet ss:Name="'||p_sheetname||'">');
        UTL_FILE.PUT_LINE(v_fh,'<ss:Table>');
      END;
      PROCEDURE end_worksheet IS
      BEGIN
        UTL_FILE.PUT_LINE(v_fh,'</ss:Table>');
        UTL_FILE.PUT_LINE(v_fh,'</ss:Worksheet>');
      END;
      PROCEDURE set_date_style IS
      BEGIN
        UTL_FILE.PUT_LINE(v_fh,'<ss:Styles>');
        UTL_FILE.PUT_LINE(v_fh,'<ss:Style ss:ID="OracleDate">');
        UTL_FILE.PUT_LINE(v_fh,'<ss:NumberFormat ss:Format="dd/mm/yyyy\ hh:mm:ss"/>');
        UTL_FILE.PUT_LINE(v_fh,'</ss:Style>');
        UTL_FILE.PUT_LINE(v_fh,'</ss:Styles>');
      END;
    BEGIN
      v_fh := UTL_FILE.FOPEN(upper(v_dir),v_file,'w',32767);
      start_workbook;
      set_date_style;
      start_worksheet('EMP');
      run_query('select * from emp');
      end_worksheet;
      start_worksheet('DEPT');
      run_query('select * from dept');
      end_worksheet;
      end_workbook;
      UTL_FILE.FCLOSE(v_fh);
    END;KPR

  • Report output in excel format.

    Dear Friends,
    I have created a report in character mode and I want to store the output of that report into an excel file. So that data of each column with heading will be stored in seperate coulmns(with each row of output in each row in excel file).
    Output as follows:-
    EMPNO ENAME DEPT
    0099 JOHN ART
    0011 SMITH ENGG
    and so on...
    I hope I will get the solution quickly.
    Thanks in advance.
    Sanjeev Bhattacharya

    Hey Sandeep,
    I am working on a similar format for a report and if possible can you please give me some guidelines. I have initially created reports using XML Publisher, but for those , the output preview format was PDF. So, if I select the preview format as EXCEL will it give me output in Excel and for this to happen, how do I define the rtf template. I believe the working will be same as for PDF, create a rdf report, get output in XML and apply the template to get the data in Excel or there is something different to this.
    Thanks,
    Sunil

Maybe you are looking for