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: 

how to handle execption with badi implementation ??

former_member186143
Active Contributor
0 Kudos

I'm curious what I have to do with the badi implementation of PROJECTDEF_UPDATE

I created my own implementation ZPROJECTDEF_UPDATE and want to run a check in the method AT_SAVE

when the check is ok than the it may continue to save the project if not then it has to raise an error message

I can use ofcourse message to create the error message and it's also working but I was wondering if I could also use the exception ERROR_WITH_MESSAGE in this ??

can I also pass allong the errormessage text when raising an exception ??

ofcourse I can't alter anymore the coding outside of the badi ??

what is the proper procedure how to use this badi and to raise the error message with my own text ??

and in which language is it most likely documentation or examples exist of a method or badi ? english or german ? in this case I couldn't find any example in either

kind regards

arthur de smidt

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos

Try this way for message within raise exception


MESSAGE e000(00) WITH 'Error' RAISING ERROR_WITH_MESSAGE.

2 REPLIES 2

former_member194669
Active Contributor
0 Kudos

Try this way for message within raise exception


MESSAGE e000(00) WITH 'Error' RAISING ERROR_WITH_MESSAGE.

naimesh_patel
Active Contributor
0 Kudos

Since there is not any exception in the definition of the method, it is not advisable to raise any kind of exception from the BADI implementation. Becuase the caller application (which call the BADI) is not able to handle those exceptions.

For perticular this BADI, Method AT_SAVE has only one parameter IM_PROJECTDEFINITION which is importing parameter - means you are not able to change anything using that parameter. Now, if you are saving your data in to some Ztable from the BADI Implementation, than you might

1. Catch the exception which are caused by your logic

2. Give the Status Message with the appropriate details.

One other way is you can generate an Application Log in case of any errors in the BADI implementation and at last give the Information message if the application log has been generated. You can find more details on [Generate Application Log|http://help-abap.blogspot.com/2008/10/generate-application-log.html]

Some BADI definition have the option for error handling. For example, Badi Defintion LE_SHP_DELIVERY_PROC method SAVE_DOCUMENT_PREPARE has a parameter CT_LOG which can be filled up in case of errors.

Regards,

Naimesh Patel