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: 

Error message in a popup on selection screen

0 Kudos

Hi All,

I am validating a parameter on selection screen for which I need to display the error message in a pop-up and I tried doing that with many of the FMs but when I am executing even after the error message the rest of the code is executing this should not happen. Therefore kindly suggest me the FMs by which I can only stay to the selection screen , and do not navigate to the rest of the code.

Thanks,

Tanya Sachan

1 ACCEPTED SOLUTION

0 Kudos

Hi Tanya,

Use statement 'STOP' at the end of the FM.

Check the below code for reference.

PARAMETERS: p_rad TYPE char1.

AT SELECTION-SCREEN.

   IF p_rad NE 'A'.

     CALL FUNCTION 'POPUP_TO_INFORM'

       EXPORTING

         titel = 'Error'

         txt1  = 'Incorrect Parameter'

         txt2  = ''.

     STOP.

   ENDIF.

START-OF-SELECTION.

   WRITE:/ 'Entered Parameter -', p_rad.



Reward if helpful.


Regards

Abhishek

7 REPLIES 7

FredericGirod
Active Contributor
0 Kudos

Hi,

it depends of the program. You could use STOP statement in a standard report, you could LEAVE TO SCREEN ... 

where are you in your code?

regards

Fred

0 Kudos

At selection screen on <param name>

0 Kudos

Hi Tanya,

Use statement 'STOP' at the end of the FM.

Check the below code for reference.

PARAMETERS: p_rad TYPE char1.

AT SELECTION-SCREEN.

   IF p_rad NE 'A'.

     CALL FUNCTION 'POPUP_TO_INFORM'

       EXPORTING

         titel = 'Error'

         txt1  = 'Incorrect Parameter'

         txt2  = ''.

     STOP.

   ENDIF.

START-OF-SELECTION.

   WRITE:/ 'Entered Parameter -', p_rad.



Reward if helpful.


Regards

Abhishek

karthikeyan_p3
Contributor
0 Kudos

Hi ,

If you are calling any function module to display the Pop up, just add the statement Leave screen below that.

Thanks,

Karthikeyan

Former Member
0 Kudos

Hi Tanya,

Can you use LEAVE LIST-PROCESSING after the FM.


For Example:

PARAMETERS p_test TYPE char10.

  IF p_test = '10'.

     MESSAGE 'Stop' TYPE 'I'.

     LEAVE LIST-PROCESSING.

   ENDIF.

   WRITE :'Success'.

Still if you failed then please post your code, I will definitely give you some Idea.

Thanks,

Satya

Former Member
0 Kudos

Add your validation at 'AT SELECTION SCREEN' event.

Message 'text here' TYPE E' DISPLAY LIKE 'I'.

LEAVE LIST PROCESSING.

Sample Code:

PARAMETERS: p_text TYPE string.

AT SELECTION-SCREEN.

   IF p_text NE 'abc'.

     MESSAGE 'TEST' TYPE 'E' DISPLAY LIKE 'I'.

     LEAVE LIST-PROCESSING.

   ENDIF.

   WRITE: 'A'.

raymond_giuseppi
Active Contributor

Why don't you use simple code like


AT SELECTION-SCREEN ON p_matnr.

  SELECT COUNT(*) FROM mara WHERE matnr EQ p_matnr.

  IF sy-subrc NE 0.

    MESSAGE e305(m3) WITH p_matnr DISPLAY LIKE 'I'.

  ENDIF.

No FM and no leave, stop, exotic statement, etc. should be required, this is basic selection-screen logic, isn't it?

Regards,

Raymond