Answer Posted / k.nagalakshmi
REPORT ZSEND .
TABLES: KNA1.
* data for send function
DATA DOC_DATA LIKE SODOCCHGI1.
DATA OBJECT_ID LIKE SOODK.
DATA OBJCONT LIKE SOLI OCCURS 10 WITH HEADER LINE.
DATA RECEIVER LIKE SOMLRECI1 OCCURS 1 WITH HEADER LINE.
SELECT * FROM KNA1 WHERE ANRED LIKE 'C%'.
WRITE:/ KNA1-KUNNR, KNA1-ANRED.
* send data internal table
CONCATENATE KNA1-KUNNR KNA1-ANRED
INTO OBJCONT-LINE SEPARATED BY
SPACE.
APPEND OBJCONT.
ENDSELECT.
* insert receiver (sap name)
REFRESH RECEIVER.
CLEAR RECEIVER.
MOVE: SY-UNAME TO RECEIVER-RECEIVER,
'X' TO RECEIVER-EXPRESS,
'B' TO RECEIVER-REC_TYPE.
APPEND RECEIVER.
* insert mail description
WRITE 'Sending a mail through abap'
TO DOC_DATA-OBJ_DESCR.
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_DATA
IMPORTING
NEW_OBJECT_ID = OBJECT_ID
TABLES
OBJECT_CONTENT = OBJCONT
RECEIVERS = RECEIVER
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.
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
what is a text table ?
What are the dynamic actions and how to configure it? : sap abap hr
foreign key enforcement?
how to update the filed value in SAP in ZAWSYS and create time and date? please tell me the answer
What two statements are required in an abap program to output an icon using a written statement?
What is a view in sap? : abap data dictionary
How do you get the number of lines in an internal table? How to use a specific number occurs statement?
What is a subroutine?
What is logo in sap script?
Differentiate screen painter from menu painter.
Can i know some of the Realtime tickets that anyone has been faced ?
A field containing quantity amounts (data type quan) must be assigned to a referencetable and a reference field. Explain?
How to debug a sapscript?
Explain the advantage of structures?
What is the use of the raising exception? : abap modularization