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: 

validations

Former Member
0 Kudos
88

Hi all,

I have added two optional parameters in the selection screen of an existing program.now the requirement is..user has to enter in any one of the parameters but not both,or none of them.

how to write the logic for this and where to write..(which event).

points assured.

thanks and regards,

maahi

1 ACCEPTED SOLUTION

Former Member
0 Kudos
68

Hi,

You can use the event AT SELECTION-SCREEN.

Check this ex..



PARAMETERS: P_MATNR TYPE MATNR,
                        P_WERKS TYPE WERKS_D.

AT SELECTION-SCREEN.

* If both the parameters are entered raise an error message.
IF NOT P_MATNR IS INITIAL AND
   NOT P_WERKS IS INITIAL.
  MESSAGE E208(00) WITH 'You cannot enter both of them'.
ENDIF.

* One of them should be mandatory.
IF P_MATNR  IS INITIAL AND
    P_WERKS IS INITIAL.
  MESSAGE E208(00) WITH 'Enter one of them'.
ENDIF.


Thanks,

Naren

2 REPLIES 2

Former Member
0 Kudos
68

You need to write the code under at selection-screen or even you can write under start-of-selection.

if p_1 is 'X'

if p_2 is 'X'.

message'.

endif.

endif.

Reward points if it is helpful

Thanks

Seshu

Former Member
0 Kudos
69

Hi,

You can use the event AT SELECTION-SCREEN.

Check this ex..



PARAMETERS: P_MATNR TYPE MATNR,
                        P_WERKS TYPE WERKS_D.

AT SELECTION-SCREEN.

* If both the parameters are entered raise an error message.
IF NOT P_MATNR IS INITIAL AND
   NOT P_WERKS IS INITIAL.
  MESSAGE E208(00) WITH 'You cannot enter both of them'.
ENDIF.

* One of them should be mandatory.
IF P_MATNR  IS INITIAL AND
    P_WERKS IS INITIAL.
  MESSAGE E208(00) WITH 'Enter one of them'.
ENDIF.


Thanks,

Naren