Cell Formatting in excel -  Webdynpro ABAP

Hi,
I have Webdynpro ABAP component. In this I am downloading some internal table data into spread sheet using following code. I need to Format data like giving Cell coloring. Could any one please tell me where i can make this format in WebDynpro ABAP.
  CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
    EXPORTING
      text   = ls_text
    IMPORTING
      buffer = ls_xtext.
  wdr_task=>client_window->client->attach_file_to_response(
**path to the word file
     i_filename = 'WDP.xls'
* String Variable
     i_content =  ls_xtext
* File Type
     i_mime_type = 'EXCEL' ).
Thanks,
Sekhar.J
Edited by: sekhar J on May 3, 2010 11:50 AM

Hello,
We did the saved the excel in  Excel XML format and duplicated the code using concatenations as given in thread http://scn.sap.com/docs/DOC-25024
.But I always see the below error
XML PARSE ERROR:  Missing whitespace between attributes
  Error occurs at or below this element stack:
    <ss:Workbook>
     <ss:Worksheet>
But the XML tags are concatenated as well in to field of type STRING .
Please advise how to resolve this .
Thanks
Shishupal.

Similar Messages

  • How to set a single cell editable in alv Webdynpro Abap

    I am trying to edit a single cell on lead selection. here the steps i did to achive this.
    1. I added a Attribute READ_ONLY  inside my node of type WDY_BOOLEAN.
    2. i am conditionally making this Attribute - READ_ONLY = 'X'.
    3. i am binding my node with new values.
    4. for ALV here is the code i have added.
    DATA :lo_cmp_usage TYPE REF TO if_wd_component_usage,
            lr_column    TYPE REF TO cl_salv_wd_column,
            lr_table_settings TYPE REF TO if_salv_wd_table_settings,
            lt_columns TYPE salv_wd_t_column_ref,
            ls_columns TYPE salv_wd_s_column_ref,
            lr_input_field TYPE REF TO cl_salv_wd_uie_input_field,
            lo_interfacecontroller TYPE REF TO iwci_salv_wd_table ,
            lv_value TYPE REF TO cl_salv_wd_config_table.
    *Taking reference of the Component Usage
      lo_cmp_usage =   wd_this->wd_cpuse_cu_alv( ).
      IF lo_cmp_usage->has_active_component( ) IS INITIAL.
        lo_cmp_usage->create_component( ).
      ENDIF.
      lo_interfacecontroller =   wd_this->wd_cpifc_cu_alv( ).
      lv_value = lo_interfacecontroller->get_model( ).
      CALL METHOD lv_value->if_salv_wd_column_settings~get_columns
        RECEIVING
          value = lt_columns.
      LOOP AT lt_columns INTO ls_columns.
        lr_column = ls_columns-r_column.
        CASE ls_columns-id.
          WHEN 'USR_ACT_RT'.
            CREATE OBJECT lr_input_field
              EXPORTING
                value_fieldname = ls_columns-id.
            lr_column->set_cell_editor( value = lr_input_field ).
            lr_input_field->set_read_only_fieldname( value = 'READ_ONLY' ).
        ENDCASE.
      ENDLOOP.
      lr_table_settings ?= lv_value.
      lr_table_settings->set_read_only( abap_false ).
      lv_value->if_salv_wd_column_settings~delete_column( id = 'READ_ONLY' ).
    but instead of changing the particular cell where i have marked READ_ONLY = 'X' it is changing whole column 'USR_ACT_RT'  data as editable .
    If anybody can  please help ASAP

    Hi Tashi,
    Thanks for your reply,i have did the same way u are doing here for setting the READ_ONLY Attribute conditionally.
    here is my code for setting the read only attribute .
    IF NOT lo_nd_nd_cost_rate IS INITIAL.
        lo_nd_nd_cost_rate->get_static_attributes_table( IMPORTING table = lt_nd_cost_rate ).
      ENDIF.
      IF NOT lo_el_nd_cost_rate IS INITIAL.
    * get all declared attributes
        lo_el_nd_cost_rate->get_static_attributes(
          IMPORTING
            static_attributes = ls_nd_cost_rate_sel ).
      ENDIF.
      lv_datum = sy-datum.
      lv_month = lv_datum+4(2).
    ** @TODO handle non existant child
      LOOP AT lt_nd_cost_rate INTO ls_nd_cost_rate WHERE quarter = ls_nd_cost_rate_sel-quarter.
        IF ls_nd_cost_rate-quarter = 'Q1'.
          IF ( lv_month  EQ '01' OR lv_month  EQ '02' OR lv_month  EQ '03' ).
            ls_nd_cost_rate-read_only = 'X'.
          ELSE.
            ls_nd_cost_rate-read_only = ''.
    *   report message
            CALL METHOD lo_message_manager->report_warning
              EXPORTING
                message_text = lv_text.
          ENDIF.
        ELSEIF ls_nd_cost_rate-quarter = 'Q2'.
          IF ( lv_month  EQ '04' OR lv_month  EQ '05' OR lv_month  EQ '06' ).
            ls_nd_cost_rate-read_only = 'X'.
          ELSE.
            ls_nd_cost_rate-read_only = ''.
    *   report message
            CALL METHOD lo_message_manager->report_warning
              EXPORTING
                message_text = lv_text.
          ENDIF.
        ELSEIF ls_nd_cost_rate-quarter = 'Q3'.
          IF ( lv_month  EQ '07' OR lv_month  EQ '08' OR lv_month  EQ '09' ).
            ls_nd_cost_rate-read_only = 'X'.
          ELSE.
            ls_nd_cost_rate-read_only = ''.
    *   report message
            CALL METHOD lo_message_manager->report_warning
              EXPORTING
                message_text = lv_text.
          ENDIF.
        ELSEIF ls_nd_cost_rate-quarter = 'Q4'.
          IF ( lv_month  EQ '10' OR lv_month  EQ '11' OR lv_month  EQ '12' ).
            ls_nd_cost_rate-read_only = 'X'.
          ELSE.
            ls_nd_cost_rate-read_only = ''.
    *   report message
            CALL METHOD lo_message_manager->report_warning
              EXPORTING
                message_text = lv_text.
          ENDIF.
        ENDIF.
        MODIFY lt_nd_cost_rate FROM ls_nd_cost_rate INDEX sy-tabix TRANSPORTING read_only .
        CLEAR ls_nd_cost_rate.
      ENDLOOP.
      lo_nd_nd_cost_rate->bind_table( lt_nd_cost_rate ).
    please see in the below sceen shot the last two cells are editable in the User Actual Rate Column whlie the selected rows cell is not editable. Please revert if u have any input for same.

  • Hide row and cell by cell formatting

    Hello,
    I am new to both diadem and VBS and I am having difficulties in translating calculations between excel and diadem.  I know that diadem doesn't have the same cell by cell formatting that excel does but is there a way to either hide rows that do not meet a certain condition or a way to say use an equation of the form
      =IF(H5> 0,J5+M4,0), where H is the conditional column and M is the resultant column?
    Thank you

    Hello ccimac,
    You might want to look at the IIF function to help you solve that particular problem,
    Example:
    Call Calculate("Ch(""ResultNV"")=IIf( Ch(""Channel1"")>1,Ch(""Channel1""),NoValue)" )
    This will create a NEW data channel called ResultNV that checks (in this example) whether a channel called Channel1 is larger than 1 or not. If it is, the value will the the actual channel value, if the values are smaller than 1 the software will replace the values with a NoValue - which is DIAdem's way of saying that a "cell" contains invalid values.
    Does that work for your question? Feel free to ask if you have further questions,
         Otmar
    Otmar D. Foehner
    Business Development Manager
    DIAdem and Test Data Management
    National Instruments
    Austin, TX - USA
    "For an optimist the glass is half full, for a pessimist it's half empty, and for an engineer is twice bigger than necessary."

  • Field format in Excel - losing leading zero

    I have field in query, which is varchar2 in database, but contains only numbers, most of which have leading zeros, i.e. '0123'.
    When the report is viewed as html, pdf, or rtf data is shown correctly, '0123', but when viewed in Excel, the data is '123'.
    Also, I have a column that is simmilar to this one - varchar2 containing only numbers (SSCC if anyone is familiar). This information is 17 characters long, so instead of '38503341002862100' i get '3,85033E+16' in Excel.
    I noticed in both cases that the cell format in Excel is general, instead of text.
    How can this be changed?

    hi arubelj,
    Excel sheet is made specificaly for number calculations.....and each cell which is having data is by default considered as number...and in numbers 0123=123 ,this is the reason why it is not displaying 0 in start..... i had cheched the excel setup options also..... but did not found anything there to change the default column or row type as text....
    Regards
    Ravi

  • Issue in cell format when exporting data to excel

    Hello there,
    I have an ABAP program that selects data from tables into an internal table and writes the data in CSV (excel) file.
    I have a very weird issue when writing the file: The data is written properly, though the dates in my data, which is written in yyyymmdd format, has different cell format in the csv file itself. I'll expain:
    Let's say I've written into CSV file a table with name and birthdate, and I have 2000 records. From record 1 to 1475, when I right-click on the date cells in those lines, and choose "cell format", I can see it's in "general" format. From line 1476 on, when I do that I see that the date cells are in format of "custom" with pattern 'yyyymmdd'.
    I want all the cells to be "general". How do I do that?
    Thanks in advance

    Hi Daniel,
    Try using these Function Module......................
    Before filling final internal table write those condition.................................
    Data:  gv_date   TYPE mch1-vfdat,
             gv_vdate(10) TYPE c.
    CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'
           EXPORTING
             date_internal            = gv_date
           IMPORTING
             date_external            = gv_vdate
           EXCEPTIONS
             date_internal_is_invalid = 1
             OTHERS                   = 2.
         IF sy-subrc <> 0.
    * Implement suitable error handling here
         ENDIF.

  • Excel Pivot in WebDynpro ABAP

    Hi All,
    I wanted to download my Internal table to Excel(PIVOT). I can download my content in EXCEL format.
    But I want it in Pivot format.
    I searched SCN and I found only for ABAP Reports but I want for Webdynpro abap.
    How to achieve this.
    Thx.

    hi,
    check the below document:
    http://scn.sap.com/docs/DOC-25024

  • Excel from abap using OLE, trying to make an excel cell-property currency

    Hello everyone,
    I have build an abap application which generates a price list as a MS Excel file using OLE techniques (ole2incl).
    One small thing in the excel file is lacking and I hope some one can help me out:
    I want to give certain cells in excel the "cell property - currency", so that excel shows the amounts as currency values. 
    Has anyone done or seen that before?
    Thanks a lot in advance.
    Kind regard, Archie Oomen

    Hi,
    I am having a similiar problem trying to fix the CELL format as TEXT.
    No matter how I try, it often ends up as 'GENERAL.
    Have you resolved your issue?
    Prehaps, you could share it if you had already rectify your problem.
    Thanks a lot

  • Need help with Report Generation Toolkit: Excel Set Cell Format.vi

    Hi people,
    I've been searching and found this old thread of someone asking what is the input parameter "Number format". And I dont know what should I put in there. I've tried so many possibilities, but nothing works so far, such as:
    0,0
    0,?
    0,#
    #,0
    ?,0
    and also with @, doesnt works. Where would I find help about this parameter?
    I'm using Excel2003, german version, thus local decimal separator is a comma.
    I also found this help from NI, but seems doesnt help me either. Do I miss something important?
    thanks,
    Yan. 

    Hi,
    I've used your suggestion and some numbers in excel doesnt need to get "right click, change to numbers" anymore (green indicators on the left-top side in some cells are gone). But, I think its still not a number, because I cant use a simple formula, such as in cell A10 I type "= A1/2" (cell A10 equals cell A1 divided with 2) . I got error which says its not a number.
    Well, but other thing is found, any format-string I put in the input of Excel Set Cell Format.vi, such as #,########, will be shown the same as "customize #,########" if I right click in a cell in excel and click "Zellen formatieren" (formatting cell). But however, the numbers are still depends on the input of the format I put in the Append Table to Report.vi.
    regards,
    Yan.

  • Currency cell format does not export to excel doc

    Hi
    i am using new numbers on my macbook also on new OSX mavrics
    i have a invoice template that i have used for a good few years
    it has a fair amount of formulas and cell formats running
    the company i contract to uses windows based (office) system so i save the spreadsheet as an exel compatible file to send to them no problems
    untill now
    when i export to excel in ether .xls or .xlsx and open the document ether in numbers or on a windows pc on office 2007 all of the currency related cells are changed to 5 digits eg   -£8295.00 instead of £25 and the cell format show custom
    if i higlight the cell and change to curency the entrys chnge to the correct value
    has any one witnessed this ?
    it also is the same saving an excel sheet as a mac format CSV file and open that in numbers
    please help

    I am having exactly the same problem. Need to send invoices for work. Desperate for someone to help with a solution!!! thanks Stuart

  • How to make cell editable alv in WebDynpro for ABAP?

    I make Column editable ALV.(See under source code)
    But I can't make Cell editable ALV.
    How to make Cell editable ALV in WebDynpro for ABAP?
    and..how to get changed data?
    DATA: l_value TYPE REF TO cl_salv_wd_config_table.
      l_value = l_ref_interfacecontroller->get_model( ).
    * { EDITABLE
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
            lr_input_field     TYPE REF TO cl_salv_wd_uie_input_field,
            lr_column          TYPE REF TO cl_salv_wd_column.
      lr_column_settings ?= l_value.
      lr_column = lr_column_settings->get_column( 'TOTAL_COUNT' ).
      CREATE OBJECT lr_input_field
        EXPORTING
          value_fieldname = 'TOTAL_COUNT'.
      lr_column->set_cell_editor( lr_input_field ).
      DATA: lr_table_settings TYPE REF TO if_salv_wd_table_settings.
      lr_table_settings ?= l_value.
      lr_table_settings->set_read_only( abap_false ).

    the code seems to be correct....but where are you writing it?
    put the code in the wddoinit method and it should work.
    have a look at this article..
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3133474a-0801-0010-d692-81827814a5a1

  • Reading & writing from MS Excel files in Webdynpro ABAP

    Dear experts,
    We have a requirement to read and write from an MS excel file in a Webdynpro ABAP based application. The application would be deployed on WAS (Web Application Server) which is running as part of SAP ECC on UNIX platform.
    What is not clear is
    1) If we store the MS Excel template on the server which has UNIX, will the file be recognised for reading/writing programmatically in Webdynpro ABAP? If this works, we have a requirement where the end users will download the excel template and upload the same after filling data into the excel file. The data filled into the excel has to be read and updated in the SAP backend (ECC).
    2) There is an article on "Modifying Excel using WD ABAP" at the following link
    https://wiki.sdn.sap.com/wiki/display/WDABAP/ModifyingexistingexcelsheetusingWDABAP
    But again it is not clear whether this approach will work on Unix based SAP server (ECC WAS).
    Thanks
    Suresh

    I don't know if there is an application in Unix that can read Excel files - if that is what you are asking.  However that has nothing to do with this forum.  If you are uploading the file to ABAP using Web Dynpro ABAP, then it doesn't matter what Operating System the server is running on.  Unix, Linux, Windows - all the processing is done in ABAP and is OS independent. The actual reading of the file in ABAP involves reading either an XML or Text Tab Delimited version of the Excel file however - if you read through the links on manipulating Excel in ABAP.

  • How to read the excel file using webdynpro abap?

    Hi,
    how to read and modify excel file using webdynpro abap?
    Regards,
    Pavani

    For reading excel file follow the steps :
    1. Use a File upload UI element and bind it with xstring.
    2. Now your excel will be uploaded and stored in Xstring.
    3. Convert Xstring to String data using FM 'HR_KR_XSTRING_TO_STRING'.
    4. Now split the string at new line so as to make an internal table .
      Ex . SPLIT l_string  AT cl_abap_char_utilities=>newline INTO TABLE it_table.
      here it_table is type table of string.
    5.now loop at the internal table and separate the content of this table separated by tab.
      Ex. SPLIT wa_table AT cl_abap_char_utilities=>horizontal_tab INTO TABLE it_new.
    it_new type string_table.
    6. For more info , refer this thread :
    Re: How to upload excel file in Webdynpro application using ABAP

  • Webdynpro abap ALV export to excel with images problem

    Hello experts,
    I'm having problems with standard excel export functionality in webdynpro abap ALV.
    In my table i have images taken from content server (employee photos) linked with URL to a table_cell Image, when i export the table to excel using standard function the images is showed as a broken picture with the following text:
    "The linked image cannot displayed. The file may have been moved, or deleted. Verify that the link points to the correct file and location."
    I'm running on sap basis 7.02 SP13 and implemented the notes 1975765 and 1985288 but not resolved this issue.
    Do you have any ideas?
    Thank you.

    Hi Jorge,
    Are you able to download the ICONs from alv table? try to use some icon source '~Icon/Add' and check out if you can download it to excel successfully.
    FYR:
    Regards,
    Rama

  • Forms 9i - Cell based formatting like Excel in canvas

    Does anyone know how to display cell-based formatting in a canvas, like how excel displays data. Example below
    |_____EVENTS_____|_____2002_____|_____2003______|
    |jlklsdjfkfsdlk__|_M Oct 13_____|__T Jan 7______|
    Etc... Pretty much I am trying to display information is a similar format to notify users of important dates, that they may register for events based on the dates, but I would like to keep it in a excel cell format.
    Any help would be appreciated.

    Hi,
    there is no spread table functionality provided within Forms. You can use an OCX (client/server only) or a JTable Java Bean (Web only). If you try to do this with Forms native methods, then you better off creating your canvas as a forms based display and set itn size and location saccordingly.
    Frank

  • Excel cell formatting

    I have a programme that sorts through test results and picks out the rejects according to its "delta" value. I've noticed now that some rejects weren't picked up for some reason. As a fail safe I want to be able to highlight any cell whose value is above a certain limit in two columns.
    Any ideas?
    Solved!
    Go to Solution.
    Attachments:
    Matching Dual Devices.vi ‏35 KB

    Hello Kevin,
    Here is a Quick diagram that should help you get started on highlighting the data you want. It looks at the column "7" data and compares it to a requirement then changes the Cell formating to a green color if the equals is true. As you can probably guess the Flase case changes the cell color to red.
    I hope this helps.

Maybe you are looking for