Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problems with dynamic drop-down and required fields

Former Member
0 Likes
820

Hi there,

I have created a new screen with two drop downs. The first drop down ("List A") will determine what the values are of the second drop down ("List B").

This all works fine until I make the drop downs and other fields on the screen "required" in the screen painter. With the "required" setting, when testing the screen, the second drop down (List B) cannot be filled with values until all "required" values have been entered. How do I get past this?

Do I need to stop using the "required' option on the screen painter and then manually code the validations? Or is there a better way to do this?

Here is an overview of how it is set up so far...



PROCESS BEFORE
OUTPUT.

"Clear List B

  CALL FUNCTION 'VRM_DELETE_VALUES'
EXPORTING
id           = ls_field "List B
EXCEPTIONS
id_not_found
= 1
OTHERS       = 2.

"Fill values based on List A

"...

"Set values for List B
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id     = ls_field "List B
values
= lt_listbox.
*
PROCESS AFTER
INPUT.
MODULE exit AT EXIT-COMMAND.

"...

"handle user-command – check sy-ucomm…

"If List A changes…

"Clear List B

  CALL FUNCTION 'VRM_DELETE_VALUES'
EXPORTING
id           = ls_field "List B
EXCEPTIONS
id_not_found
= 1
OTHERS       = 2.

"Fill values based on List A

"...

"Set values for List B
CALL FUNCTION 'VRM_SET_VALUES'
EXPORTING
id     = ls_field "List B
values
= lt_listbox.

You can assume that there are 5 fields on the screen, all marked as "required" in the screen painter...

Any advice would be appreciated

Thanks

1 ACCEPTED SOLUTION
Read only

former_member183073
Active Participant
0 Likes
736

Hi David,

You can code for the Validation instead of Checking the REQUIRED parameter, you will have write code for each field to check if it is initial and show an error message if initail.

4 REPLIES 4
Read only

former_member183073
Active Participant
0 Likes
737

Hi David,

You can code for the Validation instead of Checking the REQUIRED parameter, you will have write code for each field to check if it is initial and show an error message if initail.

Read only

0 Likes
736

Thanks for the reply Syed, but the dynamic drop down is filled in the PAI which causes validation problems.

So if the drop down is empty, and then the PAI is triggered by another drop down value change, it will fill the drop down with possible values in the PAI, and then immediately check if a value has been selected and give an error because no value has been selected yet. Since the validation and the dynamic drop down fill must be done in the PAI, how do you avoid the validation error?

E.g. I go into the screen for the first time- List A has possible values, and list B does not. I have to select a value from List A so that List B is populated with values. When I do this, then PAI is triggered. the PAI fills List B with possible values, but an actual value is not SELECTED yet since the user has not had a chance to do anything yet. No the PAI continues and checks if a value has been selected from List B - this will always fail, since the user does not get a chance to select a value before the validation is done...

Read only

0 Likes
736

Can't you delay the List B Validation until List A has some value.

If ListA is not initial.

         then only validate ListB.

End.

Read only

0 Likes
736

Hi Syed - no, I think you have misunderstood the problem... Not to worry though because I came right. I had to check the UCOMM and only execute the validations on SAVE, and not on every pass through the PAI.

Thanks for your help though