ALV to EXCEL along with the color

Hello,
      Is it possible to download an ALV report output to an EXCEL along with the color in the ALV report.I made an ALV report with some rows having red color depending on a bussiness logic. When user downloads the ALV report to excel from standard ALV layout they cannot get the colors in the excel. Is there a way to do this or any sunstitute?
Thanks,
Giri.

Hi Giridhar,
Have a look at this code
Download a report to excel with format (border, color cell, etc) 
Try this program...it may help you to change the font ..etc.
Code:
REPORT ZSIRI NO STANDARD PAGE HEADING.
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
TABLES: SPFLI.
DATA  H TYPE I.
table of flights
DATA: IT_SPFLI LIKE SPFLI OCCURS 10 WITH HEADER LINE.
*&   Event START-OF-SELECTION
START-OF-SELECTION.
read flights
  SELECT * FROM SPFLI INTO TABLE IT_SPFLI UP TO 10 ROWS.
display header
  ULINE (61).
  WRITE: /     SY-VLINE NO-GAP,
          (3)  'Flg'(001) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
          (4)  'Nr'(002) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
          (20) 'Von'(003) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
          (20) 'Nach'(004) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP,
          (8)  'Zeit'(005) COLOR COL_HEADING NO-GAP, SY-VLINE NO-GAP.
  ULINE /(61).
display flights
  LOOP AT IT_SPFLI.
  WRITE: / SY-VLINE NO-GAP,
           IT_SPFLI-CARRID COLOR COL_KEY NO-GAP, SY-VLINE NO-GAP,
           IT_SPFLI-CONNID COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
           IT_SPFLI-CITYFROM COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
           IT_SPFLI-CITYTO COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP,
           IT_SPFLI-DEPTIME COLOR COL_NORMAL NO-GAP, SY-VLINE NO-GAP.
  ENDLOOP.
  ULINE /(61).
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 'Flug'(001).
  PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
  PERFORM FILL_CELL USING 1 3 1 'Von'(003).
  PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
  PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
  LOOP AT IT_SPFLI.
copy flights to active EXCEL sheet
    H = SY-TABIX + 1.
    PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
    PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
    PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
    PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
    PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
  ENDLOOP.
changes by Kishore  - start
CALL METHOD OF H_EXCEL 'Workbooks' = H_MAPL.
  CALL METHOD OF H_EXCEL 'Worksheets' = H_MAPL." EXPORTING #1 = 2.
  PERFORM ERR_HDL.
add a new workbook
  CALL METHOD OF H_MAPL 'Add' = H_MAP  EXPORTING #1 = 2.
  PERFORM ERR_HDL.
tell user what is going on
  SET PROPERTY OF H_MAP 'NAME' = 'COPY'.
  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 'Flug'(001).
  PERFORM FILL_CELL USING 1 2 0 'Nr'(002).
  PERFORM FILL_CELL USING 1 3 1 'Von'(003).
  PERFORM FILL_CELL USING 1 4 1 'Nach'(004).
  PERFORM FILL_CELL USING 1 5 1 'Zeit'(005).
  LOOP AT IT_SPFLI.
copy flights to active EXCEL sheet
    H = SY-TABIX + 1.
    PERFORM FILL_CELL USING H 1 0 IT_SPFLI-CARRID.
    PERFORM FILL_CELL USING H 2 0 IT_SPFLI-CONNID.
    PERFORM FILL_CELL USING H 3 0 IT_SPFLI-CITYFROM.
    PERFORM FILL_CELL USING H 4 0 IT_SPFLI-CITYTO.
    PERFORM FILL_CELL USING H 5 0 IT_SPFLI-DEPTIME.
  ENDLOOP.
changes by Kishore  - end
disconnect from Excel
     CALL METHOD OF H_EXCEL 'FILESAVEAS' EXPORTING  #1 = 'C:\SKV.XLS'.
  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 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.
ENDFORM.
*&      Form  ERR_HDL
      outputs OLE error if any                                       *
-->  p1        text
<--  p2        text
FORM ERR_HDL.
IF SY-SUBRC <> 0.
  WRITE: / 'Fehler bei OLE-Automation:'(010), SY-SUBRC.
  STOP.
ENDIF.
ENDFORM.                    " ERR_HDL
  Have a look this Link
http://www.sap-img.com/abap/download-to-excel-with-format-border-color-cell-etc.htm
Regards,
Santosh

Similar Messages

  • Any file I open, along with the color swatches and sampler, in PS has a warm white color where it is supposed to be white. I don't now how this happened and I have no idea how to get the whites back. Please help, thanks, P

    as I stated. the white in any file I open in PS s a warm white. I don't know how this happened or how to fix it. I do know it is not my PC or moniter. Only in PS. any hepl is appriciated, thanks, P

    My5cats, Cris may have more to add but here are some thoughts.  A calibrated monitor does have warm whites.  We perceive a blue white as being correct but it isn't.   i don't know if you are using monitor calibration or not.   One possible area is that Photoshop is set to a paper or some other gamut.  You can check (in PS) by going to the Edit menu > Color settings.  Here is a picture of mine.  I set the working space to sRGB which is used for the web and many printers.  If you get a correct setting , consider saving it.

  • How to print the top of page part along with the ALV list and generate PDF

    HI all,
             I have created one ALV by using oops concept .
             and also am able to get the top of page where I have One standard logo on the right hand side
             and some details on the left side .
               Now my requirement is to while printing the list the logo and other top of page details should appear
               In the PDF output but currently while am pressing the print preview button only the alv data is coming
              am already using the method
        handle_top_of_page
          FOR EVENT print_top_of_page
                 OF cl_gui_alv_grid,
    may be am missing something ... How to get the top of page along with the logo printed ?

    Hi  Surya,
    After generating the grid display  click on print button,
    a spool number is generated. capture the spool number and convert it to pdf using the fm:
    CONVERT_ABAPSPOOLJOB_2_PDF  and save the file
    Hope this will solve your problem.
    Regards,
    R K.

  • Export data to excel along with Formulas

    Hi,
    I want to design a WD ABAP table ALV or normal) with a forumula for each cell like we do in excel. And upon clicking export to excel it should export the data in the table along with the formulas in it. Is it possible?
    Aditya.

    NB if you do use the standard ALV you'll have to disable the standard export and build your own. I wonder how long (or perhaps it has already happened - Ivan could probably tell us) it will take for generic export from Web Dynpro ALV code to be available.
    I've played with the exports that Ivan has been working on. They are very cool and I highly recommend them!
    Cheers,
    Chris

  • Customized Pf Status along with the standard Pf status

    Hi all
    I have created an ALV report and has its default pf status which includes all function like sum ,sort, export, variants save etc.
    I have a requirement to have an extra push button along with this PF status.
    I have created a pf status with this button.. and activated and called in REUSE_ALV_GRID_DISPLAY and did everything..
    But in my output, only my customised pf status is displayed ie only the push button is displayed and all other standard functions are gone..
    Can anyone help me to solve this problem.
    Ie I want one push button along with the standrad pf status in ALV report using REUSE_ALV_GRID_DISPLAY .
    Cheers
    Christina

    Hi All
    Creation of new button in output refer below document and screen
    if you want to add one more button in the Red line like below.
    Reffer Below steps after that you can create or change STANDARD Gui in the program .
    Go to Se41 give details like below.
    Select Copy Status button in up. As shown below screen.
    You will get below screen. Provide your custom program name.
    Like below screen. Click on Copy.
    You will get below screen click on copy button.
    You will get below status.
    Click on Activate like as shown in below.
    Click on OK button you will get it in your program.

  • Ssrs report export to excel along with parameter filters

    HI,
    In ssrs reports export to excel along with parameter filters,is it possible or not?
    Could you please help me..
    indu

    Hi Sriindu,
    According to your description, you want to export the report into an excel file with the report parameter and filters. And you want to filter data in excel. Right?
    In Reporting Services, the components for exporting report into a file called Reporting Services Rendering Extension. There are three types of Reporting Services rendering extensions: Data Render Extension,
    Soft page-break renderer extensions, Hard page-break rendering extensions. All these three extension are only for rendering data. It can't keep the filters and parameter in the report. Also excel can't support Reporting Services filter in
    an excel file. So your requirement can't be achieved.
    Reference:
    Exporting Reports (Report Builder and SSRS)
    Interactive Functionality for Different Report Rendering Extensions (Report Builder and SSRS)
    If you have any feedback on our support, please click
    here.
    Best Regards,
    Simon Hou

  • When will I receive my I phone 6 case which i ordered along with the Iphone6 ?As per the website it says october . How long is the wait time for the Iphone 6 case?

    When will I receive my I phone 6 case which i ordered along with the I phone 6 ?As per the website it says October. How long is the wait time for the I phone 6 case?

    While we have no idea within this Community Forum how long you would have to wait for your iPhone 6 Case, I can tell you that there would not be a "general" answer of value.  Like any product that is available in different materials and colors, the inventory varies based on what you have specifically ordered.  For example, I visited an Apple Store on the day after the iPhone 6 became available and was interested in the "Midnight Blue" Leather"  Apple iPhone 6 Case.  The store had plenty of all the other colors, but that specific case and color had sold out that morning. 

  • Using NonCatalogLogger along with the LogMBean

    Hi anybody
    According to the API, the NonCatalogLogger class provides application services
    for logging error messages to the weblogic server log. The name, location and
    other properties of the logfile are determined by the LogMBean for the server.
    Now, I have the instance of the LogMBean running in the server and using this
    instance I am able to configure our weblogic server's logging configuration from
    any client machine. But I am not able to log any message from a client machine
    into the server's log file. That is I am not able to use the LogMBean object along
    with the NonCatalogLogging object.
    Do you have a suggestion?
    Regards
    Zakaria Chowdhury

    http://edocs.bea.com/wls/docs60/javadocs/weblogic/management/configuration/L
    ogMBean.html
    "Rajan Annadurai" <[email protected]> wrote in message
    news:3ced8eb9$[email protected]..
    >
    hi Sanjeev,
    "in addition to FileName you can specify any LogMBean prop for a client inthe same
    manner"
    Can you please list down the LogMbean property to set rotation size. I amnot able
    to find it any where in the documentation.
    thank you,
    Rajan
    "Sanjeev Chopra" <[email protected]> wrote:
    Clients cannot log to the servers logfile. If you use NonCatalogLogger on
    the client, it creates its own file. By default however, the file is
    turned
    off. You need to turn it on by specifying the FileName prop of theLogMBean
    for that client.
    Since client config is not done thru MBeans, the way you define this is
    with
    system props i.e. -Dweblogic.log.FileName=....
    (in addition to FileName you can specify any LogMBean prop for a client
    in
    the same manner)
    "Zakaria Chowdhury" <[email protected]> wrote in message
    news:[email protected]..
    Hi anybody
    According to the API, the NonCatalogLogger class provides applicationservices
    for logging error messages to the weblogic server log. The name,
    location
    and
    other properties of the logfile are determined by the LogMBean for theserver.
    Now, I have the instance of the LogMBean running in the server and
    using
    this
    instance I am able to configure our weblogic server's loggingconfiguration from
    any client machine. But I am not able to log any message from a clientmachine
    into the server's log file. That is I am not able to use the LogMBeanobject along
    with the NonCatalogLogging object.
    Do you have a suggestion?
    Regards
    Zakaria Chowdhury

  • How do I fill an Excel spreadsheet with the contents of a DataTable? (C#, OleDb)

    The following fills a DataTable with the contents of an Excel spreadsheet.
        oledbCmd.CommandText = "SELECT * FROM [" + stSheetName + "$]";
        DataTable dtDataTable = new DataTable();
        using (OleDbDataAdapter oledbAdapter = new OleDbDataAdapter(oledbCmd))
        oledbAdapter.Fill(dtDataTable);
    How do I fill an Excel spreadsheet with the contents of a DataTable?
    bhs67

    You can try this Excel library, it can help u to
    export datatable to excel to Database.
    After add the reference to your project ,add the following code:
    private void button1_Click(object sender, EventArgs e)
    //connect database
    OleDbConnection connection = new OleDbConnection();
    connection.ConnectionString @"Provider=""Microsoft.Jet.OLEDB.4.0"";Data Source=""demo.mdb"";User Id=;Password="
    OleDbCommand command = new OleDbCommand();
    command.CommandText = "select * from parts";
    DataSet dataSet = new System.Data.DataSet();
    OleDbDataAdapter dataAdapter = new OleDbDataAdapter(command.CommandText,connection);
    dataAdapter.Fill(dataSet);
    DataTable t = dataSet.Tables[0];
    //export datatable to excel
    Workbook book = new Workbook();
    Worksheet sheet = book.Worksheets[0];
    sheet.InsertDataTable(t, true, 1, 1);
    book.SaveToFile("insertTableToExcel.xls");
    System.Diagnostics.Process.Start("insertTableToExcel.xls");
    http://www.e-iceblue.com/Tutorials/Spire.XLS/Spire.XLS-Program-Guide/Data-Export-/Import-Export-Datatable-to-Excel-from-Database.html

  • The "Apple ID Password box along with the keyboard keeps popping up on my iPad and stays there.  I have changed my email address on my iMac but my old one still remains on the iPad.  Also changed password.  Nothing works!  I can't use the iPad like this!

    The "apple ID Password" box along with the keyboard pops up when I turn the iPad on and it stays there.  I have changed my email address on my iMac and also changed my password.  The old email address is still on the iPad.  Anyway, I can't use the iPad because can't get the apple id password box to go away.  Thanks for any help!

    This is an older photo but the sleep and home buttons are still in the same place on all iPads. The home button is the round button at the bottom of the iPad and the sleep button is also called the on/off button and it is at the top right corner of the iPad.

  • Accruals Condition Record posted late in COPA along with the Settlement

    Hi Gurus,
    Accruals condition record for 1 item in an Invoice is posted along with the Settlement Credit Note in COPA. While condition records of the other items from the same invoice were posted on the Billing Date itself.
    For eg:
    Invoice 111       Date 01.03.2011
    Items     Condition   value
    1              Z1            100
    2              Z1             200
    3              Z1             300
    COPA Doc No.        Value Field        Date
         001                         200             01.03.2011
         002                         300             01.03.2011
         003                         100             30.05.2011
    30.05.2011 is the date of Rebate Credit Note for the Invoice # 111
    I also got that if Posting of Accrual is not done for an Item, Retroactive rebate settlement automatically posts a new document for accrual.
    So the question is why the posting of accrual was not done on the Invoice date in the first place?
    Edited by: Parth Kulkarni on Jul 1, 2011 4:31 PM

    Hi Suraj,
    i too have the same problem, the condition types for Values and quantity in COPA are assigned. The system updates the quantity for the first billing document but not for the subsequent billing documents.
    Cost of goods sold and revenue gets updated.
    Regards,
    Prateek

  • PO Line item attachments going along with the PO o/p to Vendor!

    Hi all,
    We are on SRM 5.0 ECS SP 13.
    I had one question regarding the attachments in the PO line items.If I attach documents at the PO Line item and sent the PO o/p to vendior through e-mail,then all the attachments at the PO line item also go along with the o/p..Is this is  a  std behaviour in SRM 5.0?
    Also if i need to avoid sending of the PO line item attachments along with the PO o/p to the vendor,then I guess the "Internal" indicator for the documents need to be set rt?Is there any way the documents at the PO line item can be set as "INTERNAL"?
    I know this is achived in SRM 6.0 and above and there is an OSS note which mentions that.
    Has anybody worked on something similar?Please share your eperiences/suggestions.
    Thanks!

    HI,Rads:
         I think you should do the inhancements in this situation. I met this question in my last case .Follow is my suggestions ,maybe helpful .
        The   BADI NAME:BBP_OUTPUT_CHANGE_SF(Document Output)
      YOU should chage the code .If you do 't  send the attachment to the vendor ,you should set "Space ",jut like this :
      WHEN 'BUS2200'.
          CV_SMARTFORM = 'ZBBP_BID_INVITATION'.
          CV_SMARTFORM_MAIL = 'ZBBP_OUTPUT_COVER'.
          "exclude attachment
          CS_PARAMETERS-ATTACH_IND = SPACE.
       Then  the attachment will not been sent out ,you can try .
    Alex !
    Bestregards

  • When I open my MacBook Air the keyboard comes up along with the screen and does not stay still?!

    When I open my MacBook Air the keyboard comes up along with the screen and does not stay still. So I need to hold down the keyboard while i open it. Other than that it works fine despite the fact that the fan noise some times is loud and sometimes it's getting warm at the base. I wonder if this can be fixed if i go to one of the apple branches.

    Yes. Take the computer to the Apple store to have it fixed.
    Best

  • Please, help! After upgrading to Yosemite, my dock has disappeared, along with the dashboard and the wallpaper! Can anyone help? I'm using a MacBook Pro, retina, bought it last year.

    Please, help!
    After upgrading to Yosemite, my dock has disappeared, along with the dashboard and the wallpaper! Can anyone help? I'm using a MacBook Pro, retina, bought it last year.
    Thanks

    Have you been trying to download from the app store? Did you get a message?
    As a suggestion, you might go to an Apple store (genius bar appointment) for help. As far as I know, there should be no charge.
    Barry

  • How does one continue to use Mail on the early MacBook Pro, Model 1,1, that is not upgradable to Lion?  I have been running iCloud on my iPhone (OS5) and iMac (Lion) along with the MacBook Pro (OS Version 10.6.8)

    How does one continue to use Mail on the early MacBook Pro, Model 1,1, that is not upgradable to Lion?  I have been running iCloud on my iPhone (OS5) and iMac (Lion) along with the MacBook Pro (OS Version 10.6.8) since November until now.  Mail will no longer download on the MacBook Pro and keeps asking for my password.

    Mail should still be usable with your machine - but you'll need to update the settings to conform to the requirements of your system. Check with your ISP (like ATT, etc.) for the settings that will work with your Mail. Once you've updated this, you should be able to email like before.
    For example, my ISP required that I go to Mail Preferences/Accounts and make sure the details conform to your email settings.
    I have no idea of what your ISP is or what the settings might be, but this is likely the source of the problem.

Maybe you are looking for

  • Error Message while opening workbook or Query in BEx Analyzer

    Hi all, Whenever I try to open any workbook or query using Bex Analyzer I get an error message saying "Serious error occured while reading history folder" Message class RSOBJS, number 170. But this doesnt stop me from opening the workbook or the quer

  • Update PO in SNC

    We have the requirement of mass update Purchase Orders in SNC. We noticed that some of the POs are created with blank Means of Transport in SNC for some reasons and it is breaking the subsequent processes. We have corrected the Master data -Transport

  • Accrual/Deferral entries

    Dear friends, What is the purpose of Accruals/Deferrals enteries. Pls explain me with one example. Where do we use this entries? can we reverse this entries in month end or year end? Pls clarify my doubts. Regards Murali

  • Unexplained UnpublishNotify on Edge Server

    I have and FMS (3.0.2) running as an edge server, republishing a stream from another ingest FMS that is recieving a stream from Adobe Flash Media Encoder (2.5). After almost exactly 5 minutes the edge FMS unpublished the stream even though I have a s

  • Photoshop CS6 Updated itself to Extended Trial

    I have found only one discussion on this subject and it is several years old. I am hoping it is easier to deal with now. I purchased Photoshop CS6 full version on CD not the Cloud. I am running Windows 7 64 bit. Today when I opened a file Photoshop s