cancel
Showing results for 
Search instead for 
Did you mean: 

Why Required filed is enabled only for Input fields with Label..?

Former Member
0 Kudos

Hi Guys,

               I am using required field attribute for some input fields which don't have a label.

Ironically its not showing it with red star on the view when I execute it.

but its fine fore fields with Labels.

I am not sure why this is happening..?

Thanks

Sam

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member184578
Active Contributor
0 Kudos

Hi,

Star mark will come only if it has label. If you dont want label, create a text view with text '*' (star) and change the semanticColor to negative. Or create an empty label( with text as .(dot) ) as suggested by Amy

Hope this helps u.,

Regards,

Kiran

amy_king
Active Contributor
0 Kudos

Hi Sam,

When you mark a field as required, the red asterisk is actually shown as part of the field's label, so a label is needed. I haven't tried this, but I wonder if you could get the asterisk if you assign a label but bind its text property to a context element that is blank-- a string with no value for example.

Cheers,

Amy

Former Member
0 Kudos

Hi Amy,

             I am using this view in FPM GAF. it's a second screen but its not checking the mandatory field is filled or not.

Also checking the mandatory field in Process_Event method of comp. controller.

IF io_event->mv_event_id = 'FPM_NEXT_STEP'.

    lo_view_controller = wd_this->lo_view.

    lo_message_manager = lo_view_controller->get_message_manager( ).

    cl_wd_dynamic_tool=>check_mandatory_attr_on_view(

      EXPORTING

        view_controller = lo_view_controller

        display_messages = abap_true

      IMPORTING

        messages = lt_msg ).

  ENDIF.

Ironically its checking it in the first screen. but they have labels.

Not sure.. not assigning label is the problem..!

amy_king
Active Contributor
0 Kudos

Hi Sam,

I don't use FPM so don't know if there is some difference in behavior, but one option for you is instead of using method CHECK_MANDATORY_ATTR_ON_VIEW of class CL_WD_DYNAMIC_TOOL, use method CHECK_MANDATORY_ATTRIBUTES. The latter method allows you to pass an explicit list of attributes you consider to be required, so it does not depend on a field's state property.

  ls_attr-attribute_name = 'ATTRIBUTE_1'.
  append ls_attr to lt_attributes.
  ls_attr-attribute_name = 'ATTRIBUTE_2'.
  append ls_attr to lt_attributes.

  cl_wd_dynamic_tool=>check_mandatory_attributes(
    attribute_list   = lt_attributes
    display_messages = abap_true
    context_root     = wd_context
  ).

Cheers,

Amy

Former Member
0 Kudos

Why dont u assign a label with no text in it and that should solve the issue, But still a Input field made mandatory not working with out a label assigned seems to be funny. I will surely try this out and update you if find some thing , till then you can have a work around to assigna label with no text.

Thanks

Phani

Former Member
0 Kudos

Hi Amy,

             Its FPM application so the FM won't work.

But I am checking with coding in WDDOBEFOREACTION method of the view controller.

Thanks

Sam

Former Member
0 Kudos

Hi Phani,

               I am Matrix Layout, so its not easy to use dummy label.

Cheers

Sam