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

Function Module error message

Former Member
0 Likes
3,788

Hi,

I have a function module to get PO details based on PO number given as the import parameter. I have taken a return parameter and need to display error message if the PO number given is not available.

The message should be like

"PO number XXXXX does not exis".

Could anyone let me know how to code this in the FM to give the error message. Need to display the PO number in the error message.

Regards,

Ramesh

7 REPLIES 7
Read only

Former Member
0 Likes
1,321

Ram,

Take the return parameter check that PO number is exist or not.

If returnparamenter is initial.

MESSAGE E000(zmamap) WITH 'PO number' PO nunber 'does not exist'.

Read only

Former Member
0 Likes
1,321

Hi Ram,

I think based on sy-subrc value we can made the code for error message. After checking the PO number related querrey then mention one IF condition like IF sy-subrc = <value>

message E..................

endif.

Hope this helps you, reply for queries, Shall post you the updates.

Regards.

Kumar. .

Read only

Former Member
0 Likes
1,321

You can find a demo program in R/3. Go to SE38 and try out this program DEMO_MESSAGES.

Hope it helps. I don't know if your function group have a message class tag to it and I don't know if there is any customized message that you have.

in addition you can view this function module in transaction se37 'DEMO_FUNCTION_MESSAGE'.

Read only

Former Member
0 Likes
1,321

Hi ,

If you want an error then raise an exception .

So first define a message in your message class as below

<b>PO Number & does not exist.</b> and also define an exception ERROR in your FM.

No in the code where you find that the PO does not exist , raise this exception.

message E009(Z_TEST) WITH PO_NUM RAISING ERROR .

Here 009 is your error message

Z_TEST message class

and PO_NUM is the PO Number entered by the user.

Hope this helps in case you have any further queries please do revert back.

Regadrs

Arun

Read only

Former Member
0 Likes
1,321

Hi,

Assign the returning parameter to a variable say po_num.

To display the error message:

if po_num is not initial.

message e000(zz) with 'Purchase order number po_num doesnot exist'.

endif.

regards,

keerthi.

Read only

Former Member
0 Likes
1,321

Hi ram

CALL FUNCTION 'DEMO_FUNCTION_MESSAGE'

EXPORTING

message_type = S (which type do u want like S ,I etc)

message_place = 10

message_event = 10

if sy-subrc <> 0.

message s0001 with "PO number XXXXX does not exis".

endif.

I hope it will Use for U

Thanks.

Jay

Read only

Former Member
0 Likes
1,321

suppose you have return value for error.

if returnval = <error or what val are you taking>.

message i000(zspd) with <var for po>.

endif.

now dbl click on message class <here it is zspd> it will go to se 91 there a table control you can find

000 PO number & does not exist

save it ..

reagrds

shiba dutta