cancel
Showing results for 
Search instead for 
Did you mean: 

Validation of Mandatory fields on Interactive form on Web Dynpro

Former Member
0 Kudos

Hi All,

I want to validate whether mandatory fields are populated on the Interactive form. My form is embedded in a AWD.

This form is being flowed through multiple roles (more than 20).

The problem is that the form fields are to be made mandatory based on scenarios dynamically.

I want to throw some error message and force the user to fill the mandatory fields before proceeding.

Any god suggestion ? How to throw error message at the button of the same window ?

Thanks & Regards,

Deb

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks for all the help. I did scripting

Former Member
0 Kudos

Thanks for all the help. I did scripting

Former Member
0 Kudos

Hi,

You can do the validation in the WDBEFOREACTION view which is holding your form.

Something like this

METHOD WDBEFOREACTION.

if lo_action is bound.

case lo_action->name.

when 'SUBMIT'.

  • call the CC method validateform

lo_componentcontroller->validateform(

).

ENDMETHOD.

In the CC Method validateform you put all your code to check for mandatory fields. The code will go some like this:

1. Read the context node which is bound to the data property of your form.

--- FORMDATA is the node in the example below bound to the data source of FORM

lo_nd_formdata = wd_context->get_child_node( name = wd_this->wdctx_formdata ).

lo_el_formdata = lo_nd_formdata->get_element( ).

lo_el_formdata->get_static_attributes(

importing

static_attributes = ls_formdata ).

2. Once you have the structure you can check for the field values whether it is filled or not

if ls_formdata-field1 is initial or

ls_formdata-field2 is initial.

l_error = 'X'.

endif.

If this flag is set after the method call then all the mandatory fields have not been filled . so display error

3. If any of the mandatory fields are blank then call message manager and display an error message.

For your case the trickiest part will be determine which field should be made mandatory based on the User who is executing.

FYI,

You can also set a field as mandatory from the Adobe Form itself . Mark the property as "User Entered - Mandatory" in the layout designed for that field.

Thanks,

Abhishek