11-06-2017 11:26 AM
Hi experts,
In include ZXM02U06 we have the necessary code to send an email depending on some conditiones when executing ME51N. It is working fine.
Now we have a new requirement which is to create a new purchase requisition after creating a material document. I did it in badi MB_DOCUMENT_BADI, method
MB_DOCUMENT_BEFORE_UPDATE. As I got a dump while executing it, I did it like this:
CALL FUNCTION 'BAPI_REQUISITION_CREATE' IN BACKGROUND TASK
But the email is not sent. I think BAPI_REQUISITION_CREATE should trigger ZXM02U06, isn't it? I aldo tried to send the email after calling BAPI_REQUISITION_CREATE but I need the purchase requisition number and at this moment (while debugging) this value is empty.
Is there any way to send this mail ? how can i get purchase requisition number after calling the bapi in background?
Thanks in advance!
Maria
11-06-2017 1:22 PM
Personnaly I would have used method POSTED of BAdI ME_REQ_POSTED or method POST of ME_PROCESS_REQ_CUST and not an old customer-exit provided for customer fields update.
I would also have wrapped the call of the BAPI in an RFC customer FM to manage the RETURN parameter and manage the COMMIT.
NB: The IN BACKGROUND registered FM are executed after the COMMIT WORK, after the V1 update FM. (Execute transaction SM58 to find any error during their execution) Check also for your debug options.
11-06-2017 11:34 AM
Hi,
did you try to debug in background & put a break-point in your include ? to check if your code is executed or not ?
regards
Fred
11-06-2017 11:44 AM
11-06-2017 1:17 PM
11-06-2017 1:18 PM
Hello Maria,
Inside BAPI 'BAPI_REQUISITION_CREATE' few other customer exits triggered.
Did you check those for your requirement ?
11-06-2017 1:22 PM
Personnaly I would have used method POSTED of BAdI ME_REQ_POSTED or method POST of ME_PROCESS_REQ_CUST and not an old customer-exit provided for customer fields update.
I would also have wrapped the call of the BAPI in an RFC customer FM to manage the RETURN parameter and manage the COMMIT.
NB: The IN BACKGROUND registered FM are executed after the COMMIT WORK, after the V1 update FM. (Execute transaction SM58 to find any error during their execution) Check also for your debug options.
11-07-2017 9:48 AM
Thanks!!
11-07-2017 10:19 AM
11-06-2017 1:35 PM
Why not implement a mail as an output type? Seems the most sensible way to do it and you have a lot more control via output conditions.
11-07-2017 9:49 AM