Error while downloading data into excel file.

Hi,
    I have a requirement to download data available in xstring to excel file.
I have a RFC which has export parameter 'file_data' of type xstring. When i call RFC
from web dynpro abap application it gives data out pout in xstring format.
I am opening excel file using that xstring data as below
cl_wd_runtime_services=>attach_file_to_response(
i_filename = 'file.xls'
i_content = ls_data_source-data_source   ***[xstring data from RFC]
i_mime_type = 'x-excel/application'
i_in_new_window = abap_true ).
But excel file not coming in correct format. its  giving an error while download
excel file
Error is
      " the file you are trying to open , 'file[1].xls', is in a different format than
specified by the file extension. Verify that the file is not corrupted and is from
a trusted source before opening the file. Do you want to open the file now? "
If i click on 'YES' button file opening but not in proper excel format. Data is coming
in tab delimiter format in excel file.
Please suggest any solution for this problem.
Thanks,
Venkat.

Hi Thomas,
Following is the logic implemented in RFC which is giving XSTRING as export parameter
STEP1      create a dynamic internal table
           Create field catalog for the table   using LVC_FIELDCATALOG_MERGE
               CALL METHOD cl_alv_table_create=>create_dynamic_table
                    EXPORTING
                       it_fieldcatalog = it_fieldcat
                     IMPORTING
                       ep_table        = dyn_table.
              CREATE  EXCEL SHEET BY SENDING FIELD CATALOG AND DATA TAB
STEP2 # Convert text table to xstring.
        CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'
          IMPORTING
            buffer   = l_content
          TABLES
            text_tab = lt_data_tab
          EXCEPTIONS
            failed   = 1
            OTHERS   = 2.
STEP3  *# Psss Data to Netweaver
          PERFORM pass_data_to_nw USING is_import
                                  CHANGING es_attachment_metadata.

Similar Messages

  • Problem in Download data into Excel File

    Hi Friends,
    I have one doubt on WDJ.
             I have got the data from the Back and display the data into Table UI Element. Depending upon po_status equals to OA Pending that time conf_Ship_date Column is Empty. That time we can Select All Checkbox Click on Download Button Excel file is not download. Why it not download? Conf_Ship_date Column is Empty. Conf_Ship_date Column is data available that time data download into Excel File.
    My Req: if Conf_Ship_date Column is empty that time click on Download that data will download in to Excel. In Excel Conf_Ship_date Column will display in NULL or 00.00.0000 Like this also.
    Code:ExcelEle.setConf_Shp_Date(StockEle.getConf_Shp_Date()); 
    This means I am getting date from PoDetails_OutTab(StockEle)this node and add this date to PoDetails_ExcelData(ExcelEle) this node.Finally the date will available in PoDetails_ExcelData this node. By Using this node I will download data.
    How to do this work?
    Regards
    Vijay

    Hi Arun,
    For Example in Table 4 rows and 14 columns data is available. Select all check boxes click on download button total 4 rows and 14 columns data is downloaded.
    Table 4 rows and 14 columns data is available. But in some cells data not available in that time I m getting null values from ECC System. That time I am not able to download.
    In Particularly this problem I am getting only date colums.
    So now I have develop this code
    public void onActiondownloadToExcel(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActiondownloadToExcel(ServerEvent)
         IPrivatePO_Details_ResultView.IPoDetails_ExcelDataNode ExcelNode = wdContext.nodePoDetails_ExcelData();
         IPrivatePO_Details_ResultView.IPoDetails_ExcelDataElement ExcelEle; 
         IPrivatePO_Details_ResultView.IPoDetails_OutTabNode StockNode = wdContext.nodePoDetails_OutTab();
         IPrivatePO_Details_ResultView.IPoDetails_OutTabElement StockEle ;
         for(int i = 0 ;i<StockNode.size();i++)
         StockEle = StockNode.getPoDetails_OutTabElementAt(i);
         if(StockEle.getCheckBox()== true)
         ExcelEle = ExcelNode.createPoDetails_ExcelDataElement();// Create Element
         if(StockEle.getConf_Shp_Date()==null)
         java.sql.Date deliverydate1=new java.sql.Date(0,0,0);
         ExcelEle.setConf_Shp_Date(deliverydate1);
         else
         ExcelEle.setConf_Shp_Date(StockEle.getConf_Shp_Date()); 
    By using this code i have to download total Records but in this Conf_Shp_Date colums i am getting 31-12.1899 this output in Excel. But i need in Excel to print Null or 00.00.0000 like
         ExcelEle.setQuantity(StockEle.getQuantity());
         ExcelEle.setDeliv_Date(StockEle.getDeliv_Date());
         if(StockEle.getExpt_Shp_Date()==null)
         java.sql.Date deliverydate2=new java.sql.Date(0,0,0);
         ExcelEle.setExpt_Shp_Date(deliverydate2);
         else
         ExcelEle.setExpt_Shp_Date(StockEle.getExpt_Shp_Date());
         ExcelEle.setVendor_Material(StockEle.getVendor_Material());
         ExcelNode.addElement(ExcelEle);
         if(ExcelNode.size()>0)
         wdThis.wdGetCO_POPendingController().downloadData(wdContext.nodePoDetails_ExcelData());// This is for Downalod data Method
         wdThis.wdGetCO_POPendingController().DownLoadToExcel();// This is for Open Popup Window
         wdContext.nodePoDetails_ExcelData().invalidate();
         else
         wdComponentAPI.getMessageManager().reportException("Please select any one po item from the table",true);
        //@@end
    Regards
    Vijay
    Edited by: KalluriVijay on May 18, 2010 10:05 AM

  • Error while exporting data into Excel Sheet

    Hi All,
    I have created a VO which is based on Query(Not based on EO) and the Query is as follows:
    select f.user_name ,
    f.description ,
    a.currency_code,
    a.amount_to ,
    a.amount_from
    from seacds.ar_approval_user_limits_nv a , seacds.fnd_user_nv f
    where f.user_id = a.user_id
    and a.document_type = 'CM'
    order by 2;
    Based on this VO I have created a search page which will search and returns data from the table and finally standard export button will export the data into excel sheet.
    In this am searching the data based on above 5 attributes. Without entering anything in the messageTextInput if i am clicking GO button, it is returning all the data into the table region. After this if i click on Export Button, data are getting exported into Excel Sheet. It is fine.
    But if i am searching the data by entering any value in any of the messageTextInput, it is returning data. But if i am clicking the Export Button then it is throwing the following error:
    Exception Details.
    oracle.apps.fnd.framework.OAException: oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT * FROM (select f.user_name ,
    f.description ,
    a.currency_code,
    a.amount_to ,
    a.amount_from
    from seacds.ar_approval_user_limits_nv a , seacds.fnd_user_nv f
    where f.user_id = a.user_id
    and a.document_type = 'CM'
    order by 2) QRSLT WHERE (( UPPER(CURRENCY_CODE) like UPPER(:1) AND (CURRENCY_CODE like :2 OR CURRENCY_CODE like :3 OR CURRENCY_CODE like :4 OR CURRENCY_CODE like :5))) ORDER BY DESCRIPTION asc
         at oracle.apps.fnd.framework.OAException.wrapperException(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.prepareException(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageErrorHandler.processErrors(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.processFormRequest(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at oracle.apps.fnd.framework.webui.OAPageBean.preparePage(Unknown Source)
         at OA.jspService(_OA.java:71)
         at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
         at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:462)
         at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594)
         at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:713)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370)
         at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453)
         at com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122)
         at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111)
         at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
         at java.lang.Thread.run(Thread.java:595)
    ## Detail 0 ##
    java.sql.SQLException: Invalid column type
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:138)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:175)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:240)
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7895)
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7572)
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:8183)
         at oracle.jdbc.driver.OraclePreparedStatement.setObjectAtName(OraclePreparedStatement.java:8206)
    Kindly give me any idea to clear this error.
    Thanks and Regards,
    Myvizhi

    Hi Myvizhi ,
    Did you try running the query from back end that got generated in the error trace ? see if that query is returning desired
    output .
    Also would like to know if you are using oracle standard search mode i.e result based search / auto customization search ?
    --Keerthi                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Function module to download data into excel file

    Hi Friends,
    Please tell me the function module name which popsup a popup box to specify a filename and the location and when clicking on the OK button, the file should be downloaded to the specified location.
    I need it ASAP.
    Thanks,
    Jaffer Ali.S

    Hi Shamshudeen,
    You have to use two funtion modules to acheive this.
    1. To get the file path from user.
    2. To download the excel sheet in prescribed path.
    For 1 use following code
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fpath .
        CALL FUNCTION 'F4_FILENAME'
         EXPORTING
           program_name        = syst-cprog
           dynpro_number       = syst-dynnr
      FIELD_NAME          = ' '
         IMPORTING
           file_name           = p_fpath  .
    The file path will be stored in p_fpath.
    Now use GUI_DOWNLOAD function module and pass the file name p_fpath to it along with filetype as .xls
    Hope this helps you.
    Thanks,
    Arun

  • Error While Uploding data from Excel File

    I try to upload data directly from Xlfile to Internal table.I have used the foll function module
    ALSM_EXCEL_TO_INTERNAL_TABLE
    and it's working nicely when i run the program from R/3.
    My Question is ,if i access the same program from ITS ,no record is uploaded .
    Any help will be much appreciated .
    Rgds,
    J.

    Hi,
    try with this sample code.
    at selection-screen on value-request for p_file.
      call function 'F4_FILENAME'
           exporting
                field_name = 'p_file'
           importing
                file_name  = p_file.
    start-of-selection.
      clear itab.
      call function 'WS_UPLOAD'
           exporting
                codepage                = ' '
                filename                = p_file
                filetype                = 'DAT'
           tables
                data_tab                = itab
           exceptions
                conversion_error        = 1
                file_open_error         = 2
                file_read_error         = 3
                invalid_type            = 4
                no_batch                = 5
                unknown_error           = 6
                invalid_table_width     = 7
                gui_refuse_filetransfer = 8
                customer_error          = 9
                others                  = 10.
      if sy-subrc ne 0.
        message e000 with text-e01.
        stop.
      endif.
    I hope it will work for you.
    Thanks.

  • Error while downloading report into CSV or EXCEL

    Hi All,
    I am facing a strange problem while downloading data in excel or CSV format. I have created a report that is nothing but output of direct database request. The report is running fine and able to download data but since yesterday it is throwing error: -
    [nQSError: 17001] Oracle Error code: 1455, message: ORA-01455: converting column overflows integer datatype at OCI call OCIStmtFetch.
    [nQSError: 17012] Bulk fetch failed.
    Sometimes it starts download and after fetching some data it throws this error. The report is bulky and generally it brings around 40 k rows.
    Can anybody faces this error or have any idea about this. Please give some suggestion as I have searched it but not reached to any conclusion. Thanks in advance.
    Thanks
    Ashok

    Hi Thomas,
    Following is the logic implemented in RFC which is giving XSTRING as export parameter
    STEP1      create a dynamic internal table
               Create field catalog for the table   using LVC_FIELDCATALOG_MERGE
                   CALL METHOD cl_alv_table_create=>create_dynamic_table
                        EXPORTING
                           it_fieldcatalog = it_fieldcat
                         IMPORTING
                           ep_table        = dyn_table.
                  CREATE  EXCEL SHEET BY SENDING FIELD CATALOG AND DATA TAB
    STEP2 # Convert text table to xstring.
            CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'
              IMPORTING
                buffer   = l_content
              TABLES
                text_tab = lt_data_tab
              EXCEPTIONS
                failed   = 1
                OTHERS   = 2.
    STEP3  *# Psss Data to Netweaver
              PERFORM pass_data_to_nw USING is_import
                                      CHANGING es_attachment_metadata.

  • ClassNotFoundException: while exporting data into excel sheet

    Hi Experts,
    While exporting data into excel sheet below error was getting even i am created jar file DC and publicpart AND j2ee
    I have to deployed the JAR files on the server:
    1. Created "External Library DC"
    2. added my JAR files into "Libraries" folder.
    3. Exposed them as Public Part.
    4. Created "J2EE Library DC"
    5. Refered "External Library DC" into J2EE Library DC.
    6. Deployed "J2EE Library DC"
    7. and lastly refered this on my Web Dynpro DC by giving Library Reference.
    but still this is the errro was getting, plz any one can help regarding this what could be the problem
    java.lang.ClassNotFoundException: org.apache.poi.hssf.usermodel.HSSFWorkbook -
    Loader Info -
    ClassLoader name: [ng.com/Reuse_Export_to_Excel] Parent loader name: [Frame ClassLoader] References: common:service:http;service:servlet_jsp service:ejb common:service:iiop;service:naming;service:p4;service:ts service:jmsconnector library:jsse library:servlet common:library:IAIKSecurity;library:activation;library:mail;library:tcsecssl library:ejb20 library:j2eeca library:jms library:opensql common:library:com.sap.security.api.sda;library:com.sap.security.core.sda;library:security.class;library:webservices_lib;service:adminadapter;service:basicadmin;service:com.sap.security.core.ume.service;service:configuration;service:connector;service:dbpool;service:deploy;service:jmx;service:jmx_notification;service:keystore;service:security;service:userstore interface:resourcecontext_api interface:webservices interface:cross interface:ejbserialization sap.com/tcwddispwda sap.com/tcwdcorecomp service:webdynpro service:sld library:tcddicddicservices library:com.sap.aii.proxy.framework library:tcgraphicsigs library:com.sap.mw.jco library:com.sap.lcr.api.cimclient library:sapxmltoolkit library:com.sap.aii.util.rb library:com.sap.util.monitor.jarm library:tcddicddicruntime library:com.sap.aii.util.xml library:com.sap.aii.util.misc library:tccmi Resources: /usr/sap//JC21/j2ee/cluster/server0/apps/ng.com/Reuse_Export_to_Excel/src.zip /usr/sap//JC21/j2ee/cluster/server0/apps/ng.com/Reuse_Export_to_Excel/webdynpro/public/lib/ng.comReuse_Export_to_Excel.jar Loading model: {parent,references,local} -
    Regards,
    Varma

    closed

  • To download data into csv file format

    Hi All
    I have to download data into csv file format. I use the FM
    GUI_DOWNLOAD and gave the filename text.csv. But data is stored in excel
    file in place of csv file.
    Can anyone tell me what should i do to load the data into csv file or any other function module should used?
    Regards

    see this sample code
    REPORT  YSG_MATSTK_REPT    LINE-SIZE 220
                               LINE-COUNT 50(5).
    *&                       DATA DECLARATION                              *
    TABLES: MARA,                      "GENERAL MASTER DATA
            MARC,                      "PLANT DATA FOR MATERIAL
            MARD,                      "STORAGE LOCATION DATA FOR MATERIAL
            MVKE,                      "SALES DATA FOR MATERIAL
            MAKT,                      "MATERIAL DESCRIPTION
            EKKO,                      "PURCHASING DOCUMENT HEADER
            EKPO,                      "PURCHASING DOCUMENT ITEM
            VBAK,                      "SALES DOCUMENT HEADER DATA
            VBAP.                      "SALES DOCUMENT ITEM DATA
    TYPE-POOLS : SLIS.
    DATA: VT_FIELDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
          V_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
          V_LAYOUT TYPE SLIS_LAYOUT_ALV,
          BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,
          BEGIN OF I_MARA OCCURS 0,
             MATNR LIKE MARA-MATNR,  "MATERIAL NUMBER
             MBRSH LIKE MARA-MBRSH,  "INDUSTRY SECTOR
             MEINS LIKE MARA-MEINS,  "BASE UNIT OF MEASURE
             MATKL LIKE MARA-MATKL,  "MATERIAL GROUP
          END OF I_MARA,
          BEGIN OF I_MARC OCCURS 0,
             MATNR LIKE MARC-MATNR,  "MATERIAL NUMBER
             WERKS LIKE MARC-WERKS,  "PLANT
             LVORM LIKE MARC-LVORM,  "FLAG MATERIAL FOR DELETION AT PLANT
                                     "LEVEL
             DISPO LIKE MARC-DISPO,  "MRP CONTROLLER
          END OF I_MARC,
          BEGIN OF I_MAKT OCCURS 0,
             MATNR LIKE MAKT-MATNR,  "MATERIAL NUMBER
             MAKTX LIKE MAKT-MAKTX,  "MATERIAL DESCRIPTION
             SPRAS LIKE MAKT-SPRAS,  "LANGUAGE KEY
          END OF I_MAKT,
          BEGIN OF I_MVKE OCCURS 0,
             MATNR LIKE MVKE-MATNR,  "MATERIAL NUMBER
             VKORG LIKE MVKE-VKORG,  "SALES ORGANIZATION
             VTWEG LIKE MVKE-VTWEG,  "DISTRIBUTION CHANNEL
          END OF I_MVKE,
          BEGIN OF I_MARD OCCURS 0,
            MATNR LIKE MARD-MATNR,  "MATERIAL NUMBER
            LGORT LIKE MARD-LGORT,  "STORAGE LOCATION
            LABST LIKE MARD-LABST,  "VALUATED STOCK WITH UNRESTRICTED USE
          END OF I_MARD,
          BEGIN OF I_EKPO OCCURS 0,
            EBELN LIKE EKPO-EBELN,  "PURCHASING DOCUMENT NUMBER
            EBELP LIKE EKPO-EBELP,  "ITEM NUMBER OF PURCHASING DOCUMENT
            MATNR LIKE EKPO-MATNR,  "MATERIAL NUMBER
          END OF I_EKPO,
          BEGIN OF I_VBAP OCCURS 0,
            VBELN LIKE VBAP-VBELN,  "SALES DOCUMENT
            POSNR LIKE VBAP-POSNR,  "SALES DOCUMENT ITEM
            MATNR LIKE VBAP-MATNR,  "MATERIAL NUMBER
          END OF I_VBAP,
          BEGIN OF I_OUT OCCURS 0,
            MATNR LIKE MARC-MATNR,
            WERKS LIKE MARC-WERKS,
            LVORM LIKE MARC-LVORM,
            DISPO LIKE MARC-DISPO,
            MBRSH LIKE MARA-MBRSH,
            MEINS LIKE MARA-MEINS,
            MATKL LIKE MARA-MATKL,
            VKORG LIKE MVKE-VKORG,
            VTWEG LIKE MVKE-VTWEG,
            SPRAS LIKE MAKT-SPRAS,
            MAKTX LIKE MAKT-MAKTX,
            LGORT LIKE MARD-LGORT,
            LABST LIKE MARD-LABST,
            EBELN LIKE EKPO-EBELN,
            EBELP LIKE EKPO-EBELP,
            VBELN LIKE VBAP-VBELN,
            POSNR LIKE VBAP-POSNR,
          END OF I_OUT,
          BEGIN OF I_HEADING OCCURS 0,
            TEXT1(20),
            TEXT2(20),
            TEXT3(20),
            TEXT4(20),
            TEXT5(20),
            TEXT6(20),
            TEXT7(20),
            TEXT8(20),
            TEXT9(20),
            TEXT10(20),
            TEXT11(40),
            TEXT12(20),
            TEXT13(20),
            TEXT14(20),
            TEXT15(20),
            TEXT16(20),
            TEXT17(20),
          END OF I_HEADING.
    *&                   S E L E C T I O N - S C R E E N                   *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-100.
    SELECT-OPTIONS: S_MATNR FOR MARA-MATNR. "OBLIGATORY.
    PARAMETERS: P_WERKS LIKE MARC-WERKS. "OBLIGATORY.
    SELECT-OPTIONS: S_LGORT FOR MARD-LGORT,
                    S_DISPO FOR MARC-DISPO,
                    S_EBELN FOR EKPO-EBELN .
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-101.
    PARAMETERS : RB1 RADIOBUTTON GROUP G1,
                 RB2 RADIOBUTTON GROUP G1,
                 RB3 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN END OF BLOCK B2.
    *&                  I N I T I A L I Z A T I O N                      *
    *INITIALIZATION.
    *&             S T A R T - O F - S E L E C T I O N                     *
    START-OF-SELECTION.
      SELECT MATNR WERKS LVORM DISPO FROM MARC
      INTO CORRESPONDING FIELDS OF TABLE I_MARC
                          WHERE MATNR IN S_MATNR
                          AND DISPO IN S_DISPO
                          AND WERKS = P_WERKS.
      IF I_MARC[] IS INITIAL.
        WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARC'.
        EXIT.
      ENDIF.
      PERFORM PURCHASEDATA_VALIDATION.
      PERFORM SALESDATA_VALIDATION.
      SELECT MATNR LGORT LABST FROM MARD INTO TABLE  I_MARD
                          FOR ALL ENTRIES IN I_MARC
                          WHERE MATNR = I_MARC-MATNR
                          AND WERKS EQ P_WERKS
                          AND LGORT IN S_LGORT.
      IF I_MARD[] IS INITIAL.
        WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MARD'.
        EXIT.
      ENDIF.
      SELECT MATNR VKORG VTWEG FROM MVKE INTO TABLE I_MVKE
                          FOR ALL ENTRIES IN I_MARC
                          WHERE MATNR = I_MARC-MATNR.
      IF I_MVKE[] IS INITIAL.
        WRITE:/ 'NO MATCHING DATA AVAILABLE FROM MVKE'.
        EXIT.
      ENDIF.
      LOOP AT I_MARC.
        MOVE-CORRESPONDING I_MARC TO I_OUT.
        CLEAR MARC.
        SELECT SINGLE MATNR MBRSH MEINS MATKL FROM MARA
                          INTO CORRESPONDING FIELDS OF MARA
                          WHERE MATNR = I_OUT-MATNR.
        IF SY-SUBRC = 0.
          MOVE: MARA-MBRSH TO I_OUT-MBRSH,
                MARA-MEINS TO I_OUT-MEINS,
                MARA-MATKL TO I_OUT-MATKL.
        ELSE.
          CONTINUE.
        ENDIF.
        SELECT SINGLE MATNR MAKTX SPRAS FROM MAKT
                        INTO  CORRESPONDING FIELDS OF MAKT
                        WHERE  MATNR = I_OUT-MATNR.
        IF SY-SUBRC = 0.
          MOVE: MAKT-MAKTX TO I_OUT-MAKTX,
                MAKT-SPRAS TO I_OUT-SPRAS.
        ELSE.
          CONTINUE.
        ENDIF.
        LOOP AT I_EKPO WHERE MATNR =  I_MARC-MATNR.
          MOVE: I_EKPO-EBELN TO I_OUT-EBELN,
                I_EKPO-EBELP TO I_OUT-EBELP.
        ENDLOOP.
        LOOP AT I_VBAP WHERE MATNR =  I_MARC-MATNR.
          MOVE: I_VBAP-VBELN TO I_OUT-VBELN,
                I_VBAP-POSNR TO I_OUT-POSNR.
        ENDLOOP.
        LOOP AT I_MARD WHERE MATNR = I_MARC-MATNR.
          MOVE: I_MARD-LABST TO I_OUT-LABST,
                I_MARD-LGORT TO I_OUT-LGORT.
        ENDLOOP.
        LOOP AT I_MVKE WHERE MATNR = I_MARC-MATNR.
          MOVE: I_MVKE-VKORG TO I_OUT-VKORG,
                I_MVKE-VTWEG TO I_OUT-VTWEG.
        ENDLOOP.
        APPEND I_OUT.
        CLEAR I_OUT.
      ENDLOOP.
      PERFORM OPTIONS.
                         FORM  OPTIONS                                *
    FORM OPTIONS.
      IF RB2 = 'X'.
        PERFORM FIELDCAT.
        PERFORM OUTPUT.
      ELSE.
        IF RB1 = 'X'.
          PERFORM HEADINGS.
          PERFORM DLOAD.
        ELSE.
          IF RB3 = 'X'.
            PERFORM HEADINGS.
            PERFORM DLOAD.
            PERFORM FIELDCAT.
            PERFORM OUTPUT.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.                    "OPTIONS
                         FORM  HEADINGS                               *
    FORM HEADINGS.
      I_HEADING-TEXT1 = 'MATNR'.
      I_HEADING-TEXT2 = 'WERKS'.
      I_HEADING-TEXT3 = 'LVORM'.
      I_HEADING-TEXT4 = 'DISPO'.
      I_HEADING-TEXT5 = 'MBRSH'.
      I_HEADING-TEXT6 = 'MEINS'.
      I_HEADING-TEXT7 = 'MATKL'.
      I_HEADING-TEXT8 = 'VKORG'.
      I_HEADING-TEXT9 = 'VTWEG'.
      I_HEADING-TEXT10 = 'SPRAS'.
      I_HEADING-TEXT11 = 'MAKTX'.
      I_HEADING-TEXT12 = 'LGORT'.
      I_HEADING-TEXT13 = 'LABST'.
      I_HEADING-TEXT14 = 'EBELN'.
      I_HEADING-TEXT15 = 'EBELP'.
      I_HEADING-TEXT16 = 'VBELN'.
      I_HEADING-TEXT17 = 'POSNR'.
      APPEND I_HEADING.
    ENDFORM.                    "HEADINGS
                         FORM  DLOAD                                  *
    FORM DLOAD.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME              = 'C:\MATSTK.csv'
          FILETYPE              = 'DAT'
          WRITE_FIELD_SEPARATOR = 'X'
        TABLES
          DATA_TAB              = I_HEADING
        EXCEPTIONS
          FILE_WRITE_ERROR      = 1.
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          FILENAME              = 'C:\MATSTK.csv'
          FILETYPE              = 'DAT'
          APPEND                = 'X'
          WRITE_FIELD_SEPARATOR = 'X'
        TABLES
          DATA_TAB              = I_OUT.
    ENDFORM.                    "DLOAD
                              FORM  FIELDCAT                          *
    FORM FIELDCAT.
      V_FIELDCAT-COL_POS = '1'.
      V_FIELDCAT-FIELDNAME     = 'MATNR'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-HOTSPOT = 'X'.
      V_FIELDCAT-REF_FIELDNAME = 'MATNR'.
      V_FIELDCAT-REF_TABNAME   = 'MARC'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '2'.
      V_FIELDCAT-FIELDNAME     = 'WERKS'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'WERKS'.
      V_FIELDCAT-REF_TABNAME   = 'MARC'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '3'.
      V_FIELDCAT-FIELDNAME     = 'LVORM'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'LVORM'.
      V_FIELDCAT-REF_TABNAME   = 'MARC'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '4'.
      V_FIELDCAT-FIELDNAME     = 'DISPO'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'DISPO'.
      V_FIELDCAT-REF_TABNAME   = 'MARC'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '5'.
      V_FIELDCAT-FIELDNAME     = 'MBRSH'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'MBRSH'.
      V_FIELDCAT-REF_TABNAME   = 'MARA'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '6'.
      V_FIELDCAT-FIELDNAME     = 'MEINS'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'MEINS'.
      V_FIELDCAT-REF_TABNAME   = 'MARA'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '7'.
      V_FIELDCAT-FIELDNAME     = 'MATKL'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'MATKL'.
      V_FIELDCAT-REF_TABNAME   = 'MARA'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '8'.
      V_FIELDCAT-FIELDNAME     = 'VKORG'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'VKORG'.
      V_FIELDCAT-REF_TABNAME   = 'MVKE'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '9'.
      V_FIELDCAT-FIELDNAME     = 'VTWEG'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'VTWEG'.
      V_FIELDCAT-REF_TABNAME   = 'MVKE'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '10'.
      V_FIELDCAT-FIELDNAME     = 'SPRAS'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'SPRAS'.
      V_FIELDCAT-REF_TABNAME   = 'MAKT'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '11'.
      V_FIELDCAT-FIELDNAME     = 'MAKTX'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'MAKTX'.
      V_FIELDCAT-REF_TABNAME   = 'MAKT'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '12'.
      V_FIELDCAT-FIELDNAME     = 'LGORT'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
    V_FIELDCAT-REF_FIELDNAME = 'LGORT'.
    V_FIELDCAT-REF_TABNAME   = 'MARD'.
      V_FIELDCAT-SELTEXT_L = 'STRG LOCT'.
      V_FIELDCAT-OUTPUTLEN = 10.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '13'.
      V_FIELDCAT-FIELDNAME     = 'LABST'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-SELTEXT_M = 'STOCK'.
      V_FIELDCAT-OUTPUTLEN = 15.
    V_FIELDCAT-REF_FIELDNAME = 'LABST'.
    V_FIELDCAT-REF_TABNAME   = 'MARD'.
      V_FIELDCAT-DO_SUM = 'X'.
      V_LAYOUT-TOTALS_TEXT = 'TOTAL STOCK:'.
      V_FIELDCAT-HOTSPOT = 'X'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '14'.
      V_FIELDCAT-FIELDNAME     = 'EBELN'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-HOTSPOT = 'X'.
      V_FIELDCAT-REF_FIELDNAME = 'EBELN'.
      V_FIELDCAT-REF_TABNAME   = 'EKPO'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '15'.
      V_FIELDCAT-FIELDNAME     = 'EBELP'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'EBELP'.
      V_FIELDCAT-REF_TABNAME   = 'EKPO'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '16'.
      V_FIELDCAT-FIELDNAME     = 'VBELN'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-HOTSPOT = 'X'.
      V_FIELDCAT-REF_FIELDNAME = 'VBELN'.
      V_FIELDCAT-REF_TABNAME   = 'VBAP'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
      V_FIELDCAT-COL_POS = '17'.
      V_FIELDCAT-FIELDNAME     = 'POSNR'.
      V_FIELDCAT-TABNAME = 'I_OUT'.
      V_FIELDCAT-REF_FIELDNAME = 'POSNR'.
      V_FIELDCAT-REF_TABNAME   = 'VBAP'.
      APPEND V_FIELDCAT TO VT_FIELDCAT1.
      CLEAR  V_FIELDCAT.
    ENDFORM.                      "FIELDCAT
                              FORM  OUTPUT                            *
    FORM OUTPUT.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM      = SY-REPID
          I_CALLBACK_TOP_OF_PAGE  = 'TOP-OF-PAGE'
          I_GRID_TITLE = 'CLICK ON MATERIAL/PURDOC/SALESDOC FOR DETAILS'
          I_CALLBACK_USER_COMMAND = 'DISPLAYDETAILS'
          IS_LAYOUT               = V_LAYOUT
          IT_FIELDCAT             = VT_FIELDCAT1
        TABLES
          T_OUTTAB                = I_OUT.
      IF SY-SUBRC <> 0.
      ENDIF.
    ENDFORM.                    "OUTPUT
                            FORM  TOP-OF-PAGE                         *
    FORM TOP-OF-PAGE.
      DATA: T_HEADER TYPE SLIS_T_LISTHEADER,
            WA_HEADER TYPE SLIS_LISTHEADER.
      WA_HEADER-TYP = 'H'.
      WA_HEADER-INFO = 'REPORT FOR : '.
      APPEND WA_HEADER TO T_HEADER.
      CLEAR WA_HEADER.
      WA_HEADER-TYP = 'S'.
      WA_HEADER-INFO = 'MATERIAL DETAILS'.
      APPEND WA_HEADER TO T_HEADER.
      CLEAR WA_HEADER.
      WA_HEADER-TYP = 'S'.
      WA_HEADER-INFO = 'PURCHASE ORDER DETAILS'.
      APPEND WA_HEADER TO T_HEADER.
      CLEAR WA_HEADER.
      WA_HEADER-TYP = 'S'.
      WA_HEADER-INFO = 'SALES ORDER DETAILS'.
      APPEND WA_HEADER TO T_HEADER.
      CLEAR WA_HEADER.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          I_LOGO             = 'GEAR'
          IT_LIST_COMMENTARY = T_HEADER.
    ENDFORM.                    "TOP-OF-PAGE
    *&                       FORM  DISPLAYDETAILS                          *
    FORM DISPLAYDETAILS USING UCOMM LIKE SY-UCOMM
          SELFIELD TYPE SLIS_SELFIELD.
      IF SELFIELD-FIELDNAME = 'EBELN'.
        IF UCOMM = '&IC1'.
          READ TABLE I_OUT INDEX SELFIELD-TABINDEX.
          PERFORM PORECDNG.
          CLEAR BDCDATA[].
        ENDIF.
      ELSE.
        IF SELFIELD-FIELDNAME = 'MATNR'.
          IF UCOMM = '&IC1'.
            READ TABLE I_OUT INDEX SELFIELD-TABINDEX.
            PERFORM MMRECDNG.
            CLEAR BDCDATA[].
          ENDIF.
        ELSE.
          IF SELFIELD-FIELDNAME = 'VBELN'.
            IF UCOMM = '&IC1'.
              READ TABLE I_OUT INDEX SELFIELD-TABINDEX.
              PERFORM SALESRECDNG.
              CLEAR BDCDATA[].
            ENDIF.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDFORM.                    "DISPLAYDETAILS
                        FORM PORECDNG                                   *
    FORM PORECDNG.
      PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0105'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'RM06E-BSTNR'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'RM06E-BSTNR'
                                    I_OUT-EBELN.
      PERFORM BDC_DYNPRO      USING 'SAPMM06E' '0120'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'RM06E-BSTPO(01)'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=AH'.
      PERFORM BDC_FIELD       USING 'RM06E-EBELP'
                                    I_OUT-EBELP.
      PERFORM BDC_FIELD       USING 'RM06E-TCSELFLAG(01)'
                                    'X'.
      PERFORM BDC_TRANSACTION USING 'ME23'.
    ENDFORM.                    "PORECDNG
                        FORM MMRECDNG                                   *
    FORM MMRECDNG.
      PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0060'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'RMMG1-MATNR'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'RMMG1-MATNR'
                                    I_OUT-MATNR.
      PERFORM BDC_DYNPRO      USING 'SAPLMGMM' '0070'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'MSICHTAUSW-DYTXT(01)'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '=ENTR'.
      PERFORM BDC_FIELD       USING 'MSICHTAUSW-KZSEL(01)'
                                    'X'.
      PERFORM BDC_TRANSACTION USING 'MM03'.
    ENDFORM.                    "MMRECDNG
                        FORM SALESRECDNG                                *
    FORM SALESRECDNG.
      PERFORM BDC_DYNPRO      USING 'SAPMV45A' '0102'.
      PERFORM BDC_FIELD       USING 'BDC_CURSOR'
                                    'VBAK-VBELN'.
      PERFORM BDC_FIELD       USING 'BDC_OKCODE'
                                    '/00'.
      PERFORM BDC_FIELD       USING 'VBAK-VBELN'
                                    I_OUT-VBELN.
      PERFORM BDC_TRANSACTION USING 'VA03'.
    ENDFORM.                    "SALESRECDNG
                     FORM BDC_TRANSACTION                               *
    FORM BDC_TRANSACTION USING TCODE.
      CALL TRANSACTION TCODE USING BDCDATA MODE 'E'.
    ENDFORM.                    "BDC_TRANSACTION
                           FORM BDC_DYNPRO                              *
    FORM BDC_DYNPRO USING PROGRAM DYNPRO.
      CLEAR BDCDATA.
      BDCDATA-PROGRAM = PROGRAM.
      BDCDATA-DYNPRO = DYNPRO.
      BDCDATA-DYNBEGIN = 'X'.
      APPEND BDCDATA.
    ENDFORM.                    "BDC_DYNPRO
                           INSERT FIELD                                  *
    FORM BDC_FIELD USING FNAM FVAL.
      CLEAR BDCDATA.
      BDCDATA-FNAM = FNAM.
      BDCDATA-FVAL = FVAL.
      APPEND BDCDATA.
    ENDFORM.                    "BDC_FIELD
    *&                  FORM  PURCHASEDATA_VALIDATION                      *
    FORM PURCHASEDATA_VALIDATION.
      SELECT EBELN EBELP MATNR
                 FROM EKPO
                 INTO TABLE I_EKPO
                 FOR ALL ENTRIES IN I_MARC
                 WHERE MATNR = I_MARC-MATNR
                 AND EBELN IN S_EBELN
                 AND WERKS EQ P_WERKS.
      IF I_EKPO[] IS INITIAL.
        WRITE:/ 'NO MATCHING DATA AVAILABLE FROM TABLE EKPO'.
        EXIT.
      ENDIF.
      DATA: T_EKPO LIKE I_EKPO OCCURS 0 WITH HEADER LINE.
      T_EKPO[] = I_EKPO[].
      REFRESH I_EKPO.
      FREE I_EKPO.
      LOOP AT T_EKPO.
        SELECT SINGLE EBELN FROM EKKO INTO EKPO-EBELN
        WHERE EBELN = T_EKPO-EBELN.
        IF SY-SUBRC = 0.
          MOVE-CORRESPONDING T_EKPO TO I_EKPO.
          APPEND I_EKPO.
          CLEAR I_EKPO.
        ELSE.
          CONTINUE.
        ENDIF.
      ENDLOOP.
      SORT I_EKPO.
    ENDFORM.                    "PURCHASEDATA_VALIDATION
    *&                  FORM  SALESDATA_VALIDATION                         *
    FORM SALESDATA_VALIDATION.
      SELECT VBELN POSNR MATNR
              FROM VBAP
              INTO CORRESPONDING FIELDS OF TABLE
              I_VBAP FOR ALL ENTRIES IN I_MARC
              WHERE MATNR = I_MARC-MATNR.
    IF I_VBAP[] IS INITIAL.
        WRITE:/ 'NO MATCHING DATA AVAILABLE FROM TABLE VBAP'.
        EXIT.
      ENDIF.
      DATA: T_VBAP LIKE I_VBAP OCCURS 0 WITH HEADER LINE.
      T_VBAP[] = I_VBAP[].
      REFRESH I_VBAP.
      FREE I_VBAP.
      LOOP AT T_VBAP.
        SELECT SINGLE VBELN FROM VBAK INTO VBAK-VBELN
        WHERE VBELN = T_VBAP-VBELN.
        IF SY-SUBRC = 0.
          MOVE-CORRESPONDING T_VBAP TO I_VBAP.
          APPEND I_VBAP.
          CLEAR I_VBAP.
        ELSE.
          CONTINUE.
        ENDIF.
      ENDLOOP.
      SORT I_VBAP.
    ENDFORM.                    "SALESDATA_VALIDATION
    regards,
    srinivas
    <b>*reward for useful answers*</b>

  • Unable to write data into excel file when it's close

    Hi,
    I'm facing this problem and it's a bit weird. I'm using the following method to insert data into excel file. But when excel file is close, it unable to write data into the excel sheet. But it was able to write the data into the excel sheet if i open the excel file when running the program.
    Can anyone please tell me what's wrong to the code?
    public int updateLog(String sheet, String no, String cpId, String CatId, String rbtCode, String rbt, String rbtName, String artistName, String price, String rbtFileName, String songId, String msg){
            int result = -1;
            try{
                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss",Locale.ENGLISH);
                String actionDate = formatter.format(new Date());
                rbtName = rbtName.replaceAll("'", "''");
                artistName = artistName.replaceAll("'", "");
                String sql = "insert into [Sheet3$] (Code, CpID, CategoryID, RBTCode, RBT, RBTName, ArtistName, Price, RBTFileName, SongID, UploadStatus, FileUploadedDateTime) ";
                sql = sql + " values ('" + no + "', '" + cpId + "', '" + CatId + "', '" + rbtCode + "', '" + rbt + "', '" + rbtName + "', '" + artistName + "', '" + price + "', '" + rbtFileName + "', '" + songId + "', '" + msg + "', '" + actionDate + "')";
                System.out.println(sql);
                log.writeLog(sql);
                result = stmnt.executeUpdate(sql);
            } catch(Exception e){
                e.printStackTrace();
                log.printStackTrace(e);
            return result;
        public int openConnection(){
            int result = -1;
            try{
                Class.forName(dbDriver);
                c = DriverManager.getConnection(conStr + excelFilePath+";ReadOnly=0;");
                stmnt = c.createStatement();
            } catch(Exception e){
                e.printStackTrace();
                log.printStackTrace(e);
                return -1;
            return 1;
        }Thanks

    HI,
    i hv a doubt regarding reading / opening of a
    password protected Excel file using jxl( java ) .
    How to read / open a password protected Excel file
    thro Java (jxl ) program .plz let me know some
    example also .
    Regards,
    Ramesh P
    845935822cross posting !! answered here
    http://forum.java.sun.com/thread.jspa?threadID=710466&messageID=9507085#9507085

  • Download ALV into excel file

    Hi experts,
                   I used subtotals in ALV.first three columns I claculated based on the addition of individual column.In fourth column i calculated the value based on three calculated values ...It is  not problem.
              when i download this into excel file the original value is only coming .the calculated value i.e) calculated based on three values didnt get displayed in excel file..Help me please...
    Thank u,
    Manjula Devi.D

    Hi.
    I find that
    List > Export > Spreadsheet
    gives no subtotals, but
    List > Export > Local File and then Spreadsheet
    does give subtotals.
    I find that
    Views > Microsoft Excel
    followed by
    Save As
    does give subtotals.
    John

  • Error while loading  data into External table from the flat files

    HI ,
    We have a data load in our project which feeds the oracle external tables with the data from the Flat Files(.bcp files) in unix.
    While loading the data, we are encountering the following error.
    Error occured (Error Code : -29913 and Error Message : ORA-29913: error in executing ODCIEXTTABLEOPEN callout
    ORA-29400: data cartridge error
    KUP-04063: un) while loading data into table_ext
    Please let us know what needs to be done in this case to solve this problem.
    Thanks,
    Kartheek

    Kartheek,
    I used Google (mine still works).... please check those links:
    http://oraclequirks.blogspot.com/2008/07/ora-29400-data-cartridge-error.html
    http://jonathanlewis.wordpress.com/2011/02/15/ora-29913/
    HTH,
    Thierry

  • Date format while downloading data into open office excel

    Hi experts,
                  i am trying to download hr personal data into excel from an internal table using GUI_DOWNLOAD, where date field, in excel, are having  2 different types of date format  and the formats are :
                                                                1)  05/08/52
                                                                 2)   22.04.1957
    But i want to maintain only one type date format... preferably the 2nd one.
    please help me out in this....
    with regards.
    Praveen

    Hi,
    Convert the date fields in the internal table using conversion routines.
    Regards
    Praveen

  • Getting error while loading  Data into ASO cube by flat file.

    Hi All,
    i am getting this error Essbase error 1270040: Data load buffer[1] does not exist while loading data into ASO cube.
    does anyone have solution.
    Regards,
    VM

    Are you using ODI to load the data or maxl? If you are using an ODI interface, are you using a load rule also which version of essbase and ODI are you using
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • How to download  data into XLSX file in ABAP ECC 6.0 using FM: GUI_DOWNLOAD or any other FunctionModules

    Hi ABAP Exterts,
    Any one help on this , there is a requirement to download the data into XLSX file only.
    I am able to to download the data into XLS file using the FM: GUI_DOWNLOAD in SAP ECC 6.0and also opening the file . But when i download the data into XLSX file . I am able to download the data into GUI_DOWNLOAD. But while opening the file i am getting the below mentioned error.
    'Excel cannot open the file 'filename.xlsx' because the file format or file extension is not valid. Verify that the file has not been corrupted and that the file extension matches the format of the file'
    Ok buttom is coming not able to open the file.
    When i use the FM: SAP_CONVERT_TO_XLS_FORMAT to download the XLS it self it is going abap DUMP that file type error.
    Any one help  any Function Module or how to download data through abap programing into XLSX file.
    Thanks.
    Murali.
    Message was edited by: Matthew Billingham - adjusted wording...

    If you want to download your ALV to an .XLXS format file, with all the formatting intact, please try the following code. I have tried to create a custom Function module Z_EXCEL_DOWNLOAD_TEST wherein I pass all the callback variables, the final ALV internal table and all the ALV details like field catalog, sort, layout, event list and so on, along with the concatenated file path and file name in I_FILE. I have used a custom class ZCL_SALVEXPORT_XML which is a copy of the standard class CL_SALV_EXPORT_XML_DIALOG, with few modifications in Method: EXECUTE and Method: DOWNLOAD. The methods where I have modified the code are also shown at the end.
    ****************Global declarations***********************
    TYPE-POOLS: slis,
    kkblo.
    TYPES: t_fccls(1) TYPE c OCCURS 0.
    TYPES: BEGIN OF ty_nosum,
    fieldname     TYPE kkblo_fieldname,           "Field name
    tabname       TYPE kkblo_tabname,             "Table name
    fieldname_dep TYPE kkblo_fieldname,           "Field name
    tabname_dep   TYPE kkblo_tabname,             "Table name
    index         TYPE sy-index,                  "Index
    END OF ty_nosum.
    TYPES: t_nosum TYPE TABLE OF ty_nosum INITIAL SIZE 0 WITH NON-UNIQUE DEFAULT KEY.
    TYPES: BEGIN OF ty_dep_field,
    s_dep_fieldcat TYPE kkblo_fieldcat,            "Field cat
    t_ref_fieldcat TYPE kkblo_t_fieldcat,          "Field cat
    END OF ty_dep_field.
    TYPES: BEGIN OF ty_ref_field,
    s_ref_fieldcat TYPE kkblo_fieldcat,           "Field cat
    s_dep_fieldcat TYPE kkblo_fieldcat,           "Field cat
    END OF ty_ref_field.
    TYPES: t_dep_field TYPE ty_dep_field OCCURS 0.        "
    TYPES: t_ref_field TYPE ty_ref_field OCCURS 0.
    TYPES: BEGIN OF ty_memory,
    object(20)  TYPE c,                        "Object
    memcount(4) TYPE c,                        "count
    END OF ty_memory.
    *ALV Customer Wrapper
    TYPES: BEGIN OF ty_type_header_info,
    tabname   TYPE kkblo_tabname,            "Table name
    fieldname TYPE kkblo_fieldname,          "Field name
    sequence  TYPE i,                        "Sequence
    field     TYPE char80,                    "Field
    pagno     TYPE sypagno,                   "Page num
    linno     TYPE sy-linno,                  "Current Line in List
    colno     TYPE sy-colno,                  "Current List Column
    END   OF ty_type_header_info,
    t_type_header_info TYPE SORTED TABLE OF ty_type_header_info
    WITH UNIQUE KEY tabname fieldname.
    TYPES: BEGIN OF ty_type_row_info,
    tabname   TYPE kkblo_tabname,            "Table name
    tabindex  TYPE syindex,                  "Index
    field     TYPE char80,                   "Field name
    pagno     TYPE sypagno,                  "Page num
    linno     TYPE sy-linno,                 "Current Line in List
    colno     TYPE sy-colno,                 "Current List Column
    END   OF ty_type_row_info,
    t_type_row_info TYPE SORTED TABLE OF ty_type_row_info
    WITH UNIQUE KEY tabname tabindex.
    TYPES: BEGIN OF ty_type_sel_header,
    tabname   TYPE kkblo_tabname,           "table name
    fieldname TYPE kkblo_fieldname,         "field name
    END   OF ty_type_sel_header,
    t_type_sel_header TYPE SORTED TABLE OF ty_type_sel_header
    WITH UNIQUE KEY tabname fieldname.
    TYPES: BEGIN OF ty_type_sel_row,
    tabname   TYPE kkblo_tabname,
    tabindex  TYPE syindex,
    END   OF ty_type_sel_row,
    t_type_sel_row TYPE SORTED TABLE OF ty_type_sel_row
    WITH UNIQUE KEY tabname tabindex.
    TYPES: BEGIN OF ty_type_sel_cell,
    tabname   TYPE kkblo_tabname,
    tabindex  TYPE syindex,
    fieldname TYPE kkblo_fieldname,
    END   OF ty_type_sel_cell.
    TYPES: BEGIN OF ty_type_selections,
    t_row_info         TYPE t_type_row_info,
    t_header_info      TYPE t_type_header_info,
    t_selected_headers TYPE t_type_sel_header,
    t_selected_rows    TYPE t_type_sel_row,
    s_current_cell     TYPE ty_type_sel_cell,
    set_headers        TYPE sap_bool,
    set_rows           TYPE sap_bool,
    set_current_cell   TYPE sap_bool,
    END   OF ty_type_selections.
    TYPES: BEGIN OF ty_stack3,
    r_grid         TYPE REF TO cl_gui_alv_grid,        "Y6DK050176
    r_salv_adapter TYPE REF TO if_salv_adapter,
    s_selections   TYPE ty_type_selections,
    r_print_state  TYPE REF TO if_alv_print_parameter_proxy, "Y6DK075821
    suppress_empty_data TYPE abap_bool,
    END OF ty_stack3.
    TYPES: t_stack3 TYPE ty_stack3 OCCURS 0.
    TYPES: BEGIN OF ty_stack,
    i_callback_program       TYPE sy-repid,
    i_callback_user_command  TYPE kkblo_formname,
    i_callback_top_of_page   TYPE kkblo_formname,
    i_callback_top_of_list   TYPE kkblo_formname,
    i_callback_end_of_page   TYPE kkblo_formname,
    i_callback_end_of_list   TYPE kkblo_formname,
    i_callback_pf_status_set TYPE kkblo_formname,
    i_callback_fieldcat_save TYPE kkblo_formname,
    i_callback_layout_save   TYPE kkblo_formname,
    i_tabname                TYPE kkblo_tabname,
    i_tabname_slave          TYPE kkblo_tabname,
    is_keyinfo               TYPE kkblo_keyinfo,
    is_layout                TYPE kkblo_layout,
    it_fieldcat              TYPE kkblo_t_fieldcat,
    i_fctype(1)              TYPE c,
    it_excluding             TYPE kkblo_t_extab,
    it_special_groups        TYPE kkblo_t_sp_group,
    it_sort                  TYPE kkblo_t_sortinfo,
    it_except_qinfo          TYPE kkblo_t_qinfo,
    is_sel_hide              TYPE kkblo_sel_hide,
    t_columns                TYPE kkblo_t_columns,
    t_filter                 TYPE kkblo_t_filter,
    s_lprint                 TYPE kkblo_lprint,
    print_line_break         TYPE char1,
    t_isetab                 TYPE kkblo_seldis,
    t_fccls                  TYPE t_fccls,
    t_sfinfo                 TYPE kkblo_t_sfinfo,
    t_ref_field              TYPE t_ref_field,
    t_dep_field              TYPE t_dep_field,
    flg_default_status(1)    TYPE c,
    flg_selections           TYPE char1,
    flg_allow_no_selection   TYPE char1,
    flg_input                TYPE char1,
    flg_called               TYPE char1,
    flg_popup                TYPE char1,
    flg_endlist              TYPE char1,
    listtype                 TYPE char1,
    actcols                  TYPE i,
    is_list                  TYPE char1,
    END OF ty_stack.
    TYPES: t_stack TYPE ty_stack OCCURS 0.
    TYPES: BEGIN OF ty_stack2,
    button_col1(20)                TYPE c,
    button_col2(20)                TYPE c,
    button_col3(20)                TYPE c,
    button_col4(20)                TYPE c,
    button_col5(20)                TYPE c,
    s_header                       TYPE kkblo_header,
    t_sfinfo_slave                 TYPE kkblo_t_sfinfo,
    t_suminfo                      TYPE kkblo_t_sfinfo,
    t_sfsave                       TYPE kkblo_t_sfinfo,
    t_nosum                        TYPE t_nosum,
    window_title                   TYPE rsmpe-tittext,  " Item_selection
    flg_scroll_to_line(1)          TYPE c, " Item_selection
    flg_top_of_page(1)             TYPE c,
    flg_subtot(1)                  TYPE c,
    flg_output_in_progress(1)      TYPE c,
    flg_grouplevels(1)             TYPE c,
    flg_groupedit(1)               TYPE c,
    flg_calculate_totals(1)        TYPE c,
    sumlevel                       TYPE sy-tabix,
    memory_stack1                  TYPE ty_memory,
    memory_stack2                  TYPE ty_memory,
    memory_outtab                  TYPE ty_memory,
    t_colmark                      TYPE kkblo_t_colmark,
    t_rowmark                      TYPE kkblo_t_rowmark,
    it_event_exit                  TYPE kkblo_t_event_exit,
    t_groups                       TYPE kkblo_t_grouplevels,
    t_filter_groups                TYPE kkblo_t_grouplevels,
    s_subtot_options               TYPE kkblo_subtot_options,
    flg_append_mode(1)             TYPE c,
    is_reprep_id                   TYPE kkblo_reprep_id,
    i_callback_before_line_output  TYPE kkblo_formname,
    i_callback_after_line_output   TYPE kkblo_formname,
    i_callback_foreign_top_of_page TYPE kkblo_formname,
    i_callback_foreign_end_of_page TYPE kkblo_formname,
    i_callback_list_modify         TYPE kkblo_formname,
    i_callback_top_of_coverpage    TYPE kkblo_formname,
    i_callback_end_of_coverpage    TYPE kkblo_formname,
    i_callback_grouplevel_change   TYPE kkblo_formname,
    i_callback_item_data_expand    TYPE kkblo_formname,
    i_callback_header_transport    TYPE kkblo_formname,
    i_callback_reprep_sel_modify   TYPE kkblo_formname,
    i_callback_subtotal_text       TYPE kkblo_formname,
    END OF ty_stack2.
    TYPES: t_stack2 TYPE TABLE OF ty_stack2 INITIAL SIZE 0.
    ** *--- iTables
    DATA: it_stack  TYPE t_stack WITH HEADER LINE.
    DATA: it_stack2 TYPE t_stack2 WITH HEADER LINE.
    ***ALV Customer Wrapper
    DATA: it_stack3 TYPE t_stack3 WITH HEADER LINE.
    CONSTANTS: BEGIN OF c_con_listtype,
    simple(1)    TYPE c VALUE 'S',
    hier_sequ(1) TYPE c VALUE 'H',
    matrix(1)    TYPE c VALUE 'M',
    END OF c_con_listtype.
    DATA:   gv_callback_program1      TYPE sy-repid,
    gv_callback_user_command1 TYPE kkblo_formname,
    gv_callback_top_of_page1  TYPE kkblo_formname,
    gv_callback_top_of_list1  TYPE kkblo_formname,
    gv_callback_end_of_page1  TYPE kkblo_formname,
    gv_callback_end_of_list1   TYPE kkblo_formname,
    gv_callback_pf_status_set1  TYPE kkblo_formname,
    gv_callback_layout_save1    TYPE kkblo_formname,
    gv_callback_fieldcat_save1  TYPE kkblo_formname,
    gv_callback_grouplevel_change1  TYPE kkblo_formname,
    gv_callback_before_line_otput1  TYPE kkblo_formname,
    gv_callback_after_line_otput1  TYPE kkblo_formname,
    gv_callback_foreign_top_of_pg1  TYPE kkblo_formname,
    gv_callback_foreign_end_of_pg1  TYPE kkblo_formname,
    gv_callback_list_modify1          TYPE kkblo_formname,
    gv_callback_top_of_coverpge1     TYPE kkblo_formname,
    gv_callback_end_of_coverpge1     TYPE kkblo_formname,
    gv_callback_item_data_expand1     TYPE kkblo_formname,
    gv_callback_header_transport1     TYPE kkblo_formname,
    gv_callback_reprep_sel_modify1    TYPE kkblo_formname,
    gv_callback_subtotal_text1       TYPE kkblo_formname,
    gv_layout1   TYPE  kkblo_layout,
    gv_fieldcat1  TYPE  kkblo_t_fieldcat,
    gv_fctype1  TYPE c,
    gv_event_exit1  TYPE  kkblo_t_event_exit,
    gv_excluding1   TYPE  kkblo_t_extab,
    gv_special_groups1  TYPE  kkblo_t_sp_group,
    gv_sort1  TYPE  kkblo_t_sortinfo,
    gv_filter1  TYPE  kkblo_t_filter,
    gv_except_qinfo1  TYPE  slis_t_qinfo_alv,
    gv_sel_hide1  TYPE  slis_sel_hide_alv,
    gv_reprep_id1   TYPE  slis_reprep_id,
    gv_screen_start_column1  TYPE i,
    gv_salv_adapter1   TYPE REF TO if_salv_adapter,
    gv_suppress_empty_data1  TYPE  sap_bool.
    FUNCTION z_excel_download_test.
    *"*"Local Interface:
    *"  IMPORTING
    *"     REFERENCE(I_BYPASSING_BUFFER) TYPE  CHAR01 OPTIONAL
    *"     REFERENCE(I_BUFFER_ACTIVE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_PROGRAM) TYPE  SY-REPID OPTIONAL
    *"     REFERENCE(I_CALLBACK_USER_COMMAND) OPTIONAL
    *"     REFERENCE(I_CALLBACK_TOP_OF_PAGE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_TOP_OF_LIST) OPTIONAL
    *"     REFERENCE(I_CALLBACK_END_OF_PAGE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_END_OF_LIST) OPTIONAL
    *"     REFERENCE(I_CALLBACK_PF_STATUS_SET) OPTIONAL
    *"     REFERENCE(I_CALLBACK_LAYOUT_SAVE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_FIELDCAT_SAVE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_GROUPLEVEL_CHANGE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_BEFORE_LINE_OUTPUT) OPTIONAL
    *"     REFERENCE(I_CALLBACK_AFTER_LINE_OUTPUT) OPTIONAL
    *"     REFERENCE(I_CALLBACK_FOREIGN_TOP_OF_PAGE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_FOREIGN_END_OF_PAGE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_LIST_MODIFY) OPTIONAL
    *"     REFERENCE(I_CALLBACK_TOP_OF_COVERPAGE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_ITEM_DATA_EXPAND) OPTIONAL
    *"     REFERENCE(I_CALLBACK_END_OF_COVERPAGE) OPTIONAL
    *"     REFERENCE(I_CALLBACK_HEADER_TRANSPORT) OPTIONAL
    *"     REFERENCE(I_CALLBACK_REPREP_SEL_MODIFY) OPTIONAL
    *"     REFERENCE(I_CALLBACK_SUBTOTAL_TEXT) OPTIONAL
    *"     REFERENCE(I_TABNAME) TYPE  SLIS_TABNAME OPTIONAL
    *"     REFERENCE(I_FCTYPE) DEFAULT 'R'
    *"     REFERENCE(IT_EXCEPT_QINFO) TYPE  SLIS_T_QINFO_ALV OPTIONAL
    *"     REFERENCE(IS_SEL_HIDE) TYPE  SLIS_SEL_HIDE_ALV OPTIONAL
    *"     REFERENCE(IS_REPREP_ID) TYPE  SLIS_REPREP_ID OPTIONAL
    *"     REFERENCE(I_SCREEN_START_COLUMN) DEFAULT 0
    *"     REFERENCE(I_OO_ALV) OPTIONAL
    *"     REFERENCE(IR_SALV_ADAPTER) TYPE REF TO  IF_SALV_ADAPTER OPTIONAL
    *"     REFERENCE(I_SUPPRESS_EMPTY_DATA) TYPE  SAP_BOOL DEFAULT
    *"       ABAP_FALSE
    *"     REFERENCE(I_FILE) TYPE  STRING OPTIONAL
    *"     REFERENCE(IT_FIELDCAT) TYPE  SLIS_T_FIELDCAT_ALV OPTIONAL
    *"     REFERENCE(IS_LAYOUT) TYPE  SLIS_LAYOUT_ALV OPTIONAL
    *"     REFERENCE(IT_SORT) TYPE  SLIS_T_SORTINFO_ALV OPTIONAL
    *"     REFERENCE(IT_FILTER) TYPE  SLIS_T_FILTER_ALV OPTIONAL
    *"     REFERENCE(IT_EXCLUDING) TYPE  SLIS_T_EXTAB OPTIONAL
    *"     REFERENCE(IT_SPECIAL_GROUPS) TYPE  SLIS_T_SP_GROUP_ALV OPTIONAL
    *"     REFERENCE(IS_KEYINFO) TYPE  SLIS_KEYINFO_ALV OPTIONAL
    *"     REFERENCE(IT_EVENT_EXIT) TYPE  SLIS_T_EVENT_EXIT OPTIONAL
    *"     REFERENCE(IS_LIST_SCROLL) TYPE  SLIS_LIST_SCROLL OPTIONAL
    *"     REFERENCE(IS_PRINT) TYPE  SLIS_PRINT_ALV OPTIONAL
    *"     REFERENCE(IS_LINEINFO) TYPE  SLIS_LINEINFO OPTIONAL
    *"     REFERENCE(I_REPID) TYPE  SYREPID OPTIONAL
    *"  TABLES
    *"      T_OUTTAB TYPE  STANDARD TABLE OPTIONAL
    *********** Local data declarations******************
    DATA: gv_list TYPE char1.
    DATA: gv_fcat_complete TYPE sap_bool.
    DATA: gv_buffer_active TYPE char01,
    wa_variant TYPE disvariant.
    DATA: gv_controller TYPE REF TO cl_salv_export_c8r.
    DATA: gv_xml           TYPE xstring.
    DATA: gv_s_xml_choice TYPE if_salv_bs_xml=>s_type_xml_choice.
    DATA: gv_t_xml_choice TYPE if_salv_bs_xml=>t_type_xml_choice.
    DATA: gv_param_lvc TYPE if_salv_export=>s_type_param_lvc.
    DATA: gv_data       TYPE REF TO data.
    DATA: gv_result_data TYPE REF TO cl_salv_ex_result_data_table.
    DATA: gv_flavour TYPE string.
    DATA: gv_version TYPE string.
    DATA:

  • Reg: Download report into Excel file

    Hi All,
    While downloading the ALV report into excel file(System -> List -> Save -> Local file) or (List -> Export -> Local file), i cannot download full report in to excel. Even though the report contains just 200 rows(I can able to download about 90 lines).
    Some reports can able to download all the data, even the report is very big. Currently I am blind to solve, anyone can help me to solve this issue.
    Thanks in advance.

    The most elegant way of downloading ALV display data to EXCEL is displaying the excel in the SAP GUI screen itself.  Select "Excel in Place" and then save it from there. Before that you need to let the VB script of SAP know as trusted macro. This is done by opening a blank excel file then go to Tools > options > Security > Macro Security > Trusted Publishers (tab) > (check) Trust access to Visual Basic Project.  This activation is one time activation. Once you do this you can see ALV display exactly like in normal ALV with all the colors fields etc.

Maybe you are looking for