Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

E-mail using SAP

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.

Tags:
Not what you were looking for? View more on this topic or Ask a question