on 05-17-2007 7:58 AM
Hi Experts,
There are 2 criterias...
1. criteria
I have created a script, i need to mail it. Please give me a step by step guide to perform it .. . Please give the comments in all the functional module to be used.
Do we have to write a separate program to send email or in the same program. i'll post my program along with this mail. I'm using this program to display report after delivery on that particular date.
REPORT ZREPORTTOEMAIL LINE-SIZE 400.
data : count, i type i.
TABLES : VBFA, "Sales Document Flow
VBAK,
KNA1,
VBKD,
VBAP,
LIPS,
LIKP,
KONP,
KOMK,
KOMP,
zkna1,
konv.
data : l_vbeln like vbfa-vbeln,
l_posnr like vbfa-posnn,
l_KNUMV like vbak-KNUMV,
L_BILL_ITEM LIKE vbfa-posnn ,
l_netwr like vbrp-netwr,
l_MWSBP like vbrp-mwsbp.
DATA: BEGIN OF TKOMV OCCURS 50.
INCLUDE STRUCTURE KOMV.
DATA: END OF TKOMV.
DATA: BEGIN OF TKOMVD OCCURS 50.
INCLUDE STRUCTURE KOMVD.
DATA: END OF TKOMVD.
.
TYPE-POOLS: SLIS.
DATA: FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,
HEADING TYPE SLIS_T_LISTHEADER,
LAYOUT TYPE SLIS_LAYOUT_ALV,
EVENTS TYPE SLIS_T_EVENT,
REPNAME LIKE SY-REPID,
F2CODE LIKE SY-UCOMM VALUE '&ETA',
G_SAVE(1) TYPE C,
G_EXIT(1) TYPE C,
G_VARIANT LIKE DISVARIANT,
GX_VARIANT LIKE DISVARIANT.
DATA: GT_LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
CONSTANTS: FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
DATA: BEGIN OF itab occurs 0,
kunnr like likp-kunnr, "ship to party
NAME2 LIKE KNA1-NAME1, "text
ORT01 LIKE KNA1-ORT01, "City
BSTNK LIKE VBAK-BSTNK, "customer P O
BSTDK LIKE VBAK-BSTDK, "date
vbeln like likp-vbeln, "delivery
ernam like likp-ernam, "person
vstel like likp-vstel, "shipping point
vkorg like likp-vkorg, "sales org
lfdat like likp-lfdat, "delivery date
kunag like likp-kunag, "sold to party
NAME1 LIKE KNA1-NAME1, "text
bil_to like VBAK-KUNNR,
name3 like kna1-name1,
traid like likp-traid, "transport/vehicle no
BOLNR LIKE LIKP-BOLNR,
wadat_ist like likp-wadat_ist, "good mov. date
posnr like lips-posnr, "item
matnr like lips-matnr, "material
arktx like lips-arktx, "item text
matkl like lips-matkl, "mat group
werks like lips-werks, "plant
lgort like lips-lgort, "stoage location
lfimg like lips-lfimg, "del qty
MEINS LIKE LIPS-MEINS,
vrkme like lips-vrkme, "sales unit
UMVKZ LIKE LIPS-UMVKZ,
UMVKN LIKE LIPS-UMVKN,
charg like lips-charg, "batch
vgbel like lips-vgbel, "reference doc
mtart like lips-mtart, "mat type
vkbur like lips-vkbur, "sales office
vkgrp like lips-vkgrp, "sales group
vtweg like lips-vtweg, "Distribution Channel
spart like lips-spart, "division
billno like vbak-vbeln,
basic like komvd-kwert,
budat like bkpf-budat,
fin_amt like vbrp-NETWR,
END OF itab.
data : begin of jtab occurs 0,
kunnr like likp-kunnr,
name2 like kna1-name2,
vbeln like likp-vbeln,
zkunnr like zkna1-zkunnr,
zname like zkna1-zname,
end of jtab.
SELECTION-SCREEN SKIP 1 .
SELECTION-SCREEN BEGIN OF BLOCK BLOCK1 WITH FRAME TITLE TEXT-003.
SELECT-OPTIONS : ABC FOR LIKP-WADAT_IST DEFAULT SY-DATUM
NO INTERVALS .
SELECT-OPTIONS : S_MATNR FOR LIPS-MATNR NO INTERVALS .
SELECT-OPTIONS : S_VKORG FOR LIKP-VKORG NO INTERVALS.
SELECT-OPTIONS : S_VSTEL FOR LIKP-VSTEL NO INTERVALS.
SELECT-OPTIONS : S_VKBUR FOR LIKP-VKBUR NO INTERVALS.
SELECT-OPTIONS : S_VKGRP FOR LIPS-VKGRP.
SELECT-OPTIONS : S_SPART FOR LIPS-SPART.
SELECT-OPTIONS : S_VBELN3 FOR LIKP-VBELN.
SELECT-OPTIONS : S_MATKL FOR LIPS-MATKL NO INTERVALS,
S_KUNAG FOR LIKP-KUNAG.
SELECTION-SCREEN END OF BLOCK BLOCK1.
select * from likp into corresponding fields of itab
WHERE WADAT_IST IN ABC
AND VBELN IN S_VBELN3
AND VKORG IN S_VKORG
and VSTEL in S_VSTEL
AND VKBUR IN S_VKBUR
and lfart like 'Z%'
AND VBTYP = 'J'
AND KUNAG IN S_KUNAG.
select * from lips into corresponding fields of itab
WHERE VBELN = ITAB-VBELN
AND MATNR IN S_MATNR
AND MATKL IN S_MATKL
AND VKBUR IN S_VKBUR
AND VKGRP IN S_VKGRP
AND SPART IN S_SPART.
IF ITAB-VRKME = 'RM' AND ITAB-MEINS = 'KG'.
ITAB-LFIMG = ITAB-LFIMG * ( ITAB-UMVKZ / ITAB-UMVKN ).
ITAB-VRKME = 'KG'.
ENDIF.
SELECT SINGLE BSTNK BSTDK INTO (ITAB-BSTNK,ITAB-BSTDK) FROM VBAK
WHERE VBELN = ITAB-VGBEL.
SELECT SINGLE NAME1 ORT01 FROM KNA1 INTO (ITAB-NAME2,ITAB-ORT01)
WHERE KUNNR = ITAB-KUNNR.
SELECT SINGLE NAME1 FROM KNA1 INTO ITAB-NAME1
WHERE KUNNR = ITAB-KUNAG.
*select single vbeln POSNN into (itab-billno,L_BILL_ITEM) from vbfa where VBELV = itab-vbeln
*and POSNV = itab-posnr and VBTYP_N in ('M','U').
select vbeln POSNN from vbfa up to 1 rows into (itab-billno,L_BILL_ITEM) where VBELV = itab-vbeln
and POSNV = itab-posnr and VBTYP_N in ('M','U') order by vbeln DESCENDING .
endselect.
select single * from vbfa where vbelv = itab-billno and posnv = l_bill_item and
vbtyp_n = 'N'.
if sy-subrc = 0.
clear : itab-billno, l_bill_item.
endif.
select single budat from bkpf into itab-budat where xblnr = itab-billno and
blart = 'RV'.
select single NETWR MWSBP into (l_netwr, l_MWSBP) from vbrp where vbeln = itab-billno
and posnr = l_bill_item.
itab-fin_amt = l_netwr + l_MWSBP.
clear : l_netwr, l_MWSBP.
select single kunnr from vbpa into itab-bil_to where
vbeln = itab-BILLNO and PARVW = 'RE'.
select single name1 into itab-name3 from kna1
where kunnr = itab-bil_to.
*select single VBELV POSNV from vbfa into (l_vbeln,l_posnr)
*where VBELN = itab-vbeln and
*POSNN = itab-posnr and VBTYP_N = 'J'.
*select single VBELN POSNN from vbfa into (l_vbeln,l_posnr)
*where VBELV = itab-vbeln and
*POSNV = itab-posnr and VBTYP_N = 'M'.
select VBELN POSNN from vbfa up to 1 rows into (l_vbeln,l_posnr)
where VBELV = itab-vbeln and
POSNV = itab-posnr and VBTYP_N = 'M' order by vbeln DESCENDING.
endselect.
select single * from vbfa where vbelv = l_vbeln and posnv = l_posnr and
vbtyp_n = 'N'.
if sy-subrc = 0.
clear : l_vbeln, l_posnr.
endif.
if sy-subrc = 0.
*select single KNUMv into l_KNUMv from vbak where vbeln = l_vbeln
select single KNUMv into l_KNUMv from vbRk where vbeln = l_vbeln
.
select * from konv where knumv = l_knumv and kposn = l_posnr and
kschl in ('ZR00','ZR01','ZR02','ZOBC').
itab-basic = itab-basic + KONV-KBETR.
ENDSELECT.
else.
*select single KNUMv into l_KNUMv from ekko where ebeln = itab-vgbel.
*select single KBETR from konv into itab-basic where knumv = l_knumv
*and kposn = itab-posnr and kschl = 'P101'.
select single KNUMv into l_KNUMv from VBRK where VBELN = itab-BILLNO.
select * from konv where knumv = l_knumv and kposn = l_BILL_ITEM AND
kschl in ('ZR00','ZR01','ZR02','ZOBC').
itab-basic = itab-basic + KONV-KBETR.
ENDSELECT.
*********************
*zkna1-zkunnr = itab-kunnr.
*insert zkna1.
*************************
endif.
clear : l_vbeln, L_BILL_ITEM, L_POSNR.
APPEND ITAB.
clear : itab-basic, itab-lfimg.
ENDSELECT.
clear : itab.
ENDSELECT.
<b>perform zscript.</b>
&----
*& Form zscript
&----
text
----
--> p1 text
<-- p2 text
----
FORM zscript .
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = 'ZREPORT2EMAIL'
LANGUAGE = SY-LANGU
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
SPONUMIV =
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
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.
LOOP AT ITAB.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'MANU'
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.
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
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.
ENDFORM. " zscript
The above one is first criteria just to understand how to send mail to the customers.
<b>Second criteria</b> is i have to send the mail to the particular customer with only their details, the process should continue until it sends to all the customers with their details for that particular date.
Please help me out.
I have seen so many posts in the sdn but not able to understand the functional modules, how they declare that and how does it works...
Please provide me a good material to understand the functional module and to declare them.
Please solve this query i'll reward them with very good points.
Thanks in advance.
A.Rafique.
hi abdur,,
just try this code which can help to send the smartform via mail..
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
wa_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
wa_doc_chng typE sodocchgi1,
w_data TYPE sodocchgi1,
wa_buffer TYPE string,"To convert from 132 to 255
Variables declarations
v_form_name TYPE rs38l_fnam,
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZZZ_TEST1'
importing
fm_name = v_form_name
exceptions
no_form = 1
no_function_module = 2
others = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION v_form_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
IMPORTING
job_output_info = w_return
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
i_otf[] = w_return-otfdata[].
call function 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
others = 4.
Fehlerhandling
if sy-subrc <> 0.
endif.
loop at i_tline.
translate i_tline using '~'.
concatenate wa_buffer i_tline into wa_buffer.
endloop.
translate wa_buffer using '~'.
do.
i_record = wa_buffer.
append i_record.
shift wa_buffer left by 255 places.
if wa_buffer is initial.
exit.
endif.
enddo.
Attachment
refresh:
i_reclist,
i_objtxt,
i_objbin,
i_objpack.
clear wa_objhead.
i_objbin[] = i_record[].
Create Message Body
Title and Description
i_objtxt = 'test with pdf-Attachment!'.
append i_objtxt.
describe table i_objtxt lines v_lines_txt.
read table i_objtxt index v_lines_txt.
wa_doc_chng-obj_name = 'smartform'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = 'smartform'.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
Main Text
wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + strlen( i_objtxt )
*.
clear i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
append i_objpack.
Attachment
(pdf-Attachment)
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
Länge des Attachment ermitteln
describe table i_objbin lines v_lines_bin.
read table i_objbin index v_lines_bin.
i_objpack-doc_size = v_lines_bin * 255 .
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'smart'.
i_objpack-obj_descr = 'test'.
append i_objpack.
clear i_reclist.
i_reclist-receiver = 'urmailid@mailserver.com'.
i_reclist-rec_type = 'U'.
append i_reclist.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = i_objpack
object_header = wa_objhead
CONTENTS_BIN = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
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.
regards...
seshu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Instead of posting all the code i mention the function module name, Just open SE37 and enter that FM name. Press where used list and select the programs check box in the coming pop up window. It will show all the program which that FM was used. Now check it out how that FM was used and how those parameters passed.
FM name: SO_NEW_DOCUMENT_ATT_SEND_API1
For second criteria: I beleive using control break events(At new..) that we can do seperate all the custoemrs details and send them.
Hope this helps you. Reply for queries, shall post the updates.
Regards.
Kumar. .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks to everyone for replying my query..... is it possible u to provide your email id and contact numbers for further references.
Because for further queries i can be directly in touch with u.
Please kindly provide me..
Thanks in advance.
A.Rafique.
my id is abdurrafique@gmail.com, abdurrafique@yahoo.com
contact no. 9845184878
Hi babar haroon,
Thanks for the link.....
I went through that link, i created smart form but i was not able to get the results because the pgm gets terminated after executing. I'll show u the code, the code is active. Please check out and tell me if i have missed anything in the code...
&----
*& Report ZZZ_TEST3
*&
&----
*&
*&
&----
REPORT ZZZ_TEST3.
*internal table declarations
data: i_otf type itcoo occurs 0 with header line,
i_tline type table of tline with header line,
i_receivers type table of somlreci1 with header line,
i_record like solisti1 occurs 0 with header line,
*Objects to send mail.
i_objpack like sopcklsti1 occurs 0 with header line,
i_objtxt like solisti1 occurs 0 with header line,
i_objbin like solisti1 occurs 0 with header line,
i_reclist like somlreci1 occurs 0 with header line,
*workarea declaration.
w_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
w_doc_chng typE sodocchgi1,
w_data TYPE sodocchgi1,
w_buffer TYPE string,"To convert from 132 to 255
Variables declarations
v_form_name TYPE rs38l_fnam,
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
call function 'SSF_FUNCTION_MODULE_NAME'
*call function '/1BCDWB/SF00000105'
exporting
formname = 'ZZZ_TEST2'
importing
fm_name = v_form_name
exceptions
no_form = 1
no_function_module = 2
others = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION '/1BCDWB/SF00000105'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB = itab1
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = wa
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
.
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 v_form_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
IMPORTING
job_output_info = w_return
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
i_otf[] = w_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Convert PDF from 132 to 255.
LOOP AT i_tline.
Replacing space by ~
TRANSLATE i_tline USING '~'.
CONCATENATE w_buffer i_tline INTO w_buffer.
ENDLOOP.
Replacing ~ by space
TRANSLATE w_buffer USING '~'.
DO.
i_record = w_buffer.
Appending 255 characters as a record
APPEND i_record.
SHIFT w_buffer LEFT BY 255 PLACES.
IF w_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Refresh: i_reclist,
i_objtxt,
i_objbin,
i_objpack.
clear w_objhead.
Object with PDF.
i_objbin[] = i_record[].
DESCRIBE TABLE i_objbin LINES v_lines_bin.
Object with main text of the mail.
i_objtxt = 'Find attached the output of the smart form.'.
APPEND i_objtxt.
DESCRIBE TABLE i_objbin LINES v_lines_txt.
i_objtxt = 'Regards,'.
APPEND i_objtxt.
i_objtxt = 'J.Jayanthi'.
APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES v_lines_txt.
Document information.
w_doc_chng-obj_name = 'Smartform'.
w_doc_chng-expiry_dat = sy-datum + 10.
w_doc_chng-obj_descr = 'Smart form output'.
w_doc_chng-sensitivty = 'F'. "Functional object
w_doc_chng-doc_size = v_lines_txt * 255.
Pack to main body as RAW.
Obj. to be transported not in binary form
CLEAR i_objpack-transf_bin.
Start line of object header in transport packet
i_objpack-head_start = 1.
Number of lines of an object header in object packet
i_objpack-head_num = 0.
Start line of object contents in an object packet
i_objpack-body_start = 1.
Number of lines of the object contents in an object packet
i_objpack-body_num = v_lines_txt.
Code for document class
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
Packing as PDF.
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'Smartform'.
CONCATENATE 'Smartform_output' '.pdf'
INTO i_objpack-obj_descr.
i_objpack-doc_size = v_lines_bin * 255.
APPEND i_objpack.
Document information.
CLEAR i_reclist.
e-mail receivers.
i_reclist-receiver = 'jayanthi.gayathri@wipro.com'.
i_reclist-receiver = 'abdurrafique@gmail.com'.
i_reclist-express = 'X'.
i_reclist-rec_type = 'U'. "Internet address
APPEND i_reclist.
Sending mail.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = w_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = i_objpack
object_header = w_objhead
contents_hex = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
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.
Please reply me back, it is very urgent..
Thanks and regards.
A.Rafique
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.