cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a Dropdown by index field Mandatory

Former Member
0 Kudos

Hi Experts,

I have a dropdown by index field and an input field in a view, i made both the fields as required field.

And on the action i have used cl_wd_dynamic_tool=>check_mandatory_attr_on_view to check for mandatory fields. But its not considering the Dropdown, it gives the error message only when the input field is empty.

But i want to check for Dropdown as well.

Please help me to resolve this.

Many Thanks!!!

Regards

Raj

Accepted Solutions (0)

Answers (2)

Answers (2)

rameshkumar_ramasamy2
Participant
0 Kudos

hi Raj..

Yes its working 5n.. I have created a Dropdownbyindex UI element and made the state as Required and wrote the following code in WDDOBEFOREACTION method..

data lt_msg TYPE cl_wd_dynamic_tool=>t_check_result_message_tab.
    DATA LO_API_MAIN TYPE REF TO IF_WD_VIEW_CONTROLLER.
    LO_API_MAIN = WD_THIS->WD_GET_API( ).

CALL METHOD CL_WD_DYNAMIC_TOOL=>CHECK_MANDATORY_ATTR_ON_VIEW
  EXPORTING
    VIEW_CONTROLLER  = LO_API_MAIN
    DISPLAY_MESSAGES = ABAP_TRUE
  IMPORTING
    MESSAGES         = lt_msg.

Former Member
0 Kudos

Hi,

Yeah, seems like check mandatory attribute method doesn't work with DD by Index, as an alternative you can manually do the same check in dobeforeaction, just read the lead selected index of context node binded to DD by Index and check if lead selection index is < 0, If yes then nothin is selected and throw an error.

Regards

manas Dua

Former Member
0 Kudos

Hi Manas,

Thanks for the response.

I am doing it in the same way now.

And i have 6 views and in each view i have more than 10 Dropdowns, instead of checking all the attributes manually, is there any other way to check for all the mandatory attributes in the node where it returns some value if not all the attributes are entered. (I tried cl_wd_dynamic_tool=>check_mandatory_attributes but not sure what i have to assign to ATTRIBUTE_LIST. And even i am not sure this will help me or not)

And regarding the error message, the Business saw what is happening with Input field, an error message just like an hyperlink to the empty field. So, you mean to say that is not at all possible with the Dropdown's right?

Thanks,

Raj

Edited by: Raj Raam on Apr 15, 2010 8:12 AM