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

Populating the error message log (while executing BAdI implementation)

Former Member
0 Likes
1,906

Hi there,

I have a BAdI to implement CRM_ORDERADM_H_BADI where it will check certain header data. If there is a certain condition that is met, we must not allow the transaction to continue by adding error message on the top (the red button). How can we populate this error log within the BAdI implementation (putting it in codes in the method of the BAdI implementation).

Many thanks in advance,

Regards,

MuJi

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,256

put like this

data: w_msg type standard table of shp_badi_error_log initial size 0,

msg like line of w_msg.

if sy-subrc ne 0.

msg-msgty = 'E'.

msg-msgid = 'YW2'.

msg-msgno = '041'.

msg-msgv1 =

'PGI not allowed ,Pls Enter Truck No in Bill of lad.Field'.

append msg to ct_log.

endif.

<b>In BADI u cannt raise Error Messages but u can Post the Messages to Application Logs, So u have to Update ur messages to CT_LOG.</b>Regards

Prabhu

Message was edited by: Prabhu Peram

6 REPLIES 6
Read only

Former Member
0 Likes
1,257

put like this

data: w_msg type standard table of shp_badi_error_log initial size 0,

msg like line of w_msg.

if sy-subrc ne 0.

msg-msgty = 'E'.

msg-msgid = 'YW2'.

msg-msgno = '041'.

msg-msgv1 =

'PGI not allowed ,Pls Enter Truck No in Bill of lad.Field'.

append msg to ct_log.

endif.

<b>In BADI u cannt raise Error Messages but u can Post the Messages to Application Logs, So u have to Update ur messages to CT_LOG.</b>Regards

Prabhu

Message was edited by: Prabhu Peram

Read only

0 Likes
1,256

Thanks Prabhu,

What is the type of msg?

Also what do you mean by <i>CT_lOG create APPLICATION Log for the transaction.</i>?

Many thanks,

MuJi

Read only

0 Likes
1,256

Check the Changing and Export parameters of the BADI method you are implementing, normally most of the BADIs have a parameter defined to handle error messages. My system doesnt have the enhancement otherwise would have helped you in pointing out the parameter.

hith

Sunil Achyut

Read only

0 Likes
1,256

Unfortunately, I don't think there is any parameter that handles errors...

http://static.flickr.com/96/235931030_60f8ecc1c4_o.jpg

Read only

0 Likes
1,256

Hi Prabhu,

Seems liek shp_badi_error_log is not recognised, is that the correct one?

Read only

0 Likes
1,256

If your objective is just to show an error, then you can use a message type I to show a popup at the cost of annoying user to hit enter. If however, you use message type E, it basically stops the transaction which I dont think is your objective. Have you read the documenation in SPRO to see if there is any error handling done in the BADI. Normally each BADI has a purpose and sometimes you may not have error handling in the BADI, it all depends on what the BADI is trying to influence.

hith

Sunil Achyut