Back ground job to download data into excel in the given path on sel-screen

Hi Friends,
  I have 2 radion buttons on the selection screen 1. Online 2. Back ground.
If i select the back ground radion button all program should run in back ground only, and finally the data should be downloaded to excel file on the given path in selection screen.
Does any one have code for this.
Thanks in advance
Ajay
Edited by: Ajay kumar on Aug 30, 2010 11:03 AM

Hi Ajay,
try this way..
If sy-batch = 'X' . "background Job
*   Submit report in background and creating spool
  SUBMIT (w_rname) USING SELECTION-SET p_var
      TO SAP-SPOOL WITHOUT SPOOL DYNPRO
      SPOOL PARAMETERS wa_pri_params AND RETURN.
  COMMIT WORK AND WAIT.
*   To fetch the spool number from TSP01 table
  IF sy-subrc EQ 0.
    SELECT rqident
           FROM tsp01
           INTO p_spool
*             UP TO 1 ROWS
           WHERE rq2name = wa_pri_params-plist.
    ENDSELECT.
  ENDIF.
ENDIF.
* Fetching Spool data into internal table
  CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
    EXPORTING
      rqident              = p_spool
    TABLES
      buffer               = t_Excel_data.
"Now format the Data into excel format or Comma seperated format and download to Appl server.
Prabhudas

Similar Messages

  • Regarding downloading data into excel from internal table

    hi all ,
    i'm using the function module  SAP_CONVERT_TO_XLS_FORMAT to download data of internal table into excel . now i need to know . when user presses the button for downlading it should download after downloading if he again tries to download it in the same  should not allow him to download or  it should refresh the excel of the speecific path and then it should downlaod . please let me know how  make it.

    Hi,
    Use below FM
    call function 'MS_EXCEL_OLE_STANDARD_DAT'
    exporting
    file_name = p_file " path offile where u need to download
    CREATE_PIVOT = 0
    DATA_SHEET_NAME = ' '
    PIVOT_SHEET_NAME = ' '
    PASSWORD = ' '
    PASSWORD_OPTION = 0
    tables
    PIVOT_FIELD_TAB =
    data_tab = <dyn_table>  "internal table with data
    *fieldnames = int_head "internal table with header
    exceptions
    file_not_exist = 1
    filename_expected = 2
    communication_error = 3
    ole_object_method_error = 4
    ole_object_property_error = 5
    invalid_filename = 6
    invalid_pivot_fields = 7
    download_problem = 8
    others = 9
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    Regards,
    Prashant

  • Download date into excel sheet without changing the properties of column

    Hi All,
    I am trying to download a date field from SAP to Excel sheet. But the date is getting downloaded successfully, but the format of the column is getting changed to DATE. Is there any way to restrict it?
    I am using GUI_DOWNLOAD for downloading the data.
    I have declared the date field as CHAR10  Eg (09/13/2011) and moving the data into excel.
    Result i need : data should be downlaoded as 09/13/2011 but format of the cell should not be changed.
    Regards
    Eswar.

    Hi Eswar,
    Change the date format type dats instead of char format or any standards like erdat from vbak.Then you can in proper format.
    Regards,
    Madhu.

  • How to download data into excel by displaying field names in top 2 rows

    Hi experts,
             i am trying to download an internal table data into excel(open office) by reserving top 2 rows. In 1st row i want to display tech.name where as in 2nd row i want to display discription of tech name of the fields. Well, i tried with FM gui_upload and used fieldnames  parameter and even its working too but i'm unable to work with 2nd col.
    Please help me out....
    with regards.
    Praveen.

    Try this code:
    If IT_FINAL is the internal table containing the data that you want to download :
    IF IT_FINAL[] IS INITIAL.
        WRITE : 'No Data Fetched'.
      ELSE.
      Build header table Field catelague
        PERFORM UR_FIELDCAT_BUILD USING G_F_REPNM
                                        'IT_FINAL'
                                 CHANGING IT_FCAT_001.
        DATA: L_F_LINES TYPE I,
              L_F_FROM TYPE I,
              L_F_TO TYPE I,
              L_F_DIFF TYPE I,
              L_TEMP_FINAL LIKE TABLE OF IT_FINAL.
        DESCRIBE TABLE IT_FINAL LINES L_F_LINES.
        IF L_F_LINES > 16000.
          L_F_FROM = 1.
          L_F_TO = 16000.
          DO.
            APPEND LINES OF IT_FINAL FROM L_F_FROM
                                              TO L_F_TO TO L_TEMP_FINAL.
            PERFORM DOWNLOAD_DATA_HEADER TABLES L_TEMP_FINAL
                                                   IT_FCAT_001
                                             USING GF_FILE1.
            IF L_F_TO >= L_F_LINES.
              EXIT.
            ENDIF.
            L_F_FROM = L_F_TO + 1.
            L_F_DIFF = L_F_LINES - L_F_TO.
            IF L_F_DIFF >= 16000.
              L_F_TO = L_F_TO + 16001.
            ELSE.
              L_F_TO = L_F_LINES.
            ENDIF.
            REFRESH: L_TEMP_FINAL.
         ENDDO.
       ELSE.
         PERFORM DOWNLOAD_DATA_HEADER TABLES IT_FINAL
                                         IT_FCAT_001
                                  USING GF_FILE1.
       ENDIF.
    ENDIF.
    FORM UR_FIELDCAT_BUILD
                 USING P_REPID
                       P_TABNAM
    CHANGING C_T_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
       REFRESH C_T_FIELDCAT.
       CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
            EXPORTING
                 I_PROGRAM_NAME         = P_REPID
                 I_INTERNAL_TABNAME     = P_TABNAM
               I_STRUCTURE_NAME       = 'TY_FLODAT'
                 I_INCLNAME             = P_REPID
                 I_BYPASSING_BUFFER     = 'X'
            CHANGING
                 CT_FIELDCAT            = C_T_FIELDCAT
            EXCEPTIONS
                 INCONSISTENT_INTERFACE = 1
                 PROGRAM_ERROR          = 2
                 OTHERS                 = 3.
    ENDFORM.
    FORM DOWNLOAD_DATA_HEADER
                  TABLES T_OUTTAB
                  T_FIELDCAT
                  USING P_FILENAM.
       TYPE-POOLS: SLIS.
       REPLACE 'YYYYMMDD' WITH SY-DATUM INTO P_FILENAM.
       DATA: T_GXXLT_O    TYPE TABLE OF GXXLT_O WITH HEADER LINE,
             T_GXXLT_H    TYPE TABLE OF GXXLT_H WITH HEADER LINE,
             T_GXXLT_H_TEMP TYPE TABLE OF GXXLT_H WITH HEADER LINE,
             T_GXXLT_P    TYPE TABLE OF GXXLT_P WITH HEADER LINE,
             T_GXXLT_S    TYPE TABLE OF GXXLT_S WITH HEADER LINE,
             T_GXXLT_V    TYPE TABLE OF GXXLT_V WITH HEADER LINE,
             L_S_FIELDCAT TYPE SLIS_FIELDCAT_ALV..
       DATA: F_FILE       TYPE GXXLT_F-FILE,
             F_ATT_COLS   TYPE I,
             F_HRZ_KEYS   TYPE I,
             F_VRT_KEYS   TYPE I.
    TYPES: BEGIN OF TY_FLDNM,
               FIELDNAME(30) TYPE C,
            END   OF TY_FLDNM.
    DATA : L_T_FLDNAME TYPE TABLE OF TY_FLDNM,
            L_R_FLDNAME TYPE TY_FLDNM.
    REFRESH:  L_T_FLDNAME.
    LOOP AT T_FIELDCAT INTO L_S_FIELDCAT .
       CLEAR L_R_FLDNAME.
       CONCATENATE  L_S_FIELDCAT-SELTEXT_S  '_'
                    L_S_FIELDCAT-FIELDNAME
        INTO L_R_FLDNAME-FIELDNAME.
       APPEND L_R_FLDNAME TO L_T_FLDNAME.
    ENDLOOP.
    IF T_OUTTAB[] IS INITIAL.
       WRITE : /'No data Fetch !'.
    ELSE.
       DESCRIBE TABLE T_FIELDCAT LINES F_ATT_COLS.
       LOOP AT T_FIELDCAT INTO L_S_FIELDCAT.
         T_GXXLT_H-COL_NO        = L_S_FIELDCAT-COL_POS.
         T_GXXLT_H-ROW_NO        = 1.
         T_GXXLT_H-COL_NAME      = L_S_FIELDCAT-FIELDNAME.
         APPEND T_GXXLT_H.
         CLEAR T_GXXLT_S.
         T_GXXLT_S-COL_NO        = L_S_FIELDCAT-COL_POS.
         T_GXXLT_S-COL_OPS       = 'NOP'.
         T_GXXLT_S-COL_SRC       = L_S_FIELDCAT-COL_POS.
         CASE L_S_FIELDCAT-INTTYPE.
           WHEN 'Z' OR 'P' OR 'I' OR 'F'.
             T_GXXLT_S-COL_TYP   = 'NUM'.
           WHEN 'C' OR 'X' OR 'T' OR 'N'.
             T_GXXLT_S-COL_TYP   = 'STR'.
           WHEN 'D'.
             T_GXXLT_S-COL_TYP   = 'DAT'.
          WHEN OTHERS.
            T_GXXLT_S-COL_TYP   = 'STR'.
        ENDCASE.
        APPEND T_GXXLT_S.
        IF L_S_FIELDCAT-KEY EQ 'X'.
          CLEAR T_GXXLT_H.
          T_GXXLT_H-COL_NO     = L_S_FIELDCAT-COL_POS.
          T_GXXLT_H-ROW_NO     = 1.
          T_GXXLT_H-COL_NAME   = L_S_FIELDCAT-FIELDNAME.
          APPEND T_GXXLT_H.
        ENDIF.
      ENDLOOP.
      MOVE P_FILENAM TO F_FILE.
      LOOP AT T_FIELDCAT INTO L_S_FIELDCAT.
        READ TABLE T_GXXLT_H WITH KEY COL_NAME = L_S_FIELDCAT-FIELDNAME.
        IF SY-SUBRC EQ 0.
          T_GXXLT_H_TEMP-COL_NO = T_GXXLT_H-COL_NO.
          T_GXXLT_H_TEMP-ROW_NO = 2.
          T_GXXLT_H_TEMP-COL_NAME =  L_S_FIELDCAT-SELTEXT_S.
          APPEND T_GXXLT_H_TEMP TO T_GXXLT_H.
          CLEAR T_GXXLT_H.
          ENDIF.
        ENDLOOP.
        CALL FUNCTION 'XXL_FULL_API'
             EXPORTING
                  FILENAME          = F_FILE
                  NO_START          = ''
                  N_ATT_COLS        = F_ATT_COLS
                  N_HRZ_KEYS        = F_HRZ_KEYS
                  N_VRT_KEYS        = F_VRT_KEYS
                  SEMA_TYPE         = ''
                  SO_TITLE          = ''
             TABLES
                  DATA              = T_OUTTAB
                  HKEY              = T_GXXLT_H
                  ONLINE_TEXT       = T_GXXLT_O
                  PRINT_TEXT        = T_GXXLT_P
                  SEMA              = T_GXXLT_S
                  VKEY              = T_GXXLT_V
             EXCEPTIONS
                  CANCELLED_BY_USER = 1
                  DATA_TOO_BIG      = 2
                  DIM_MISMATCH_DATA = 3
                  DIM_MISMATCH_SEMA = 4
                  DIM_MISMATCH_VKEY = 5
                ERROR_IN_HKEY     = 6
                ERROR_IN_SEMA     = 7
                FILE_OPEN_ERROR   = 8
                FILE_WRITE_ERROR  = 9
                INV_DATA_RANGE    = 10
                INV_WINSYS        = 11
                INV_XXL           = 12
                OTHERS            = 13.
      ENDIF.
    ENDFORM.

  • 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 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.

  • Regarding downloading data into excel from alv output

    hi experts,
    i have developed a customized report(ALV) in which the employee number and all details are coming but when i press
    download to excel button and get downloaded it to the excel sheet the employee number is only not coming but all details are coming in the excel sheet.please help me to short out this problem.
    Also what i found that when i press print preview button then employee number here is also not coming but rest
      of the details are coming.

    Hi Ravi,
               For downloading the data from ALV to Excel use the following FM's
    SAP_CONVERT_TO_XLS_FORMAT
    GUI_DOWNLOAD.
    In the function GUI_DOWNLOAD use the filetype as "DBF" due to which all the data gets downloaded perfectly.
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                        = fname
          FILETYPE                        = 'DBF'
        APPEND                          = ' '
        WRITE_FIELD_SEPARATOR           = ' '
        HEADER                          = '00'
        TRUNC_TRAILING_BLANKS           = ' '
        WRITE_LF                        = 'X'
        COL_SELECT                      = ' '
        COL_SELECT_MASK                 = ' '
        DAT_MODE                        = ' '
        CONFIRM_OVERWRITE               = ' '
        NO_AUTH_CHECK                   = ' '
        CODEPAGE                        = ' '
        IGNORE_CERR                     = ABAP_TRUE
        REPLACEMENT                     = '#'
        WRITE_BOM                       = ' '
        TRUNC_TRAILING_BLANKS_EOL       = 'X'
        WK1_N_FORMAT                    = ' '
        WK1_N_SIZE                      = ' '
        WK1_T_FORMAT                    = ' '
        WK1_T_SIZE                      = ' '
        WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
      IMPORTING
        FILELENGTH                      =
        tables
          data_tab                        =  itab
        FIELDNAMES                      =
      EXCEPTIONS
        FILE_WRITE_ERROR                = 1
        NO_BATCH                        = 2
        GUI_REFUSE_FILETRANSFER         = 3
        INVALID_TYPE                    = 4
        NO_AUTHORITY                    = 5
        UNKNOWN_ERROR                   = 6
        HEADER_NOT_ALLOWED              = 7
        SEPARATOR_NOT_ALLOWED           = 8
        FILESIZE_NOT_ALLOWED            = 9
        HEADER_TOO_LONG                 = 10
        DP_ERROR_CREATE                 = 11
        DP_ERROR_SEND                   = 12
        DP_ERROR_WRITE                  = 13
        UNKNOWN_DP_ERROR                = 14
        ACCESS_DENIED                   = 15
        DP_OUT_OF_MEMORY                = 16
        DISK_FULL                       = 17
        DP_TIMEOUT                      = 18
        FILE_NOT_FOUND                  = 19
        DATAPROVIDER_EXCEPTION          = 20
        CONTROL_FLUSH_ERROR             = 21
        OTHERS                          = 22
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Pls reward if useful.
    Thanks,
    Sirisha.

  • 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

  • Download data into excel with boxes

    Hi Folks,
               In my goods receipt report output, there is a footer with boxes for signature purpose.
               This output should be able to download in Excel format.
               Is it possible to show the boxes in excel file while downloading the output?
               If so, please suggest me how to do so..
              Thanks in advance,
              Shyam.

    Hi ermac,
                  Is there any simple process other than OLE application, as it is a simple report.
                       Thanks,
                       Shyam.

  • Create Back ground job for data recieved from a legacy system

    Hi All,
    I have a requirement where i need to schedule a back ground job once a proxy is triggered for the address data sent from a Legacy system. This proxy is triggerred from SAP PI, then i need to create a job shedule where address data is created as BP's(Business Partners) and assigned to a already created Target Group. Then once the Target group is completed with all BP needs to assigned to aCampaign Id. As the data is large it takes lot of time to execute. Please Advice.
    Regards,
    Nagesh Thanneeru

    Hi
    If you can divide the data into two internal tables and later collect into the one internal table, this could solve yuor problem.
    Also you need to make sure that enough memory is available in the system. Check DB6cockpit for that.
    Also there are a lot of correction notes available with SAP for the error"TSV_TNEW_BLOCKS_NO_ROLL_MEMORY"
    Check what the job exactly does, and search for the relevant notes, as there are different notes for different application areas...
    if its a loading job(Infopackage) you can reduce the data packet size of the IP, but that might hamper the loading performance.
    Hope this helps
    Regards
    Shilpa

  • How to download data into  two different columns 2003 excel format in ole

    Hi ALL
    when we download data into excel using ole with delimiter it works fine in 2007 but when we check this with 2003 format
    both fields come in only one column .Can any one suggest  
      CONCATENATE WA_ALL-PERNR LV_ICNUM INTO WA_PERNR SEPARATED BY W_DELI   IN CHARACTER MODE.

    If you're already using OLE, you can fill in value for each cell separately instead of using a delimiter. Something like this fragment:
    FORM fill_cell USING p_row p_col p_value.
      CALL METHOD OF obj_excel 'CELLS' = obj_cell
        EXPORTING
        #1 = p_row
        #2 = p_col.
      SET PROPERTY OF obj_cell 'VALUE' = p_value.
    ENDFORM.                    "fill_cell

  • Download BSP data into Excel

    Hello all,
    I want create a BSP page, with 2 radio buttons,
    If 1st selected I want read 2 tables and display data other BSP page.
    If 2nd one selected I want download 2 tables data into excel file.
    Any one can help how to download data into excel file and display data into other bsp page.
    Thanks,
    Regards,
    Venkat

    For downloading to a spread sheet:
    Convert your fetched data to a string and convert to XSTRING format and finally download to a spread sheet.
    Sample: I selected data from vbak say vbeln and kunnr in an internal table.
    data : v_string type string, v_xstring type xstring.
    <header portion - to have the heading in the spread sheet>
    concatenate 'Order Number' 'Customer'
       cl_abap_char_utilities=>cr_lf into v_string
       separated by cl_abap_char_utilities=>horizontal_tab.
    <Line item entries from my internal table say i_vbak>
    loop at i_vbak into wa_vbak.
      concatenate v_string wa_vbak-vbeln wa_vbak-kunnr
       cl_abap_char_utilities=>cr_lf into v_string
       separated by cl_abap_char_utilities=>horizontal_tab.
    endloop.
    All the data is now in string format. Calling the FM to convert to XSTRING
      call function 'SCMS_STRING_TO_XSTRING'
        exporting
          text     = v_string
          mimetype = 'APPLICATION/MSEXCEL; charset=utf-16le' (probably create this in a variable and call here)
        importing
          buffer   = v_xstring.
    concatenate cl_abap_char_utilities=>byte_order_mark_little v_xstring into v_xstring in byte mode.
    Now we have it in XSTRING format - this can be downloaded to a spread sheet.
    v_appl = 'APPLICATION/MSEXCEL; charset=utf-16le'.
    runtime->server->response->set_header_field( name = 'content-type' value = v_appl ).
    Eliminating the cache problems when loading Excel Format
    runtime->server->response->delete_header_field( name = if_http_header_fields=>cache_control ).
    runtime->server->response->delete_header_field( name = if_http_header_fields=>expires ).
    runtime->server->response->delete_header_field( name = if_http_header_fields=>pragma ).
    Start excel in a separate window
    runtime->server->response->set_header_field( name = 'content-disposition' value = 'attachment; filename=Order_list.xls' ).
    Displaying the data in excel.
    v_len = xstrlen( v_xstring ).
    runtime->server->response->set_data( data = v_xstring length = v_len ).
    navigation->response_complete( ).
    All the above code can be written in onInputprocessing event (probably your loop/selection can be in a method of your appl class).
    I believe you are triggering the event based on a click (say radio button or a button after selecting the radiobutton).
    In the other screen you can use tableview to display your data - probably two sub screens(page fragment) to display each table.
    Regds,
    Krish

  • Error while activating ODS is not caught in the back ground job..

    Hi All,
    We have a back ground job to load data to ODS and to activate it..If there is any error while loading or activating the data, back ground job is going into loop instead of cancelling the job..As the job is going into loop we are unable to trace the error unless we cancel the job manually and checking it..We have switched off displaying any messages while doing the back ground job...also we can not set any time limit for the job as it always depends on the volume of the data.
    My requirement is , back ground job must get cancelled if there is any error while loading the ODS..Can anybody suggest any idea on this..
    Thanks for reading.
    Umamaheswar kumar

    Hi Uma,
    A few hints for running and schedule and monitoring process chains:
    - always schedule the process chain in tcode RSPC
    - check the log in RSPC for error messages, or
    - check BW monitor for the ODS concerned (tcode RSMO, tab Details)
    if anything is not working fine, the status of the corresponding load will show you the errors, warnings ...
    either in RSPC - log or RSMO.
    hope it helps.
    Regards,
    Lilly

  • 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

  • Exporting into Excel Using the Dynpro Binary Cache is not working on NW04s

    Hello,
    I am using excel data export using the
    "Exporting Context Data into Excel Using the Web Dynpro Binary Cache" guide at
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/edc2f3c2-0401-0010-8898-acd5b6a94353">this link</a>.
    The tutorial is working on NW04 but when I use it on NW04s I receive errors for the StringBuffer object:
    java.lang.NoSuchMethodError: java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/AbstractStringBuilder;
    Any ideas?

    Hallo Roy,
    I have created an updated/enhanced version of this tutorial running on NW 7.0. The new solution allows to open the exported Excel File instantly without opening a popup window befor:
    See <a href="https://wiki.sdn.sap.com/wiki/x/0mQ">Exporting Table Data Using On-Demand Streams - SAP NetWeaver 7.0</a>.
    <b>NOTE:</b>
    Use <b>LinkedHashMap</b> instead of <i>HashMap</i>
      private Map getProductColumnInfos() {
        Map columnInfosMap = new LinkedHashMap();
        columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.QUANTITY, "Quantity");
        columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.ARTICLE, "Article");
        columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.COLOR, "Color");
        columnInfosMap.put(IPrivateTableCompBasketView.IProductsElement.PRICE, "Price in EURO");
        columnInfosMap.put(
          IPrivateTableCompBasketView.IProductsElement.TOTAL__PER__ARTICLE,
          "Total Per Article In Euro");
        return columnInfosMap;
    This keeps the order of key-displaytext-pairs passed by the client (table component) to the service (excel export component) stable.
    Regards, Bertram

Maybe you are looking for