Enhancing a standard component - Table Cell Variant

Hi Forum,
I am trying to enhance the standard WD component /SAPSRM/WDC_UI_SC_DOTC_BD view V_SC_DOTC_BASIC in SRM 7.0 .
The requierment that for certain condition the Quantity cell in a row should be read only.
Carried out the following steps:
1. Created an enhancement
2. In the standard table column ITEMS_TABLE_QUANTITY  [Columns] , removed the standard inputfield.
3. Added two cell variants ZITEMS_TABLE_QUANTITY_CV1  [CellVariants]  and ZITEMS_TABLE_QUANTITY_CV2  [CellVariants]  first one contans a text view and second contains inputfield. Variant key for first one is DISPLAY and for second one is EDITABLE.
4. Enhanced the method WDDOMODIFYVIEW with below code:
**Read the ITEMS table
  DATA lo_nd_items TYPE REF TO if_wd_context_node.
  DATA lt_items TYPE wd_this->elements_items.
  DATA ls_item LIKE LINE OF lt_items.
  DATA lo_el_context TYPE REF TO if_wd_context_element.
  DATA ls_context TYPE wd_this->element_context.
  DATA lv_disable_quantity TYPE wd_this->element_context-enable_quantity.
  DATA lr_table_column TYPE REF TO cl_wd_table_column.
** navigate from <CONTEXT> to <ITEMS> via lead selection
  lo_nd_items = wd_context->path_get_node( path = `COMP_CONTEXT.ITEMS` ).
  lo_nd_items->get_static_attributes_table( IMPORTING table = lt_items ).
  lr_table_column ?= view->get_element( 'ITEMS_TABLE_QUANTITY' ).
  LOOP AT lt_items INTO ls_item .
    IF  ls_item-catalogid EQ 'VEP_Staples_D0'.
      lr_table_column->set_selected_cell_variant( value = 'DISPLAY' ).
    ELSE.
      lr_table_column->set_selected_cell_variant( value = 'EDITABLE' ).
    ENDIF.
  ENDLOOP.
But even after the condition is true ALL cell i.e. the complete column is DISABLED or when the condition is false the COMPLETE column is enabled instead of enabling disabling ONLY THE SPECIFIC CELL.
Is there a problem with the code in WDDOMODIFYVIEW or something else?
Thanks,
Anubhav

Hi  Saravanan
Under ITEMS node I added one more Node(cv_quantity) and one attribute(cell_variant_quantity) with in this node.
And code in WDDOMODIFYVIEW :
DATA lo_nd_items TYPE REF TO if_wd_context_node.
  DATA lt_items TYPE wd_this->elements_items.
  DATA ls_item LIKE LINE OF lt_items.
  DATA lo_el_context TYPE REF TO if_wd_context_element.
  DATA ls_context TYPE wd_this->element_context.
  DATA lr_table_column TYPE REF TO cl_wd_table_column.
** navigate from <CONTEXT> to <ITEMS> via lead selection
  lo_nd_items = wd_context->path_get_node( path = `COMP_CONTEXT.ITEMS` ).
  lo_nd_items->get_static_attributes_table( IMPORTING table = lt_items ).
  lr_table_column ?= view->get_element( 'ITEMS_TABLE_QUANTITY' ).
  DATA lo_nd_cv_quantity TYPE REF TO if_wd_context_node.
  DATA lo_el_cv_quantity TYPE REF TO if_wd_context_element.
  DATA ls_cv_quantity TYPE wd_this->element_cv_quantity.
IF first_time EQ abap_true.
  lr_table_column->set_selected_cell_variant( value = 'EDITABLE' ).<--Initially ALL cells shoud be editable
ELSE.
  lr_table_column->bind_selected_cell_variant( path = 'COMP_CONTEXT.ITEMS.CV_QUANTITY.CELL_VARIANT_QUANTITY' )  .
* navigate from <CONTEXT> to <CV_QUANTITY> via lead selection
  lo_nd_cv_quantity = wd_context->path_get_node( path = `COMP_CONTEXT.ITEMS.CV_QUANTITY` ).
  IF lo_nd_cv_quantity is BOUND.
  lo_el_cv_quantity = lo_nd_cv_quantity->get_element( ).
      LOOP AT lt_items INTO ls_item .
        IF  ls_item-catalogid EQ 'VEP_Staples_D0' AND ls_item-number_int IS NOT INITIAL AND ls_item-description IS NOT INITIAL.
          lo_el_cv_quantity->set_attribute(
                                            name =  `CELL_VARIANT_QUANTITY`
                                            value = 'DISPLAY' ).
        ELSEIF ls_item-catalogid NE 'VEP_Staples_D0' OR ( ls_item-number_int  IS INITIAL AND ls_item-description IS INITIAL ) ."If the condition is not satisfied OR no item is added to that line
          lo_el_cv_quantity->set_attribute(
                                            name =  `CELL_VARIANT_QUANTITY`
                                            value = 'EDITABLE' ).
        ENDIF.
      ENDLOOP.
ENDIF.
ENDIF.
Now If I add an item that DO NOT satisfy the comdition to be read only, for that row the quantity is enabled but for all the rows below it quantity cells are DISABLED.
Hope my issue is clear?
Thanks a lot,
Anubhav

Similar Messages

  • Enhancement to standard configuration table

    hi gurus
    what does it mean that a standard configuration table is enhanceable?
    Does it mean we can change the domain of existing fields or add new fields?

    Hi,
    Go through the description written below:
    Structures and tables that were defined by SAP in the ABAP Dictionary can be enhanced subsequently by customers using Customizing includes or append structures. The enhancements do not only refer to structures/ tables themselves, but also to dependent structures that adopt the enhancement as an include or referenced structure. Append structures that only take effect at the end of the original structure can also cause shifts - in the case of dependent structures - even within these structures.
    You must select an enhancement category for the following reason: In programs where there is no active Unicode check, enhancements to tables and structures can cause syntax and runtime errors during type checks and particularly in combination with deep structures.
    In programs where there is an active Unicode check, statements, operand checks, and accesses with an offset and length are problematic - for example, if numeric or deep components are inserted into a purely character-type structure and the structure thus loses its character- type nature.
    Depending on the structure definition, the radio buttons allowed in the dialog box are ready for input. Choose one of the possible enhancement categories:
    <b>Cannot be enhanced</b>
    The structure must not be enhanced.
    <b>Can be enhanced or character type</b>
    All structure components and their enhancements must be character-type (C, N, D, or T). The original structure and all enhancements through Customizing includes or through append structures are subject to this limitation.
    <b>Can be enhanced or character-type or numeric</b>
    The structure and its enhancement must not contain any deep data types (tables, references, strings).
    <b>Reward Points for helpful answers.</b>
    Regards,
    Amit

  • Error while enhancing standard component CRMCMP_CND

    Hi,
    We have one requirement that Phase Id and Offer Id needs to added in the /SAPCND/GCM transaction and the same needs to be disaplay in the web ui.  So we added two fields in field catalog after that we made two implementation in /SAPCND/ROLLNAME and CRM_COND_COM_BADI.
    Now the funtionality is working fine in the GUI and in WEBUI the field is added but the F4 value is not visible in the new web ui screen.
    So I tried to enhance the standard component CRMCMP_CND, in order to retreive the F4 value help.  While selecting the context node in the standard view CondRecEditView we are getting the status message u201CError during analysis of method REATE_CONDRECORD of class L_CRMCMP_C_CONDRECEDITV0_CTXT. Message no. BSP_WD_TOOLS031u201D
    In standard view itself I am getting this error and while enhancing the component the context node is not converted in to Zclass.
    If we try to add attribute from the context node its giving error create_condrecord does not exist error.
    So I am unable to proceed further.  If any one aware how to solve this issue kindly let me know.

    Hi,
    While enhancing a view of a component only the controller (xx_IMPL) and the context class (xx_CTXT) are extended into Z classes. Context nodes (xx_CNXX) are not automatically extended. You have to do it manually only for the context node(s) you would like to modify. Indeed there is a message that appears when you select the context node but this is not the reason why the CN class is not extended.
    What you have to do is to redefine the method CREATE_CONDRECORD in class ZL_CRMCMP_C_CONDRECEDITV0_CTXT and create a new class ZL_CRMCMP_C_CONDRECEDITV0_CN00 that extends CL_CRMCMP_C_CONDRECEDITV0_CN00
    In ZL_CRMCMP_C_CONDRECEDITV0_CN00 implement method GET_V_xx for the field you want a search help on
    Regards,
    Fabian

  • Enhancing standard component with new component usage

    Hi!
    I try to enhance standard component /SAPSRM/WDC_AOFC_BEV with new component usage (say, SALV_WD_TABLE). It allows me to add new usage, but the usage does not appear in the "Component Usages" tree node.
    Is it a bug? Is it possible to enhance a standard component with new component usage?

    Hi Thomas!
    We've been communicating with SAP on this issue for a while and last response we obtained is next:
    Dear customer,
    the possibility to create external controller usages (as required for
    the ALV-usage) is not supported by the Web Dynpro ABAP development
    tools. However, you could try a programmatic apporach by adding the
    ALV-usage dynamically (e.g. in methods or method exits created within
    your enhancement implementation).
    See test component WDR_TEST_DYN_ALV_USAGE for details.
    What's your opinion on this? Is it really not a bug?

  • Populate data into standard component alv from Zcomponent popup data selected

    HI All
    I have to call Zcomponent in standard component and need to pass value into Zcomponent (table) and from  Zcomponent select row and pass back to standard component.
    Steps
    1) Created Zcomponent with interface node
    2) Enhanced the standard component and create used components for  Zcomponent and make it available at component controllers and view controllers.
    When I click on Button in standard component I am calling this Zcomponent as popup window.
    My problem I when I select data in Zcomponent I need to populate the data in ALV of standard component.
    I thought of 2 methods to take my selected back and populate data into standard component ALV.
    1) Create event: EVENT1 and   Interface method Method1 and link to EVENT1
    So that I can raise this event in Zcomponent and populate the data into standard component ALV
    Problem: Under events interface checkbox is visible, when I select my enhancement implementation the interface checkbox not visible under events tab?.
    2) Create Interface method Method1 write logic to populate data into standard component ALV
    But here to when I select my enhancement implementation the interface checkbox not visible under?
    Can anyone please help me why interface checkbox is not visible or any better solution to populate the data back to standard component alv?
    Thanks
    Gopal

    Hi Gopal,
    You can achieve your requirement by using EVENTS as below
    Create an event SET_DATA in component controller of zcomponent and mark it as interface and also include the parameters like context_element( type ref to if_wd_context_element), etc as below
    Now, create an action for the event onLeadSelect of your zcomp Table and write the below code
                     DATA lo_ctx_element TYPE REF TO if_wd_context_element.
                   "get the selected row
                     lo_ctx_element = wdevent->get_context_element( name =
                        'NEW_ROW_ELEMENT' ).
                   "Raise the event with parameter
                   wd_comp_controller->fire_set_data_evt( context_element = lo_ctx_element ).
    Use the Zcomponent in your standard component and make available in std. view's properties
    Create an event handler SET_DATA method for your Zcomp's event as below
    Now, inside this method, you get the parameter CONTEXT_ELEMENT and get the data from this context element as below
                   context_element->get_attrribute( ) or
                   context_element->get_static_attributes( )
    You can populate the data into standard component based on the obtained value from Zcomponent.
    Hope this helps you.
    Regards,
    Rama

  • Dynamic table cell editor type

    I have a table that the user wants one of two things in a cell.  The cell will either be a check box (allowing for further processing) or text.  What is the best method to place either the textview or checkbox in each cell of the table?
    Diane

    In NW04s, you can use table cell variants to have different editors in the same column.
    See https://help.sap.com/javadocs/NW04S/current/wd/com/sap/tc/webdynpro/clientserver/uielib/standard/api/IWDTableStandardCell.html
    Armin

  • Modify CRM 2007 ICWEB Client standard component

    Hi,
    How to copy and modify CRM 2007 ICWEB Client standard component view UI element button ,label  etc,..
    Can any one expin step by step .
    Thanks and Regards,
    Kaaviya.

    Hi,
    To Enhance a Standard Component
    1, Go to SM 34 Transaction 
    2. Create an Enhancement Set  in BSPWDVC_CMP_EXT
    3, Then Go to Transaction  bsp_wd_cmpwb
    4,On the right corner there will be Enhance  Component Button
    5.Click , Then it will ask for an Application Give Z(component name ) to the application.
    6.Give Repository Name.
    7.To check -  all component controllers, custom controllers and views will be in disabled mode.
    To Enhance a standard view
    1. Right click on the Standard view u want to enhance , Click on enhance.
    2. To check the disabled view will be in editable mode.
    I hope it helps
    Regards,
    Sijo
    Edited by: sijokjohn85 on Jun 8, 2009 2:53 PM

  • Use of Cell Variant for a normal table

    Hi Experts,
    I have a requirement in a normal table where a row is first in read-only mode, then on click of edit button (given on that row),
    the row should become editable and also edit button should become invisible and two more buttons update/cancel have to be visible. How to achieve this using a cell variant for this normal table.
    A detailed reply would be appreciated.
    Thanks in Advance,
    Mirza Hyder.

    Hi Mirza,
    Cell variant property is used to chenge the cell property not for other.That means in one cell you want checkbox and in other cell you want textview like this you can change the property of cell as you want.
    Test this standard program WDR_TEST_TABLE in that test view cell varint for your understanding.
    Coming to your requirement.You can do in this way.
    Check in the below thread in that i gave code to make the entire row is editable when you click on the lead selection of row.I gave code for ALV.I hope that code is use ful for you.
    How to make all columns of alv editable
    To make tool bar buttons disable and enable:Write your logic in method handler of lead selection event like change the visible property of button to none.
    Note: In the event handler method you dont get reference of view.You only get reference of view in WDDOMODIFYVIEW only so take a global variable of type ref to if_wd_view and populate that global variable in method WDODIFYVIEW.So that you can access any view element in any method.
    For cell variant in ALV check this Article written by me.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0e7461d-5e6c-2b10-dda9-9e99df4d136d

  • Unable to make use of ALV table in a standard component.

    Hi All,
    I am enhancing a standard wd component. I want to make use of ALV table in my enhancement. I am able to add SALV_WD_TABLE in "Used components". But the same is not getting reflected in "Component Usages".
    Can anybody guide regarding this?
    Regards,
    Yugesh Adalam

    Hi yugesh,
    Sorry, for me also it is not coming in Enh mode.
    Refer this thread:
    Regarding enhancement for ALV usage Need Help!
    Ans by Thomas:
    Re: Component Usage in Enhancement
    For the ALV, you can always do the data mapping dynamically in code using the SET_DATA method of the ALV Component Interface

  • Table cell with more than one component

    how can i make table cell with more than one component
    like below, cell in column 3 contains few button
    col0 | col1 | col2 |
    a | b |[btn1] [btn2] [btn3]|
    a | b |[btn1] [btn2] |
    and when i click on the any of the button a dialog box pop up saying something..

    Here's link to someone who did a lot with tables. Not sure about multiple buttons, but it should get you started.
    http://www2.gol.com/users/tame/swing/examples/SwingExamples.html

  • Setting new cell variant for an alv table column

    Hi,
    I want to set a new cell variant for a column. Therefore I did the following steps:
    1. Create an object of CL_SALV_WD_CV_STANDARD
    2. SET_KEY( 'CELLVAR1 )
    3. set_cell_design([..]-goodvalue_medium )
    4. SET_EDITOR( lr_alv_input_field )
    After that I added the cell variant to the column by using the method "add_cell_variant".
    The last step is to call method SET_SELECTED_CELL_VARIANT.
    I checked my program by using get_selected_cell_variant( ) and the return string was okay.
    But when the table is displayed, the new cell variant isn't working. I defined an input field as the cell editor for my new cell variant but when the table is shown, it is just text - no input possible. In addition to that the selected cell design (goodvalue_medium , step 3) isn't working. So I think the cell variant is not used.
    Can you help me?
    Thanks & Regards,
    Hendrik

    Hi
    I wonder if you can help me please, I too am having issues implementing ALV cell changes in WDA?
    I am basically trying to dynamically change the individual color of a cell (not the entire column or row) dependant on certain criteria. I apologies but find that you are the closest resource for any potential information. Please see screen shot below.
    Currently my code is as follows:
    see: www.picasaweb.google.co.uk/dave.alexander69/Pictures#5244416971466907938
    data: lr_cv TYPE REF TO cl_salv_wd_cv_standard.
    loop at table 1 row data
            loop at table columns
              for the date columns only...
              IF <fs_column>-id(4) = 'CELL'.
               get and set column header dates from select option user input - done
                loop at table 2 row data (table 2 contains date ranges for row concerned)
                  MOVE: ls_zdata-variance TO lv_variance.
                  method 1 - as in sap press WD4A -:
                  lr_cv = cl_wd_table_standard_cell=>new_table_standard_cell(
                                                     view        = view
                                                    variant_key = lv_variance ).
                 as mentioned...
                  CREATE OBJECT lr_cv.
                  lr_cv->set_key( 'VARIANCE' ).
                  lr_cv->set_cell_design( '09' ).
                  lr_cv->set_editor( lr_input_field ).
                  lr_column->add_cell_variant( lr_cv ).
                  lr_column->set_cell_editor( lr_input_field ).
                  lr_column->set_sel_cell_variant_fieldname( 'VARIANCE' ).
                  lr_column->set_cell_design_fieldname( value = 'COLOR_CELL' ).
                  lr_field = lr_table->if_salv_wd_field_settings~get_field( <fs_column>-id ).
                  lr_field->if_salv_wd_sort~set_sort_allowed( abap_false ).
                  the only way I get cell coloring to work - but this is for entire column?
                  ls_zdata-color_cell = cl_wd_table_standard_cell=>e_cell_design-one.
                  MODIFY lt_zdata FROM ls_zdata..
                ENDLOOP.
              ENDIF.
              IF <fs_column>-id = 'COLOR_CELL'.
                CALL METHOD lr_column->set_visible( EXPORTING value = '00' ).
              ENDIF.
            ENDLOOP
          ENDLOOP.
    As you see I am in the dark a bit regarding cell variants and wonder if you can point me in a better direction.
    Many thanks for any help,
    Dave Alexander

  • Enhancement of Standard Webdynpro Component ( Component Usages )

    Dear All,
    There is a standard WDC_MAIN.  It uses many sub components WDC_SUB1, WDC_SUB2, WDC_SUB3.
    The problem here is I need to access the context node information of all the sub components ( WDC_SUB1, WDC_SUB2, WDC_SUB3. ) in the main component WDC_MAIN.
    <<<Reason for the need to access context nodes in sub component:
        I need to collect some fields from various views of various subcomponents into one view of my Main Component.  I think this can be done by enhancement implementation where I can create a new view>>>
    I can access the nodes of sub components only if the context node in the component controllers are marked as Interface Node.  But I cant edit the sub component, because it is a standard SAP provided component.
    Solutions that I am trying:
    1. I tried to create enhancement implementation and tried to achieve this... but I dont know for some reason SAP doesnt allow to enhance the context node as Interface node.
    2. I tried to copy the standard component to Z component, but another risk here is that, this main component is referenced else where and it is difficult again to give reference to this new Z_ component.
    Kindly guide me on how to achieve this.
    Thanks in advance!!!
    Regards,
    Sur.
    Edited by: Gaurav Desai on Aug 7, 2008 9:14 AM

    Hello,
    Using enhancements, create a context node and a an interface method so you can pass the contexts that you need over this method.
    Or you can try to do an external mapping to you context like in the ALV component.
    Regards.

  • Example ---Defining Cell Variants: TableSingleMarkableCell-Getting error

    Hi All,
          We are trying an example of cell variant concept of table as given in NetWeaver help. But after deploying we are getting folllowing error. Please guide me.
    <b>Create a value attribute attributePointer, switch to the Properties, click … for the property type, and select the Java Simple Type. Enter com.sap.tc.webdynpro.progmodel.api.IWDAttributePointer and confirm with Ok</b>---
    I am not able to get this type..I have chosen ---com.sap.ide.webdynpro.uielementdefinitions.AttributePointer
    Thanks in Advance,
    Gangadhar.
    <b>Error we are getting is</b>  
    java.lang.NoClassDefFoundError: com/sap/tc/webdynpro/clientserver/uielib/standard/api/IWDAbstractTableColumn
         at java.lang.Class.getDeclaredConstructors0(Native Method)
         at java.lang.Class.privateGetDeclaredConstructors(Class.java:1618)
         at java.lang.Class.getConstructors(Class.java:865)
         at com.sap.tc.webdynpro.progmodel.generation.ControllerHelper.createDelegate(ControllerHelper.java:68)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.<init>(DelegatingView.java:41)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.createUninitializedView(ViewManager.java:486)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.getView(ViewManager.java:523)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.bindRoot(ViewManager.java:421)
         at com.sap.tc.webdynpro.progmodel.view.ViewManager.init(ViewManager.java:130)
         at com.sap.tc.webdynpro.progmodel.view.InterfaceView.initController(InterfaceView.java:41)
         at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:200)
         at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.displayToplevelComponent(ClientComponent.java:135)
         at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:404)
         at com.sap.tc.webdynpro.clientserver.task.WebDynproMainTask.execute(WebDynproMainTask.java:618)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:59)
         at com.sap.tc.webdynpro.clientserver.cal.ClientManager.doProcessing(ClientManager.java:251)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doWebDynproProcessing(DispatcherServlet.java:154)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:116)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:48)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:160)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
    <b>Example we are trying is</b>
    You need the option to select a single cell to provide a value help for individual cells, for example.
    The interface TableSingleMarkableCell allows you to group cell variants in any way as you like and to make a single cell selectable in this group. The following example shows how to proceed if you want to implement a selection of a single cell from an entire table.
    Prerequisites
    You have created an applicaton with a component and view in your Web Dynpro project.
    Procedure
    Creating the Context
           1.      Create a value node TableNode for the data of the table and insert three value attributes of the type String for the table columns.
           2.      Create a value attribute selectedCellVariant of the type String in the TableNode.
           3.      Create a value attribute attributePointer, switch to the Properties, click … for the property type, and select the Java Simple Type. Enter com.sap.tc.webdynpro.progmodel.api.IWDAttributePointer and confirm with Ok.
    Creating the View
           1.      Open the context menu in the Outline, select Apply Template and then Table. In the subsequent dialog box from the context, select three attributes for the columns (col1, col2, col3). Confirm by choosing Finish
           2.      Set the property selectionMode of the table to none.
    Repeat the steps for each column.
           3.      Highlight the column and open the context menu. Select Insert Cell Variant, TableSingleMarkableCell and confirm with Finish.
           4.      Enter the same value for each TableSingleMarkableCell for the property variantKey - for example, variant1
           5.      Insert a cell editor of the type TextView in each TableSingleMarkableCell.
    Binding the UI Elements
           1.      Bind the text property of each TextView to the column in which the property is contained.
           2.      Bind the attributeToMarkproperty of the corresponding TableSingleMarkableCell to the column in which the element is contained.
           3.      Bind the selectedCellVariantproperty of each TableColumn to the context attribute selectedCellVariant.
           4.      Add the following source code to the wdDoInit method.
    wdDoInit()
    1
    2
    3
    IPrivateUseSingleMarkableCellsView.ItableNodeElement elem;
          int count = 10;
    // Fill dummy data
         for(int i=0; i<count; i++) {
             elem = wdContext.nodeTableNode().createTableNodeElement();
             wdContext.nodeTableNode().addElement(elem);
             elem.setCol1(“1.” + i);
             elem.setCol2(“2.” + i);
             elem.setCol3(“3.” + i);
    // set TableSingleMarkableCell as a variant for the table
             elem.setSelectedCellVariant(“variant1”);
                For each element that is created in the for loop and is then added, the
                TableSingle MarkableCell is set as a cell variant in row 3.
           5.      Add the following source code to the wdDoModifyView method.
    wdDoModifyView()
    IWDAttributeInfo markedDataInfo = wdContext.currentContextElement().getAttributePointer(“attributePointer”).getAttributeInfo();
                            ((IWDTableSingleMarkableCell) view.getElement(“TableSingleMarkableCell1”)).bindMarkedData(markedDataInfo);
                            ((IWDTableSingleMarkableCell) view.getElement(“TableSingleMarkableCell2”)).bindMarkedData(markedDataInfo);
         1.                          ((IWDTableSingleMarkableCell) view.getElement(“TableSingleMarkableCell3”)).bindMarkedData(markedDataInfo);
    The current AttributeInfo is now retrieved at every change of the view and is bound to the context using the markedDataproperty.
    Result
    Each single cell can be selected separately. You can define an action and in its method, you can determine the coordinates of the currently selected cell using the following code:
    IWDAttributePointer attPointer = wdContext.currentContextElement().getAttributePointer();
    Message was edited by:
            Gangadharayya Hiremath

    Hi Gangadhar,
    at first: you are right: you have to choose
    com.sap.ide.webdynpro.uielementdefinitions.AttributePointer
    and not the other one. I already updated the documentation for this.
    In which SP are you working?
    Kind Regards
    Stefanie

  • Small issue with custom table cell editor and unwanted table row selection

    I'm using a custom table cell editor to display a JTree. Thing i notice is that when i select a value in the tree pop-up, the pop-up closes (as it should) but then every table row, from the editing row to the row behind the pop-up when i selected the value becomes highlighted. I'm thinking this is a focus issue, but it thought i took care of that. To clairfy, look at this: Before . Notice how the "Straightening" tree item is roughly above the "Stock Thickness" table row? When i select Straightening, this is what happens to my table: After .
    My TreeComboBox component:
    public class TreeComboBox extends JPanel implements MouseListener {
        private JTextField itemField;
        private TreeModel treeModel;
        private ArrayList<ActionListener> actionListeners = new ArrayList<ActionListener>();
        private Object selectedItem;
         * Creates a new <code>TreeComboBox</code> instance.
         * @param treeModel the tree model to be used in the drop-down selector.
        public TreeComboBox(TreeModel treeModel) {
            this(treeModel, null);
         * Creates a new <code>TreeComboBox</code> instance.
         * @param treeModel the tree model to be used in the drop-down selector.
         * @param selectedItem tree will expand and highlight this item.
        public TreeComboBox(TreeModel treeModel, Object selectedItem) {
            this.treeModel = treeModel;
            this.selectedItem = selectedItem;
            initComponents();
         * Returns the current drop-down tree model.
         * @return the current <code>TreeModel</code> instance.
        public TreeModel getTreeModel() {
            return treeModel;
         * Sets the tree model.
         * @param treeModel a <code>TreeModel</code> instance.
        public void setTreeModel(TreeModel treeModel) {
            this.treeModel = treeModel;
         * Returns the selected item from the drop-down selector.
         * @return the selected tree object.
        public Object getSelectedItem() {
            return selectedItem;
         * Sets the selected item in the drop-down selector.
         * @param selectedItem tree will expand and highlight this item.
        public void setSelectedItem(Object selectedItem) {
            this.selectedItem = selectedItem;
            String text = selectedItem != null ? selectedItem.toString() : "";
            itemField.setText(text);
            setToolTipText(text);
         * Overridden to enable/disable all child components.
         * @param enabled flat to enable or disable this component.
        public void setEnabled(boolean enabled) {
            itemField.setEnabled(enabled);
            super.setEnabled(enabled);
        public void addActionListener(ActionListener listener) {
            actionListeners.add(listener);
        public void removeActionListener(ActionListener listener) {
            actionListeners.remove(listener);
        // MouseListener implementation
        public void mouseClicked(MouseEvent e) {
        public void mouseEntered(MouseEvent e) {
        public void mouseExited(MouseEvent e) {
        public void mousePressed(MouseEvent e) {
        public void mouseReleased(MouseEvent e) {
            showPopup();
        private void initComponents() {
            setLayout(new GridBagLayout());
            itemField = new JTextField();
            itemField.setEditable(false);
            itemField.setText(selectedItem != null ? selectedItem.toString() : "");
            itemField.addMouseListener(this);
            add(itemField, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0,
                    GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
        private void showPopup() {
            final TreePopup popup = new TreePopup();
            final TreeComboBox tcb = this;
            final int x = itemField.getX();
            final int y = itemField.getY() + itemField.getHeight();
            int width = itemField.getWidth() + popupButton.getWidth();
            Dimension prefSize = popup.getPreferredSize();
            prefSize.width = width;
            popup.setPreferredSize(prefSize);
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    popup.show(tcb, x, y);
                    popup.requestFocusInWindow();
        private void fireActionPerformed() {
            ActionEvent e = new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "TreeComboBoxSelection");
            for (ActionListener listener : actionListeners) {
                listener.actionPerformed(e);
        private class TreePopup extends JPopupMenu {
            private JTree tree;
            private JScrollPane scrollPane;
            public TreePopup() {
                initComponents();
                initData();
            private void initData() {
                if (treeModel != null) {
                    tree.setModel(treeModel);
            private void initComponents() {
                setFocusable(true);
                setFocusCycleRoot(true);
                tree = new JTree();
                tree.setRootVisible(false);
                tree.setShowsRootHandles(true);
                tree.setFocusable(true);
                tree.setFocusCycleRoot(true);
                tree.addTreeSelectionListener(new TreeSelectionListener() {
                    public void valueChanged(TreeSelectionEvent e) {
                        tree_valueChanged(e);
                scrollPane = new JScrollPane(tree);
                add(scrollPane);
            private void tree_valueChanged(TreeSelectionEvent e) {
                DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
                setSelectedItem(node.getUserObject());
                fireActionPerformed();
                this.setVisible(false);
    }My TreeComboBoxTableCellEditor:
    public class TreeComboBoxTableCellEditor extends AbstractCellEditor implements TableCellEditor, ActionListener {
        protected TreeComboBox treeComboBox;
        protected ArrayList<CellEditorListener> cellEditorListeners = new ArrayList<CellEditorListener>();
        public TreeComboBoxTableCellEditor(TreeComboBox treeComboBox) {
            this.treeComboBox = treeComboBox;
            treeComboBox.addActionListener(this);
        public Object getCellEditorValue() {
            return treeComboBox.getSelectedItem();
        public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
            treeComboBox.setSelectedItem(value);
            return treeComboBox;
        public void actionPerformed(ActionEvent e) {
            stopCellEditing();
    }Any thoughts?
    Edited by: MiseryMachine on Apr 3, 2008 1:21 PM
    Edited by: MiseryMachine on Apr 3, 2008 1:27 PM

    As I said, you have to have empty context elements before additional rows will be open for input.
    For instance if you want to start with 5 rows available for input do the following to your internal table that you will bind:
    data itab type standard table of sflight.
    do 5 times.
      append initial line to itab.
    enddo.
    context_node->bind_table( itab ).
    The other option if you need n number of rows is to add a button to the table toolbar for adding more rows. When this button is pressed, you add a new context element to the node - thereby creating a new empty row in the table.

  • How to add cell editor to cell variant dynamically?

    Hi everyone,
      I'm developing a web dynrpo component. In one of the views , I need to modify the view dynamically
    because the data structure only can be determined at runtime. And the table column should have two
    cell variants. I don't know the exact cell variant class which should be used. I only find an abstract class about cell variant CL_WD_ABSTR_TABLE_CELL_VAR , but I can't find any method in this class which
    can add cell editor under this cell variant.
    Thanks in advance.

    Hi Sireesha,
    Thanks for link you provided.
    I am able to add Column with CommandImageLink.And onclick of that link i am able to display another popup.
    Now another problem which i am facing is when i select one row from popup and click "Ok" i have to modify some columns from Dyanamic table which is displayed on main page.
    For this.
    1)First i took the selected row from dyanamic table to update that perticular row depending upon the row which i select from popup.
    if you see the code above i am refaring the list as collection for data.So i am updating that collection but again it is refreshing to it's original value.
    because number of times getList() method of bean get's called equal to number of columns. which brings the values from database.
    Here On click of popup's Ok button I don't want to save the data for table i just want to show there in some column's .and After click on SAVE button from table i have to save it.
    Let me help how can i modify the Dynamic table's data.
    Thanks for all help.
    Jaydeep

Maybe you are looking for

  • Can people connect to my computer via airplay if I use their wifi?

    I've always wondered this about the airplay function, and I'm not sure if that's possible because on the top right hand corner there is an airplay icon and when I look through it I can find some AppleTV's that do not belong to me and are from the pla

  • Photo size when uploaded from camera

    I have been trying to order prints off of snapfish, and keep getting the resolution warning on every single picture. I have a Canon Powershot camera and have adjusted it so that it is on the highest resolution, so I think the problem comes from uploa

  • Initial feedback

    Hi, This is a great resource and I like how forms can be completed on mobile devices, including iPhone. A few points: The colour picker is quite dark and is not particularly easy to select appropriate colours. I think the circle instead of square swa

  • Error when building gyachi [finally SOLVED]

    now when i go to issue the command makepkg -s i get the following error configure: error: cannot find include files for libpulse-simple.  Perhaps you need to install the libpulse or libpulse-simple development package? make: *** No targets specified

  • Error on Screen Exit

    Good day experts, I would like to seek your help after I exhausted all possible solutions I knew in my mind and some research I did on net. I am working right now in tcode, WB21, WB22, WB23 --Trading Contract... My requirement is. a. Add 5 additional