How to cancel a function in a codeunit from report

Hi all, i have a function in a codeunit and it’s working fine… But when i run a report, which runs the codeunit it gives me an error about my function. My question is, how can i cancel my function in that codeunit when i run the report? Thanks…

What is the error message?

What do you mean by cancel?

The function is in the Item Jnl.-Post Line codeunits PostItem trigger, it’s prevents item gettin minus iventory, but when i run the Adjust Cost - Item Entries report it gives me my error in my function.

What i want to do is, when i run the Adjust Cost - Item Entries report, i don’t want my function in codeunit 22 to work? Is there a way to do it?

You need to tell the Codeunit 22 that it was called from Adjust Cost - Item Entries and in that case skip your function.

Check SetCalledFromAdjustment function in Codeunit 5895…

I managed, thak you for the help…