Making CRM Field mandatory to appear in red dynamically
I am trying to achieve below one..
In the compliant screen header section we have status and text field (Note ) which is custom field as shown in attachment.. I need to make validation if compliant status is closed we have to check if the user entered the note or not..if not need to raise error message and highlighter the note in red color like mandatory field..
I did the below steps..
Main component: BT120H_CPL
View where the note&status:BT120H_CPL/Detail
I am validating this in save event EH_ONSAVE of View BT120H_OVViewset..
so I am getting error message as per the requirement but my field is not getting highlighted when error message is raised..
I read in SDN threads I need to write my code in DO_FINISH_INPUT to high lite the field as mandatory..
But I have below questions..
In which view DO_FINISH_INPUT i have to write the code..in the main view where we have note field(BT120H_CPL/Detail) or save view(BT120H_OVViewset) where we are doing validations..
I have written below code for testing purpose in two views but none of the code is working..
* Mark the field Priority in red
CALL METHOD lr_msg_srv->set_field_state
iv_binding_string = '//BTADMINH/ZRMC_T'
iv_page_id = me->component_id
iv_state = 'E'.
not sure if it's related to binding string or not..
My Second question if above thing works I need to make this code active when the error is raised so i am planning to raise a flag in the save view where I am doing my validation..but how to access this flag in the method..of DO_FINISH_INPUT.. where i have to declare the flag in order to use it in two views..?
or is there any other approach is good in this scenario..
I appreciate your help and comments on this..
Pavel Duchac replied
Personally I would change BT120H_OVViewset as described in the link provided.
But there are different solutions as well.
1, You can change the field dynamically via GET_P method.
2, You can use switch:
For both solutions I would recommend to discuss the solution with a developer.