Skip to Content

Introduction:

This document is about to make editable a particular cell of selected row.

Step by Step Process:

step 1: Create webdynpro component.


sc1.JPG

Step 2: Create node.


sc2.JPG

add one more attribute editable to same node with following .

sc3.JPG

Step 3: View Context.

sc4.JPG


Step 4:Create UI element table in view and bind with context node.

sc6.JPG

Step 5:Bind the required table column and assign editable to required fields read only part.

sc7.JPG

Step 6 : Bind table in doinit method of view.

method WDDOINIT .

     DATA LO_ND_N_T001 TYPE REF TO IF_WD_CONTEXT_NODE.

     DATA LT_N_T001 TYPE WD_THIS->ELEMENTS_N_T001.

     DATA Ls_N_T001 TYPE WD_THIS->ELEMENT_N_T001.

*   navigate from <CONTEXT> to <N_T001> via lead selection

     LO_ND_N_T001 = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_N_T001 ).

select * from t001 into corresponding fields of ls_n_t001 up to 5 rows.

   ls_n_t001-editable = ‘X’.

   append ls_n_t001 to lt_n_t001.

   clear ls_n_t001.

   endselect.

*

     LO_ND_N_T001->BIND_TABLE( NEW_ITEMS = LT_N_T001 SET_INITIAL_ELEMENTS = ABAP_TRUE ).

endmethod.

Step 7: To make cell editable on lead select we will create a lead select action and will write code to make cell editable.

sc8.JPG

code in Leadselect :

METHOD ONACTIONLEADSELECT .

* READ AS TABLE OPERATION

data: x type i.

  x = sy-index.

  x = sy-tabix.

      DATA LO_ND_N_T001 TYPE REF TO IF_WD_CONTEXT_NODE.

      DATA LT_N_T001 TYPE WD_THIS->ELEMENTS_N_T001.

*    navigate from <CONTEXT> to <N_T001> via lead selection

      LO_ND_N_T001 = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_N_T001 ).

      LO_ND_N_T001->GET_STATIC_ATTRIBUTES_TABLE( IMPORTING TABLE = LT_N_T001 ).

* LO_ND_N_T001->BIND_TABLE( NEW_ITEMS = LT_N_T001 SET_INITIAL_ELEMENTS = ABAP_TRUE ).

**READ WITHOUT TABLE OPERATION

        DATA LO_EL_N_T001 TYPE REF TO IF_WD_CONTEXT_ELEMENT.

        DATA LS_N_T001 TYPE WD_THIS->ELEMENT_N_T001.

*      navigate from <CONTEXT> to <N_T001> via lead selection

        LO_ND_N_T001 = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_N_T001 ).

*      get element via lead selection

        LO_EL_N_T001 = LO_ND_N_T001->GET_ELEMENT( ).

*      get all declared attributes

        LO_EL_N_T001->GET_STATIC_ATTRIBUTES(

          IMPORTING

            STATIC_ATTRIBUTES = LS_N_T001 ).

LS_N_T001-EDITABLE = ‘ ‘.

MODIFY LT_N_T001 FROM LS_N_T001 TRANSPORTING EDITABLE WHERE BUKRS = LS_N_T001-BUKRS.

*

          LO_ND_N_T001->BIND_TABLE( NEW_ITEMS = LT_N_T001 SET_INITIAL_ELEMENTS = ABAP_TRUE ).

ENDMETHOD.

Step 8 : Activate and create application for the same and test the apllication

When it is tested:

sc9.JPG

When we lead select on first row the cell city became editable for the same row.

sc10.JPG

When we lead select on second row the cell city became editable for the same row.

sc11.JPG

When we lead select on third row the cell city became editable for the same row.

sc12.JPG

Hope this will help you……….

Thanks & regards,

Mangesh Sonawane





To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply