cancel
Showing results for 
Search instead for 
Did you mean: 

Mandatory Fields

ged_hurst
Participant
0 Kudos

Hi all,

I would like to define an ItemListBox as mandatory and, apparently, there's not such a property in WebDynpro.

Is there any workaround to this?

Thanks!

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

For displaying '*' in red please try the below mentioned code:

CALL METHOD cl_fitv_wd_util=>ui_set_required

EXPORTING

io_view       = view

iv_id            = 'ID of the UI element'

iv_required = abap_true.

For highlighting the UI element.

Try the method REQUEST_FOCUS of the interface IF_WD_VIEW_CONTROLLER.

Regards,

Sanjeev Kotwal.

former_member199125
Active Contributor
0 Kudos

Hiii.

I dont know about itemlist box, but i made the fileupload as mandatory by using below coding. approach in this way it wll be usefull.

data: l_View_Controller type ref to if_wd_view_Controller.

l_View_controller = wd_this->wd_get_api( ).

cl_wd_dynamic_tool=>check_mandatory_attr_on_View( exporting

view_controller = l_View_controller

dispaly_message = abap_true ).

I am not sure whether it wil workfor you.. or not. waiting for others replies

Regards

Srinivas

former_member184578
Active Contributor
0 Kudos

Hi.,

there is no required property for itemlistbox., you can read the node to which the itemListBox is binded and if it is initial display error messge.,

@srinivas : the code you provided is to check all the required fields in view are entered or not, and display error message automatically..

hope this helps u.,

Thanks & Regards,

Kiran

ged_hurst
Participant
0 Kudos

Hi,

this I already knew and already implemented. The thing is that the red star isn't displayed next to the label of the itemlistbox.

And even if I manage to display it, when the itemlistbox is empty and I raise an error, the control isn't highlighted in red.

Is there any way to achieve this?

Former Member
0 Kudos

Hi

IF you wanty to display '*' in red?

you can try by using Test veiw. After Label use one text veiw and give text '*', and in semantic property select NEGATIVE,

it will give red color. And display message if no data select. I think you already done this.

Cheers,

Kris.

Madhu2004
Active Contributor
0 Kudos

HI,

For highlighting the item list box when error is occured use the function module: REPORT_ATTRIBUTE_ERROR_MESSAGE.

Pass trhe attribute name, Element and it will get highlighted.

Regards,

Madhu

ged_hurst
Participant
0 Kudos

Nope,

I used that method but the itemlistbox t doesn't get highlighted whilst other UI controls do.

Is this normal?

Former Member
0 Kudos

Hi ,

I too have faced the similar issue with drop down by index UI element . I don't think SAP allows Item list box or drop down by index to be made mandatory fields . As said above , I gave custom error message if value is initial and highlighting the UI element may not be possible . If anybody has the solution , please let me know .

Thanks,

Sankeerth .

0 Kudos

Hai,

by using  below Method we can highlight error giving input field

CALL METHOD lo_message_manager->report_attribute_error_message
         EXPORTING
           message_text              =  'Enter valid amount
           element                      =  'Header'   "Context node name
           attribute_name            =  'Amount'  "Context attribute name

and In Webdynpro for  Drop-down by index  we can set mandatory Attribute also.