ALV Object Model - Merged Cells

Hi all
   When utilizing ALV Object Model, how do I display cells as merged when they have the same content?
   Can someone help me out?
   Thank you very much!

Hello Yun
In dialog cells are merged automatically as soon as you sort the column containing repeated values.
Thus, when you call method SET_TABLE_FOR_FIRST_DISPLAY you should additionally provide parameter IT_SORT with the appropriate entries.
For example, you want to sort your ALV list according to COL_A (1st) and COL_B (2nd):
ls_sort-spos = 1.
ls_sort-fieldname = 'COL_A'.
ls_sort-up        = 'X'.  " sort ascending
append ls_sort to lt_sort.
ls_sort-spos = 2.
ls_sort-fieldname = 'COL_B'.
ls_sort-up        = 'X'.  " sort ascending
append ls_sort to lt_sort.
Regards
  Uwe

Similar Messages

  • Questions about ALV object model

    Hi,
    for a new report i´m planing to use the "new" ALV object model to create the ALV list. Now I´ve got two questions concerning this topic:
    - is it possible to switch the ALV into the edit mode like it´s possible if  the "old" CL_GUI_ALV_GRID class  
      is used?
    - how I can encolor specific cells?
    I couldn´t find any hints or demo programms for these questions
    Regards,
    Andy

    it is not possible to Edit the ALV using Object Model.
    For coloring...check this code.
    DATA: alv TYPE REF TO cl_salv_table.
    TYPES: BEGIN OF ty_tab,
             carrid TYPE sflight-carrid,
             connid TYPE sflight-connid,
             color  TYPE lvc_t_scol,
           END OF ty_tab.
    DATA: wt_color TYPE  lvc_t_scol,
          wa_color TYPE  lvc_s_scol,
          w_color  TYPE  lvc_s_colo.
    DATA: wa_flight TYPE ty_tab.
    DATA: column_tab TYPE REF TO cl_salv_columns_table,
          column TYPE REF TO cl_salv_column_table.
    DATA: column_ref TYPE   salv_t_column_ref,
          wa LIKE LINE OF column_ref.
    DATA: it_flight TYPE STANDARD TABLE OF ty_tab.
    SELECT carrid connid FROM sflight
    INTO CORRESPONDING FIELDS OF TABLE it_flight
    UP TO 10 ROWS.
    w_color-col = 4.
    w_color-int = 0.
    w_color-inv = 0.
    LOOP AT it_flight INTO wa_flight.
      w_color-col = 4.
      wa_color-fname = 'CARRID'.
      wa_color-color = w_color.
      APPEND wa_color TO wt_color.
      w_color-col = 6.
      wa_color-fname = 'CONNID'.
      wa_color-color = w_color.
      APPEND wa_color TO wt_color.
      wa_flight-color = wt_color.
      MODIFY it_flight FROM wa_flight.
    ENDLOOP.
    cl_salv_table=>factory(
      IMPORTING
        r_salv_table   = alv
      CHANGING
        t_table        = it_flight
    "get all the columns
    column_tab = alv->get_columns( ).
    column_tab->set_color_column( value = 'COLOR' ).
    column_ref = column_tab->get( ).
    "loop each column
    LOOP AT column_ref INTO wa.
      "Conditionally set the column type as key or non key
      IF wa-columnname   = 'CARRID'.
        column ?= wa-r_column.
        column->set_key( abap_true ).
      ENDIF.
    ENDLOOP.
    alv->display( ).

  • Editable field in ALV Object Model

    Hi Guys,
    I'm using method cl_salv_table=>factory to display an ALV (Object Model) in my report.
    I want to "open up" one field for user entries, in other words make one column of my table editable.
    I assumed to find the respective methods in class cl_salv_table, cl_salv_columns_table or cl_salv_display_settings, so far without getting anywhere.
    I know about the field-catalogue and the method set_ready_for_input in class CL_GUI_ALV_GRID - it's not working once you're in the object model.
    Any ideas how to do that?
    Thank you!
    With best regards,
    Andreas

    Hi Guys,
    I'm using method cl_salv_table=>factory to display an ALV (Object Model) in my report.
    I want to "open up" one field for user entries, in other words make one column of my table editable.
    I assumed to find the respective methods in class cl_salv_table, cl_salv_columns_table or cl_salv_display_settings, so far without getting anywhere.
    I know about the field-catalogue and the method set_ready_for_input in class CL_GUI_ALV_GRID - it's not working once you're in the object model.
    Any ideas how to do that?
    Thank you!
    With best regards,
    Andreas

  • END_OF_PAGE in ALV Object model

    Dear all,
    I am using ALV Object model, but the END_OF_PAGE is not triggering. I have pasted the sample code below. Let me know how to get  END_OF_PAGE  in ALV OM.
    REPORT  ztest_rr.
    DATA : it_sflight TYPE TABLE OF sflight.
    DATA : gr_sflight TYPE REF TO cl_salv_table,
           gr_content TYPE REF TO cl_salv_form_element,
           gr_sorts   TYPE REF TO cl_salv_sorts,
           gr_events  TYPE REF TO cl_salv_events,
           gr_print   TYPE REF TO cl_salv_print.
          CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_top_of_page FOR EVENT
              top_of_page OF cl_salv_events
              IMPORTING
              page
              table_index
              r_top_of_page,
          handle_end_of_page FOR EVENT
              end_of_page OF cl_salv_events
              IMPORTING
              page
              r_end_of_page.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    DATA : gr_handler TYPE REF TO lcl_eventhandler.
          CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_top_of_page.
        PERFORM create_alv_form_content_top
          USING    page
                   table_index
          CHANGING gr_content.
        r_top_of_page->set_content( gr_content ).
      ENDMETHOD.                    "handle_top_of_page
      METHOD handle_end_of_page.
        PERFORM create_alv_form_content_eop
        USING    page
        CHANGING gr_content.
        r_end_of_page->set_content( gr_content ).
      ENDMETHOD.                    "handle_end_of_page
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT *
      FROM sflight
      INTO TABLE it_sflight.
      TRY.
          CALL METHOD cl_salv_table=>factory
            EXPORTING
              list_display   = if_salv_c_bool_sap=>true
       r_container    =
       container_name =
            IMPORTING
              r_salv_table   = gr_sflight
            CHANGING
              t_table        = it_sflight
        CATCH cx_salv_msg .
      ENDTRY.
      CALL METHOD gr_sflight->get_sorts
        RECEIVING
          value = gr_sorts.
      CALL METHOD gr_sorts->set_group_active
        EXPORTING
          value = if_salv_c_bool_sap=>true.
      TRY.
          CALL METHOD gr_sorts->add_sort
            EXPORTING
              columnname = 'CARRID'
       position   =
       sequence   = IF_SALV_C_SORT=>SORT_UP
       subtotal   = IF_SALV_C_BOOL_SAP=>FALSE
               group      = if_salv_c_sort=>group_with_newpage
       obligatory = IF_SALV_C_BOOL_SAP=>FALSE
    receiving
       value      =
        CATCH cx_salv_not_found .
        CATCH cx_salv_existing .
        CATCH cx_salv_data_error .
      ENDTRY.
      CALL METHOD gr_sflight->get_event
        RECEIVING
          value = gr_events.
      CALL METHOD gr_sflight->get_print
        RECEIVING
          value = gr_print.
      CALL METHOD gr_print->set_reserve_lines
        EXPORTING
          value = 5.
      CREATE OBJECT gr_handler.
      SET HANDLER gr_handler->handle_top_of_page FOR gr_events.
      SET HANDLER gr_handler->handle_end_of_page FOR gr_events.
      CALL METHOD gr_sflight->display
    *&      Form  CREATE_ALV_FORM_CONTENT_TOP
          text
         -->P_PAGE  text
         -->P_TABLE_INDEX  text
         <--P_GR_CONTENT  text
    FORM create_alv_form_content_top  USING    l_page
                                               l_table_index
                                      CHANGING lr_content.
      WRITE 'HAI'.
    ENDFORM.                    " CREATE_ALV_FORM_CONTENT_TOP
    *&      Form  CREATE_ALV_FORM_CONTENT_EOP
          text
         -->P_PAGE  text
         <--P_GR_CONTENT  text
    FORM create_alv_form_content_eop  USING    l_page
                                      CHANGING lr_content.
      WRITE 'BYE'.
    ENDFORM.                    " CREATE_ALV_FORM_CONTENT_EOP

    Dear all,
    I am using ALV Object model, but the END_OF_PAGE is not triggering. I have pasted the sample code below. Let me know how to get  END_OF_PAGE  in ALV OM.
    REPORT  ztest_rr.
    DATA : it_sflight TYPE TABLE OF sflight.
    DATA : gr_sflight TYPE REF TO cl_salv_table,
           gr_content TYPE REF TO cl_salv_form_element,
           gr_sorts   TYPE REF TO cl_salv_sorts,
           gr_events  TYPE REF TO cl_salv_events,
           gr_print   TYPE REF TO cl_salv_print.
          CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_top_of_page FOR EVENT
              top_of_page OF cl_salv_events
              IMPORTING
              page
              table_index
              r_top_of_page,
          handle_end_of_page FOR EVENT
              end_of_page OF cl_salv_events
              IMPORTING
              page
              r_end_of_page.
    ENDCLASS.                    "lcl_eventhandler DEFINITION
    DATA : gr_handler TYPE REF TO lcl_eventhandler.
          CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
      METHOD handle_top_of_page.
        PERFORM create_alv_form_content_top
          USING    page
                   table_index
          CHANGING gr_content.
        r_top_of_page->set_content( gr_content ).
      ENDMETHOD.                    "handle_top_of_page
      METHOD handle_end_of_page.
        PERFORM create_alv_form_content_eop
        USING    page
        CHANGING gr_content.
        r_end_of_page->set_content( gr_content ).
      ENDMETHOD.                    "handle_end_of_page
    ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION
    START-OF-SELECTION.
      SELECT *
      FROM sflight
      INTO TABLE it_sflight.
      TRY.
          CALL METHOD cl_salv_table=>factory
            EXPORTING
              list_display   = if_salv_c_bool_sap=>true
       r_container    =
       container_name =
            IMPORTING
              r_salv_table   = gr_sflight
            CHANGING
              t_table        = it_sflight
        CATCH cx_salv_msg .
      ENDTRY.
      CALL METHOD gr_sflight->get_sorts
        RECEIVING
          value = gr_sorts.
      CALL METHOD gr_sorts->set_group_active
        EXPORTING
          value = if_salv_c_bool_sap=>true.
      TRY.
          CALL METHOD gr_sorts->add_sort
            EXPORTING
              columnname = 'CARRID'
       position   =
       sequence   = IF_SALV_C_SORT=>SORT_UP
       subtotal   = IF_SALV_C_BOOL_SAP=>FALSE
               group      = if_salv_c_sort=>group_with_newpage
       obligatory = IF_SALV_C_BOOL_SAP=>FALSE
    receiving
       value      =
        CATCH cx_salv_not_found .
        CATCH cx_salv_existing .
        CATCH cx_salv_data_error .
      ENDTRY.
      CALL METHOD gr_sflight->get_event
        RECEIVING
          value = gr_events.
      CALL METHOD gr_sflight->get_print
        RECEIVING
          value = gr_print.
      CALL METHOD gr_print->set_reserve_lines
        EXPORTING
          value = 5.
      CREATE OBJECT gr_handler.
      SET HANDLER gr_handler->handle_top_of_page FOR gr_events.
      SET HANDLER gr_handler->handle_end_of_page FOR gr_events.
      CALL METHOD gr_sflight->display
    *&      Form  CREATE_ALV_FORM_CONTENT_TOP
          text
         -->P_PAGE  text
         -->P_TABLE_INDEX  text
         <--P_GR_CONTENT  text
    FORM create_alv_form_content_top  USING    l_page
                                               l_table_index
                                      CHANGING lr_content.
      WRITE 'HAI'.
    ENDFORM.                    " CREATE_ALV_FORM_CONTENT_TOP
    *&      Form  CREATE_ALV_FORM_CONTENT_EOP
          text
         -->P_PAGE  text
         <--P_GR_CONTENT  text
    FORM create_alv_form_content_eop  USING    l_page
                                      CHANGING lr_content.
      WRITE 'BYE'.
    ENDFORM.                    " CREATE_ALV_FORM_CONTENT_EOP

  • ALV object model - List download

    H Experts,
    I have used ALV object model to list display.
    Also i have used class CL_ALV_COLUMNS_TABLE and its method set_long_text to set the column heading.
    Now if i execute this report, long text is displayed properly in column heading.
    But when i download this report output in spreadsheet, short text is displayed in column heading which is taken from the data element in DDIC.
    Example:
    I have declaed a column of type ABWTG.
    I have set leng text as 'TEST'.
    When i execute the report, column heading is displayed "TEST', which is as expected.
    But when i download this report in spreadsheet, column heading is displayed as 'NUMBER' in spread sheet. While downloading column heading is taken from the data element for field ABWTG. But i want the long text 'TEST' to be displayed when the report output is downloaded.
    Please suggest how to do it.
    Regards

    Hi,
    As per my understanding , it is displaying in excel based on ur ddic_output_length field.
    only becoz of that field it will show the same header.
    IF u will change the value at run time for this field then u will not get that issue,
    I m also searching on the same issue.
    Thanks
    Rahul

  • How do I create a context menu in the new ALV object model (cl_salv_table)?

    Hi,
    Does anyone know how to create a context menu (right click on line or field) in the new ALV object model (class CL_SALV_TABLE)?
    Thanks in advance
    Keld Gregersen
    PS: In the past we could use event CONTEXT_MENU_REQUEST in class CL_GUI_ALV_GRID, so it must be possible

    I don't think there's "any such animal" in the new class. I'm not 100% certain however but the new class is only useful for fairly simple display only type grids.
    There's no edit capability either.
    I'd stick with cl_gui_alv_grid until there's some decent extra functionality in the cl_salv_table class.
    It's fine for quick "bog standard" displays as it doesn't need a field catalog or any screens to be created by the user or developer  - but you pay a price for that in limited fnctionality.
    Cheers
    jimbo

  • ALV  object  model examples

    Dear All
    Can anybody tell me, where will i find the examples for ALV report using object model (two-dimensional table).
    Thanks
    ravi

    Hi Ravindra,
    Transaction DWDM, Under grid controls...
    Also check out all report programs that contain BCALV_GRID*
    BCALV_GRID_DEMO being the simple one..
    CL_GUI_ALV_GRID is the class, you can find some sample programs by doing a where used list on it as well..
    Sri
    Message was edited by: Srikanth Pinnamaneni

  • Alv object model and cl_salv_hierseq_level

    I have used the cl_salv_hierseq_level to enable expand and collapse on an instance of cl_salv_hierseq_table.
    The function to show the detail lines works until the grid table is refreshed from the database.  I have tried using the set_items_expanded method again after the refresh to no avail.
    Can anyone provide information on how to use the class and methods after some grid processing to keep expand and collapse enabled?

    There are no replies to this question; but I have noticed the expand/collapse works after process and refresh now.

  • Message in Status Bar while using ALV Objects

    Hi All,
    If we use ALV in objects (Build in class and methods for ALV),is it possible to display a error message using Message statement in Status bar.
    Thanks in advance.

    Hi,
    Yes, it is possible.  You can do it using the ALV Object Model (ALV OO methods) within an event handler method.  For example, the event "added_function of cl_salv_events" can be used and you can add code similar to the following code within the event handler method:
    CASE e_salv_function.
      WHEN 'XYZ'.
        MESSAGE w001(00) WITH 'Message text goes here...'.
    ENDCASE.
    The warning message will either show up as a popup or in the status bar depending on your user settings.  Of course, you can also use other message types (e.g. I, E, S) or other message techniques besides the message statement.
    Best Regards,
    Jamie

  • Merge cells in reuse alv

    Hello gurus.
    Please help me with merging cells.
    I need to merge some cells in alv grid. To create grid i use reuse_alv FM. For example it is needed to merge all cells in several rows. What should i do ? I think that there should be some manipulations with fieldcatalog but i don't know the correct ones.
    Thanks.
    regards,
    alex.

    If you would like to merge cells,  meaning that you want to hide repeating values in a certain column, then you can simply sort by that column. 
    report zrich_0004
           no standard page heading.
    type-pools slis.
    data: fieldcat type slis_t_fieldcat_alv.
    data: sort     type slis_t_sortinfo_alv.
    data: begin of ivbap occurs 0,
           vbeln type vbap-vbeln,
           kunnr type vbak-kunnr,
           vkorg type vbak-vkorg,
           netwr type vbap-netwr,
          end of ivbap.
    * Selection Screen
    start-of-selection.
      select vbak~vbeln vbak~kunnr vbak~vkorg vbap~netpr
                  into table ivbap
                          from vbak
                             inner join vbap
                                on vbak~vbeln = vbap~vbeln
                                      up to 100 rows.
      perform write_report.
    *  WRITE_REPORT
    form write_report.
      data: tmp_sort type line of slis_t_sortinfo_alv.
      data: fc_tmp type slis_fieldcat_alv .
    * Build feildcat
      clear fc_tmp. refresh fieldcat.
      fc_tmp-reptext_ddic    = 'Sales Org'.
      fc_tmp-fieldname  = 'VKORG'.
      fc_tmp-tabname   = 'IVBAP'.
      fc_tmp-outputlen  = '4'.
      append fc_tmp to fieldcat.
      clear fc_tmp.
      fc_tmp-reptext_ddic    = 'Customer'.
      fc_tmp-fieldname  = 'KUNNR'.
      fc_tmp-tabname   = 'IVBAP'.
      fc_tmp-outputlen  = '10'.
      append fc_tmp to fieldcat.
      clear fc_tmp.
      fc_tmp-reptext_ddic    = 'SD DOC'.
      fc_tmp-fieldname  = 'VBELN'.
      fc_tmp-tabname   = 'IVBAP'.
      fc_tmp-outputlen  = '10'.
      append fc_tmp to fieldcat.
      clear fc_tmp.
      fc_tmp-reptext_ddic    = 'Net'.
      fc_tmp-fieldname  = 'NETWR'.
      fc_tmp-tabname   = 'IVBAP'.
      fc_tmp-outputlen  = '15'.
      fc_tmp-datatype = 'QUAN'.
      append fc_tmp to fieldcat.
    * Build sort table
      clear sort. refresh sort.
      clear tmp_sort.
      tmp_sort-fieldname = 'VKORG'.
      tmp_sort-tabname   = 'IALV'.
      tmp_sort-up        = 'X'.
      append tmp_sort to sort.
    * CALL ABAP LIST VIEWER (ALV)
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                it_sort     = sort
                it_fieldcat = fieldcat
           tables
                t_outtab    = ivbap.
    endform.
    Regards,
    Rich Heilman

  • Logo in Object Model ALV ?

    Hi Experts
    I have a small doubt in object model alv...
    Is there any chance to create logo in alv using OBJECT MODEL (CL_SALV_TABLE)..
    Regards,
    Vamsi

    Hey, check this example code:
    METHOD alv_set_header.
         DATA: lv_grid   TYPE REF TO cl_salv_form_layout_grid, "Header Layout
               lv_label  TYPE REF TO cl_salv_form_label,       "Label
               lv_logo   TYPE REF TO cl_salv_form_layout_logo, "Logo
               lv_text   TYPE REF TO cl_salv_form_text.        "Text
         CREATE OBJECT lv_grid.
         lv_label = lv_grid->create_label(
                      text   = 'Execution Date:'(008)
                      row    = 1
                      column = 1 ).
         lv_text = lv_grid->create_text(
                     text   = sy-datum
                     row    = 1
                     column = 2 ).
         lv_label = lv_grid->create_label(
                      text   = 'Execution Time:'(009)
                      row    = 2
                      column = 1 ).
         lv_text = lv_grid->create_text(
                     text   = sy-uzeit
                     row    = 2
                     column = 2 ).
         lv_label = lv_grid->create_label(
                      text   = 'Responsible:'(010)
                      row    = 3
                      column = 1 ).
         lv_text = lv_grid->create_text(
                     text   = sy-uname
                     row    = 3
                     column = 2 ).
         lv_grid->add_row( ).
         lv_grid->add_row( ).
         lv_grid->add_row( ).
         lv_label = lv_grid->create_label(
                      text   = 'Total Records:'(011)
                      row    = 5
                      column = 1 ).
         lv_text = lv_grid->create_text(
                     text   = me->mv_total
                     row    = 5
                     column = 2 ).
         lv_label->set_label_for( lv_text ).
         CREATE OBJECT lv_logo.
         lv_logo->set_left_content( lv_grid ).
         lv_logo->set_right_logo( 'CUSTOMER_LOGO' ) .
         me->mo_salv_table->set_top_of_list( lv_logo ).
    ENDMETHOD.                    "alv_set_header

  • Print ALV with merged cells

    Hi all,
    I have a requirement to print an ALV grid display exactly in the same format as we see in output. That is, if the cells are merged in ALV then in Print also they should come as merged.
    But when I am printing the ALV output it does not give merged cells. I am using OO ALV.
    Is my requirement feasible. If yes, Please help me to proceed?
    Thanks,
    Daya

    Hi Daya,
    In the ALV grid control print or print preview, cells that have identical content are not merged.  This is necessary in order to be able to distinguish between blank cells and cells that only become blank after merging.  The standard behaviour for the different ALV lists is described in Note 447055.
    Regards,
    Md Ziauddin

  • ABAP WD: ALV merge cells

    Hello,
    I have a hierarchical ALV. I need to merge some cells in it.
    For instance, there is a column name: Brand Name. There are multiple rows that have same brand name, let's say SONY.
    Is it possible to merge these cells that have same brand name? If so what should I use?
    Thank you.
    Best Regards,
    Georgy Norkin

    Hi,
    Go through the links,
    Merging cells of a table in Webdynpro
    merging cells in table
    Regards,
    Azaz.

  • Excel export are merging cells for data on multiple lines !

    Hello,
    I'm using Crystal Report XI R2, when we are doing an export to Excel with have an unexpected formatting.
    For example the value of the name is on 2 lines:
    => So, on Excel the result is on 2 lines but merged. We want to have this result only on one cells.
    Remark: if we delete the 2nd lines, because cells are merged we obtain the expected result.
    Proposal A:
    Are they any set-up available concerning the formatting of Excel ?
    Proposal B:
    Could we run some VBA when we click on Export button to make queries on the Excel ?

    When they introduced Unicode support in Crystal 9 (I believe), they had to completely re-write the export routines. At that time, they made a decision to change the functionality of the excel export. Crystal is attempting to remain absolutely faithful to the graphical layout of the report as you see it in the viewer. So it creates merged cell sections, empty columns between columns, and empty rows to give you as close to exactly what you see in the viewer as possible. Unfortunately, the result is typically less than useful. Iu2019ve had several conversations with Business Objects (now SAP) with regards to this when they changed it between versions 8.5 and 10, and they have no intention of changing the functionality as it now exists.
    There is a document which is now likely somewhere on the SAP portal that explains what you need to do to obtain the best results when exporting to excel.
    The jist of it is this:
    Line up all of the columns detail data with thier headers, and make sure that data fields are the same size as thier headers. 
    Line up all rows (headers and detail rows). (ie: select everything in the row, right click, align tops, and make the same height)
    cram everything as close together as possible. zero space in the report translates to zero extra collumns and rows in the export.
    the other option is to use the export to data only functionality, but that may not be what you're looking for either.

  • [CS3/CS4 JS] How can you get the associatedXMLElement of a merged cell in a table?

    Hi!
    Inserting a table, and autotagging it, I get a table with a number of cell elements in the XML Structure.
    Selecting an item in the table, I can find the associated XML by the following line of code:
    app.selection[0].associatedXMLElement
    My problems begin when cells are merged. Then the associatedXMLElement for the cell returns null.
    How can I find the associatedXMLElement for a merged cell?
    Using the getElements makes no difference.
    app.selection[0].getElements()[0].associatedXMLElement
    (returns null)
    In the XML structure I can see that the merged cell is still associated to an XML Element, which becomes underlined and also referrs back to the cell, selecting it when double clicking the XML Element link in the structure.
    Is there no way to get to the xml element of a merged cell?
    I have tested in CS3 and CS4 as well, and they act in the same way.
    I also found a similar, unanswered, question from Anne-Laure Jallon in the "With CS3, some things have changed" ( http://forums.adobe.com/message/1105813#1105813 ):
    Hello,
    I'm working with VBscript.
    Is there a difference between cell.associatedXmlElement in CS2 and CS3?
    All my cells in CS2 had an associatedXmlElement.
    In CS3, my table has an associatedXmlElement, but all its cells don't (The value is Nothing)
    Is this a bug? Is it linked with XML evolution?   Thanks Anne Laure
    Adding some more info:
    I made a test, by selecting the XMLElement in the structure, and from that object finding the cell, and finding back to the assiciatedXMLElement:
    app.selection[0].getElements()[0].cells[0].associatedXMLElement
    Result: [object XMLElement]
    So that kind of "chain" works.
    But with the merged cell as only reference, I can't find its associatedXMLElement. Any ideas would be appreciated.
    Best regards,
    Andreas Jansson
    Message was edited by: Andreas Jansson

    In my opinion, locate a cell according to his content is not so effortable. What happens if contents of more than two cells are equals?
    I take xml elements of associated xml element of table and put them into an array.
    This array contains associated xml elements of every cell ordered by cell positions into table.
    Now, locate associated xml element of a cell based on its array position (index) is more reliable:
    var myCell_cell = app.selection[0];
    var myElement = myCell.associateXMLElement
    if (!myElement || !myElement.isValid)  {
         var table =  myCell.parent;
         var xml_tab = table.associatedXMLElement;
         var xml_cells_arr = xml_tab.xmlElements.everyItem().getElements();
         var idx = myCell.index;
         myElement = xml_cells_arr[idx];
    Alex ;-)

Maybe you are looking for