cancel
Showing results for 
Search instead for 
Did you mean: 

Making a field dynamically mandatory?

0 Kudos

Hi,

I have a task to make Location field mandatory if the importance is high in Appointment.

For this i enhanced BT126H_APPT/ApptDetails  in the context node Btactivityh  GET_P_ACT_LOCATION  i did the coding.It is working fine.

Now the problem is

1) Importance->high               Location->mandt          Fine.

2)Importance->low                 Location->Not mandt.   Here mandatory mark(*) is getting is removed but field is getting highlighted with red color.

I have attached screen shot

Can any body please tell me how can i handle this?

Thanks,

Hari.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Redifine  DO_FINISH_INPUT method of the view(IMPL) class and write following lines of code in that method.

DATA : lv_message_service TYPE REF TO  cl_bsp_wd_message_service.

     global_messages->delete_message( condition =cl_bsp_wd_view_controller=>co_mandatory_field_empty ).

     lv_message_service = me->view_manager->get_message_service( ).

     CALL METHOD lv_message_service->remove_fields_state

       EXPORTING

         iv_page_id = me->component_id.


Regards,

Ritesh Chetwani


0 Kudos

Hi Ritesh,

Thanks for Answering.

CALL METHOD lv_message_service->remove_fields_state

       EXPORTING

         iv_page_id = me->component_id.

It is removing field state of all fields.


Thanks,

Hari.


Former Member
0 Kudos

Hi Hari,

just redefine the DO_FINISH_INPUT method.do not write any code in this method.

hope it will work.

Regards,

Ritesh

sebastianlenz85
Explorer
0 Kudos

Hi Hari,

I'm facing the same issue right now and tried many things already.

But nothing is working.

Could you find a solution for our problem?

Best regards,

Sebastian

Answers (3)

Answers (3)

sumeet_gehlot
Contributor
0 Kudos

Hi,

Regsrds,

Sumeet

Former Member
0 Kudos

Hi Hari,

Try debugging the GET_EMPTY_MANDATORY_FIELDS method of IMPL class. It returns a table, if the table has your field, try redefining the method, call the super and delete the entry based on your condition.

Thanks,

Pratheek

sebastianlenz85
Explorer
0 Kudos

Hi Pratheek,

Thank you very much for your repsonse!

Now the UI is behaving how it's supposed to.

Best regards,

Sebastian

former_member210661
Active Contributor
0 Kudos

Hi Hari,

Please provide your code what you have wrote in get_p method and one more thing open the component and view go to config tab click on technical property of that field check whether the  field  is checked with the display mandatory property or not if the field is checked then unchecked that property.

Thanks & Regards,

Srinivas.

0 Kudos

Hi Srinivas,

Thanks for reply.In get p method i have written code  to make Location mandatory according to the importance.It is working fine.

And Location is not mandatory in configuration.In run time if the importance is high Location will show mandatory mark.

If the Importance is not High mandt mark is getting removed.

But the problem is in previous it is mandatory(now not) so field is getting highlighted with red color .Please check the screen shot of original post.

Thanks,

Hari.