cancel
Showing results for 
Search instead for 
Did you mean: 

Making CRM Field mandatory to appear in red dynamically

Former Member
0 Kudos

Hi All,

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

        EXPORTING

          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..

Thanks,

Sanjana.

Accepted Solutions (1)

Accepted Solutions (1)

pavelduchac
Participant
0 Kudos

Hi Sanjana,

You are definitely on the right track.

I would put my code into DO_FINISH_INPUT of a Viewset.

Please check this thread for complete code: http://scn.sap.com/thread/3167145

Cheers,

Pavel

Note: Check attribute ERRONEOUS_FIELDS in LV_MESSAGE_SERVICE during runtime. It will loop through views and at some time it should contain the field you are trying to set to red.

Former Member
0 Kudos

Thanks Pavel ..but I couldn't achieve this..not sure because as this is note field..and field is added from custom controller..

do we have to follow seperate approach for note field..?

Thanks,

Sanjana.

pavelduchac
Participant
0 Kudos

Hi Sanjana,

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.

http://scn.sap.com/community/crm/webclient-ui-framework/blog/2013/07/15/make-a-field-dynamically-man...


2, You can use switch:

http://scn.sap.com/community/crm/webclient-ui-framework/blog/2014/02/14/dynamic-fields-in-webui-usin...


For both solutions I would recommend to discuss the solution with a developer.


Best Regards,


Pavel

Former Member
0 Kudos

Thanks Pavel,

First link worked in my case..

Thanks,

Sanjana SAP.

Answers (0)