Introduction:
This document is about to make editable a particular cell of selected row.
step 1: Create webdynpro component.
Step 2: Create node.
add one more attribute editable to same node with following .
Step 3: View Context.
Step 4:Create UI element table in view and bind with context node.
Step 5:Bind the required table column and assign editable to required fields read only part.
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.
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:
When we lead select on first row the cell city became editable for the same row.
When we lead select on second row the cell city became editable for the same row.
When we lead select on third row the cell city became editable for the same row.
Hope this will help you..........
Thanks & regards,
Mangesh Sonawane
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 | |
4 | |
3 | |
3 |