Pieter Rijlaarsdam
Read all my blogsIn the CRM webclient, the properties of a field can be changed.
The change can vary from changing the field type, for instance changing a dropdown listbox to an ordinary input field or a checkbox or a radiobutton, to changing the tooltip text, to implementing navigation to another screen when clicking on the field.
The changes are done in the GET_P of an attribute of the context node.
The change can vary from changing the field type, for instance changing a dropdown listbox to an ordinary input field or a checkbox or a radiobutton, to changing the tooltip text, to implementing navigation to another screen when clicking on the field.
The changes are done in the GET_P of an attribute of the context node.
1. Determine the component and view to be changed.
In the CRM webclient navigate to the search screen to be adjusted, click in a field and press. Note the component and the viewname.
In the CRM webclient navigate to the search screen to be adjusted, click in a field and press
2. Enhance the component and view
First enhance the component and enhance the view. How to enhance a component and a view can be found here.
First enhance the component and enhance the view. How to enhance a component and a view can be found here.
3. Redefine the method DO_INIT_CONTEXT.
Redefine the DO_INIT_CONTEXT Remember to always call the super class. How to redefine a method can be found here.
Redefine the DO_INIT_CONTEXT Remember to always call the super class. How to redefine a method can be found here.
[IMG OF WORKBENCH SELECTING THE CONTEXT NODE].
The GET_P is run several times when adding the field to the screen at runtime.
Examples:
Changing a field to a hyperlink:The following example changes the field to a hyperlink, which when clicked upon, will navigate to a different screen
Changing a field to a hyperlink:The following example changes the field to a hyperlink, which when clicked upon, will navigate to a different screen
CASE iv_property.
WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_event_link.
WHEN if_bsp_wd_model_setter_getter=>fp_onclick.
rv_value = ‘NAVIGATE_TO_TARGET’.
ENDCASE.
WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_event_link.
WHEN if_bsp_wd_model_setter_getter=>fp_onclick.
rv_value = ‘NAVIGATE_TO_TARGET’.
ENDCASE.
Of course, you will also need to implement the event EH_ONNAVIGATE_TO_TARGET.
Changing a field to a checkbox and adding a tooltip.
CASE iv_property.
WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_checkbox.
WHEN if_bsp_wd_model_setter_getter=>fp_tooltip.
rv_value = text-001.
ENDCASE.
WHEN if_bsp_wd_model_setter_getter=>fp_fieldtype.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_checkbox.
WHEN if_bsp_wd_model_setter_getter=>fp_tooltip.
rv_value = text-001.
ENDCASE.
Additional comments.
One of the importing parameters of the get_p is the field IV_DISPLAY_MODE. This field can be checked to see whether the field is in change or in display mode. You can implement different properties to the field in change and in display mode.
Another of the importing parameters is the IV_INDEX. This can be used to determine in which line you are in the table.
One of the importing parameters of the get_p is the field IV_DISPLAY_MODE. This field can be checked to see whether the field is in change or in display mode. You can implement different properties to the field in change and in display mode.
Another of the importing parameters is the IV_INDEX. This can be used to determine in which line you are in the table.
22 reacties op “Field properties modification using the GET_P”
Pieter I am using the get p to set tool tip text for my fields. The thing is we use two languages in our system German DE and English EN. I use transaction sotr_edit to add Aliases to enter a context in English and one for German. If I log into the system in English I see my tool tips. But if I log in in German language then the tooltips just display the standard sap tooltips of the field, which is simply the value of the field. I posted this issue on sap sdn forums here
http://forums.sdn.sap.com/Thread.jspa?threadid=1869068&tstart=0 but no answers…
Sorry here is the correct link: http://forums.sdn.sap.com/thread.jspa?threadID=1869238&tstart=0
@Pieter – Do you have any idea why this is happening. This seems to still be an issue for me. Logically it makes sense. I create a tool tip SOTR_EDIT and I've added a context (a transaltion to the german lanugage" I wrote up the get_p method and it works if I log in the US Language I see the tool tip. But when I log in the DE (German) language then the tooltip is the standard SAP tooltip…
Nevermind peter about the get_p I just got it!
1) Go to transaction SOTR_EDIT
2) Create a new SOTR_EDIT like so:
3) Make sure to enter in language EN ENGLISH
4) Object Type is WAPP
5) Enter the text and save it
6) Go to the edit menu->context->create
7) A popup will come up (make sure you DO NOT PUT ANYTHING IN FOR COUNTRY / INDUSTRY)
8) Keep the popup empty and click the green check mark
9) Now it will redisplay your otr, just change the language to DE and translate the text, in the text field take the value that is in there which is in English and translate it to DE.
10) Click the save button
Then just write get_p.
Great! I would have guessed on SE63, but if this works that's great! Thanks for sharing 🙂
Hi Peter,
How can we hightlight the input field with red color similar to mandatory field?
Bhanu
I am afraid it is currently not yet possible to have fields become mandatory dynamically. At lease not that I know of… If you do find out, I would be very interested!
Thanks,
Pieter
Hi Peter,
I would not actually need to make the field mandatory but just to look like a mandatory by setting red color to it. Any ideas how to set field properties, i know we can hightlight the field using fp_focus but that comes in blue color which is not what i really need. Any ideas plz?
Bhanu
I am afraid I don't know. Sorry. I guess this change would include a change of the stylesheet as well. By the way, the way fields are shown depends on the skin the user has chosen (and thus the stylesheet).
Hi Peter,
Is there anyway to change the field to hyperlink without using get_p method.
There is a hyperlink in UI but no get_p mehtod is defined for the same field.I tried debuggin but unable to locate. Plz help!
Regards,
Rohit
Rohit, which field?
There is a search page in which clicking on search button will list all the product with product ID, description etc.
The product description is a hyperlink but in the component view no get_p method is defined for the description field.
any idea??
What is the component/node/attribute? I can have a look.
u wont b able to look at those component…
company policy…but will appreciate if you can help me with any pointers.. 🙂
is der anyway to change a field to hyperlink without using get_p method??
Ow, I don't mean to look in your system, but take a look in my own system.
In general, the mapping of a URL is done in the navigation bar profile in the Generic OP Mapping.
If you change this, you change the behaviour of links. Be aware though that it is called GENERIC for a reason. Changing this might influence other links as well.
You might by the way still be able to implement a get_p, even though the workbench doesn't allow you to. In some cases if you implement it in SE80, it is still called.
Hope this helps. If you give me the component name etc I can take a look for you.
Hi Pieter,
plz hav a look…
CRM UI->Goto Master Data->Listings->Search
in the result hyperlink is on listing (description) but in crmcmp_lst component no get_p method is defined.
Also, in the result Listing ID is from crmcmp_lstsrch component and listing is from crmcmp_lst component.
Component : 1)CRMCMP_LST/CondRecEditListView
2)CRMCMP_LSTSRCH/AdvCndRecSearchView
Thanks in advance!
Hi,
I would need to make a field invisible based on the value of another field. How could I do this? Thank you.
Hi,
without get p method can we used get v method in piclist? If yes then how?
You can adjust the available values in the GET_V, but if the field is not a ddlb yet, you can arrange this by changing the GET_P for the field.
hi,
any body could please explain how to fields display dynamically on web page.
Hi,
Can anyone support me why i can not see the fp_bgcolor so i can change the background color of one cell or row in tree view.
if_bsp_wd_model_setter_getter=>fp_bgcolor
Thanks
Hi
This blog talks about dynamically didsplaying fields. http://scn.sap.com/community/crm/webclient-ui-framework/blog/2012/07/25/form-iterator-for-chtmlbconfig
and SAP note 1937399 has a good example of changing the background colour of cells baed on the content.