07-25-2006 5:19 AM
The following program is, to send a details in sap to email, can any body explain the marked lines
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata <b><--</b>
document_type = 'RAW' <b><--</b>
put_in_outbox = 'X' <b><--</b>
tables
object_header = 'adss' <b><--</b>
object_content = 'asdfasdfasdf' <b><--</b>
receivers = 'you@123.com' <b><--</b>
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.
Thanks & good regards
Vallamuthu
07-25-2006 5:27 AM
Check the help for the FM
FU SO_NEW_DOCUMENT_SEND_API1
____________________________________________________
Short Text
SAPoffice: Send new document
Functionality
This function module enables you to send a new document, which has not yet been created, internally and externally. During the send process the document is created, along with the attributes and content that are to be transferred.
Import parameters
DOCUMENT_TYPE
Default = 'RAW'.
Document class. All classes are possible except for folders ('FOL') and distributions lists ('DLI').
PUT_IN_OUTBOX
Default = ' '.
If this flag is activated ('X'), the newly created document is also placed in the outbox of the active user when it is sent.
DOCUMENT_DATA
This structure must contain the attributes of the document to be sent.
Table parameters
OBJECT_HEADER
This table must contain the document class-relevant data. For example, SAPscript documents store information here about forms and styles, Excel list viewer documents store, amongst other things, the number of rows and columns and PC documents store their original file names.
LINE
Requires class-relevant document information line by line.
OBJECT_CONTENT
This table must contain the actual content of the document.
LINE
Requires the content of the document line by line.
RECEIVERS
This table must contain the document recipients.
RECEIVER
Name of recipient.
Go through the sample program
REPORT ztest_email .
DATA: OBJCONT LIKE SOLISTI1 OCCURS 5 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: ENTRIES LIKE SY-TABIX.
DATA: NAME(15).
Fill the document
DOC_CHNG-OBJ_NAME = 'URGENT'.
DOC_CHNG-OBJ_DESCR = 'Read at once !'.
DOC_CHNG-SENSITIVTY = 'P'.
OBJCONT = 'Hey Altaf what are you doing !!!'.
APPEND OBJCONT.
OBJCONT = 'Lets go for movie !'.
APPEND OBJCONT.
DESCRIBE TABLE OBJCONT LINES ENTRIES.
READ TABLE OBJCONT INDEX ENTRIES.
DOC_CHNG-DOC_SIZE = ( ENTRIES - 1 ) * 255 + STRLEN( OBJCONT ).
Fill the receiver list
CLEAR RECLIST.
RECLIST-RECEIVER = 'LOGIN'. " replace with <login name>
RECLIST-REC_TYPE = 'B'.
RECLIST-EXPRESS = 'X'.
APPEND RECLIST.
Send the document
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_TYPE = 'RAW'
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
OBJECT_CONTENT = OBJCONT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
CASE SY-SUBRC.
WHEN 0.
LOOP AT RECLIST.
IF RECLIST-RECEIVER = SPACE.
NAME = RECLIST-REC_ID.
ELSE.
NAME = RECLIST-RECEIVER.
ENDIF.
IF RECLIST-RETRN_CODE = 0.
WRITE: / NAME, ': succesfully sent'.
ELSE.
WRITE: / NAME, ': error occured'.
ENDIF.
ENDLOOP.
WHEN 1.
WRITE: / 'Too many receivers specified !'.
WHEN 2.
WRITE: / 'No receiver got the document !'.
WHEN 4.
WRITE: / 'Missing send authority !'.
WHEN OTHERS.
WRITE: / 'Unexpected error occurred !'.
ENDCASE.
07-25-2006 6:04 AM
sir,
i am vallamuthu, i am the new programmer to ABAP. very thanks to sending the sample program.sorry for disturbing u. i your program i got one error message(sy-sbrc message) i.e. after execution i got "NO RECEIVER GOT THE DOCUMENT". Please help me.
thanks & good regards
vallamuthu
07-25-2006 6:16 AM
Hi Vallamuthu,
Check my code again and change the 'LOGIN' to the user id with which you are entering into your SAPLOGON.Check your SAP mail box.The mail will come to your SAP mail box.If you face any problem reply this mail.
Reward point if your problem is solved.
Regards,
Mukesh Kumar
07-25-2006 5:36 AM
In SE37 give the fn module name and display...then click Function module documentation...u can get the details.
anywayz...
document_data -
This will contain the details to be sent thru mail
document_type------Class of document.Default is RAW
put_in_outbox---it will place the mail in outbox
object_header---- this will have the relevant details of the output
object_content---have the actual data to be sent
receivers----mailid to whom the mail has to be sent
07-21-2009 11:05 AM