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

How to write error message?

Former Member
0 Likes
5,846

Hi,

I have a question about how to write message.

In the selection screen, when user enter a customer code, if the records belong to the customer code has been deleted from internal table T. No data will come out. I need to wite the message when the user enter an uneffected customer code.

Questions:

1,Where can I write the warnning message in my program.

2, How to write it?

Please help, Thank you.

7 REPLIES 7
Read only

Former Member
Read only

Former Member
0 Likes
2,028

Write like this

In this example, company is not selected.

AT-SELECTION-SCREEN .

IF P_CO = ' '.

message W016(pn) with 'COMPANY NOT SELECTED'.

ENDIF.

Hope this helps

vinodh Balakrishnan

Read only

Former Member
0 Likes
2,028

Hi,

Write the error message in AT SELECTION-SCREEN ON FIELD event.

Ex; PARAMETERS: P_BUKRS type BUKRS.

AT SELECTION-SCREEN ON p_bukrs.

IF p_bukrs <> '7570'.

MESSAGE w208(00) WITH 'In correct Company code'.

ENDIF.

Read only

0 Likes
2,028

Hi,

Thanky you for your advice.

I have another question is that the program is using

GET kna1.

GET knb1.

GET bsid."INS MG050706

CHECK bsid-budat <= dd_stida.

CHECK bsid-augdt = '00000000' OR bsid-augdt > dd_stida.

in the start-of-selection.

How can I write the error message when the records of bsid-kunnr the user enter in the selection screen has been deleted in the internal table T?

Please help. Thank you.

Read only

0 Likes
2,028

Hi,

You mean, how to display message after deleting the data from internal table based on kunnr.

If my understanding is correct, check the below logic:

Loop at itab where kunnr = p_kunnr.(selection screen kunnr)

Delete itab.

flag = 'X'. (to know whether atleast 1 record has been deleted or not)

Endloop.

If flag = 'X'.

MESSAGE I208(00) WITH 'Customer code records are deleted'.

(In start-of-selection, if you want to display the error message and stop the process, i.e., going back to selection screen, then dont use 'E' for error message, use 'I' or 'W' and use 'STOP' statement after message display.)

endif.

Read only

Former Member
0 Likes
2,028

Hi,

use the below logic ok.

parameters : var type i.

if var ne <condition>

message e001(pn) with 'It is not in a range'.

endif.

e000 : e stands for error message.

s001 : s stands for success message

w002 : w stands for warning message

a003 : a stands for abend message

Reward points if helpful.

Kiran Kumar.G.A

Have a Nice Day..

Read only

Former Member
0 Likes
2,028

Hi ,

Example :

if sy-batch = space.

CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'

exporting

textline1 = p_mess.

else.

MESSAGE E899(bd) WITH p_mess.

endif.

Reward points if it is useful...

Girish