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

Sending Mail error

RKSK
Participant
0 Likes
1,116

Dear All,

I am working on user-exit IMRC0001 for measuring point.

Basically my requirement is that when ever Meas Reading increases the target value a notification should get generated (this part i have done successfully) and a mail should be sent to the concern person, now the problem is that i m not able to send the mail i m using the FM SO_NEW_DOCUMENT_SEND_API1

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_data = git_maildata

DOCUMENT_TYPE = 'RAW'

PUT_IN_OUTBOX = 'X'

COMMIT_WORK = 'X'

IMPORTING

SENT_TO_ALL = git_flag

NEW_OBJECT_ID = git_objid

tables

  • OBJECT_HEADER =

OBJECT_CONTENT = git_content[]

  • CONTENTS_HEX =

  • OBJECT_PARA =

  • OBJECT_PARB =

receivers = git_reciever[]

EXCEPTIONS

TOO_MANY_RECEIVERS = 1

DOCUMENT_NOT_SENT = 2

DOCUMENT_TYPE_NOT_EXIST = 3

OPERATION_NO_AUTHORIZATION = 4

PARAMETER_ERROR = 5

X_ERROR = 6

ENQUEUE_ERROR = 7

OTHERS = 8

.

IF sy-subrc <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Now if i marks the COMMIT_WORK = 'X' it gives dump ' Invalid COMMIT WORK in a COMMIT WORK or ROLLBACK WORK. '

and if i doesn't give it doesnt send the mail.

What should i do the same scenerio if i run in a report program its running fine but in user exit it is giving dumb.

Please help me!!

Edited by: Rachit Khanna on Dec 24, 2007 11:30 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,083

Hi Rachit,

This is not really a reply to your question.

I am searching for messages related to userexit IMRC0001 and I found this message you posted.

I am having problems creating a Notification from within the userexit using FM IQS4_CREATE_NOTIFICATION. The Notification is successfully created but when I view the Notification it gives me the error "Object does not exist (status management)". But when I look at table QMEL the Notification is created and posted.

However, when I execute IQS4_CREATE_NOTIFICATION by itself using the Test functionality in SE37, the Notification is successfully created and I can also view it no problem.

I only get the error viewing the Notification when the function module is called from the userexit.

Any thoughts on this one?

Thanks.

Hi Pankaj,

I have checked the queue nothing is going there but if i execute the same FM in my report program its working fine there , even if i comment commit work there its running fine but it is not working in my user - exit , nothing is coming in queue.

What can be done please suggest.

Thanks and Regards,

Rachit Khanna

8 REPLIES 8
Read only

Former Member
0 Likes
1,083

Hi Rachit,

You can't use COMMIT_WORK = 'X' in this exit because it's triggered by COMMIT WORK statement itself ehn you save.

Regarding mail sending, you check the sy-subrc after this FM to mail send, if its zero then mail is send.

You check in transaction SOST and if it's there it means mail is sent/in queue .

Regards,

Pankaj

Read only

0 Likes
1,083

Hi Pankaj,

I checked the value of sy-subrc it is coming 0(Zero) but when i check the mail sent queue it is not present there.

Is there any other way to do it.

Thanks and Regards,

Rachit Khanna

Read only

0 Likes
1,083

Hi Rachit,

You check the Waiting as well as Errors queue in SOST.

If it's in waiting you can send it from there, i can gv you the code to put in user exit if its there.

Regards,

Pankaj

Read only

0 Likes
1,083

Hi Pankaj,

I have checked the queue nothing is going there but if i execute the same FM in my report program its working fine there , even if i comment commit work there its running fine but it is not working in my user - exit , nothing is coming in queue.

What can be done please suggest.

Thanks and Regards,

Rachit Khanna

Read only

Former Member
0 Likes
1,083

Dear ,

Commit work is not mandatory,

U just try below.

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

document_type = 'RAW'

document_data = git_maildata

put_in_outbox = 'X'

TABLES

object_content = git_content[]

receivers = git_reciever[]

EXCEPTIONS

TOO_MANY_RECEIVERS = 1

DOCUMENT_NOT_SENT = 2

DOCUMENT_TYPE_NOT_EXIST = 3

OPERATION_NO_AUTHORIZATION = 4

PARAMETER_ERROR = 5

X_ERROR = 6

ENQUEUE_ERROR = 7

OTHERS = 8

.

IF sy-subrc 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Read only

0 Likes
1,083

Hi Chandra,

I have already tried this but this is not working please suggest what else can be done. this same scenerio is working fine when i use it in a report program.

Is there any way by which i can pass the value from user exit to my report program.

Please suggest!!!

Thanks and Regards,

Rachit Khanna

Read only

Former Member
0 Likes
1,084

Hi Rachit,

This is not really a reply to your question.

I am searching for messages related to userexit IMRC0001 and I found this message you posted.

I am having problems creating a Notification from within the userexit using FM IQS4_CREATE_NOTIFICATION. The Notification is successfully created but when I view the Notification it gives me the error "Object does not exist (status management)". But when I look at table QMEL the Notification is created and posted.

However, when I execute IQS4_CREATE_NOTIFICATION by itself using the Test functionality in SE37, the Notification is successfully created and I can also view it no problem.

I only get the error viewing the Notification when the function module is called from the userexit.

Any thoughts on this one?

Thanks.

Read only

0 Likes
1,083

Hi Giscard,

Please check BAPIRET2 table in your FM see if it is giving some error , secondly use commit work after the function-module get executed , use commit-work after the FM gets Executed.

The second option is that you can run the BDC for creating Notification this is what i have done , if you want the code then please tell me i will mail you.

Regards,

Rachit Khanna