cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicate Error message for mandatory fields.

Former Member
0 Kudos

Hello All,

I have developed small application WDA.

I have used the below code for creating select options on screen.

    FREE ob_field.

* create a range table that consists of this new data element plant search

    ob_field = wd_this->m_handler->create_range_table(

    i_typename = c_planttypename ).

* add a new field to the selection

    wd_this->m_handler->add_selection_field(

    it_result         = ob_field

    i_read_only       = w_read_only

    i_id              = c_selectoptionsplantid

    i_value_help_type = if_wd_value_help_handler=>co_prefix_searchhelp

    i_value_help_id   = w_plant_srch_hlp

    i_description     = c_selectoptionsplantdesc

    i_obligatory      = abap_true

    ).

I am facing issue when errror message is displayed for mandatory fields.

It contains duplicate entries.

I have attached screen shot for reference.

Need your expert guidance to resolve this issue.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Dear All,

The issue is resolved.

I observed that one message was getting added before the method call and other duplicate message was getting added after the button click method. So I put a exit inside the method if any of the mandatory field is initial. It is working for now.

Thanks for your help.

bharath_k6
Active Participant
0 Kudos

Hi Anshul,

I guess, This mandatory check error messages are coming when you click on Execute Report button right?

We explicitly write some code to perform mandatory check if normal input field is there in aplication using CHECK_MANDATORY_ATTR_ON_VIEW / CHECK_MANDATORY_ATTRIBUTES methods.

But i am surprised, in your case(reusing Select-options component) how this being handled?

Please explain.

Regards,

Bharath.

Former Member
0 Kudos

Hi Bharath,

I have not used any method explicitly for displaying the error message.

I just need to pass the i_obligatory      = abap_true in the add selection field method.

Thanks & regards,

Anshul

Former Member
0 Kudos

Dear All,

Please help to resolve this issue.

Thanks & Regards

Anshul Jaiswal

Former Member
0 Kudos

Which table you are using.

Former Member
0 Kudos

Hi Karthik,

I am not using any table for message display.

The message is displayed when I don't enter any value in mandatory fields.

Its a standard error.

Former Member
0 Kudos

Are you asking to avoid duplicate entries or allow duplicate entries for the mandatory fields.If i am wrong pls, Tell your requirement clearly

Former Member
0 Kudos

Hi Karthik,

I need to avoid duplicate entries for error messages of mandatory fields..

If you can see the attached screen shot you will see that I am getting 4 error messages while I have not provided entries for 2 mandatory fields. I should get only two error messages.

Thanks for your help.

Former Member
0 Kudos

Where have you written the code to show errors.

Ideally you should not get the duplicates.Also check if you are getting the duplicates when you use REPORT_ERROR_MESSAGE instead  of REPORT_ELEMENT or REPORT_ATTRIBUTE methods of message manager.

Former Member
0 Kudos

Hi Lekha,

Thanks for your reply.

The error i am getting is standard error which is coming because i have declared field mandatory.

I have written the below code in init method of view.

    wd_this->m_handler->add_selection_field(

    it_result         = ob_field

    i_read_only       = w_read_only

    i_id              = c_selectoptionsplantid

    i_value_help_type = if_wd_value_help_handler=>co_prefix_searchhelp

    i_value_help_id   = w_plant_srch_hlp

    i_description     = c_selectoptionsplantdesc

    i_obligatory      = abap_true

    ).

I have not used any method for displaying this message.

Former Member
0 Kudos

Test this example one WDR_TEST_SELECT_OPTIONS for the same test case of duplication.

Are you creating more than one instance of the select option.

Have you subscribed to any event of the select option. Are using any button to validate (CHECK) or hitting ENTER key to check for errors right.

Former Member
0 Kudos

Hi Lekha,

I have created only one instance of the select option.

I am using a submit button to fetch the report based on the values provided on selection screen.

I have used the below logic to fetch the values provided in selection parameters.

* Retrieve the data from the select option
   ob_field = wd_this->m_handler->get_range_table_of_sel_field(
                            i_id = c_plant ).

I am getting the errors when I click this button.

Former Member
0 Kudos

Hi,

I have tried using the logic you have given for mandatory checks but I am still getting the same error messages from standard.

Though it is going into the code i have added but still I am getting same duplicate messages.

Thanks

former_member199125
Active Contributor
0 Kudos

I think messages displaying for low and high values,  i mean select option low value and select option high value.

thats y you are getting four messages.

if you enable NO interval option then you will get single message but you can enter only low value.

Regards

Srinivas    

bharath_k6
Active Participant
0 Kudos

Hi,

You must have written some code to perform the mandatory check. What is the code you have written?

Regards,

Bharath.

Former Member
0 Kudos

I think sana is right

bharath_k6
Active Participant
0 Kudos

Hi Karthik,

No, it is not raising duplicate error message for Low and High values. There must be something wrong.

When you use select-option with intervals, it is expecting atleast one entry either in the low or high but not both. Then there should be one error message raised when mandatory check failed.

Did you enable standard buttons (Cancel ,Check....). Are you using Check button to perform mandatory check or written any other code in your component.

Check the sample WD component - WDR_TEST_SELECT_OPTIONS

Regards,

Bharath.

Former Member
0 Kudos

HI Bharath,

I have written the below code in init method of view for adding select option and there is one parameter to make it mandatory. I have done no additional coding for mandatory field check.

    wd_this->m_handler->add_selection_field(

    it_result         = ob_field

    i_read_only       = w_read_only

    i_id              = c_selectoptionsplantid

    i_value_help_type = if_wd_value_help_handler=>co_prefix_searchhelp

    i_value_help_id   = w_plant_srch_hlp

    i_description     = c_selectoptionsplantdesc

    i_obligatory      = abap_true

    ).