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

Can we catch ASSERT error occuring in FM/BAPI?

vimal
Active Participant
0 Likes
3,000

I have tried to look for options on SDN but couldn't find any solution for this issue. We are using a standard FM and it's giving us ASSERT error. We are able to find the issue and correct it but for better management of errors ,we want to raise an error whenever a record is going in that issue but FM currently is going in dump, So is there any way we can catch the error e.g. by catching exceptions , so that we could display proper error for that record ?.

Thanks,

Vimal

1 ACCEPTED SOLUTION
Read only

joltdx
Active Contributor
0 Likes
2,441

No. Sorry. If you control the calling of the FM/BAPI, make that check yourself before the call...

Or is there something wrong or inconsistent with your data? ASSERTS are often used for situations that shouldn't occur... But of course that might not be the case here and if you have found the reason then you would know...

6 REPLIES 6
Read only

FredericGirod
Active Contributor
0 Likes
2,441

do you try to call the BAPI in destination NONE ?

Read only

vimal
Active Participant
0 Likes
2,441

No , BAPI is called as normal FM(Call Function xyz).

Read only

stanislaslemaire
Participant
0 Likes
2,441

perhaps do you have to use ERROR_MESSAGE exception in list of exceptions of function module... (I don't remenber if ASSERT error is managed as standard error message)
Try it.

Read only

Sandra_Rossi
Active Contributor
2,441

ASSERT means that the developer wants the program to short dump because the condition should never happen or because the program is called with wrong parameters and that should never happen. You should first investigate why this ASSERT condition is false.

Read only

former_member708560
Discoverer
0 Likes
2,441

Yes, we have explored and found the issue but we want standard FM to return an error message for same rather than dumping on ASSERT statement. If that's not possible we have to put extra line of code for validation.

Read only

joltdx
Active Contributor
0 Likes
2,442

No. Sorry. If you control the calling of the FM/BAPI, make that check yourself before the call...

Or is there something wrong or inconsistent with your data? ASSERTS are often used for situations that shouldn't occur... But of course that might not be the case here and if you have found the reason then you would know...