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.
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.
Please post your comments if like this post.....
ReplyDeleteSuperb Karthick.....Raghuram
Deletecheck out here for this and many more ALV examples http://www.sapdev.co.uk/reporting/alv/alvgrid_cellcolor.htm
ReplyDelete