Unable to download the data perfectly into excel sheet

Hi Frnds,
when i am trying to download the data from the output of a report into excel, some of the records(line items/rows) are getting stored in one of column of the excel sheet. Fog eg: my report outputs 500 line items. In excel after 100 rows the next 5-10 records/rows are storing in one column. so at the end of excel sheet i may not find total 500 records/line items.
Plz suggest me how to handle this.
Thnks,
Pavan

*& Report  ZETA_EXCEL_DOWNLOAD_CLIPBOARD                               *
report  zeta_excel_download_clipboard           .
include ole2incl.
data:  w_cell1     type ole2_object,
       w_cell2     type ole2_object.
*--- Ole data Declarations
data: h_excel     type ole2_object,        " Excel object
      h_mapl      type ole2_object,        " list of workbooks
      h_map       type ole2_object,        " workbook
      h_zl        type ole2_object,        " cell
      h_f         type ole2_object,        " font
      gs_interior type ole2_object,        " Pattern
      worksheet   type ole2_object,
      h_cell      type ole2_object,
      h_cell1     type ole2_object,
      range       type ole2_object,
      h_sheet2    type ole2_object,
      h_sheet3    type ole2_object,
      gs_font     type ole2_object,
      flg_stop(1) type c.
          Internal table Declaration
data: begin of t_excel occurs 0,
vkorg(20) type c, "Sales Org
vbtyp(20) type c, "Document Category
auart(20) type c, "Document Type
ernam(20) type c, "Created By
vbeln(20) type c, "Document Number
posnr(20) type c, "Item Number
erdat(20) type c, "Created Date
vdatu(20) type c, "Header Requested Delivery Date
reqdat(20) type c, "Request date
condat(20) type c, "Confirm date
lifsk(20) type c, "Header Block
txt30(30) type c, "Order User Status Description
lifsp(20) type c, "Line Block
dispo(20) type c, "MRP Controller
dsnam(20) type c, "MRP Controller Description
vmsta(20) type c, "Material Sales Status
kunnr(20) type c, "Sold To
cname(35) type c, "Sold To Name
regio(20) type c, "State
cufd(10) type c, "CUD
bstnk(20) type c, "PO#
bsark(20) type c, "Ordering Method
matnr(20) type c, "Material
maktx(35) type c, "Material Description
t200(20) type c, "T200
vtext(20) type c, "T200 Description
matkl(20) type c, "Material Group
zzbomind(7) type c, "BOM Indicator
ostat(20) type c, "Order Status
cmgst(20) type c, "CRD
inco1(20) type c, "Incoterms
oqty(20) type c, "Order Quantity
pqty(20) type c, "Open Quantity
unit(20) type c, "UOM
onet(20) type c, "Order Value
pnet(20) type c, "Open Value
curr(20) type c, "Currency key
so_bezei like tvkbt-bezei,"Sales Office
sg_bezei like tvgrt-bezei,"Sales Group
bname(20) type c, "Ordering Party
contact(20) type c, "Contact Name
telf1(20) type c, "Contact telf1
reqqty(20) type c, "Item Request qty
reqval(20) type c, "Item Request value
conqty(20) type c, "Item Confirm qty
conval(20) type c, "Item Confirm value
zzrev(02) type c, "Revenue recognition acceptance
bezei(20) type c, "Revenue recognition text
vgbel(20) type c, "Reference Order for RETURNS
0008text(255) type c, "Internal Order Comment Text
end of t_excel.
data: t_excel_bckord like t_excel occurs 0 with header line,
      t_excel_bcklog like t_excel occurs 0 with header line,
      t_excel_blkord like t_excel occurs 0 with header line.
  types: data1(1500) type c,
         ty          type table of data1.
  data:  it          type ty with header line,
it_2          type ty with header line,
it_3          type ty with header line,
         rec         type sy-tfill,
         deli(1)     type c,
         l_amt(18)   type c.
data: begin of hex,
         tab type x,
        end of hex.
  field-symbols: <fs>      .
  constants cns_09(2) type n value 09.
  assign deli to <fs> type 'X'.
  hex-tab = cns_09.
  <fs> = hex-tab.
data gv_sheet_name(20) type c .
M A C R O Declaration
define ole_check_error.
  if &1 ne 0.
    message e001(zz) with &1.
    exit.
  endif.
end-of-definition.
t_excel_bckord-vkorg = 'ABC'.
t_excel_bckord-vbtyp = 'DEF'.
t_excel_bckord-auart = 'GHI'.
t_excel_bckord-ernam = 'JKL'.
t_excel_bckord-vbeln = 'MNO'.
t_excel_bckord-0008text = 'XYZ'.
append t_excel_bckord.
t_excel_bckord-vkorg = 'ABC1'.
t_excel_bckord-vbtyp = 'DEF1'.
t_excel_bckord-auart = 'GHI1'.
t_excel_bckord-ernam = 'JKL1'.
t_excel_bckord-vbeln = 'MNO1'.
t_excel_bckord-0008text = 'XYZ1'.
append t_excel_bckord.
t_excel_bckord-vkorg = 'ABC2'.
t_excel_bckord-vbtyp = 'DEF2'.
t_excel_bckord-auart = 'GHI2'.
t_excel_bckord-ernam = 'JKL2'.
t_excel_bckord-vbeln = 'MNO2'.
t_excel_bckord-0008text = 'XYZ2'.
append t_excel_bckord.
t_excel_bcklog-vkorg = 'ABC'.
t_excel_bcklog-vbtyp = 'DEF'.
t_excel_bcklog-auart = 'GHI'.
t_excel_bcklog-ernam = 'JKL'.
t_excel_bcklog-vbeln = 'MNO'.
t_excel_bcklog-0008text = 'XYZ'.
append t_excel_bcklog.
t_excel_bcklog-vkorg = 'ABC1'.
t_excel_bcklog-vbtyp = 'DEF1'.
t_excel_bcklog-auart = 'GHI1'.
t_excel_bcklog-ernam = 'JKL1'.
t_excel_bcklog-vbeln = 'MNO1'.
t_excel_bcklog-0008text = 'XYZ1'.
append t_excel_bcklog.
t_excel_bcklog-vkorg = 'ABC2'.
t_excel_bcklog-vbtyp = 'DEF2'.
t_excel_bcklog-auart = 'GHI2'.
t_excel_bcklog-ernam = 'JKL2'.
t_excel_bcklog-vbeln = 'MNO2'.
t_excel_bcklog-0008text = 'XYZ2'.
append t_excel_bcklog.
t_excel_bcklog-vkorg = 'ABC3'.
t_excel_bcklog-vbtyp = 'DEF3'..
t_excel_bcklog-auart = 'GHI3'.
t_excel_bcklog-ernam = 'JKL3'.
t_excel_bcklog-vbeln = 'MNO3'.
t_excel_bcklog-0008text = 'XYZ3'.
append t_excel_bcklog.
t_excel_blkord-vkorg = 'ABC'.
t_excel_blkord-vbtyp = 'DEF'.
t_excel_blkord-auart = 'GHI'.
t_excel_blkord-ernam = 'JKL'.
t_excel_blkord-vbeln = 'MNO'.
t_excel_blkord-0008text = 'XYZ'.
append t_excel_blkord.
t_excel_blkord-vkorg = 'ABC1'.
t_excel_blkord-vbtyp = 'DEF1'.
t_excel_blkord-auart = 'GHI1'.
t_excel_blkord-ernam = 'JKL1'.
t_excel_blkord-vbeln = 'MNO1'.
t_excel_blkord-0008text = 'XYZ1'.
append t_excel_blkord.
t_excel_blkord-vkorg = 'ABC2'.
t_excel_blkord-vbtyp = 'DEF2'.
t_excel_blkord-auart = 'GHI2'.
t_excel_blkord-ernam = 'JKL2'.
t_excel_blkord-vbeln = 'MNO2'.
t_excel_blkord-0008text = 'XYZ2'.
append t_excel_blkord.
t_excel_blkord-vkorg = 'ABC3'.
t_excel_blkord-vbtyp = 'DEF3'..
t_excel_blkord-auart = 'GHI3'.
t_excel_blkord-ernam = 'JKL3'.
t_excel_blkord-vbeln = 'MNO3'.
t_excel_blkord-0008text = 'XYZ3'.
append t_excel_blkord.
t_excel_blkord-vkorg = 'ABC4'.
t_excel_blkord-vbtyp = 'DEF4'..
t_excel_blkord-auart = 'GHI4'.
t_excel_blkord-ernam = 'JKL4'.
t_excel_blkord-vbeln = 'MNO4'.
t_excel_blkord-0008text = 'XYZ4'.
append t_excel_blkord.
loop at t_excel_bckord.
concatenate
t_excel_bckord-vkorg
t_excel_bckord-vbtyp
t_excel_bckord-auart
t_excel_bckord-ernam
t_excel_bckord-vbeln
t_excel_bckord-posnr
t_excel_bckord-erdat
t_excel_bckord-vdatu
t_excel_bckord-reqdat
t_excel_bckord-condat
t_excel_bckord-lifsk
t_excel_bckord-txt30
t_excel_bckord-lifsp
t_excel_bckord-dispo
t_excel_bckord-dsnam
t_excel_bckord-vmsta
t_excel_bckord-kunnr
t_excel_bckord-cname
t_excel_bckord-regio
t_excel_bckord-cufd
t_excel_bckord-bstnk
t_excel_bckord-bsark
t_excel_bckord-matnr
t_excel_bckord-maktx
t_excel_bckord-t200
t_excel_bckord-vtext
t_excel_bckord-matkl
t_excel_bckord-zzbomind
t_excel_bckord-ostat
t_excel_bckord-cmgst
t_excel_bckord-inco1
t_excel_bckord-oqty
t_excel_bckord-pqty
t_excel_bckord-unit
t_excel_bckord-onet
t_excel_bckord-pnet
t_excel_bckord-curr
t_excel_bckord-so_bezei
t_excel_bckord-sg_bezei
t_excel_bckord-bname
t_excel_bckord-contact
t_excel_bckord-telf1
t_excel_bckord-reqqty
t_excel_bckord-reqval
t_excel_bckord-conqty
t_excel_bckord-conval
t_excel_bckord-zzrev
t_excel_bckord-bezei
t_excel_bckord-vgbel
t_excel_bckord-0008text
into it
separated by deli.
append it.
    clear it.
endloop.
loop at t_excel_bcklog.
concatenate
t_excel_bcklog-vkorg
t_excel_bcklog-vbtyp
t_excel_bcklog-auart
t_excel_bcklog-ernam
t_excel_bcklog-vbeln
t_excel_bcklog-posnr
t_excel_bcklog-erdat
t_excel_bcklog-vdatu
t_excel_bcklog-reqdat
t_excel_bcklog-condat
t_excel_bcklog-lifsk
t_excel_bcklog-txt30
t_excel_bcklog-lifsp
t_excel_bcklog-dispo
t_excel_bcklog-dsnam
t_excel_bcklog-vmsta
t_excel_bcklog-kunnr
t_excel_bcklog-cname
t_excel_bcklog-regio
t_excel_bcklog-cufd
t_excel_bcklog-bstnk
t_excel_bcklog-bsark
t_excel_bcklog-matnr
t_excel_bcklog-maktx
t_excel_bcklog-t200
t_excel_bcklog-vtext
t_excel_bcklog-matkl
t_excel_bcklog-zzbomind
t_excel_bcklog-ostat
t_excel_bcklog-cmgst
t_excel_bcklog-inco1
t_excel_bcklog-oqty
t_excel_bcklog-pqty
t_excel_bcklog-unit
t_excel_bcklog-onet
t_excel_bcklog-pnet
t_excel_bcklog-curr
t_excel_bcklog-so_bezei
t_excel_bcklog-sg_bezei
t_excel_bcklog-bname
t_excel_bcklog-contact
t_excel_bcklog-telf1
t_excel_bcklog-reqqty
t_excel_bcklog-reqval
t_excel_bcklog-conqty
t_excel_bcklog-conval
t_excel_bcklog-zzrev
t_excel_bcklog-bezei
t_excel_bcklog-vgbel
t_excel_bcklog-0008text
into it_2
separated by deli.
append it_2.
    clear it_2.
endloop.
loop at t_excel_blkord.
concatenate
t_excel_blkord-vkorg
t_excel_blkord-vbtyp
t_excel_blkord-auart
t_excel_blkord-ernam
t_excel_blkord-vbeln
t_excel_blkord-posnr
t_excel_blkord-erdat
t_excel_blkord-vdatu
t_excel_blkord-reqdat
t_excel_blkord-condat
t_excel_blkord-lifsk
t_excel_blkord-txt30
t_excel_blkord-lifsp
t_excel_blkord-dispo
t_excel_blkord-dsnam
t_excel_blkord-vmsta
t_excel_blkord-kunnr
t_excel_blkord-cname
t_excel_blkord-regio
t_excel_blkord-cufd
t_excel_blkord-bstnk
t_excel_blkord-bsark
t_excel_blkord-matnr
t_excel_blkord-maktx
t_excel_blkord-t200
t_excel_blkord-vtext
t_excel_blkord-matkl
t_excel_blkord-zzbomind
t_excel_blkord-ostat
t_excel_blkord-cmgst
t_excel_blkord-inco1
t_excel_blkord-oqty
t_excel_blkord-pqty
t_excel_blkord-unit
t_excel_blkord-onet
t_excel_blkord-pnet
t_excel_blkord-curr
t_excel_blkord-so_bezei
t_excel_blkord-sg_bezei
t_excel_blkord-bname
t_excel_blkord-contact
t_excel_blkord-telf1
t_excel_blkord-reqqty
t_excel_blkord-reqval
t_excel_blkord-conqty
t_excel_blkord-conval
t_excel_blkord-zzrev
t_excel_blkord-bezei
t_excel_blkord-vgbel
t_excel_blkord-0008text
into it_3
separated by deli.
append it_3.
    clear it_3.
endloop.
  if h_excel-header = space or h_excel-handle = -1.
start Excel
    create object h_excel 'EXCEL.APPLICATION'.
  endif.
PERFORM err_hdl.
*--- get list of workbooks, initially empty
  call method of h_excel 'Workbooks' = h_mapl.
PERFORM err_hdl.
  set property of h_excel 'Visible' = 1.
add a new workbook
  call method of h_mapl 'Add' = h_map.
PERFORM err_hdl.
*GV_SHEET_NAME = '1st SHEET'.
gv_sheet_name = 'Back Orders'.
  get property of  h_excel 'ACTIVESHEET' = worksheet.
set property of worksheet 'Name' = gv_sheet_name .
*--Formatting the area of additional data 1 and doing the BOLD
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 50.
call method of h_excel 'Range' = h_cell
exporting
#1 = w_cell1
#2 = w_cell2.
*CALL METHOD OF gs_cells 'Select' .
get property of h_cell 'Font' = gs_font .
set property of gs_font 'Bold' = 1 .
        data l_rc type i.
  call method cl_gui_frontend_services=>clipboard_export
    importing
      data                 = it[]
    changing
      rc                   = l_rc
    exceptions
      cntl_error           = 1
      error_no_gui         = 2
      not_supported_by_gui = 3
      others               = 4.
  call method of h_excel 'Cells' = w_cell1
    exporting
      #1 = 1
      #2 = 1.
  call method of h_excel 'Cells' = w_cell2
    exporting
      #1 = 1
      #2 = 1.
PERFORM err_hdl.
   call method of h_excel 'Range' = range
    exporting
      #1 = w_cell1
      #2 = w_cell2.
  call method of range 'Select'.
PERFORM err_hdl.
  call method of worksheet 'Paste'.
PERFORM err_hdl.
CALL METHOD OF h_excel 'QUIT'.
*GV_SHEET_NAME = '2ND SHEET'.
gv_sheet_name = 'Backlog'.
get property of h_excel 'Sheets' = h_sheet2 .
  call method of h_sheet2 'Add' = h_map.
set property of h_map 'Name' = gv_sheet_name .
  get property of  h_excel 'ACTIVESHEET' = worksheet.
*--Formatting the area of additional data 1 and doing the BOLD
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 50.
call method of h_excel 'Range' = h_cell
exporting
#1 = w_cell1
#2 = w_cell2.
get property of h_cell 'Font' = gs_font .
set property of gs_font 'Bold' = 1 .
  call method cl_gui_frontend_services=>clipboard_export
    importing
      data                 = it_2[]
    changing
      rc                   = l_rc
    exceptions
      cntl_error           = 1
      error_no_gui         = 2
      not_supported_by_gui = 3
      others               = 4.
  call method of h_excel 'Cells' = w_cell1
    exporting
      #1 = 1
      #2 = 1.
  call method of h_excel 'Cells' = w_cell2
    exporting
      #1 = 1
      #2 = 1.
PERFORM err_hdl.
   call method of h_excel 'Range' = range
    exporting
      #1 = w_cell1
      #2 = w_cell2.
  call method of range 'Select'.
PERFORM err_hdl.
  call method of worksheet 'Paste'.
*GV_SHEET_NAME = '3rd SHEET'.
gv_sheet_name = 'Blocked Orders'.
get property of h_excel 'Sheets' = h_sheet3 .
  call method of h_sheet3 'Add' = h_map.
set property of h_map 'Name' = gv_sheet_name .
  get property of  h_excel 'ACTIVESHEET' = worksheet.
*--Formatting the area of additional data 1 and doing the BOLD
call method of h_excel 'Cells' = w_cell1
exporting
#1 = 1
#2 = 1.
call method of h_excel 'Cells' = w_cell2
exporting
#1 = 1
#2 = 50.
call method of h_excel 'Range' = h_cell
exporting
#1 = w_cell1
#2 = w_cell2.
get property of h_cell 'Font' = gs_font .
set property of gs_font 'Bold' = 1 .
  call method cl_gui_frontend_services=>clipboard_export
    importing
      data                 = it_3[]
    changing
      rc                   = l_rc
    exceptions
      cntl_error           = 1
      error_no_gui         = 2
      not_supported_by_gui = 3
      others               = 4.
  call method of h_excel 'Cells' = w_cell1
    exporting
      #1 = 1
      #2 = 1.
  call method of h_excel 'Cells' = w_cell2
    exporting
      #1 = 1
      #2 = 1.
PERFORM err_hdl.
   call method of h_excel 'Range' = range
    exporting
      #1 = w_cell1
      #2 = w_cell2.
  call method of range 'Select'.
PERFORM err_hdl.
  call method of worksheet 'Paste'.
*--- disconnect from Excel
  free object h_zl.
  free object h_mapl.
  free object h_map.
  free object h_excel.

Similar Messages

  • Error while download the data to an Excel sheet for ECC report from EP

    Hi experts,
    I had created a report program which will download the data to an Excel sheet using SAP OLE object
    For this report i had created a tcode too. The report which i developed is perfectly working fine in SAPGUI. But if i download the data to an Excel sheet for the same report throught SAP EP.I am getting the  error that "Error in excel downlaod"
    I analyed by putting dubigg point and it throws exception while calling Function module.
    The excpetion is " OLE object id not found".
    Can any body gives a light on this why i'm not able download the excel in ep?
    Thanks,
    JB

    Hello,
    (by the way I came here to ask my question and is my first time visit but...)
    The problem is obvious: How do you expect OLE handler can "touch" the local PC Excel through a web browser? I believe that is not possible. That means (at least for me) that I have to create the whole documents before I return them to the user. That is why I use XML Office documents generation or you can try to hack some Export to excel features of ERP reports.
    Regards Otto

  • User request to explore the possibility of downloading the distribution lists into excel for maintenance in t-code SO23.

    Hi Experts,
    There is a requirement from user that  "To explore the possibility of downloading the distribution lists
    into excel for maintenance in t-code SO23 ".
    Kindly provide your valuable informations/assistance in this regard.
    Madhavan K

    This Applesctipt will add comma's to the file count:
    (Copy into Applescript Editor, and Save as File Format: App, then just click the App to run)
    set x to choose folder with prompt "Choose Folder to Count Files" default location alias (the path to pictures folder as text)
    set filecount to do shell script "find " & POSIX path of x & " ! -type d ! \\( -name \".*\" -or -name \"Icon*\" \\) | wc -l"
    display dialog "File Count: " & comma_delimit(trim(filecount))
    on trim(someText)
              repeat until someText does not start with " "
                        set someText to text 2 thru -1 of someText
              end repeat
              repeat until someText does not end with " "
                        set someText to text 1 thru -2 of someText
              end repeat
              return someText
    end trim
    on comma_delimit(this_number)
              set this_number to this_number as string
              if this_number contains "E" then set this_number to number_to_text(this_number)
              set the num_length to the length of this_number
              set the this_number to (the reverse of every character of this_number) as string
              set the new_num to ""
              repeat with i from 1 to the num_length
                        if i is the num_length or (i mod 3) is not 0 then
                                  set the new_num to (character i of this_number & the new_num) as string
                        else
                                  set the new_num to ("," & character i of this_number & the new_num) as string
                        end if
              end repeat
              return the new_num
    end comma_delimit

  • How to put the data from one excel sheet in another excel sheet

    hi ,
    I want put the data from one excel sheet in another excel sheet in seq. order Eg: I have one excel sheet in which i have 3 col. Name , Sno. , Email along with data .I want to put data from this sheet to another excel sheet in the following orders of col. Sno,Name, Email .
    While loading data in another sheet , i have to perform validation like char field should n't contain numeric values and vice versa .
    Let me know on this soon ..
    regards
    Prashant

    Well, you can issue separate queries with the ordering you need from each tab in the spreadhseet. You can open an ODBC connection from a VBA macro, select a sheet, run a query, select another sheet and run another query. As for the validation, you can do this in Oracle via stored procedures or again in VBA code.

  • Reg: Downloading the internal table into excel file.

    Hi,
    My requirement is i am collecting data in the internal table and i have to download the contents in an excel file and i have declared like this.
    PARAMETERS : x_test    TYPE string
                          DEFAULT 'C:\temp\file.txt'.
    I have given the default file path  like this and i am using the function module .
      CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
      BIN_FILESIZE                    =
          FILENAME                      = OUTPUT_PATH
          FILETYPE                      = 'DAT'
    IMPORTING
      FILELENGTH                      =
        TABLES
          DATA_TAB                        = INT_INPUT
      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.
    My requirement is i dont want to change my extension as .txt from .exl to my parameter addition and in the function module the file type should be 'dat' only and in the runtime i want to change the file name which i have given in the .
    PARAMETERS : x_test    TYPE string
                          DEFAULT 'C:\temp\file.txt' this file.txt into datas.xls.
    it would be grateful if some one share some valuable views to wards this query
    Thanks and Regards,
    Keny

    Hi,
    Use this code.
    It will ask for the file name...there u can change.
      data : l_filename type string,
             l_filetype type char10,
             l_path type string,
             l_fullpath type string.
      l_filetype = 'DAT'.
    *Get the file name
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
        EXPORTING
          FILE_FILTER          = '*.DAT'
          INITIAL_DIRECTORY    = 'C:\'
        CHANGING
          FILENAME             = l_filename
          PATH                 = l_path
          FULLPATH             = l_fullpath
        EXCEPTIONS
          CNTL_ERROR           = 1
          ERROR_NO_GUI         = 2
          NOT_SUPPORTED_BY_GUI = 3
          others               = 4.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      check l_fullpath is not initial.
    *Download file
      CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
        EXPORTING
          FILENAME                = l_fullpath
          FILETYPE                = l_filetype
        CHANGING
          DATA_TAB                = t_data_sum[]
        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
          NOT_SUPPORTED_BY_GUI    = 22
          ERROR_NO_GUI            = 23
          others                  = 24.
      IF sy-subrc NE 0.
        MESSAGE e398(00) WITH sy-subrc ' Error downloading file' '' ''.
      ENDIF.
    Regards
    Sandeep REddy

  • Downloading the ALV layout to Excel sheet

    Displaying ALV using OOPS concept.
    Dynamic internal table is passed in the
        CALL METHOD gcl_grid->set_table_for_first_display
    For downloading into Excel sheet used EXPORT->LOCAL FILE->Spread sheet
    <b>The TEXT.XLS file is not looking like as it is there in the layout.</b>
        gv_layout-cwidth_opt = 'X'.
        gv_layout-sel_mode   = 'A'.
        CALL METHOD gcl_grid->set_table_for_first_display
          EXPORTING
       I_BYPASSING_BUFFER            =
       I_BUFFER_ACTIVE               =
       I_CONSISTENCY_CHECK           =
       i_structure_name              =
       IS_VARIANT                    =
            i_save                        = 'A'
            i_default                     = 'X'
            is_layout                     = gv_layout
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
          CHANGING
            it_outtab                     = <tabx>
            it_fieldcatalog               = gt_fieldcatalog
       IT_SORT                       =
       IT_FILTER                     =
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
    What will be the problem? Pls. resolve this.

    Hi Sreedevi,
       1) Once you have alv report displayed in the screen.
       2) Click button 'View' ( next to print button) on application toolbar
       3) Select Excel in Place
       4) This will download the same format as of Report
    I hope your ALV have all the Standard functions in Toolbar. If not copy the status from and get the function as mentioned above.
    Program - SAPLSALV
    Status - STANDARD
    Reward points if this Helps.
    Manish

  • Unable to capture the Data Source into a Transport Request

    Hi All,
    We have a product hierarchy and we are using the data source :4R_PRODH_D_LGEN_HIER for the hierarchy.
    Now we need to transport this structure to the quality environment but we were not able to capture the datasource:4R_PRODH_D_LGEN_HIER into a transport request.
    When ever we activate the data source:4R_PRODH_D_LGEN_HIER it is asking for the Package and the Transport Request Number.If we give these details and save it, data source is not getting captured in the request, only the "bject Directory Entry" is getting captured.
    Can someone please guide me on how to capture the datasource under "Data Sources in BW" in a transport request.
    Regards,
    Sachin Dehey.

    Hi Sachin,
    Hierarachy datasource is not captured as Attributes and Text Datasource. So what ever you have done is correct.
    What ever is captured in Object Directory Entry is correct. So go ahead with your transports, once transport is done check the Hierarchy Infopackage with Available OLTP hierarchies and load the data.
    Most important thing first see that the all Master & Transactional Datasources are transported in R/3 Dev to QA to PRD
    In BW, datasources are not transported, only their replica is transported.
    Transportation of Datasource is done in R/3. Only their replica is transported in BW.
    So wht ever you have done till now is correct. So go ahead.
    While attaching Hierarchy Datasource it is captured only in "Object Directory Entry"
    Regards,
    Vishnu.

  • Download the grid output to excel sheet

    Hi Friends,
    i have generated an ALV GRID report, in that its showing 800+ records, but when i download that  to excel sheet 25 odd records are missing in the between,
    i have downloaded through local file -
    > to spreadsheet.
    Can you please tell me the error.
    Regards
    Kumar M

    hi kumar,
    have generated an ALV GRID report, in that its showing 800+ records, but when i download that to excel sheet 25 odd records are missing in the between,
    i have downloaded through local file -
    > to spreadsheet.
    Can you please tell me the error.
    how u solved this problem  same problem  i am also getting plz tell me the solution.
    Thanks & Regards,
    Ravi.

  • Weird problem when downloading the output to an excel sheet

    Hi to all,
          when i download the list, output by an alv grid, i observe a weird problem..in the excel sheet the last digit (10th digit) of the first col. which is delivery no., is getting truncated...0001802563 is getting downloaded as 000180256..couldn't understand why...when i use conversion_exit fm, the values are not getting truncated and downloading correctly...curious to know what's gone wrong in this funcationality? thanks all
    cheers,
    Shankar. M.

    actually the problem is in the field catalog.if u can send me the code, i shall bug fix it for u.

  • Can i use OER to store the data from a excel sheet that pertains to the entire integrations ?

    hi ,
    i know that the OER can be used to view the entire landscape for the SOA composites and how they are related with each other. However we have a requirement wherein we need to store the data for the entire integration end systems e.g. ebiz, mfgpro, siebel etc ( that is we need to store data one level up).
    Also,  we want a customized form in OER wherein user can manually add data regarding the integrations.
    So is it possible to do so ? If yes, how ?

    ok, let me put it this way,
    I tried using the import/export utility available under OER admin tab.
    When i export my existing assets it generates the .xml file for each asset. Now as i have hundreds on new assets to be created for each asset type i want to be able to create a new .xml file and want it to create the new asset once i import it using import utility. I tried creating a new .xml file giving it a new UUID but it does not seem to work. Has anyone tried this earlier who can give the steps to do this ?

  • Download the data into excel sheet

    hello experts,
    I am using the GUI_DOWNLOAD fm to download the data in to excell sheet on to the desktop but here i am getting some problem
    For some of the fields i put constant values like '004' or '001' when it is downloaded the data into to .xls its removing the leading zeros.. and just downloading the values as 4 or 1
    can anyone guide me how to hold those leading zeros
    its bit urgent plz

    These are XL Issue ,you can use diffrenet logic
    Check the below logic :
    REPORT ZTEST3 line-size 400.
    <b>DATA : V_CHAR(1) TYPE C VALUE ''''.</b>
    data : v_field(12) type c.
    data : begin of itab occurs 0,
           fld1(12) type c,
           end of itab.
    start-of-selection.
    v_field = '0000012345'.
    CONCATENATE V_CHAR  V_FIELD  INTO V_FIELD.
    itab-fld1 = v_field.
    append itab.
    CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
        FILENAME                      =
        'C:\Documents and Settings\smaramreddy\Desktop\fff.xls'
       FILETYPE                      = 'ASC'
      MODE                          = ' '
      WK1_N_FORMAT                  = ' '
      WK1_N_SIZE                    = ' '
      WK1_T_FORMAT                  = ' '
      WK1_T_SIZE                    = ' '
      COL_SELECT                    = ' '
      COL_SELECTMASK                = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      TABLES
        DATA_TAB                      = itab
      FIELDNAMES                    =
    EXCEPTIONS
       FILE_OPEN_ERROR               = 1
       FILE_WRITE_ERROR              = 2
       INVALID_FILESIZE              = 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 <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    I have used one field here ,i am not sure for many fields in internal table.
    Thanks
    Seshu

  • Downloading PO's into excel sheet?

    Hello All!
    I am trying to download the po's into excel sheet through a programm. In this regard i would like to know the procedure for that.
    Presently my plan is to collect all the fields into two internal tables (one for header and another for item data).Now how to append the two internal table into a single itab. I want to use this itab in gui_download funtion module!
    Am i doing right. If i am going wrong plz guide me.
    Mail me to [email protected]
    Regards,
    LN

    hi,
    no need to download the header and data seperately.
    dowload the data only.
    kindly chek the below code.
    here 'v_start_row' is '2', so it avoid the header. if u wants the header make it as '1'.
    v_end_col means the numbers of columns u have
    DATA : int_excel LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.
    DATA : v_start_col TYPE i VALUE '1',
           v_start_row TYPE i VALUE '2', "only from data row
           v_end_col   TYPE i VALUE '6', "no of columns.
           v_end_row   TYPE i VALUE '1000'.
      PERFORM f_upload.
    *&      Form  f_upload
          text
    -->  p1        text
    <--  p2        text
    FORM f_upload .
      CLEAR : int_excel, int_excel[].
      CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        EXPORTING
          filename                = wf_filename
          i_begin_col             = v_start_col
          i_begin_row             = v_start_row
          i_end_col               = v_end_col
          i_end_row               = v_end_row
        TABLES
          intern                  = int_excel
        EXCEPTIONS
          inconsistent_parameters = 1
          upload_ole              = 2
          OTHERS                  = 3.
      IF sy-subrc <> 0.
    *Message is 'Unable to upload data from  '  wf_filename.
        MESSAGE e169(zm050) WITH wf_filename.
      ELSE.
        SORT int_excel BY row col.
        REFRESH : record.
        CLEAR   : record.
        LOOP AT int_excel.
          CASE int_excel-col.
            WHEN 1.
              record-wf_mf_zone_code_003  = int_excel-value.
            WHEN 2.
              record-wf_mf_country_code_004 = int_excel-value.
            WHEN 3.
              record-wf_country_code_001 = int_excel-value.
            WHEN 4.
              record-wf_zone_desc_002 = int_excel-value.
            WHEN 5.
              record-wf_loekz = int_excel-value.
          ENDCASE.
          AT END OF row.
            APPEND record.
            CLEAR record.
          ENDAT.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " f_upload
    hope this helps u.
    if so pls reward points
    regards,
    anversha
    [email protected]

  • How to download data displayed in a BSP page into Excel sheet

    Hi,
    I'm displaying an internal table data into tableview of a BSP page. I want to provide a feature to download the tableview contents to Excel sheet from Internet Explorer.  How do I do it?  Can someone guide me.
    Kedhar.

    Hi Kedhar,
    welcome to SDN. You should try to use the Search functionality here. Then you will find this Weblog:
    <a href="/people/thomas.jung3/blog/2004/09/02/creating-a-bsp-extension-for-downloading-a-table">Creating a BSP Extension for Downloading a Table</a>.
    You can award points if this answer was helpfull.
    Regards
    Gregor

  • How to export a dynamically generated datatable into excel sheet 2013?

    I have one data table and in that data table i am fetching data from sharepoint 2013 lists.
    When I export that data table into excel sheet, what ever data is static will be shown but the data which I fetch from lists are not coming.
    How should I get that data in my excel sheet from that data table?
    This is the code for Export to Excel:
    public void ExportToExcel(DataTable dt)
    if (dt.Rows.Count > 0)
    string filename = "WebTrafficReport.xls";
    System.IO.StringWriter tw = new System.IO.StringWriter();
    System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
    DataGrid dgGrid = new DataGrid();
    dgGrid.DataSource = dt;
    dgGrid.DataBind();
    //Get the HTML for the control.
    dgGrid.RenderControl(hw);
    //Write the HTML back to the browser.
    //Response.ContentType = application/vnd.ms-excel;
    Response.ContentType = "application/vnd.ms-excel";
    Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename + "");
    this.EnableViewState = false;
    Response.Write(tw.ToString());
    Response.End();
    Thanks in Advance.

    ublic void ExportToExcel(DataTable dt)
    if (dt.Rows.Count > 0)
    string filename = "WebTrafficReport.xls";
    System.IO.StringWriter tw = new System.IO.StringWriter();
    System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);
    DataGrid dgGrid = new DataGrid();
    dgGrid.DataSource = dt;
    dgGrid.DataBind();
    //Get the HTML for the control.
    dgGrid.RenderControl(hw);
    //Write the HTML back to the browser.
    //Response.ContentType = application/vnd.ms-excel;
    Response.ContentType = "application/vnd.ms-excel";
    Response.AppendHeader("Content-Disposition", "attachment; filename=" + filename + "");
    this.EnableViewState = false;
    HttpContext.Current.Response.Write(sw.ToString());
                        HttpContext.Current.Response.Flush();
                        HttpContext.Current.Response.End();
    }}try this should help

  • Regarding the o/p in excel sheet

    hi experts,
    i have developed one report in alv when i transfer it to excel sheet its coming rt in development server,,but in production server when i take it to excel sheet the material number gets cut (half) and extra zero is coming ...why plz help me.....

    hi,
    go to the following thread
    Can we generate output of a report in an Excel Sheet?
    weird problem when downloading the output to an excel sheet
    ALV Report output in Excel format
    <b>plz reward if  useful</b>
    Swati

Maybe you are looking for

  • IMovie HD projects on an external hard drive problems?

    I've recently been making a highlight tape for my football team. Since i dont want to take up that much space on my computer, I've decided to use an external hard drive. Making this project means taking DVD's that arent in the correct format and ripp

  • How to add observable behaviour in existing code?

    Hi everyone, I'm new to design patterns. I have an existing numerical analysis package that I use to find roots using multiple strategy (bisection, secant, newton, etc). I want to show the process of root finding for every iterations taken by the alg

  • UDF help

    Dear All, Kindly let me know what am I doing wrong in the below code? I am getting errors in the UDF ... int I_Length = 0; int H_Count = 0; String flag; H_Count = I_Val.replaceAll("-","").length();  // Count all "-" in the string I_Length = I_Val.len

  • LabVIEW 8.2 - Custom Probe mystery behavior

    Hi: I recently updated code built in v7.1 to v8.2.  In one section, I have a simple wire that contains I16 data array.  When I put a probe on the wire, the probe shows the data as it should.  When I select a custom probe via 'custom probe,' 'controls

  • Where can I find a link to buy the activation key?

    My laptop dies and I replaced it.  I need Acrobat for my work.  So I downloaded the trial version.  It works just fine.  The trial expired and I want to purchase the activation key.  I cannot find a link anywhere on the Adobe website.  Can someone po