Problem in generating output in Excel

Hi, 
     I have pasted this code from a blog.
But i get the output in a single cell of an excel sheet.
I guess its not recognising the horizontal tab and new line.
Does anyone have an alternative?
     <%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
  <htmlb:page title=" " >
    <htmlb:form>
      <%
  DATA: flights TYPE FLIGHTTAB,
  flight  LIKE LINE OF flights,
  output  TYPE string.
  CONSTANTS:
  crlf TYPE string VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF,
  tab  TYPE string VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
  SELECT * FROM sflight INTO TABLE flights UP TO 20 ROWS.
  LOOP AT flights INTO flight.
  DATA: seatsmax TYPE string.  seatsmax = flight-seatsmax. CONDENSE seatsmax.
  DATA: seatsocc TYPE string.  seatsocc = flight-seatsocc. CONDENSE seatsocc.
  CONCATENATE output
  flight-carrid     tab
  flight-connid     tab
  flight-fldate     tab
  flight-planetype  tab
  seatsmax          tab
  seatsocc          tab
  crlf
  INTO output.
  ENDLOOP.
  response->delete_header_field( name = if_http_header_fields=>cache_control ).
  response->delete_header_field( name = if_http_header_fields=>expires ).
  response->delete_header_field( name = if_http_header_fields=>pragma ).
  response->set_header_field( name  = if_http_header_fields=>content_type
  value = 'application/msexcel' ).
  response->set_header_field( name = 'content-disposition'
  value = 'attachment;filename=webforms.xls' ).
  response->set_cdata( data = output ).
      %>
    </htmlb:form>
  </htmlb:page>
</htmlb:content>

Sure.  I have a stateless application with a single page: excel_test.htm.  There are no page attributes.
The following is my layout:
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
  <htmlb:page title=" " >
    <htmlb:form>
      <htmlb:button id      = "test"
                    text    = "test"
                    onClick = "test" />
    </htmlb:form>
  </htmlb:page>
</htmlb:content>
Here is the coding of the OnInputProcessing:
* event handler for checking and processing user input and
* for defining navigation
  data: flights type flighttab,
  flight like line of flights,
  output type string,
  output2 type xstring.
  constants:
  crlf type string value cl_abap_char_utilities=>cr_lf,
  tab type string value cl_abap_char_utilities=>horizontal_tab.
  select * from sflight into table flights up to 20 rows.
  loop at flights into flight.
    data: seatsmax type string. seatsmax = flight-seatsmax. condense seatsmax.
    data: seatsocc type string. seatsocc = flight-seatsocc. condense seatsocc.
    concatenate output
    flight-carrid cl_abap_char_utilities=>horizontal_tab
    flight-connid cl_abap_char_utilities=>horizontal_tab
    flight-fldate cl_abap_char_utilities=>horizontal_tab
    flight-planetype cl_abap_char_utilities=>horizontal_tab
    seatsmax cl_abap_char_utilities=>horizontal_tab
    seatsocc cl_abap_char_utilities=>horizontal_tab
    cl_abap_char_utilities=>cr_lf
    into output.
  endloop.
  data: response type ref to if_http_response.
  response = runtime->server->response.
  response->delete_header_field( name = if_http_header_fields=>cache_control ).
  response->delete_header_field( name = if_http_header_fields=>expires ).
  response->delete_header_field( name = if_http_header_fields=>pragma ).
  response->set_header_field( name = if_http_header_fields=>content_type
  value = 'application/msexcel' ).
  response->set_header_field( name = 'content-disposition'
  value = 'attachment;filename=webforms.xls' ).
  call function 'SCMS_STRING_TO_XSTRING'
    exporting
      text     = output
      mimetype = 'text/unicode; charset=utf-16le'
    importing
      buffer   = output2.
  concatenate  cl_abap_char_utilities=>byte_order_mark_little
  output2
  into output2 in byte mode.
  data: l_len type i.
  l_len = xstrlen( output2 ).
  response->set_data( data = output2
  length = l_len ).
  navigation->response_complete( ).
This example does cast the data to Unicode and sends it back as a byte stream.  However if you wanted to go with your original example you could use the following:
* event handler for checking and processing user input and
* for defining navigation
  data: flights type flighttab,
  flight like line of flights,
  output type string,
  output2 type xstring.
  constants:
  crlf type string value cl_abap_char_utilities=>cr_lf,
  tab type string value cl_abap_char_utilities=>horizontal_tab.
  select * from sflight into table flights up to 20 rows.
  loop at flights into flight.
    data: seatsmax type string. seatsmax = flight-seatsmax. condense seatsmax.
    data: seatsocc type string. seatsocc = flight-seatsocc. condense seatsocc.
    concatenate output
    flight-carrid cl_abap_char_utilities=>horizontal_tab
    flight-connid cl_abap_char_utilities=>horizontal_tab
    flight-fldate cl_abap_char_utilities=>horizontal_tab
    flight-planetype cl_abap_char_utilities=>horizontal_tab
    seatsmax cl_abap_char_utilities=>horizontal_tab
    seatsocc cl_abap_char_utilities=>horizontal_tab
    cl_abap_char_utilities=>cr_lf
    into output.
  endloop.
  data: response type ref to if_http_response.
  response = runtime->server->response.
  response->delete_header_field( name = if_http_header_fields=>cache_control ).
  response->delete_header_field( name = if_http_header_fields=>expires ).
  response->delete_header_field( name = if_http_header_fields=>pragma ).
  response->set_header_field( name = if_http_header_fields=>content_type
  value = 'application/msexcel' ).
  response->set_header_field( name = 'content-disposition'
  value = 'attachment;filename=webforms.xls' ).
*  call function 'SCMS_STRING_TO_XSTRING'
*    exporting
*      text     = output
*      mimetype = 'text/unicode; charset=utf-16le'
*    importing
*      buffer   = output2.
*  concatenate  cl_abap_char_utilities=>byte_order_mark_little
*  output2
*  into output2 in byte mode.
  data: l_len type i.
  l_len = strlen( output ).
  response->set_cdata( data = output
  length = l_len ).
  navigation->response_complete( ).
Both examples work fine in my system.  Personally I would stick with Unicode if you could possibly need to support more than one language in your data.  The increase in data size will most likely be mostly offset by HTTP compression.

Similar Messages

  • Oracle Reports 9I generate output in excel

    Report Builder 9.0.4.0.33
    I tried generating output to Excel using 10GR2 Report builder using SPREADSHEET for destype on the web and it works.
    The requirement is for this one customer who is on 9I and they are asking for excel output functiuonality on thier existing reports.
    Does oracle has a patch or any other way to generate the exisitng reports on 91 where we can give them a selection like SPREADSHEET in the parameter screen and it would generate the report in excel.
    Thanks
    I tried by appending below to the url in the before report trigger.
    &mimetype=application/vnd.ms-excel
    which works but, we give other selections to the user too where they can change the desformat to PDF or HTMLCSS...and they all try to open the report output in excel.
    Edited by: Forms_Reports_Beginner on Oct 6, 2009 3:17 PM

    Thank you Lalitk and Dennis,
    My team mate wrote a javascript function on before report trigger that checks the paramter selection for desformat and append the mimetype accordingly.Hence, able to achieve the functionality.
    Thanks.

  • Not able to generate output in CSV(EXCEL) format

    Hi,
    XML Publisher report is giving me an error when the Preview Format is 'EXCEL'. When I keep the Preview Format as 'PDF', the concurrent program is running successfully and the PDF output is getting generated. But for EXCEL outputs, I am getting the following error :
    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.
    The operation completed successfully. Error processing resource 'http://erpap01:8010/OA_CGI/FNDWRR.exe?temp_id=1...
    <td valign="top" class="c7"><p class="c8"><span class="c9">13 July 2009  13:15:57 PM</span>...
    I have using the following Data Template for Data Definition
    <?xml version="1.0" encoding="UTF-8"?>
    <dataTemplate name="EMPDT" description="Employee Details" version="1.0">
    <parameters>
    <parameter dataType="character" name="p_DeptNo"> </parameter>
    </parameters>
    <dataQuery>
    <sqlStatement name="Q1">
    <![CDATA[SELECT EMPNO
                       ,ENAME
                       ,JOB
                       ,MGR
                       ,HIREDATE
                       ,DEPTNO
                       ,SAL
                       ,COMM
                 FROM scott.Emp
              WHERE deptno = NVL(:p_DeptNo,deptno)
         ]]>
    </sqlStatement>
    </dataQuery>
    <dataStructure>
    <group name="G_EMP" dataType="varchar2" source="Q1">
    <element name="EMPNO" value="EMPNO"/>
    <element name="ENAME" value="ENAME"/>
    <element name="JOB" value="JOB"/>
    <element name="MGR" value="MGR"/>
    <element name="HIREDATE" value="HIREDATE"/>
    <element name="DEPTNO" value="DEPTNO"/>
    <element name="SAL" value="SAL"/>
    <element name="COMM" value="COMM"/>
    </group>
    </dataStructure>
    </dataTemplate>
    When I click on Diagnostic - View XML, copy the XML file and generate report using Word plugin, I am able to generate output in PDF and in EXCEL. But for some reason, when I try to run the XML Publisher report using concurrent program, I am unable to generate output in EXCEL and I am getting the error as listed above.
    When I click on View Template - Preview, keeping the Preview format as Excel, I get the following error :
    Exception Detail
    java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor179.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at oracle.apps.xdo.common.xml.XSLT10gR1.invokeParse(XSLT10gR1.java:517)
    at oracle.apps.xdo.common.xml.XSLT10gR1.transform(XSLT10gR1.java:224)
    at oracle.apps.xdo.common.xml.XSLTWrapper.transform(XSLTWrapper.java:177)
    at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:1044)
    at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:997)
    at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:212)
    at oracle.apps.xdo.template.FOProcessor.createFO(FOProcessor.java:1657)
    at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:967)
    at oracle.apps.xdo.oa.schema.server.TemplateHelper.runProcessTemplate(TemplateHelper.java:5888)
    at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3438)
    at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3527)
    at oracle.apps.xdo.oa.template.server.TemplatesAMImpl.processTemplate(TemplatesAMImpl.java:2130)
    at sun.reflect.GeneratedMethodAccessor173.invoke(Unknown Source)
    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:190)
    at oracle.apps.fnd.framework.server.OAUtility.invokeMethod(OAUtility.java:153)
    at oracle.apps.fnd.framework.server.OAApplicationModuleImpl.invokeMethod(OAApplicationModuleImpl.java:749)
    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:587)
    at oracle.apps.fnd.framework.webui.OAWebBeanContainerHelper.processRequest(OAWebBeanContainerHelper.java:247)
    at oracle.apps.fnd.framework.webui.OAPageLayoutHelper.processRequest(OAPageLayoutHelper.java:1136)
    at oracle.apps.fnd.framework.webui.beans.layout.OAPageLayoutBean.processRequest(OAPageLayoutBean.java:1569)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:959)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
    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:959)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequestChildren(OAWebBeanHelper.java:926)
    at oracle.apps.fnd.framework.webui.OAWebBeanHelper.processRequest(OAWebBeanHelper.java:646)
    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:2335)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:1734)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:508)
    at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(OAPageBean.java:429)
    at oa_html._OA._jspService(_OA.java:85)
    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._OA._jspService(_OA.java:95)
    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)
    Caused by: oracle.xdo.parser.v2.XMLParseException: Start of root element expected.
    at oracle.xdo.parser.v2.XMLError.flushErrors1(XMLError.java:324)
    at oracle.xdo.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:319)
    at oracle.xdo.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:281)
    at oracle.xdo.parser.v2.XMLParser.parse(XMLParser.java:266)
    Any inputs would be appreciated
    Regards
    David

    May be it is browser problem? use another browser like Firefox
    Edited by: ranalawa on Jul 14, 2009 2:21 PM

  • Problem getting output in Excel

    Hi!
    I'm having problems with getting output in excel.
    I generated report that gives me xml and it was ok.
    Then I started concurrent to merge template and this xml and chosed Excel as output.
    When I try to open it in IE all I'm getting is
    End tag 'p' does not match the start tag 'a'. Error processing resource 'http://testserver.hlutrija.hr:8001/OA_CGI/FNDWRR.e...
    <td class="c2"><p class="c8"><a name="Text35" id="Text35"><a name="Text34" id="Text34"><span cla...
    When I try to view output from Firefox(it's more forgiving for incorrect xml then IE) it opened the whole document as a text (no xml, no excel but text - I saw that on a page info).
    Anyway I realized that indeed generated xml wasn't correct since one <a tag wasn't closed.
    But I tried to copy/paste to text editor and save as .xls file and it opened it OK.
    But this certainly isn't the solution you would wan't to offer to a client.
    On this instance XML is 5.0.
    I tried bunch of things to make it open directly in Excel (I believe that then it wouldn't have any problems - ie when I used preview on defining template it offered me to open or save in Excel and I got what I wanted).
    I tried to define Viewer Options (added applications/vnd.ms-excel for XML, HTML, Text Desc: Microsoft Excel), set the profile Viewer:Application for HTML/XML/Text to Microsoft Excel). But that didn't help either.
    I even tried defining new Profile -> Viewer:Application for Excel based on similar Profiles. But this also didn't help.
    Every time the result is the same both in IE(stops because of bad xml) and Firefox (I get bad xml recognized as text).
    On another instance I have xmlp v 5.6.2
    There I have some sample report and sample template.
    When I there try to open output in Firefox once again I get xml recognized as text.
    When I try to open in IE(7.0) I get a page that looks like html in browser.On the Page file menu I have option to edit in Excel. When I choose that it opens Excel but instead of this same page I only get: Authentication failed.
    When I try to save this page it offers me only web formats (whole web page...). But nevertheless I tell it to save like test.xls. It saves ok. But when I try to open it. Excel starts but again all I get is: Authentication failed.
    When I open this in text editor it has only:
    From: <Saved by Windows Internet Explorer 7>
    Subject:
    Date: Thu, 30 Aug 2007 14:28:37 +0200
    MIME-Version: 1.0
    Content-Type: text/html;
         charset="iso-8859-2"
    Content-Transfer-Encoding: 7bit
    X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
    Content-Location: http://server.client.hr:8002/OA_CGI/FNDWRR.exe?temp_id=3132885517
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META http-equiv=Content-Type content="text/html; charset=iso-8859-2">
    <META content="MSHTML 6.00.6000.16525" name=GENERATOR></HEAD>
    <BODY><PRE>Authentication failed.
    </PRE></BODY></HTML>
    I really don't have any more ideas.
    I've searched this forum, metalink, web, but nothing yet helped.
    Can anyone help?

    Is your xml file being generated correctly?
    For the request that you submitted, click the 'View Details' button. If the 'View XML' button is enabled, click that and it will open your XML in a new browser.
    If it's not enabled, the request needs to be changed so its output is XML.
    Not sure if this will help, but at least it will eliminate that there is anything wrong with the file or data.
    Janel

  • Down Loading ALV Output to Excel Sheet

    Hi All,
    I am working on Vendor Line Items Report which have both Header details as well as line item details.
    So i developed Heirarical ALV to display the output and it is working fine.But my problem is Downloading output to Excel sheet functionality is not working.
    In output screen LIST->EXPORT->SPREADSHEET functionality is not working.
    Please give me suggestions regarding the same or is there any another way to do the same by using ALV List Display.
    Points will be rewarded
    Thanks and Regards,
    Siva.

    hi ,
    this is a working example check this...
    REPORT  zvenkattest0.
    TABLES:pa0002,pa0008.
    TYPE-POOLS:slis.
    CONSTANTS:c VALUE 'X'.
    DATA:BEGIN OF it_pa0008 OCCURS 0,
         pernr LIKE pa0008-pernr,
         begda LIKE pa0008-begda,
         endda LIKE pa0008-endda,
         preas LIKE pa0008-preas,
         ansal LIKE pa0008-ansal,
         lga01 LIKE pa0008-lga01,
         expand TYPE xfeld,
         END OF it_pa0008.
    DATA:BEGIN OF it_pa0002 OCCURS 0,
         pernr LIKE pa0002-pernr,
         vorna LIKE pa0002-vorna,
         nachn LIKE pa0002-nachn,
         gbdat LIKE pa0002-gbdat,
         gblnd LIKE pa0002-gblnd,
         sprsl LIKE pa0002-sprsl,
         perid LIKE pa0002-perid,
         END OF it_pa0002.
    DATA: wa_field_cat TYPE slis_fieldcat_alv,
          it_field_cat TYPE slis_t_fieldcat_alv,
          wa_keyinfo TYPE slis_keyinfo_alv,
          it_layout TYPE slis_layout_alv.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:s_pernr FOR pa0002-pernr NO INTERVALS.
    SELECTION-SCREEN: SKIP.
    PARAMETERS:p_expand AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN END OF BLOCK b1.
    START-OF-SELECTION.
    PERFORM select_data.
    PERFORM build_field_cat.
    PERFORM disply_data.
    *&      Form  SELECT_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM select_data .
    SELECT pernr
           begda
           endda
           preas
           ansal
           lga01
           FROM pa0008
           INTO CORRESPONDING FIELDS OF TABLE it_pa0008
           UP TO 10 ROWS.
    IF NOT it_pa0008[] IS INITIAL.
    SELECT pernr
           vorna
           nachn
           gbdat
           gblnd
           sprsl
           perid
           FROM pa0002
           INTO CORRESPONDING FIELDS OF TABLE it_pa0002
           FOR ALL ENTRIES IN it_pa0008
           WHERE pernr = it_pa0008-pernr.
    ENDIF.
    SORT it_pa0008 BY pernr.
    ENDFORM.                    " SELECT_DATA
    *&      Form  BUILD_FIELD_CAT
          text
    -->  p1        text
    <--  p2        text
    FORM build_field_cat .
        wa_field_cat-tabname = 'PA0008'.
        wa_field_cat-fieldname = 'PERNR'.
        wa_field_cat-seltext_l = 'personnelno'.
        APPEND wa_field_cat TO it_field_cat.
        wa_field_cat-tabname = 'PA0008'.
        wa_field_cat-fieldname = 'BEGDA'.
        wa_field_cat-seltext_l = 'begindate'.
        APPEND wa_field_cat TO it_field_cat.
        wa_field_cat-tabname = 'PA0008'.
        wa_field_cat-fieldname = 'ENDDA'.
        wa_field_cat-seltext_l = 'enddate'.
        APPEND wa_field_cat TO it_field_cat.
        wa_field_cat-tabname = 'PA0008'.
        wa_field_cat-fieldname = 'PREAS'.
        wa_field_cat-seltext_l = 'reason'.
        APPEND wa_field_cat TO it_field_cat.
        wa_field_cat-tabname = 'PA0008'.
        wa_field_cat-fieldname = 'ANSAL'.
        wa_field_cat-seltext_l = 'annualsalary'.
        APPEND wa_field_cat TO it_field_cat.
        wa_field_cat-tabname = 'PA0008'.
        wa_field_cat-fieldname = 'LGA01'.
        wa_field_cat-seltext_l = 'wagetype'.
        APPEND wa_field_cat TO it_field_cat.
        wa_field_cat-tabname = 'PA0002'.
        wa_field_cat-fieldname = 'VORNA'.
        wa_field_cat-seltext_l = 'firstname'.
        APPEND wa_field_cat TO it_field_cat.
        wa_field_cat-tabname = 'PA0002'.
        wa_field_cat-fieldname = 'NACHN'.
        wa_field_cat-seltext_l = 'lastname'.
        APPEND wa_field_cat TO it_field_cat.
        wa_field_cat-tabname = 'PA0002'.
        wa_field_cat-fieldname = 'GBDAT'.
        wa_field_cat-seltext_l = 'birhtdate'.
        APPEND wa_field_cat TO it_field_cat.
        wa_field_cat-tabname = 'PA0002'.
        wa_field_cat-fieldname = 'GBLND'.
        wa_field_cat-seltext_l = 'birthcountry'.
        APPEND wa_field_cat TO it_field_cat.
        wa_field_cat-tabname = 'PA0002'.
        wa_field_cat-fieldname = 'SPRSL'.
        wa_field_cat-seltext_l = 'languageused'.
        APPEND wa_field_cat TO it_field_cat.
        wa_field_cat-tabname = 'PA0002'.
        wa_field_cat-fieldname = 'PERID'.
        wa_field_cat-seltext_l = 'personnelid'.
        APPEND wa_field_cat TO it_field_cat.
    ENDFORM.                    " BUILD_FIELD_CAT
    *&      Form  DISPLY_DATA
          text
    -->  p1        text
    <--  p2        text
    FORM disply_data .
      it_layout-group_change_edit = c.
      it_layout-colwidth_optimize = c.
      it_layout-zebra             = c.
      it_layout-detail_popup      = c.
      it_layout-get_selinfos      = c.
      IF p_expand = c.
      it_layout-expand_fieldname  = 'EXPAND'.
      ENDIF.
      wa_keyinfo-header01 = 'PERNR'.
      wa_keyinfo-item01 = 'PERNR'.
    wa_keyinfo-item02 = 'SUBTY'.
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
        EXPORTING
          i_callback_program      = sy-cprog
          is_layout               = it_layout
          it_fieldcat             = it_field_cat
          i_tabname_header        = 'PA0008'
          i_tabname_item          = 'PA0002'
          is_keyinfo              = wa_keyinfo
        TABLES
          t_outtab_header         = it_pa0008
          t_outtab_item           = it_pa0002.
    ENDFORM.                    " DISPLY_DATA
    regards,
    venkat.

  • Problems in generating excel output

    Hi all,
    I'm facing a problem submitting a report with XML output (XML Publisher 5.0.1). I created a RTF template in order to generate an excel output but when I launch the concurrent, its status after few minutes becomes "Warning" logging java.lang.OutOfMemoryError. The strangest thing is that the PDF output generates normally without errors or warnings.
    I've found on metalink a note in which they suggest to create a configuration file (xdo.cfg) where i've declared a temporary folder in order to split the XML in two parts to allow the XDO to create correctly my excel output....but it didnt work! :(
    After that I added to my concurrent execution options the string "-Xmx512m" to increase the memory for that particular task (even if i think that 128 mb for a XML file of 5 MB are more than necessary)... but no results (in this case i've had another error "java.io.FileNotFoundException: /opt/app/oracle//admin/out//o2260792.out (No such file or directory)" ).
    Can someone help me??
    Is it a normal behaviour?? It seems to be a joke, cause in metalink they suggest everybody to apply patches and patches!!
    Thx all

    Hi Nisha,
    Refer to that link.....May be it will helpful for you....
    Are You All Able to get the Output In EXCEL Format
    Otherwise you can do one thing......Add one more Viewer option for XML type data... Most probably earlier For viewing the XML data you are using Browser... So by default whenever you are trying to see the output it is opening it in Browser....
    Now add one more Viewer option For XML as Microsoft Excel......
    So After making two viewer option for XML data whenever you will try to see the output of XML data it will ask you...Viewing option...1.Browser 2. Excel
    Choose Excel here it will not give you any error and you will be able to open the output in Excel format.....
    Regards
    Ravi

  • Problem to display a negative number in XML Publisher output in excel

    Hi All,
    I am facing problem in displaying a negative number in XML Publisher output in excel.
    My requirement is that I have to display a negative number in brackets when the output is taken in excel format. Eg: If the value is -123 then i have to display it as (123).
    I have put these brackets using a formula column in the RDF, but it is the default functionality of excel that whenever there is a number in brackets then it automatically displays that as a negative value.
    Can anyone please help me how I can display this negative number within brackets and not as a negative digit. Is there any special tag or is there any formula which can be used to convert this into text and written in the Help text of RTF template.
    This is very urgent. If someone knows please reply asap.
    Regards,
    Shruti

    This is very urgent. If someone knows please reply asap.We are all volunteers here, so no ones questions are more urgent then other ones.
    If its that urgent it would have helped if you had chosen the correct forum to ask your question BI Publisher

  • Problem while downloading the alv output to excel file.

    Hii,
    While downloading the alv output to an excel file i am facing a problem. Either the output comes as 1.23456E+11 or the values get cut .
    Cant put in txt file  as the users require to calculate directy and i have even tried to increase the output length .But both doesnt help.
    So what are the other ways to do so.
    Edited by: mansi_v27 on Mar 24, 2010 12:35 PM

    Hi,
    Welcome to SCN!!!.
    Please go through the forum rules. This has been discussed many times. You can search in the forum for this.
    Infact there is no problem. Just expand that excel cell. You can see the full value. This is standard excel property.
    Thanks,
    Vinod.

  • Can we generate output of a report in an Excel Sheet?

    Hi All,
      Can anyone tell me how to generate output of a report in an Excel Sheet format?
    Thanks in advance,
    Jasmine.

    hi,
    try this sample...
    data: begin of itab occurs 0,
          vbeln like vbak-vbeln,
          posnr like vbap-posnr,
          end of itab.
    select vbeln
           posnr
           from vbap
           up to 20 rows
           into table itab.
    * EXCEL sheet using OLE automation.
    INCLUDE OLE2INCL.
    * handles for OLE objects
    DATA: H_EXCEL TYPE OLE2_OBJECT,        " Excel object
          H_WORK  TYPE OLE2_OBJECT,
          H_SHEET TYPE OLE2_OBJECT,
          H_CELL  TYPE OLE2_OBJECT,
          V_COL   LIKE SY-TABIX.     " column number of the cell
    DATA:
      V_STEP(30),
      V_FILE LIKE RLGRAP-FILENAME.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Creating Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * start Excel
      V_STEP = 'Starting Excel'.
      CREATE OBJECT H_EXCEL 'EXCEL.APPLICATION'.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_EXCEL  'Visible' = 1.
      CALL METHOD OF H_EXCEL 'APPEND'
        EXPORTING  #1 = 'D:SappdfABAP Trainingsheettr.xls'.
    *  PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * Get the list of workbooks
      V_STEP = 'Preaparing Excel'.
      CALL METHOD OF H_EXCEL 'WORKBOOKS' = H_WORK.
      PERFORM ERR_HDL.
    ** Add new workbook (create a file)
      CALL METHOD OF H_WORK 'ADD'.
      PERFORM ERR_HDL.
    * Get the created worksheet
    ************************Sheet Number
      CALL METHOD OF H_EXCEL 'WORKSHEETS' = H_SHEET EXPORTING #1 = 3.
    ************************Sheet Number
      PERFORM ERR_HDL.
    * Activate (select) the first sheet
      CALL METHOD OF H_SHEET 'ACTIVATE'.
      PERFORM ERR_HDL.
    * tell user what is going on
      CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
         EXPORTING
    *           PERCENTAGE = 0
               TEXT       = 'Adding Data to Excel...'
           EXCEPTIONS
                OTHERS     = 1.
    * output column headings to active Excel sheet
      V_STEP = 'Adding data to Excel'.
      LOOP AT ITAB.
        V_COL = SY-TABIX.
        PERFORM FILL_CELL USING 1 V_COL ITAB-vbeln.
        PERFORM FILL_CELL USING 2 V_COL ITAB-posnr.
      ENDLOOP.
      V_STEP = 'Releasing Excel'.
      FREE OBJECT H_EXCEL.
      PERFORM ERR_HDL.
      H_EXCEL-HANDLE = -1.
    *&      Form  ERR_HDL
    *       text
    *  -->  p1        text
    FORM ERR_HDL.
      IF SY-SUBRC <> 0.
        WRITE: / 'Error in processing Excel File:', V_STEP.
        STOP.
      ENDIF.
    ENDFORM.                    " ERR_HDL
    *&      Form  FILL_CELL
    *       text
    *      -->P_1      text
    *      -->P_1      text
    *      -->P_1      text
    FORM FILL_CELL USING  ROW COL VAL.
      CALL METHOD OF H_EXCEL 'Cells' = H_CELL
                     EXPORTING #1 = ROW #2 = COL.
      PERFORM ERR_HDL.
      SET PROPERTY OF H_CELL 'Value' = VAL .
      PERFORM ERR_HDL.
    ENDFORM.                    " FILL_CELL
    regards
    satesh

  • Facing problem while downloading ALV grid Output into Excel

    Hi Guys,
    I am facing problem while downloading ALV grid Output into Excel.
    It is downloading into excel, but all character columns first and next all quantity columns it is displaying. But I need columns order as it is in the grid.
    If I take all columns as characters it works fine. But it will be problem for calculating total, subtotals of quantity columns
    Can someone help me regarding this
    thanks for your help

    Hi,
    Open up Excel on your desktop. Goto Tools > Macro > Security.
    Make sure that your security is set to Medium (or less). SAP uses OLE automation to run the Excel instance and in Office 2003 (for example), Microsoft has increased their default security setting to High. With the High setting, the output to Excel fails.
    Was this your problem? Don't forget those points, either.
    check with this wetther it is solved or not.
    Regards,
    sana.

  • How to Generate HTML Report Output in Excel

    Dear Experts,
    How to convert HTML report output in Excel.
    I have reports which output is coming in HTML format & the same I want to use in Excel.
    So tell me how I can covert the same in Excel.
    Thanks
    Sudhir

    hello,
    in your case, you might want to make the following :
    a) use DESFORMAT=HTML
    b) use MIMETYPE=application/vnd.msexcell (or whatever mimetype your excel application is bound to)
    i am nor sure if excel will understeand our HTMLCSS (which is actually HTML4.0 using layers for best possible rendering of the paper page in the browser).
    regards,
    the oracle reports team

  • Problem when dowloading the ALV report output to Excel Sheet.

    Hi ,
    I am dowloading the ALV report output to Excel Sheet.
    There is field Condition Unit(KOMP-KMEIN) in the output of the ALV, this has values PC and CSE , but when I download to Excel Sheet, CSE is appearing as CSE ,but PC is appearing as ******.
    Can you please help me in knowing the reson for this.
    Regards,
    Madhu.

    hi
    refer to following link
    http://www.****************/Tutorials/ALV/ColorSALV/Demo.htm
    http://www.sap-img.com/abap/download-to-excel-with-format-border-color-cell-etc.htm
    Cheers
    Snehi
    Edited by: snehi chouhan on Jul 11, 2008 12:42 PM

  • Problem in Download ALV Output to Excel

    Hi All,
    When iam going to Download the ALV ( Grid ) Output to Excel, all columns are not coming in Output.
    But the ALV Output Contains 140 Columns.
    How to solve this issue.
    Points Rewarded.
    Thanks & Regards,
    Kiran . I

    Hi,
    You can download the report by going to menu option
    List->export->local file.. in this select spreadsheet and give the name for this to download.
    You can view all the columns here in xls sheet.
    Regards,
    Ram Mohan
    Pls reward poins if useful...

  • 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

  • Issue in output of excel

    Hi All,
    In xml file the german letters are printing proper way.
    come to excel output.. in place of german letters it shows junk characters.
    Even I checked thru xml publsiher desktop tool the output is printing well.
    Issue: The german letters are not printing well but xml is generated with german letters..
    I think it might be issue with printing thru apps
    is there any thing related to FONT in RTF?
    Please any one can help me in this..
    Thanks

    Hi Ananth,
    Thanks for quick reply.
    I gone thru the link, but I did not get much information..
    in xml the data is like: MÜNCHEN ---- showing perfect in XML as same as DB
    in Excel it is showing as: MÃ?NCHEN.----- problem in output in EXCEL
    Please help me out.
    Thanks,
    Edited by: user633508 on Dec 1, 2010 7:00 PM
    Edited by: user633508 on Dec 1, 2010 7:01 PM

Maybe you are looking for