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

E-mail using SAP

Former Member
0 Likes
1,345

Hi , following is the program which actually has to send mail. In the screen I have to give the mail id . It has only 12 characters length . But the mail id is larger than it has.

Please have a look at the following program and let me know what the problem is and what the solution is.

REPORT zbk_email .

DATA: x_object_type LIKE sood-objtp.

DATA: BEGIN OF x_object_hd_change.

INCLUDE STRUCTURE sood1.

DATA: END OF x_object_hd_change.

DATA: BEGIN OF x_objcont OCCURS 10.

INCLUDE STRUCTURE soli.

DATA: END OF x_objcont.

DATA: BEGIN OF x_objhead OCCURS 0.

INCLUDE STRUCTURE soli.

DATA: END OF x_objhead.

DATA: BEGIN OF raw_head.

INCLUDE STRUCTURE sorh.

DATA: END OF raw_head.

DATA: BEGIN OF x_receivers OCCURS 0.

INCLUDE STRUCTURE soos1.

DATA: END OF x_receivers.

PARAMETERS: receiver LIKE x_receivers-recnam. " Name

*BUILD MESSAGE HEADER

MOVE 'Sort field goes here' TO x_object_hd_change-objsrt. " Sort field

MOVE 'Name of the object goes here' TO x_object_hd_change-objnam. " Name

MOVE 'Document title goes here' TO x_object_hd_change-objdes. " Title

MOVE 'F' TO x_object_hd_change-objsns. " Functional OBJECT

MOVE 'E' TO x_object_hd_change-objla. " Language

  • Object type of the new document

MOVE 'RAW' TO x_object_type.

CLEAR x_objcont.

MOVE 'Contents of mail' TO x_objcont-line.

APPEND x_objcont.

CLEAR x_objcont-line. APPEND x_objcont.

MOVE 'More contents' TO x_objcont-line.

APPEND x_objcont.

MOVE 'Still more contents'

TO x_objcont-line.

APPEND x_objcont.

MOVE ' ' TO x_objcont-line.

APPEND x_objcont.

  • Specific header (Dependent on the object type, here RAW)

REFRESH x_objhead.

DESCRIBE TABLE x_objcont LINES raw_head-rawsiz.

MOVE raw_head TO x_objhead.

APPEND x_objhead.

*RECEIVERS table

CLEAR x_receivers.

REFRESH x_receivers.

MOVE receiver TO x_receivers-recnam. " Name

MOVE 'B' TO x_receivers-recesc. " Receiver type

MOVE 'X' TO x_receivers-sndcp. " Send as a copy

MOVE 'X' TO x_receivers-sndex. " EXPRESS DOCUMENT

APPEND x_receivers.

CALL FUNCTION 'SO_OBJECT_SEND'

EXPORTING

  • folder_id = 'OUTBOX'

  • forwarder = x_forwarder

  • object_fl_change = x_object_fl_change

object_hd_change = x_object_hd_change

  • object_id = x_object_id

object_type = x_object_type

outbox_flag = 'X'

owner = sy-uname

  • store_flag = x_store_flag

  • importing

  • object_id_new = x_object_id_new

  • sent_to_all = x_sent_to_all "May need to use

TABLES

objcont = x_objcont

objhead = x_objhead

  • objpara = x_objpara

  • objparb = x_objparb

receivers = x_receivers.

Thanking you.

12 REPLIES 12
Read only

Former Member
0 Likes
1,236

Hi balakrishna,

1. This program is to send

email to SAP Busines work place

(and not externa email address like yahoo, etc)

2. We in this field, we have to input

the userid.

regards,

amit m.

Read only

Former Member
0 Likes
1,236

use

RECEIVER-RECEXTNAM instead of x_receivers-recnam.

Dont pass any value to x_receivers-recnam.

Create one parameter P_MAIL with length 132 type c.

Pass the value to RECEIVER-RECEXTNAM.

i.e RECEIVER-RECEXTNAM = P_MAIL .

Read only

Former Member
0 Likes
1,236

Sorry

use X_RECEIVERS instaed of RECEIVERS

X_RECEIVERS-RECEXTNAM instead of x_receivers-recnam.

Dont pass any value to x_receivers-recnam.

Create one parameter P_MAIL with length 132 type c.

Pass the value to X_RECEIVERS-RECEXTNAM.

i.e X_RECEIVERS-RECEXTNAM = P_MAIL

Read only

0 Likes
1,236

As Amit said, it is working for the SAP buisiness work place. I used the x_receivers-recextnam as you told . But short dump is coming. Please see the program and correct. Don't mind please.

Thanking you.

Read only

0 Likes
1,236

Thank you very much. I used the x_receivers-recextnam and I am not getting any short dumps too. But the thing I did not the mail in my inbox of yahoo id. I check the status in SOST. In that I found 'wait for communication service'.

Read only

Former Member
0 Likes
1,236

HI

GOOD

HERE YOU HAVE MENTIONED THE STRUCTURE AS S00S1 AND FIELD NAME IS recnam.

THOUGH THIS IS A STANDARD FIELD YOU CANT ABLE TO MAKE ANY CHANGES HERE.SO YOU CANT INCREASE THE LENTH OF THE PARAMETER FIELD.

DO ONETHING CREATE YOUR OWN STRUCTURE AND USE THIS PARTICULAR FIELD AND THE SAME DATAELEMENT AND DOMAIN.HERE YOU CAN INCREASE YOUR LENGTH OF THE DATAELEMENT WHICH WILL LATER REFLECT IN YOUR PARAMTER STATEMENT.

THANKS

MRUTYUN

Message was edited by: Mrutyunjaya Tripathy

Read only

Former Member
0 Likes
1,236

Please fill the receiver parameters like this.

CLEAR X_RECEIVERS.

REFRESH X_RECEIVERS.

  • X_RECEIVERS-RECNAM =

X_RECEIVERS-RECEXTNAM = 'abc@anywhere.com'

X_RECEIVERS-RECESC = 'U'. "<-

X_RECEIVERS-SNDART = 'INT'. "<-

MOVE 'X' TO X_RECEIVERS-SNDCP. " Send as a copy

MOVE 'X' TO X_RECEIVERS-SNDEX. " EXPRESS DOCUMENT

APPEND X_RECEIVERS.

Or tell what dump u r getting

Read only

Former Member
0 Likes
1,236

Hi.

Your program uses this statement.

MOVE 'B' TO x_receivers-recesc. " Receiver type

Please change to

MOVE 'B' TO x_receivers-recesc. " Receiver type

Also write COMMIT WORK after SO_SEND_OBJECT.

Goto T.Code SOST and refresh it.You will get the mail.

Let me know your feedback.

Read only

Former Member
0 Likes
1,236

Hi.

Your program uses this statement.

MOVE 'B' TO x_receivers-recesc. " Receiver type

Please change to

MOVE 'U' TO x_receivers-recesc. " Receiver type

Also write COMMIT WORK after SO_SEND_OBJECT.

Goto T.Code SOST and refresh it.You will get the mail.

Let me know your feedback.

Read only

0 Likes
1,236

In the transaction SOST , I found that 'wait for communication service' in the status text.

When it will be completed.

Read only

Former Member
0 Likes
1,236

To send mail to normal email ids use

BP_CREATE_MAIL

BP_SEND_MAIL

Regards,

Anand.

Read only

Former Member
0 Likes
1,236

Hii

When we send mail through abap code

it is not send directly

the basis team sends it using SCOT at regular intervals

do it manually using SCOT TRANSACTION

now open scot,

EXECUTE

and then click ok

If you are unable to do it consult your BASIS consulatant for configuring the node in SCOT tranaction and defining http in SM59 and opening the port..after that you can send email

Regards

Naresh