Skip to Content
0

Sending email in ZXM02U06

Nov 06, 2017 at 11:26 AM

74

avatar image

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

10 |10000 characters needed characters left characters exceeded

Which kind of dump do you receive?

0
* Please Login or Register to Answer, Follow or Comment.

5 Answers

Best Answer
Raymond Giuseppi
Nov 06, 2017 at 01:22 PM
2

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.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
I wrote my code in method post of badi ME_PROCESS_REQ_CUST but didn't work, I'll try as you say and see if it Works.

Thanks!!

0

Raymond, solved using ME_REQ_POSTED. Thanks a lot !!

0
Swadhin Ghatuary Nov 06, 2017 at 01:18 PM
1

Hello Maria,

Inside BAPI 'BAPI_REQUISITION_CREATE' few other customer exits triggered.

Did you check those for your requirement ?

Share
10 |10000 characters needed characters left characters exceeded
Mike Pokraka Nov 06, 2017 at 01:35 PM
1

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.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

The consultant wants to manage the message like this..

0
avatar image
Former Member Nov 06, 2017 at 11:34 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded
Maria Merino Nov 06, 2017 at 11:44 AM
0

Yes I tried but it doesn't stop.

Share
10 |10000 characters needed characters left characters exceeded