I have a requirement where I need to check whether a STO exists for the idoc PORDCR102. Another requirement is to check Post Goods Issue is present. If STO exists and PGI exists, I need to fail the idoc. How to do this(both failing idoc and checking how PGI exists). I am using the user exit EXIT_SAPL2012_001 for this purpose.
Below are the inbound function module which in turn are calling the bapis to post the document
IDOC_INPUT_PORDCR1 calls BAPI_PO_CREATE1
IDOC_INPUT_PORDCR calls BAPI_PO_CREATE
Search for a exit in BAPI ...which will serve you requirement ....ie. in turn throw a error message if the bapi throws a message the idoc will fail...!