Creating a Custom field and display it in a table view
This document will help you how to add a new filed in the table view, so that we can display any data related to that node. So for that we have to create a z (custom) field for that and add it to this screen. Now we will see standard filed and display data in a table view.
We may sometime come across a requirement of adding standard field to table view in CRM web UI. This article explains how to add standard field to the table view and display data based on search.
1) Add value or model attributes to the table view context node ( in my scenario i have taken value node).
2) redefine GET_TABLE_LINE_SAMPLE and extend the existing structure by adding z fields
3) go to SPRO and search for design layer. There you have to check disable hiding of fields by design layer checkbox
4) Find out the relation between context nodes.
5) populate the value in the fields by using relation name in GETTER and SETTER method.
Step 1: Add value attributes to the table view context node
go to table context node right click and create.
Provide the attribute name any name which is relevant to your requirement and DDIC structure that is data element for that field.
click on continue.
Click on complete the wizard will generate one filed under your context node.
While creating table view at that moment wizard will create one structure in GET_TABLE_LINE_SAMPLE.
Step 2 : redefine GET_TABLE_LINE_SAMPLE and extend the existing structure by adding z fields
Enhance the GET_TABLE_LINE_SAMPLE method under your context node..
Extending the structure by adding your field in to GET_TABLE_LINE_SAMPLE.
Step 3 : go to SPRO and search for design layer. There you have to check disable hiding of fields by design layer checkbox
SPRO->CRM->UI Framework->Design layer-> Deactivate Hiding of Fields.
Go to table view click on configuration move your filed form available to display.
Then we can see your filed in result view.
If we want to display data for that filed we can write the code in getter and setter methods.
Based on the relation we can fetch the data.
Step 4: Find out the relation between nodes.
Go to web ui in which field u have to identify the relation place a cursor on that field click on f2 then u can identify the component name, view name, context node.
Go to that component there is a method do_prepare_method.
Place a breakpoint
We have to pass typed_context->context_node->collection_wrapper right side same as like above.
Double click on that.
Click on collection_ref-> ENTITY_LIST-> CONTAINER_PROXY->data_ref-> RELATIONS
Under this is the relation.
This relation we have to use.
Step 5: In getter and setter method write this code.
In setter method .
This is the out put..
Thanks & Regards