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: 

selection screen

Former Member
0 Kudos

After error message how to bring back selection screen for user

14 REPLIES 14

bpawanchand
Active Contributor
0 Kudos

Hi

In the Command Box , I mean where you write T-codes in that box write BACK and enter.

Regards

Pavan

Former Member
0 Kudos

If you want to return to the selection screen, put the error message under AT SELECTION-SCREEN event.


*----------------------------------------------------------------------*
*                      AT SELECTION-SCREEN EVENT                       *
*----------------------------------------------------------------------*

AT SELECTION-SCREEN.

  MOVE sy-ucomm TO sscrfields-ucomm.
  CHECK sscrfields-ucomm EQ 'ONLI'.

* To validate the user input vendor number.
  PERFORM validate_vendor.

*----------------------------------------------------------------------*
*  FORM VALIDATE_VENDOR                                                *
*----------------------------------------------------------------------*
*  Subroutine for validating the user input vendor number.             *
*----------------------------------------------------------------------*
*  There are no interface parameters to be passed to this subroutine.  *
*----------------------------------------------------------------------*
FORM validate_vendor .

  SELECT SINGLE
         lifnr                         " Vendor number
         name1                         " Vendor name
         ort01                         " City
    INTO (w_lifnr,
          w_vend_name,
          w_vend_city)
    FROM lfa1
   WHERE lifnr IN s_lifnr.

  IF sy-subrc NE 0.
    MESSAGE e888(sabapdocu)
       WITH text-nov.
  ENDIF.                               " IF SY-SUBRC NE 0

ENDFORM.                               " VALIDATE_VENDOR

If the user enters the wrong vendor, the error message will be triggered and the user will be returned to the selection screen. If you are in the START-OF-SELECTION event and the processing needs to be stopped immediately, then use a success or information message and write EXIT command. That too will return the selection screen for the user to change the selection-criteria.

Former Member
0 Kudos

use At selection-screen on <field> which would allow to back at the same position.

Regards

Shashi

Former Member
0 Kudos

hii

you can use

set screen '0'.

leave screen.

or make message type as warning message by using

message 'Message' type ' w '.

regards

twinkal

Former Member
0 Kudos

No, after calling ALV function module, if I get an error message like no data found, I should bring the control back to initial selection screen.

0 Kudos

in event end-of-selection do this.

end-of-selection.

IF IT_ALVFINAL is initial.

Message I000 'No records found for the selection criteria'.

set screen '0'.

leave screen.

endif.

0 Kudos

You should be checking if the report output table contains any data or not, even before calling the function module.

Former Member
0 Kudos

Hi,

Instead putting a error message, you can put a warning message, which makes the user to continue with his program execution after that.

Regards,

Sumalatha

Former Member
0 Kudos

Hi,

you can use leave to transaction.

e.g

AT selection-screen output

IF <CONDITION>

MESSAGE <msg type>.

LEAVE TO TRANSACTION '<tcode>'.

ENDIF.

Former Member
0 Kudos

Hi MN

just use AT SELECTION SCREEN

THANXS N REGARDS

SACHIN SHARMA

Former Member
0 Kudos

After message use the statement.

STOP.

Regards,

Madan Mohan.

Former Member
0 Kudos

1 .use information message

after that write stop statement to brig back to selection screen

2. use at user command

write down the query under Execute's(F8) user command

if no data found give eroor msg which will bring to selection screen

bpawanchand
Active Contributor
0 Kudos

Hi

Before passing the internal table to ALV function module you check whether Any data exists or not if there is not data then simply print a message.

Regards

Pavan

Former Member
0 Kudos

Hi

AT SELECTION-SCREEN provides a facility to get back your focus even got the ERROR message

Thanks