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

Error check for multiple ranges input

Former Member
0 Likes
637

Hi,

I have coded a report with the following select options:

SELECT-OPTIONS:

S_PONUM FOR EKKO-EBELN NO INTERVALS,

S_PODAT FOR EKKO-BEDAT NO-EXTENSION,

S_LCNUM FOR EIKP-VORNU NO-EXTENSION NO INTERVALS,

S_VENDR FOR EKKO-LIFNR NO-EXTENSION NO INTERVALS.

I want that a check should be applied at the selection screen level that at least one field should contain a value, i.e. report cannot be run with all blank selection fields.

I am using this code:

AT SELECTION-SCREEN.

IF S_PONUM-LOW IS INITIAL AND

S_PODAT-LOW IS INITIAL AND

S_LCNUM-LOW IS INITIAL AND

S_VENDR-LOW IS INITIAL.

MESSAGE I007(ZSH_MSGC) WITH 'All selection fields cannot be blank'.

ENDIF.

This works fine, but the problem is that when entering multiple ranges for S_PONUM, when the button on the right of the field is clicked to input range values the message pops up. I want that the check should be applied on execute (F8). Any suggestions? Help is appreciated.

Regards,

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
609

Use the following code under START_OF_SELECTION.

IF S_PONUM[] IS INITIAL AND

S_PODAT[] IS INITIAL AND

S_LCNUM[] IS INITIAL AND

S_VENDR[] IS INITIAL.

MESSAGE E007(ZSH_MSGC) WITH 'All selection fields cannot be blank'.

ENDIF.

5 REPLIES 5
Read only

Former Member
0 Likes
610

Use the following code under START_OF_SELECTION.

IF S_PONUM[] IS INITIAL AND

S_PODAT[] IS INITIAL AND

S_LCNUM[] IS INITIAL AND

S_VENDR[] IS INITIAL.

MESSAGE E007(ZSH_MSGC) WITH 'All selection fields cannot be blank'.

ENDIF.

Read only

Former Member
0 Likes
609

HI,

Put the code under start of selection event and check the same.

regards,

mrunal

Read only

Former Member
0 Likes
609

Hello,

check the sy-ucomm when the button on the right of the field is clicked keep the condition which i have kept it.

before the if statement keep this condition also

SELECT-OPTIONS:

S_PONUM FOR EKKO-EBELN NO INTERVALS,

S_PODAT FOR EKKO-BEDAT NO-EXTENSION,

S_LCNUM FOR EIKP-VORNU NO-EXTENSION NO INTERVALS,

S_VENDR FOR EKKO-LIFNR NO-EXTENSION NO INTERVALS.

AT SELECTION-SCREEN.

if sy-ucomm ne 'find the sy-ucomm'.

IF S_PONUM-LOW IS INITIAL AND

S_PODAT-LOW IS INITIAL AND

S_LCNUM-LOW IS INITIAL AND

S_VENDR-LOW IS INITIAL.

MESSAGE 'All selection fields cannot be blank' type 'E'.

ENDIF.

endif.

Edited by: Santosh Marupally on Apr 22, 2009 9:41 AM

Read only

Former Member
0 Likes
609

Hi,

"AT SELECTION-SCREEN" event is triggered whenever you press any key on selection screen.

hence you get the popup when you click on the button.

Try using following code



SELECT-OPTIONS:
S_PONUM FOR EKKO-EBELN NO INTERVALS,
S_PODAT FOR EKKO-BEDAT NO-EXTENSION,
S_LCNUM FOR EIKP-VORNU NO-EXTENSION NO INTERVALS,
S_VENDR FOR EKKO-LIFNR NO-EXTENSION NO INTERVALS.


START-OF-SELECTION.                       <<<<<----Change the event 
IF S_PONUM-LOW IS INITIAL AND
S_PODAT-LOW IS INITIAL AND
S_LCNUM-LOW IS INITIAL AND
S_VENDR-LOW IS INITIAL.

MESSAGE I007(ZSH_MSGC) WITH 'All selection fields cannot be blank'.
submit <prog> VIA SELECTION-SCREEN.
ENDIF.

Hope it helps,

RJ

Read only

Former Member
0 Likes
609

How about using of SY-UCOMM?