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

Issue while mail triggering using function module SO_NEW_DOCUMENT_SEND_API1

Former Member
0 Likes
2,504

Hi all,

I have requirement to send mails from BADI.For that i used following function modules-SO_NEW_DOCUMENT_SEND_API1

and

SO_NEW_DOCUMENT_ATT_SEND_API1,

Both of these two function module requires to use COMMIT WORK statement.

But if we use COMMIT WORK statement in BADI a run time error is occuring as its not allowed in BADI.

Can anybody provide solution for this or provide another function module.

Thank you.

1 ACCEPTED SOLUTION
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,160

Hello,

As pointed out by Avinash the param: COMMIT_WORK in the FMs is not mandatory, you can skip it inside your BAdI.

If you have any valid reason as to why you have passed this value to the FM.

BR,

Suhas

19 REPLIES 19
Read only

former_member156446
Active Contributor
0 Likes
2,160

Refer to this link: [E-Mail attachment from remote location|http://www.sapfans.com/forums/viewtopic.php?f=13&t=322733&p=981260]

Read only

Former Member
0 Likes
2,160

HI,

The COMMIT WORK statement is not required while using the FM SO_NEW_DOCUMENT_SEND_API1

and SO_NEW_DOCUMENT_ATT_SEND_API1 to send the email.

Can you be more clear regarding the your problem.

To send the email after excuting the with waing for batch job to triggrer the email sending process..

submit rsconn01 with mode = 'INT'

with output = 'X'

and return.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,161

Hello,

As pointed out by Avinash the param: COMMIT_WORK in the FMs is not mandatory, you can skip it inside your BAdI.

If you have any valid reason as to why you have passed this value to the FM.

BR,

Suhas

Read only

Former Member
0 Likes
2,160

From ECC6.0 onwards,as per my knowledge/experience, its mandatory to use commit_work statement for mail trigger function modules.

thanks.

Read only

Former Member
0 Likes
2,160

Hi Sanu,

It is not required to commit_work statement after these FM''s. You need to have RSCONN01 to trigger the mail immediatly..i have written lot of code using these FM in ECC 6.0 but no where i have used the Commit Work statment and still they are working fine,

Read only

0 Likes
2,160

can submit RSCONN01 program, but never heard of writing commit after send email.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,160

Hello Sanu,

Even i have ECC 6.0 version & i donot think its mandatory. Anyways Avinash has already given an explanation to this.

BR,

Suhas

Read only

Former Member
0 Likes
2,160

hi

for this perpose i used the same function module SO_NEW_DOCUMENT_SEND_API1 but i have not used commit work.so commit work its not necessary.can u give what is the exact error u faced.ok

regards

poluankireddy

Read only

0 Likes
2,160

The issue is , in BADI we are not allowed to use SUBMIT statement or CALL TRANSACTION .So i can not use-

SUBMIT rsconn01 WITH mode = 'INT'

WITH output = ''

AND RETURN.

This works in se38/normal program not in BADI.

I

Edited by: sanu debu on Mar 18, 2009 4:13 AM

Read only

0 Likes
2,160

its not mandatory to have the program submited.... Ideally every client will have it scheduled on a general interval to 10 minutes job... but commit is not needed... use the FM for email it should be fine.

Read only

Former Member
0 Likes
2,160

Hi,

After bringing your final alv data in the final internal table,

go through this link , i also had an same requirement to send data after converting to excel file and

send it as an attachment to mail id outside Sap,

https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/to%252bsend%252b2%252bint%252btables%252bdat...

Hope it helps

Regrds

Mansi

Read only

0 Likes
2,160

Without submit and commit work teh function module getting executed but i dont receive any mail

niether it appears in wait mode in SOST transaction.Can you please tell me reason behind the same and how to resolve.

Read only

I355602
Product and Topic Expert
Product and Topic Expert
0 Likes
2,160

Hi,

Refer:

/people/thomas.jung3/blog/2004/09/09/receiving-e-mail-and-processing-it-with-abap--version-610-and-higher

Hope this helps you.

Regards,

Tarun

Read only

0 Likes
2,160

Hi,

Did you check the below highlighted export parameters in your call from BADI.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

STARTING NEW TASK 'ZMAIL'

EXPORTING

DOCUMENT_DATA = MAILDATA

PUT_IN_OUTBOX = 'X'

COMMIT_WORK = 'X'

TABLES

PACKING_LIST = MAILPACK

OBJECT_HEADER = MAILHEAD

CONTENTS_BIN = MAILBIN

CONTENTS_TXT = MAILTXT

RECEIVERS = MAILREC

EXCEPTIONS

TOO_MANY_RECEIVERS = 1

DOCUMENT_NOT_SENT = 2

OPERATION_NO_AUTHORIZATION = 4

OTHERS = 99.

Thanks,

Subba

Read only

0 Likes
2,160

COMMIT_WORK = 'X' commented as it leads to runtime error.As i said COMMIT_WORK not allowed in badi.

Thank you.

Read only

0 Likes
2,160

As i said commit work not allowed in BADI.It gives runtime error.Please provide alternative solution.

Read only

0 Likes
2,160

Hi,

Use SCOT transaction and start send process with address type "INT". It will put your mail from waiting to completed state.

And still if you are not getting any mail then check your Node under "INT". and also check RFC destination in that node. It might be taking wrong RFC connection.

Sourabh

Read only

0 Likes
2,160

commit work not allowed in BADI.It gives runtime error

Information on commit work.

becos for commit work. sy-subrc will allways sets to zero.

you can better use commitwork and wait. it sets sy-subrc.

To avoid runtime error / dump you can check the sy-subrc value. if its not equal to zero. just

Roll back work.

Plz look at the piece of code below

commit work and wait.

if sy-subrc eq 0.

exit.

else.

rollback work.

wa_error-msg = "Failed to update the status in the database "

append wa_error to it_error.

exit.

endif.

Also check the badi signature. there you have a internal table to store the error messages.

if commit work fails then add the appropriate error message to the internal table .

Hope this gives you some idea on commit work.

But as everyone says, commit work is not required for that function module . i too agree with that.

if you try to update any database after you successfully send the file . then i think commit work statement is necessary for you.

Thanks,

Uma

Read only

Former Member
0 Likes
2,160

Hi,

Check the below Link

Regards,

Anki Reddy