Skip to Content
avatar image
Former Member

Selection screen processing

Dear all,

I've got a selection screen with two select-options fields for which I would like to make a check:

If field 1 and field 2 are empty then triggering an Error message.

For this I thought to use the "at selection-screen block" combined with

if field 1 and field 2 is initial.

message...

endif.

But in that case, I can not use any more the multiple selection button (at the right of the field) becase I have my event "at selection-screen block" triggered with the error message.

I tried to declare my message after the start of selection but then I have a new empty screen with my error message on the bottom of it.

How to deal with that?

Regards.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 11, 2007 at 11:16 AM

    Hi

    AT SELECTION-SCREEN.

    if sy-ucomm = 'ONLI'. "Only when you execute the program

    if field1 is initial....Your condition for giving error.

    endif.

    Regards

    Navneet

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 11, 2007 at 11:09 AM

    perform ur validation in <b>AT SELECTION-SCREEN</b> event instead of <b>AT SELECTION-SCREEN block</b>

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I've tried that but it is the same:

      Error message triggered when I try to use the multiple selection.

      Regards.

  • avatar image
    Former Member
    Oct 11, 2007 at 11:10 AM

    HI

    you can put OBLIGATORY key word for that two selection screen fields

    then that field will show error untill u enter the value in it

    REPORT ZNNR_REPORT NO STANDARD PAGE HEADING MESSAGE-ID ZNNR LINE-SIZE 100 LINE-COUNT 65(4).

    ******DATA DECLARATIONS**********

    DATA : BEGIN OF IT_PLANT OCCURS 0,

    MATNR LIKE MARA-MATNR,

    WERKS LIKE MARC-WERKS,

    PSTAT LIKE MARC-PSTAT,

    EKGRP LIKE MARC-EKGRP,

    END OF IT_PLANT.

    DATA : BEGIN OF IT_PONO OCCURS 0,

    EBELN LIKE EKKO-EBELN,

    EBELP LIKE EKPO-EBELP,

    MATNR LIKE EKPO-MATNR,

    WERKS LIKE EKPO-WERKS,

    LGORT LIKE EKPO-LGORT,

    END OF IT_PONO.

    TABLES EKKO.

    ********END OF DATA DECLARATIONS*********

    ********SELECTION SCREEN DESIGN ***********

    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

    PARAMETER : P_WERKS LIKE MARC-WERKS OBLIGATORY MODIF ID S1.

    SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN OBLIGATORY NO INTERVALS MODIF ID S2.

    SELECTION-SCREEN END OF BLOCK B1.

    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-004.

    SELECTION-SCREEN BEGIN OF LINE.

    PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X'.

    SELECTION-SCREEN COMMENT 5(20) TEXT-002 FOR FIELD R1.

    SELECTION-SCREEN END OF LINE.

    SELECTION-SCREEN BEGIN OF LINE.

    PARAMETERS : R2 RADIOBUTTON GROUP G1.

    SELECTION-SCREEN COMMENT 5(20) TEXT-003 FOR FIELD R2.

    SELECTION-SCREEN END OF LINE.

    SELECTION-SCREEN END OF BLOCK B2.

    ******END OF SELECTION SCREEN DESIGN****************

    *********INITIALIZATION OF SELECTION SCREEN ELEMENTS.*****

    INITIALIZATION.

    P_WERKS = '1000'.

    S_EBELN-LOW = '4500016926'.

    S_EBELN-OPTION = 'EQ'.

    S_EBELN-SIGN = 'I'.

    APPEND S_EBELN.

    CLEAR S_EBELN.

    ************END OF INITIALIZATION***********************

    ***********SCREEN MODIFICATIONS*******************

    AT SELECTION-SCREEN OUTPUT.

    LOOP AT SCREEN.

    IF R1 EQ 'X' AND SCREEN-GROUP1 EQ 'S2'.

    SCREEN-INPUT = 0.

    MODIFY SCREEN.

    ENDIF.

    IF R2 EQ 'X' AND SCREEN-GROUP1 EQ 'S1'.

    SCREEN-INPUT = 0.

    MODIFY SCREEN.

    ENDIF.

    ENDLOOP.

    ********END OF SCREEN MODIFICATIONS*****************

    ***************SCREEN VALIDATIONS *****************

    at selection-screen.

    SELECT SINGLE *

    FROM EKKO

    INTO EKKO

    WHERE EBELN IN S_EBELN.

    IF SY-SUBRC <> 0.

    SET CURSOR FIELD 'S_EBELN-LOW'.

    MESSAGE E999 WITH TEXT-005.

    ENDIF.

    ********end of screen validation*****************

    <b>Rewar dif usefull</b>

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      Yes of course.

      But the thing is that there is some condition for the OBLIGATORY:

      If field 1 empty then only field 2 obligatory and if field 2 empty then only field 1 obligatory.

      Regards.

  • avatar image
    Former Member
    Oct 11, 2007 at 11:11 AM

    at selection-screen.

    if field1 is initial and field2 is initial.

    message e000 with 'Please enter either of the values'.

    endif.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      hi,

      instead of showing ur message as an ERROR MSG (TYPE E)

      show it as information msg (type i) or sucess msg (type S)

      and use STOP command immediately after it so that it remains on the selection screen only

  • Oct 11, 2007 at 11:12 AM

    Hi

    this Validation and Error Message must be done in the Event AT SELECTION-SCREEN.

    Then it solves ur problem.

    REWARD IF HELPFUL.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 11, 2007 at 11:22 AM

    Hi nozome

    didnt get your point clearly ... what you mean by multiple selection..

    are you talking about Select-Options.

    Add comment
    10|10000 characters needed characters exceeded