Application Development 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: 

having mandatory checks at start of selection event

Former Member
0 Kudos
399

I have a selection screen with some elements.There are some radio buttons also.According to the value of these radio buttons the selection screen is modified like some fields are visible while some are not (using AT SELECTION SCREEN OUTPUT for this). I also have some fields which are mandatory so i have used obligatory for them.

But as soon as user selects a radio button, these automatic mandatory checks trigger and if the field is empty it displays an error that the field is mandatory.But i want these checks to be performed when user presses F8(executes it).I have the option of writing my own method at AT START OF SELECTION.But i was wondering, is it possible to achieve this with automatic checks itself.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
346

Hi Gaurav,

Don't make the field obligatory. Instead in the Event AT SELECTION-SCREEN Place a check like below.

If SY-UCOMM EQ 'ONLI' AND p_name IS INITIAL.

Message text-000 TYPE 'E'.

ENDIF.

ONLI -> Function Code for Execute Button/F8.

This serves the same purpose as of making the field mandatory/obligatory.

Thanks and Regards,

Vinay Mutt

9 REPLIES 9

Former Member
0 Kudos
346

this should help you, a little different approach that you will need to apply

https://scn.sap.com/thread/1615574

Former Member
0 Kudos
347

Hi Gaurav,

Don't make the field obligatory. Instead in the Event AT SELECTION-SCREEN Place a check like below.

If SY-UCOMM EQ 'ONLI' AND p_name IS INITIAL.

Message text-000 TYPE 'E'.

ENDIF.

ONLI -> Function Code for Execute Button/F8.

This serves the same purpose as of making the field mandatory/obligatory.

Thanks and Regards,

Vinay Mutt

0 Kudos
346

This is the answer

0 Kudos
346

Marking this as answer as i guess this is the closest to the solution.

0 Kudos
346
  • Do not check only 'ONLI' but also 'PRIN'. (Or affect a common 'DUMMY' function code to every radiobuttton, and inverse the check to IF NE 'DUMMY'.
  • Do not use SY-UCOMM but declare a TABLES sscrfields and use sscrfields-ucomm.
  • Use a AT SELECTION-SCREEN ON field/group to allow user to correct the error

Regards,

Raymond

0 Kudos
346

Can you please explain your second point.

0 Kudos
346

Hi Gaurav,

Suggestion from Raymond is Instead of using sy-ucomm, We have to use sscrfields-ucomm.

To use this we have to make declaration like TABLES: SSCRFIELDS.

Regards,

Vinay Mutt

0 Kudos
346

Hi, I wanted to know what benefit sscrfields-ucomm serves over sy-ucomm?

0 Kudos
346

The default rule written in SAP documentation is "never use sy-ucomm", always use ok_code or  sscrfields-ucomm in selection-screen.

It is not recommended that the system field sy-ucomm instead of sscrfields-ucomm is evaluated, since this does not guarantee that sy-ucomm is always given the correct value in selection screen processing.


Regards,

Raymond