How to Download colours of ALV outout into Excel file ?

Hi All,
I have a requirement, Download ALV output into Excel file
but the ALV output contains colors,
I need to download as it is ALV output into Excel,
Please guide me, how to do ?
If it is not possible, Pls provide any other solution for this ?
Appreciate your valuable answers,
Thanks.
Regards,
Prasad.

Hi,
Instead of ALV,  ucan directly write the output to EXCEL along with the required attributes.  Find the below sample code. This might solve ur problem.
Venkat.
*& Report  Y_ALV_OLE
REPORT  YALV_OLE.
this report demonstrates how to send some ABAP data to an
EXCEL sheet using OLE automation.
include ole2incl.
handles for OLE objects
data: h_excel type ole2_object, " Excel object
h_mapl type ole2_object, " list of workbooks
h_map type ole2_object, " workbook
h_zl type ole2_object, " cell
h_f type ole2_object, " font
h_c type ole2_object. " color
DATA: FILENAME LIKE RLGRAP-FILENAME.
tables: spfli.
data h type i.
table of flights
data: it_t100 like T100 occurs 10 with header line.
*& Event START-OF-SELECTION
start-of-selection.
read flights
select *
from t100
up to 100 rows
into table it_t100
where SPRSL = sy-langu .
tell user what is going on
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-007
exceptions
others = 1.
start Excel
create object h_excel 'EXCEL.APPLICATION'.
PERFORM ERR_HDL.
set property of h_excel 'Visible' = 1.
CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING #1 =
*'c:\kis_excel.xls' .
PERFORM ERR_HDL.
tell user what is going on
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-008
exceptions
others = 1.
get list of workbooks, initially empty
call method of h_excel 'Workbooks' = h_mapl.
perform err_hdl.
add a new workbook
call method of h_mapl 'Add' = h_map.
perform err_hdl.
tell user what is going on
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
PERCENTAGE = 0
text = text-009
exceptions
others = 1.
output column headings to active Excel sheet
perform fill_cell using 1 1 1 200 'Language Key'.
perform fill_cell using 1 2 1 200 'Application Area'.
perform fill_cell using 1 3 1 200 'Message number'.
perform fill_cell using 1 4 1 200 'Message text'.
perform fill_cell using 1 5 1 200 'Dep. Time'.
loop at it_t100.
copy flights to active EXCEL sheet
h = sy-tabix + 1.
perform fill_cell using h 1 0 000145000 it_t100-SPRSL.
perform fill_cell using h 2 0 246156138 it_t100-ARBGB.
perform fill_cell using h 3 0 111230222 it_t100-MSGNR.
perform fill_cell using h 4 0 130230230 it_t100-text.
perform fill_cell using h 5 0 115115105 it_spfli-deptime.
endloop.
EXCEL FILENAME
CONCATENATE SY-REPID '_' SY-DATUM6(2) '_' SY-DATUM4(2) '_'
SY-DATUM(4) '_' SY-UZEIT '.XLS' INTO FILENAME.
CALL METHOD OF H_MAP 'SAVEAS' EXPORTING #1 = FILENAME.
free object h_excel.
perform err_hdl.
FORM FILL_CELL *
sets cell at coordinates i,j to value val boldtype bold *
form fill_cell using i j bold col val.
call method of h_excel 'Cells' = h_zl
exporting
#1 = i
#2 = j.
perform err_hdl.
set property of h_zl 'Value' = val .
perform err_hdl.
get property of h_zl 'Font' = h_f.
perform err_hdl.
set property of h_f 'Bold' = bold .
perform err_hdl.
set property of h_f 'Color' = col.
perform err_hdl.
endform. "FILL_CELL
*& Form ERR_HDL
outputs OLE error if any *
--> p1 text
<-- p2 text
form err_hdl.
if sy-subrc <> 0.
write: / 'OLE-Automation Error:'(010), sy-subrc.
stop.
endif.
endform. " ERR_HDL

Similar Messages

  • How to download the blocked ALV output to PDF file.

    How to download the blocked ALV output to PDF file.
    I am able to download the BLocked ALV output in PDF format,
    but the each bolck in ALV is displaying different pages of PDF.
    In my report I have 4 block in 1 page, I am able to see the output in PDF but in different page.
    How to avoid the Page-break in PDF.
    Thanks,
    Ravi Yasoda.

    hi,
    I believe that your have 4 containers on the screen with individual ALV display. in this case, there is no way to get combined PDF output to my knowledge.
    However you can use Smartform/Sapscript as output which would allow you to display ALV in blocks and also print it in one.
    Regards,
    Nirmal

  • How to convert alv list into excel file?

    Hi Experts,
            i have created one report for Due Date Analysis.
    Now My output is displaying in ALV list. But I need to convert the data which in alv list into Excel File. then only i have to send the Excel File to the Customer Thro Email.
         So i need the Function Module to Convert the Data into Excel File.
    Thanks,
    Neptune.M

    Hi,
      U can use function module gui_download.
      CALL FUNCTION 'GUI_DOWNLOAD'
         EXPORTING
        BIN_FILESIZE       =
          filename           = 'C:\Transportaionlane.XLS'
          filetype                       = 'DAT'
        WRITE_FIELD_SEPARATOR           = ' '
        HEADER                          = '00'
        TABLES
          ata_tab                       = t_trans_lane_dis[]
           OTHERS                          = 22
    if u want with header then pass the header.
    regards
    Ahasan

  • How to download Data from Database directly into excel

    I have a requirement to download very large quantity of data from database into Excel file.
    But condition is excel file should have only 65,536 rows in a single spread sheet(that's the limit i suppose),if i have more data points(rows) than it should be stored into different spreadsheet.......this continues so there can be many spread sheets in a single excel file.
    Data size can be 1 GB or more.
    Also specific naming conventions need to be followed for giving name to excel as well as different spread sheets in it.
    Please see if someone could help me out.

    Thanks for ur reply,
    But my requirement is to call "download to excel" method,in a java program on click by user for downloading an excel sheet on his machine.
    This is be done as part of a web application which is to be made (so can't open the excel first)

  • How to Downlaod Data from Alv List to Excel File

    Hi,
      I have a Requirement like While download data from ALV to Excel File .After Download data into Excel we will not allow user to edit the Excel data..
    Plz  help me to complete this scenario.
    Thanks & Regards,
    Kumaran Duraiswamy.

    hi,
    try these following fm's
    MS_EXCEL_OLE_STANDARD_DAT
    EXCEL_OLE_STANDARD_DAT
    CALL FUNCTION 'MS_EXCEL_OLE_STANDARD_DAT'
    EXPORTING
    file_name = 'Your Path' " enter your path to save the file.
    CREATE_PIVOT = 0
    * DATA_SHEET_NAME = ' '
    * PIVOT_SHEET_NAME = ' '
    * PASSWORD = ' '
    * PASSWORD_OPTION = 0
    VISIBLE = '0'
    No_DIALOG = 'X'
    TABLES
    * PIVOT_FIELD_TAB =
    DATA_TAB = t_deli_final
    * FIELDNAMES =
    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.
    2nd fm
      CALL FUNCTION 'EXCEL_OLE_STANDARD_DAT'
           EXPORTING
                FILE_NAME                 = 'Your Path' "path to save your file
                DATA_SHEET_NAME           = V_SHEET_NAME
           TABLES
                DATA_TAB                  = TLX
           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 NE 0.
        WRITE:/ 'ERROR OPENING EXCEL'.
      ENDIF.
    ELSE.
      WRITE:/ 'ERROR OR NO DATA'.
    ENDIF.

  • Alv report into excel file.

    Hello experts,
    I have alv report , and i want to export this alv to excel file, how can i do this ?
    Thanks for your help.
    Avi.

    Hi Avi,
    U can download to any format by using ctrlshiftF9 or using the button to 'Local File'. Then  apopup appears as:
    In which format should the list
    be saved ?
    And some radio buttons. U select the 'SPreadsheet' option for excel.
    And click enter.Then it will prompt for the Directory and filename for saving.
    Keerthi

  • How to download data from different sheet of excel file.

    Hi Friends,
    I have a Excel file with different sheet like sheet 1, sheet 2 and so on,
    and i have to download each sheet data in to different internal tables.
    Is there any FM or something else.
    Pl. help
    Thanks
    Sunil.

    Hi,
       You can create the function module for this.
    The code sample is as below:
    *Code Sample *
    FUNCTION Z_UPLOADING_FROM_2SHEETS.
    ""Local interface:
    *" IMPORTING
    *" VALUE(FILE_NAME) LIKE RLGRAP-FILENAME
    *" VALUE(START_ROW_SHEET1) TYPE I
    *" VALUE(START_COLUMN_SHEET1) TYPE I
    *" VALUE(START_ROW_SHEET2) TYPE I
    *" VALUE(START_COLUMN_SHEET2) TYPE I
    *" VALUE(END_ROW_SHEET1) TYPE I
    *" VALUE(END_COLUMN_SHEET1) TYPE I
    *" VALUE(END_ROW_SHEET2) TYPE I
    *" VALUE(END_COLUMN_SHEET2) TYPE I
    *" TABLES
    *" IT_DATA1 STRUCTURE ALSMEX_TABLINE
    *" IT_DATA2 STRUCTURE ALSMEX_TABLINE
    *" EXCEPTIONS
    *" INCONSISTENT_PARAMETERS
    *" UPLOAD_OLE
    DATA DECLARATION
    DATA: excel_tab TYPE ty_t_sender,
    excel_tab1 TYPE ty_t_sender.
    DATA: ld_separator TYPE c.
    DATA: application TYPE ole2_object,
    workbook TYPE ole2_object,
    SHEET TYPE OLE2_OBJECT,
    range TYPE ole2_object,
    worksheet TYPE ole2_object.
    DATA: h_cell TYPE ole2_object,
    h_cell1 TYPE ole2_object.
    DATA: ld_rc TYPE i.
    MESSAGE DEFINATION
    DEFINE m_message.
    case sy-subrc.
    when 0.
    when 1.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    when others. raise upload_ole.
    endcase.
    END-OF-DEFINITION.
    PARAMETER CHECK
    IF START_ROW_SHEET1 > END_ROW_SHEET1.
    RAISE inconsistent_parameters.
    ENDIF.
    IF START_COLUMN_SHEET1 > END_COLUMN_SHEET1.
    RAISE inconsistent_parameters.
    ENDIF.
    IF START_ROW_SHEET2 > END_ROW_SHEET2.
    RAISE inconsistent_parameters.
    ENDIF.
    IF START_COLUMN_SHEET2 > END_COLUMN_SHEET2.
    RAISE inconsistent_parameters.
    ENDIF.
    CLASS cl_abap_char_utilities DEFINITION LOAD.
    ld_separator = cl_abap_char_utilities=>horizontal_tab.
    OPENING EXCEL FILE
    IF application-header = space OR application-handle = -1.
    CREATE OBJECT application 'Excel.Application'.
    m_message.
    ENDIF.
    CALL METHOD OF APPLICATION 'Workbooks' = WORKBOOK.
    m_message.
    CALL METHOD OF application 'Workbooks' = workbook.
    m_message.
    CALL METHOD OF workbook 'Open' EXPORTING #1 = FILE_NAME.
    m_message.
    CALL METHOD OF APPLICATION 'Worksheets' = SHEET EXPORTING #1 = 1.
    m_message.
    CALL METHOD OF APPLICATION 'Worksheets' = SHEET EXPORTING #1 = 1.
    m_message.
    CALL METHOD OF SHEET 'Activate'.
    m_message.
    GET PROPERTY OF application 'ACTIVESHEET' = sheet.
    m_message.
    MARKING OF WHOLE SPREADSHEET
    CALL METHOD OF sheet 'Cells' = h_cell
    EXPORTING #1 = START_ROW_SHEET1 #2 = START_COLUMN_SHEET1.
    m_message.
    CALL METHOD OF sheet 'Cells' = h_cell1
    EXPORTING #1 = END_ROW_SHEET1 #2 = END_COLUMN_SHEET1.
    m_message.
    CALL METHOD OF sheet 'RANGE' = range
    EXPORTING #1 = h_cell #2 = h_cell1.
    m_message.
    CALL METHOD OF range 'SELECT'.
    m_message.
    Copy marked area (SHEET1) into Clippboard
    CALL METHOD OF range 'COPY'.
    m_message.
    Read clipboard into ABAP
    CALL METHOD cl_gui_frontend_services=>clipboard_import
    IMPORTING
    data = excel_tab
    EXCEPTIONS
    cntl_error = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    OTHERS = 4
    IF sy-subrc <> 0.
    MESSAGE a037(alsmex).
    ENDIF.
    PERFORM separated_to_intern_convert TABLES excel_tab IT_DATA1
    USING ld_separator.
    Clear the clipboard
    REFRESH excel_tab.
    CALL METHOD cl_gui_frontend_services=>clipboard_export
    IMPORTING
    data = excel_tab
    CHANGING
    rc = ld_rc
    EXCEPTIONS
    cntl_error = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    OTHERS = 4
    Working in Second Excel Work Sheet
    CALL METHOD OF APPLICATION 'Worksheets' = SHEET EXPORTING #1 = 2.
    m_message.
    CALL METHOD OF SHEET 'Activate'.
    m_message.
    GET PROPERTY OF application 'ACTIVESHEET' = sheet.
    m_message.
    Mark Sheet2
    CALL METHOD OF sheet 'Cells' = h_cell
    EXPORTING #1 = START_ROW_SHEET2 #2 = START_COLUMN_SHEET2.
    m_message.
    CALL METHOD OF sheet 'Cells' = h_cell1
    EXPORTING #1 = END_ROW_SHEET2 #2 = END_COLUMN_SHEET2.
    m_message.
    CALL METHOD OF sheet 'RANGE' = range
    EXPORTING #1 = h_cell #2 = h_cell1.
    m_message.
    CALL METHOD OF range 'SELECT'.
    m_message.
    Copy Marked Area (Sheet2) into Clippboard
    CALL METHOD OF range 'COPY'.
    m_message.
    Read Clipboard into ABAP
    CALL METHOD cl_gui_frontend_services=>clipboard_import
    IMPORTING
    data = excel_tab1
    EXCEPTIONS
    cntl_error = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    OTHERS = 4
    IF sy-subrc <> 0.
    MESSAGE a037(alsmex).
    ENDIF.
    PERFORM separated_to_intern_convert TABLES excel_tab1 IT_DATA2
    USING ld_separator.
    Clear Clipboard
    REFRESH excel_tab.
    CALL METHOD cl_gui_frontend_services=>clipboard_export
    IMPORTING
    data = excel_tab1
    CHANGING
    rc = ld_rc
    EXCEPTIONS
    cntl_error = 1
    ERROR_NO_GUI = 2
    NOT_SUPPORTED_BY_GUI = 3
    OTHERS = 4
    Leaving Application .
    CALL METHOD OF application 'QUIT'.
    m_message.
    FREE OBJECT application.
    m_message.
    ENDFUNCTION.

  • How to download A006 table data in a excel file

    i need to download A006 condition table records of a particular server into my pc in excel format.
    wat all things i hav to do in GUI_Download  function.

    HI,
    CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
            filename         = lcl_file
            filetype         = 'ASC'
            dat_mode         = 'X'               
          TABLES
            data_tab         = it_file
          EXCEPTIONS
            file_write_error = 1
            OTHERS           = 2.
        IF sy-subrc <> 0.
    message...      
        ENDIF.
      ENDIF.
    pass file path where u want to save, internal table name
    regards
    rahul

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

  • How to download alv grid output(with field catalog) into excel file format

    Hi all,
    How to download alv grid output(with field catalogs) into excel file format and same file has to download to application server.
    Please help.
    Regards,
    Satya.

    Hi,
    On list where alv is displayed, select export icon( green color -> ),select spread sheet.
    This will display records in Excel sheet.

  • How can i download dynamic alv report into excel  ?

    when i create dynamic alv report and try to download it
    to my pc ( to excel file ) the data is not set in the
    write position , also i get message in the excel
    "Dynamic List Display " .
    how can i set the data like the alv display ?

    ALV has standard download functionality to Excel. Aren't you able to use this functionality? Have you written your own custom code for DOWNLOAD?

  • 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

  • Unable to download data in ALV output with local file option

    Hi,
    I am displaying ouput in ALV grid display.Its showing output fine.When i am trying to down load the data into Excel file from ALV ouput .when i am downloaded the data by using Local file option,its down loading the data but its not downloading all the fields.
    Could you plz provide me solution.Thanks!

    Just Check that one of your parameters is defined in lower case letters.
    Earlier it used to give dump on execution but now if you download then it will give ABAP dump.
    I have seen this problem many times.
    Regards,
    Gaurav Sood

  • Export header of alv-oo into excel

    When I export an alv function into excel also exports the header but when I'm working with alv-oo doesn't export the header.
    How can I do to export into excel also the header of the alv-oo??
    Thanks a lot!!!

    Hi,
    I think Field catalog not set properly.
    Otherwise u can provide one pushbutton OR use same standard Button & in the coding part use 'WS_DOWNLOAD' function module.
    It will work. U can pass header data also in this & also provide path using F4_FILENAMEu2019 function module.
    salil

  • How to convert Oracle reports previewer output into delimited file.

    How to convert Oracle reports previewer output into delimited file if the report has more than 1000 pages.
    I tried with previewer option File --> Generate to file --> Delimited file, but the report engine is crashing.Not generating .TXT file.
    I observed that this option is not working for more than 400 pages.
    I am using Oracle reports 6i version.
    Plz suggest me to generate .TXT file from Report previewer.

    You can specify a delimiter (a character or string of characters) to separate the data (boilerplate or field objects) in your report output in either of the following ways:
    On the command line using the DELIMITER keyword.
    In the Delimited Output dialog box or DelimitedData Output dialog box (displayed with File > Generate to File > Delimited or File > Generate to File > DelimitedData) in Reports Builder.
    for further information goto this link
    http://download.oracle.com/docs/cd/B14099_17/bi.1012/b13895/orbr_concepts2.htm#sthref760

Maybe you are looking for

  • CS3 not opening .CR2 files

    I can't get either Photoshop or Bridge to recognize/open .cr2 files. I have Camera Raw pug-in 4.6 installed, fully updated CS3, Snow Leopard 10.6.4 and the pictures are taken with an EOS 7D. Can't get my head around what's going on here. The funny th

  • Dent in Macbook pro 15 inch

    I have a dent in my Macbook Pro 15 inch, early 2011 It is located near the battery indicator on the side of the laptop. How much will it approximately cost to fix this? This dent caused small gap between the unibody and the bottom case. Thanks a lot

  • Cant increase partition size

    Recently I partitioned my drive so I could transfer files from my mac partition to my bootcamp partition (I had 3 partitions total). I had some problems with that partition so I deleted it using disk utility (I ended up with 2 partitions and free spa

  • Get the flv total time in AS2

    Hi. I am loading a flv video in AS2: var conexion:NetConnection = new NetConnection(); conexion.connect(null); var stream:NetStream = new NetStream(conexion); mi_video.attachVideo(stream); stream.play("motto.flv"); this.onEnterFrame = function() {   

  • IPod touch unique issue

    I have an iPod touch that is disabled. iTunes won't recognize it (it doesn't give an error code, it says that the passcode must be typed in before it will recognize it) and obviously I can't type in the passcode when it's disabled. I've tried restori