Making particular column (or) all columns
editable in Web dynrpo ALV

      Refer the previous tutorial steps from 1 to 19 to create the web dynpro component and design the layout with alv table. Instead of doing 20th step, Follow the below one to make particular column editable.

************** To make particular column editable ****************
Step 20 :      Write the below code 


*Retrieving column to be in edit mode
data lr_column type ref to cl_salv_wd_column.
call method lv_value->if_salv_wd_column_settings~get_column
exporting
  id    = 'EBELN'
receiving
  value = lr_column.

*Creating UI Elmenent 'INPUT FIELD' to make the column editable
data lr_input type ref to cl_salv_wd_uie_input_field.
create object lr_input
exporting
value_fieldname = 'EBELN'.

*Assigning input field to the column
call method lr_column->set_cell_editor
exporting
  value = lr_input.

*Enabling editing mode in ALV table
lv_value->if_salv_wd_table_settings~set_read_only( abap_false ). 



OR

************** To make all columns editable ****************
Step 20 :      Write the below code

*Internal table and work area to store all column id and reference
data lt_columns type salv_wd_t_column_ref.
data ls_columns like line of lt_columns.
*column reference
data lr_column type ref to cl_salv_wd_column.
*input field UI Element
data lr_input type ref to cl_salv_wd_uie_input_field.
*Retrieving all column id and reference
call method lv_value->if_salv_wd_column_settings~get_columns
receiving
value = lt_columns.
*Making all columns editable
loop at lt_columns into ls_columns.
*Assigning column reference
lr_column = ls_columns-r_column.
*Creating input field UI Element
create object lr_input
exporting
  value_fieldname = ls_columns-id.
*Assigning input field to column to make it as editable
call method lr_column->set_cell_editor
exporting
  value = lr_input.
endloop.
*Enabling editing mode in ALV table
lv_value->if_salv_wd_table_settings~set_read_only( abap_false ).



OUTPUT :  



Follow the steps 21 to 23 from the previous tutorial.

* Making particular column editable



OR

*Making all columns editable



By
Karthick.R,
Kaavian Systems.







Coloring particular column of ALV table in Web dynrpo

Step 1 :   Open SE80 transaction and create an object


Step 2 :   Provide descriptions and save (Ctrl + S)


Step 3 :
1.     Double click on component name
2.     Provide any relevant name in ‘Component Use’ column ,
‘SALV_WD_TABLE’ in the ‘Component’ column under the ‘Used Components’ tab and press Enter


Step 4 :  
1.     Double click on Main view
2.     Press ‘Select controller usage’
3.     Select alv component and press Enter


Step 5 :  
1.     Double click on Component Controller
2.     Go to Context tab
3.     Right click context to create node


Step 6 :  Provide node name, dictionary structure, cardinality, lead selection and supply function for data retrieval. Press ‘Add Attribute from structure’ to add attributes in the node 


Step 7 :  Select required fields and press Enter


Step 8 :  Go to methods tab and Double click supply function ‘Data Fill’.


Step 9 :   Do uncomment the following code and insert the select query as given below to retrieve data


Step 10 :  
1.     Select Component Usage->ALV->Interface Controller
2.     Press ‘Controller Usage’ and select the component from the pop up window so that we can see the context of component controller


Step 11 :  Drag the node ‘Table’ of component controller  to the node ‘Data’ of interface controller


Step 12 :  Double click main view, Go to layout tab, Right click ROOTUIELEMENT and select ‘Insert Element’ to insert new element


Step 13 :  Provide Element ID and Type as ‘ViewContainerUIElement’. Press Enter


Step 14 :  
1.     Double click on window name
2.     Select main->view( View Container UI Element )
3.     Rightclick it and select ‘Embed View’ to embed the ALV table


Step 15 :  Select ALV table from the pop up window


Step 16 :  
1.     Double click on Main View
2.     Go to Methods tab
3.     Double click on method ‘WDDOINIT’


Step 17 :  
1.     Click ‘Web dynpro code wizard’
2.     Go to  ‘General’ tab
3.     Choose ‘Instantiate Used Component’ radio button
4.     Select ALV component from the F4 help window


Step 18 :
1.     Again click ‘Web dynpro code wizard’
2.     Choose ‘Method call in used controller’ radio button
3.     Select ALV component in the F4 help window


Step 19 :    Give Method Name as ‘GET_MODEL’ and press Enter


Step 20 :  Write the below code

*Defining  column reference
data lr_column type ref to cl_salv_wd_column.
*Assigning column reference
call method lv_value->if_salv_wd_column_settings~get_column
exporting
  
id    = 'EBELN'
receiving
  
value = lr_column.
*Setting column color
call method lr_column->set_cell_design
exporting
  
value = 1.


Below are the sample color codes that we can specify as export value of method ‘set_cell_design‘ in the above code    


Step 21 :   Activate the whole web dynpro component and create application by right clicking and selecting create->web dynpro application


Step 22 :  Provide description for application, press Enter and Save

   
Step 23 :  Right click the application and select ‘Test’ to the test the web dynpro application


OUTPUT :  



By
Karthick.R,
Kaavian Systems.