Application Development 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: 

ABAP - Mails sending

Former Member
0 Kudos

Hi SAP Gurus,

I have developed a Z-Program which picks data and sends mails to respective vendors. I have used FM SO_NEW_DOCUMENT_SEND_API1. Mails are getting triggered but late by 5 hours which is Time Zone(CET) but not system time . ex: system time = 12:00:00 CET Time : 15:00:00

After i trigger mail i have to go to the tcode SOST and set wait time to system time everytime. But system time and CET time should be maintained as indicated above. I cannot change CET time.

Please provide me the solution so that whenever i trigger mails programmatically it has to reach vendors immediately.

Regards,

Kranthi

8 REPLIES 8

Former Member
0 Kudos

You can use the class CL_BCS instead of the FM that you are using with which you can trigger the email immediately using the method SET_SEND_IMMEDIATELY

Check the sap demo programs BCS_EXAMPLE_1, BCS_EXAMPLE_2, BCS_EXAMPLE_3, BCS_EXAMPLE_4, BCS_EXAMPLE_5, BCS_EXAMPLE_6 to learn about the usage of this class.

Regards,

Trikanth Basetty

0 Kudos

Hi,

Thanks for replying . But how to use this SET_SEND_IMMEDIATELY method as i am new to the OOPs. I have checked the method in the programs you have provided but i couldn't get the solution. Please help me.

Regards,

Kranthi

0 Kudos

Copy the BCS_EXAMPLE_1 into a Z Program and change the recipient email id to your own in the code which is hard-coded.

If you execute the zprogram as is after changing email id, an email will be triggered as per you SCOT setting on how frequent the emails will be sent out from the system.

But if you call the SET_SEND_IMMEDIATELY , no matter how the settings are, the email will be dispatched immediately.

Just add the following call before the SEND method as shown in the code below

CALL METHOD SEND_REQUEST->SET_SEND_IMMEDIATELY('X').


CALL METHOD SEND_REQUEST->SET_SEND_IMMEDIATELY('X').

**     ---------- send document ---------------------------------------
      CALL METHOD SEND_REQUEST->SEND(
        EXPORTING
          I_WITH_ERROR_SCREEN = 'X'
        RECEIVING
          RESULT              = SENT_TO_ALL ).
      IF SENT_TO_ALL = 'X'.
        WRITE TEXT-003.
      ENDIF.

      COMMIT WORK.

You can also refer the following Help to explore the functionality of each method.

[http://help.sap.com/saphelp_nw2004s/helpdata/en/2d/1c5d3aebba4c38e10000000a114084/frameset.htm]

Regards,

Trikanth

b_deterd2
Active Contributor
0 Kudos

Hi,

I fully agree with Trikanth. Use CL_BCS. You will be much more flexible.

Regards,

Bert

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi,

Add the below code after send email FM..It will trigger the email when ever the email is generated from the FM

SUBMIT rsconn01 WITH mode = 'INT'
                  WITH output = ''
                  AND RETURN.

Former Member
0 Kudos

check the link

/people/thomas.jung3/blog/2004/09/08/sending-e-mail-from-abap--version-610-and-higher--bcs-interface

Former Member
0 Kudos

Hello, in the variable that points to somlreci1 (where you indicate the addressee), you have him to set the field express = 'X'.