cancel
Showing results for 
Search instead for 
Did you mean: 

Custom error messages in selection-screen

satvik_panchal
Participant
0 Kudos

Hello All,

I have one query. I have developed a vendor aging report. In the SELECT-OPTIONS, there are 5 fields namely company code, business area, vendor group, vendor code and cash management group. What the user wants is if he enters any invalid value in any of the 5 fields, custom error message should be displayed like 'invalid company code' etc. I think we have to write these messages in 'at-selection-screen' event. Can u help me out with a sample code snippet w.r.t the above program? I have written the code as:

AT SELECTION-SCREEN.

IF S_BUKRS ne BSIK-BUKRS.

MESSAGE e000. 'invalid company code' TYPE 'E'.

ENDIF.

But not giving the correct output.i.e. even if I enter a valid company code, the error message is displayed. Can u help me in solving this problem?

Thanks and Regards,

Satvik

Edited by: Satvikpanchal on Jul 22, 2011 9:42 AM

Accepted Solutions (0)

Answers (2)

Answers (2)

satvik_panchal
Participant
0 Kudos

answered

Former Member
0 Kudos

Hi,

use AT SELECTION-SCREEN on S_BUKRS-low.

Use select query for checking the Company code in T001 table check the

Company code already exist or not? If it is not there show the message.

Code like


AT SELECTION-SCREEN on S_BUKRS-low.
select single bukrs into lv_bukrs
      from T001 where bukrs = s_bukrs-low.
if sy-subrc NE 0.
MESSAGE e000. 'invalid company code' TYPE 'E'.
ENDIF.

i think you company code is select option so you have to check S_BUKRS-high also.

using the event AT SELECTION-SCREEN on S_BUKRS-high.

Regards,

DHina..

satvik_panchal
Participant
0 Kudos

Hi Dhina,

Thanks for ur answer.