‎2006 Jun 05 10:43 AM
hi friends,
In my below coding, i getting the same spool id..whenever i run this program.thereby my mail contents gets the previous mails content added with this mail ..can anyone try to resolve this problem plz..
sorry for not sending the code in the first attempt..
please note me if u make some changes thanx in advance..
&----
*& Report ZMAIL_SEND
*&
&----
*&
*&
&----
REPORT ZMAIL_SEND.
DATA : x_itcpo TYPE itcpo, "SAPscript output interface
x_itcpp1 TYPE itcpp, "SAPscript output parameters
x_itcpp2 TYPE itcpp,
c_std_text(8) TYPE c VALUE 'STD_TEXT', "variable that is used in SAP SCRIPT
it_packing_list TYPE TABLE OF sopcklsti1 INITIAL SIZE 0 WITH HEADER LINE,
it_objtxt TYPE TABLE OF solisti1 INITIAL SIZE 0 WITH HEADER LINE,
s_spool TYPE tsp01-rqident,
it_spool_file TYPE TABLE OF soli INITIAL SIZE 0 WITH HEADER LINE,
v_sender TYpe soextreci1-receiver VALUE 'B00732@FREESCALE.COM',
c_addr_type TYPE soextreci1-adr_typ VALUE 'INT',
it_reclist TYPE TABLE OF somlreci1 INITIAL SIZE 0 WITH HEADER LINE,
v_receiver TYPE somlreci1-receiver VALUE 'RAJKUMAR.S@LNTINFOTECH.COM',
x_docdata TYPE sodocchgi1,
tab_lines TYPE sy-tabix,
lin1 TYPE i.
------ Printer settings structure -
x_itcpo-tddest = ''.
x_itcpo-tdrdidev = ''.
x_itcpo-tdnewid = 'x'.
x_itcpo-tdsenddate = sy-datum.
x_itcpo-tdsendtime = sy-uzeit.
x_itcpo-tdschedule = 'IMM'.
x_itcpo-tdimmed = ' '.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
device = 'PRINTER'
dialog = 'X'
form = 'ZTEST_FORM '
language = sy-langu
options = x_itcpo
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
SPONUMIV =
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT = X_ITCPP1
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Assigning the standard text name
CALL FUNCTION 'TEXT_SYMBOL_SETVALUE'
EXPORTING
name = c_std_text
value = 'ZTEST_STD1'
value_length = 0
replace_symbols = 'x'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'E05_HEADER '
function = 'SET'
type = 'BODY'
window = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ELEMENT1'
function = 'SET'
type = 'BODY'
window = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'E05_FOOTER '
function = 'SET'
type = 'BODY'
window = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
CODEPAGE = 9
OTHERS = 10
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = x_itcpp2
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 6
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
***********************EXECUTES SUCCESSFULLY UNTIL THIS*********************************
------- spool no. of the spool generated -
s_spool = x_itcpp2-tdspoolid.
------- Fetching of the spool contents -
IF NOT s_spool IS INITIAL.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = s_spool
first_line = 1
last_line = 1000
desired_type = 'RAW'
IMPORTING
REAL_TYPE =
SP_LANG =
TABLES
buffer = it_spool_file "mail content
BUFFER_PDF =
EXCEPTIONS
NO_SUCH_JOB = 1
JOB_CONTAINS_NO_DATA = 2
SELECTION_EMPTY = 3
NO_PERMISSION = 4
CAN_NOT_ACCESS = 5
READ_ERROR = 6
TYPE_NO_MATCH = 7
OTHERS = 8
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
CALCULATING THE NO OF RECORDS IN IT_SPOOL_FILE************
DESCRIBE TABLE it_spool_file LINES lin1.
*------ Filling the spool contents into internal table obtxt,-----
*------ whose contents will be displayed as the body of email -
*
CLEAR it_objtxt.
IF lin1 GT 0.
LOOP AT it_spool_file.
it_objtxt-line = it_spool_file-line.
APPEND it_objtxt.
CLEAR it_objtxt.
CLEAR it_spool_file-line.
ENDLOOP.
ENDIF.
DESCRIBE TABLE it_objtxt LINES tab_lines.
READ TABLE it_objtxt INDEX tab_lines.
*------ Calculating doc. size which is email -
*
x_docdata-obj_name = 'ZTEST_STD1'.
x_docdata-obj_descr = 'HAI TEST'.
x_docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_objtxt ).
*THIS SET OF CODE IS TO UPDATE THE RECEIVER EMAIL ADDRESS
CLEAR it_reclist.
REFRESH it_reclist.
it_reclist-receiver = v_receiver.
it_reclist-rec_type = 'U'.
it_reclist-copy = 'x'.
it_reclist-blind_copy = ' '.
APPEND it_reclist.
*contains the document description
CLEAR it_packing_list.
REFRESH it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
DESCRIBE TABLE it_objtxt LINES it_packing_list-body_num.
*
it_packing_list-doc_type = 'RAW'.
APPEND it_packing_list.
*this is the function module which sends the mail
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = x_docdata
put_in_outbox = 'X'
sender_address = v_sender "senders mail address
sender_address_type = 'INT'
commit_work = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
SENDER_ID =
TABLES
packing_list = it_packing_list
OBJECT_HEADER =
CONTENTS_BIN =
contents_txt = it_objtxt "this is the table which contains the content of the mail
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
receivers = it_reclist "contains the receivers mail id
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
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
‎2006 Jun 05 10:46 AM
------ Printer settings structure -
x_itcpo-tddest = ''.
x_itcpo-tdrdidev = ''.
<b>x_itcpo-tdnewid = 'X'.</b>"Change to capital letter X
x_itcpo-tdsenddate = sy-datum.
x_itcpo-tdsendtime = sy-uzeit.
x_itcpo-tdschedule = 'IMM'.
x_itcpo-tdimmed = ' '.
REgards,
ravi
‎2006 Jun 05 10:46 AM
------ Printer settings structure -
x_itcpo-tddest = ''.
x_itcpo-tdrdidev = ''.
<b>x_itcpo-tdnewid = 'X'.</b>"Change to capital letter X
x_itcpo-tdsenddate = sy-datum.
x_itcpo-tdsendtime = sy-uzeit.
x_itcpo-tdschedule = 'IMM'.
x_itcpo-tdimmed = ' '.
REgards,
ravi
‎2006 Jun 05 10:56 AM
‎2006 Jun 05 11:17 AM
<b>x_itcpo-tdnewid = 'x'.</b>
<b>
replace_symbols = 'x'.
RESULT = x_itcpp2</b>
CLEAR it_reclist.
REFRESH it_reclist.
it_reclist-receiver = v_receiver.
it_reclist-rec_type = 'U'.
<b>it_reclist-copy = 'x'.</b>it_reclist-blind_copy = ' '.
APPEND it_reclist.
In the above code of urs Use Capital 'X'.
Kindly reward the points<b></b><b></b><b></b>