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

Selection screen validation - facing an issue

former_member654348
Participant
0 Likes
1,601

Hi All,

I am facing an issue while doing validations on selections screen of a report program.

On selecting a checkbox, a field related to that should become mandatory.

But if I do the validation in selection screen events,

for the first time also, when I select the check box, it is displaying error message saying no data in mandatory field.

So I am doing the validation in start-of-selection event.

Is there any work around for this?

Please help me in this regard.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,570

Hi Nagapallavi,

Try using the below statement along with your loop at screen statements

screen-required = '2'.

the above statement is make the selection fields as conditional mandatory.

Hope this may be helpful.

Regards,

Sharin.

13 REPLIES 13
Read only

Former Member
0 Likes
1,570

HI,

You could check for the checkbox input in the event at selection on the chck box field. If the field to be made mandatory is not passed on teh selection screen, you could display an error message on the selection screen.

Read only

former_member386202
Active Contributor
0 Likes
1,570

Hi,

Remove OBLIGATORY from your selection screen and do the validation on even AT SELECTION-SCREEN ON FIELD.

Regards,

Prashant

Read only

prince_isaac
Active Participant
0 Likes
1,570

Hi

maybe you could try coding the validations at selection-screen.

Also remove OBLIIGATORY syntax in selection screen coding.

check the value in your check box and make the required field mandatory there.


at selection-screen.
if chk_val = 'X'.
  if s_mblnr[] is initial.
    if s_ebeln[] is initial.
      if s_matnr is initial or s_budat is initial.
        message e000(fb) with 'Enter at least a PO and material number/GR date!'.
      endif.
    endif.
  endif.
else.
...
endif.

regards

Isaac Prince

Edited by: prince isaac on Nov 9, 2010 11:45 AM

Read only

0 Likes
1,570

HI

Thanks for your inputs.

But validating in selection screen events is not working for me, as I have user command for my check box.

ex: I tick my check box, as there is a user command for that, the selection screen events get triggered, and it displays the error message saying 'NO data entered' , even if the user plans to enter a message now.

Read only

0 Likes
1,570

Hi

If these are selection screen checks you want to employ i would suggest removing the user-command and impleneting the checks at selection screen. I think its much easier to do so.

regards

Isaac Prince

Read only

0 Likes
1,570

Hi

Based on the checkbox selected or not, some of the selection screen fields have to be disabled in my program, so I should have user command edition to my check box.

Read only

0 Likes
1,570

Hi,

If you are using a radio button or a Check box You should give USER-COMMAND addition to the declarations.So when an user clicks on these boxes or buttons the fcode(Function code) which you mentioned in user-command gets populated in SY-UCOMM.

Best Regards,

lakshman.

Read only

0 Likes
1,570

Yes this can still be achieved without the user-command code.

Place your code in at selection-screen


loop at screen.
   if chk_val = 'X'.
      if screen-name = 'S_MATNR'.
         screen-input = 0.
      endif.
else.
  if screen-name = 'S_MATNR'.
    screen-input = '1'.
   endif.
endif.
modify screen
endloop.

I hope this is helpfull.

regards

Isaac Prince

Edited by: prince isaac on Nov 9, 2010 12:40 PM

Read only

0 Likes
1,570

Hi,

If your mandatory field is suppose 'p_field'. then write your code under AT SELECTION-SCREEN ON p_field event. p_chk is the parameter name for the checkbox. For eg:

AT SELECTION-SCREEN ON p_field.

IF p_chk = 'X'.

IF p_field IS INITIAL.

MESSAGE e000 with 'Enter mandatory field'.

ENDIF.

ENDIF.

Hope this works.

Sudip

Read only

0 Likes
1,570

Hi Prince

Thanks for you time.

I tried with this.

But when the user selects the check box, the program has to allow the user to enter the field, and when he tries to execute the same it has to throw an error.

With this code, it throws the error immediately when the check box is selected.

Read only

0 Likes
1,570

Hi,

Put the validation code after START-OF-SELECTION.

Read only

Former Member
0 Likes
1,571

Hi Nagapallavi,

Try using the below statement along with your loop at screen statements

screen-required = '2'.

the above statement is make the selection fields as conditional mandatory.

Hope this may be helpful.

Regards,

Sharin.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,570

Do your validations after start of selection.