‎2009 Mar 17 2:24 PM
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.
‎2009 Mar 17 3:18 PM
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
‎2009 Mar 17 2:34 PM
Refer to this link: [E-Mail attachment from remote location|http://www.sapfans.com/forums/viewtopic.php?f=13&t=322733&p=981260]
‎2009 Mar 17 2:38 PM
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.
‎2009 Mar 17 3:18 PM
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
‎2009 Mar 17 3:58 PM
From ECC6.0 onwards,as per my knowledge/experience, its mandatory to use commit_work statement for mail trigger function modules.
thanks.
‎2009 Mar 17 4:03 PM
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,
‎2009 Mar 17 4:06 PM
can submit RSCONN01 program, but never heard of writing commit after send email.
‎2009 Mar 17 4:07 PM
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
‎2009 Mar 17 4:17 PM
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
‎2009 Mar 18 3:12 AM
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
‎2009 Mar 18 3:21 AM
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.
‎2009 Mar 18 3:36 AM
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,
Hope it helps
Regrds
Mansi
‎2009 Mar 18 4:09 AM
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.
‎2009 Mar 18 4:11 AM
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
‎2009 Mar 18 4:27 AM
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
‎2009 Mar 18 8:19 AM
COMMIT_WORK = 'X' commented as it leads to runtime error.As i said COMMIT_WORK not allowed in badi.
Thank you.
‎2009 Mar 18 9:58 AM
As i said commit work not allowed in BADI.It gives runtime error.Please provide alternative solution.
‎2009 Mar 19 4:32 AM
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
‎2009 Mar 19 5:21 AM
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
‎2009 Mar 18 8:47 AM