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.

Message Handling in Web Dynpro
 ( Assistance Class )


Step 1 :       Go to SE80 and create a web dynpro component ‘ZWD_MSG_HANDLE’


1.a) Select ‘YES’


1.b Provide description and Press ‘Enter’


1.c)    Provide name package name and save it       


Step 2 :  Creating Assistance Class.
2.aDouble click on component name


2.b)   Ensure Editing mode (Ctrl + F1)


2.c)   Provide an assistance class name starts with ‘Z’ and double click on it


2.d Select ‘Yes’


2.e)  Provide Package name

 

The following screen will appear


2.f)  Slect menu path Goto->Text Elements


2.g)  Provide message texts, save(Ctrl + S) , activate(Ctrl+F3) and Go back(F3).

 

Step 3 : Double click on main view to create context attribute and to design layout

 

3.a)    Right Click the context to create an attribute


3.b)    Provide attribute name and data type


3.c)    Goto ‘Layout’ tab
Creating Label ‘Name’


Creating Input Field


Binding the context attribute value ‘NAME’ to input field


Creating Push button and creating event ‘Validate’ 


Step 4 :  Goto ‘Method’ tab and double click on method ‘ONACTIONVALIDATE’


4.a Select Code Wizard(Ctrl + F7)


Read the value of the context attribute ‘NAME’


The variable ‘lv_name’ holds the input value


Declare a variable named ‘msg’ which will hold message texts


Using code wizard(Ctrl + F7),  Select radio button ‘Generate Message’ and choose a method ‘REPORT_ERROR_MESSAGE’ from the F4 help and press Enter


Delete the below selected lines


When user does not enter input value, Using instance object wd_assist, assign the error message text to variable ‘msg’ and call the method 'report_message_error', Otherwise assign success message text to variable ‘msg’ and call the method 'report_success'.


Activate the whole web dynpro component.

Step 5 : Create web dynpro application, enter description and save it



Right click on created application and choose ‘test’

 

OUTPUT :

When input field is empty


When input value is provided



By
R.Karthick,
Kaavian Systems.