Skip to Content

Making CRM Field mandatory to appear in red dynamically

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.

Compliant.PNG (36.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    May 21, 2015 at 02:36 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded