Sending spool pdf through XI to external app
we are able to produce the .pdf locally from spool files with no problem.
the problem occurs when we try to pass a pdf to XI for transmission to Filenet.
the XI guys say they can't handle .pdf native format - we have to convert to string an encode in 64bit.
so, we convert the pdf table (which is in TLINE format) to a string and run it through FM 'SCMS_BASE64_ENCODE_STR' to 64 bit encode it.
this does allow us to pass the data stream to XI and XI sends to Filenet, however, the resulting document is not readable by Adobe Acrobat.
has anyone been able to send pdf files through XI to an external app?
thanks alot. points will be awarded.
robert.
thanks.. let me add a little more info..
i'm an abapper. is there anything I can do without the aid of the XI team to get this to work?
they already have a webservice in place that other non-SAP systems use to send their pdf files. The XI team wants us to use the same one.
Similar Messages
-
How to send "SPOOL" on SAP MAil or external mail in background???
I tried using 'SO_DOCUMENT_REPOSITORY_MANAGER' function but it failed when I run it in background. I learned that it calls a screen at the middle of the process which needs user input to go on with the process.
Is there other way that I could send spool on SAPMail or external Mail in background??? Any suggesstions will be greatly appreciated.. thanx...see below sample function module, you can use in backgroud also
FUNCTION Z_SEND_MAIL_FOR_SPOOLLIST.
""Local interface:
*" IMPORTING
*" VALUE(SPOOLNUMBER) LIKE SY-SPONO DEFAULT SY-SPONO
*" VALUE(MAILNAME) LIKE SOOD1-OBJNAM DEFAULT 'NOTE'
*" VALUE(SUBJECT) LIKE SOOD1-OBJDES
*" VALUE(RECEPIENT) LIKE SY-UNAME OPTIONAL
*" VALUE(DLI) LIKE SOOS1-DLINAM OPTIONAL
*" TABLES
*" TEXT STRUCTURE SOLI OPTIONAL
*" EXCEPTIONS
*" ERROR
DATA: OBJECT_HD_CHANGE LIKE SOOD1 OCCURS 0 WITH HEADER LINE,
OBJPARA LIKE SELC OCCURS 0 WITH HEADER LINE,
RECEIVERS LIKE SOOS1 OCCURS 0 WITH HEADER LINE.
OBJECT_HD_CHANGE-OBJLA = SY-LANGU.
OBJECT_HD_CHANGE-OBJNAM = MAILNAME.
OBJECT_HD_CHANGE-OBJDES = SUBJECT.
OBJECT_HD_CHANGE-OBJSNS = 'F'.
OBJECT_HD_CHANGE-VMTYP = 'T'.
OBJECT_HD_CHANGE-SKIPS = 'X'.
OBJECT_HD_CHANGE-ACNAM = 'SP01'.
OBJECT_HD_CHANGE-OBJCP = 'X'.
RECEIVERS-RCDAT = SY-DATUM.
RECEIVERS-RCTIM = SY-UZEIT.
IF DLI IS INITIAL.
RECEIVERS-RECNAM = RECEPIENT.
RECEIVERS-RTUNAM = RECEPIENT.
ELSE.
RECEIVERS-RECNAM = DLI.
RECEIVERS-ADR_NAME = DLI.
RECEIVERS-RECESC = 'C'.
ENDIF.
RECEIVERS-SNDEX = 'X'. " Express-Mail
APPEND RECEIVERS.
OBJPARA-NAME = 'SPI'.
OBJPARA-LOW = SPOOLNUMBER.
APPEND OBJPARA.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
OBJECT_HD_CHANGE = OBJECT_HD_CHANGE
OBJECT_TYPE = 'RAW'
OWNER = SY-UNAME
TABLES
OBJCONT = TEXT
OBJPARA = OBJPARA
RECEIVERS = RECEIVERS
EXCEPTIONS
OTHERS = 01.
IF SY-SUBRC NE 0.
RAISE ERROR.
ENDIF.
ENDFUNCTION. -
Sending Interactive PDF through mail - as INLINE item
Hi All,
I have a requirement, wherein I have to send an Interactive PDF form through mail, as INLINE (i.e. displayed in the body of the message item),and not as ATTACHMENT.
i.e. The Interactive PDF content should be seen in the body page of the mail itself.
I have to send the PDF from a java application. I was able to do it with an image(as INLINE) using the HTML tag <img>.
For PDF, I tried using the HTML tags <iframe> and <embed>. i even tried javascript embeded within HTML code. But no use.
IMPORTANT : Please note that, it is an Interactive PDF form, there will be editable Input fields in the PDF file.
Any one please help me to solve this....
Thanks,
Prabhakar.You can set the main content of your message to be the PDF content with MIME
type application/pdf, but I doubt that you can convince most mailers to display this
content as you intend. As far as I know, this is not a commonly supported feature.
If you can use some other program to create a message that displays the way you
want, you can copy the structure of that message with your JavaMail program. -
Sending spool request through email
Hi
I am executing ransaction SP01. then i am displaying spool requests of a particular user. next screen shows spool reuqests of that user. now when i click on a spool request , on next screen in meny send mail option is not appearing. How can i send contents of my output via emai.
Thanks in advanceAlfonsus
Thanks for your reply. I tried that. I am getting a document in mail box with following error
Error log
E0332 EDI: Partner profile not available
F0251 In form F110_US_AVIS / window MAIN , the element 610-H (Text-H) is missing
F0253 Output of the relevant forms is defective
Can you help on this.
Thanks -
HI,
I need to send the pdf through email. for that i have used 'CONVERT_OTF_2_PDF' which converts into PDF.
Now how to send this through mail.Hi
[Check this|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/convertSpoolrequesttoPDFandsendase-mail]
Regards
Pavan -
ALV output converted into PDF format and send that PDF to user through mail
Hi Experts,
I have report earlier its output was in alv grid.
Now i want that ALV output converted into PDF format.And that PDF output send to user through mail.
Can u please tell how to do?
My code is here(output is displaying in ALV grid).
INCLUDE <icon>.
TYPE-POOLS: slis, kkblo.
TABLES : zmsd_freight_hdr, zmsd_freight_det, zmsd_blinfo, zmsd_diheader.
TABLES : lfa1.
DATA : t_hdr LIKE zmsd_freight_hdr OCCURS 0 WITH HEADER LINE,
T_DET LIKE ZMSD_FREIGHT_DET OCCURS 0 WITH HEADER LINE,
t_bl LIKE zmsd_blinfo OCCURS 0 WITH HEADER LINE,
t_di LIKE zmsd_diheader OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF t_det OCCURS 0.
INCLUDE STRUCTURE zmsd_freight_det.
DATA type(30).
DATA: END OF t_det.
DATA: v_target2(30),
v_zsammg LIKE t_det-zsammg,
v_gsttotal LIKE t_det-zamount.
DATA : BEGIN OF t_data OCCURS 0,
zsammg LIKE zmsd_freight_hdr-zsammg,
zdidbl LIKE zmsd_freight_hdr-zdidbl,
zvkorg LIKE zmsd_freight_hdr-zvkorg,
zinvno LIKE zmsd_freight_hdr-zinvno,
zttlamt LIKE zmsd_freight_hdr-zttlamt,
zstatus LIKE zmsd_freight_hdr-zstatus,
ztype LIKE zmsd_freight_hdr-ztype,
zconfirm LIKE zmsd_freight_hdr-zconfirm,
zconfirmdate LIKE zmsd_freight_hdr-zconfirmdate,
erdat LIKE zmsd_freight_hdr-erdat,
ernam LIKE zmsd_freight_hdr-ernam,
erzet LIKE zmsd_freight_hdr-erzet,
aedat(10),
aenam LIKE zmsd_freight_hdr-aenam,
aezet LIKE zmsd_freight_hdr-aezet,
zline LIKE zmsd_freight_det-zline,
zfptype LIKE zmsd_freight_det-zfptype,
zchrcode LIKE zmsd_freight_det-zchrcode,
zcurcode LIKE zmsd_freight_det-zcurcode,
zqty LIKE zmsd_freight_det-zqty,
zuom LIKE zmsd_freight_det-zuom,
zrate LIKE zmsd_freight_det-zrate,
zamount LIKE zmsd_freight_det-zamount,
zexrate LIKE zmsd_freight_det-zexrate,
zccode LIKE zmsd_blinfo-zccode, "MADK991565
zccode like ZMSD_FREIGHT_HDR-zfcode, "MADK991565
zbldate(10),
zbl LIKE zmsd_blinfo-zbl,
type(3),
waerk LIKE zmsd_freight_det-zcurcode,
zamountl LIKE zmsd_freight_det-zamount,
END OF t_data.
DATA : w_layout TYPE slis_layout_alv,
w_catalog TYPE slis_fieldcat_alv,
t_catalog TYPE slis_t_fieldcat_alv,
w_sort TYPE slis_sortinfo_alv,
t_sort TYPE slis_t_sortinfo_alv.
DATA V_ZINVNO like T_HDR-ZINVNO. "MADK991565
DATA : v_count TYPE i.
SELECTION-SCREEN BEGIN OF BLOCK a0 WITH FRAME TITLE text-001.
PARAMETERS : p_zvkorg LIKE zmsd_freight_hdr-zvkorg OBLIGATORY .
SELECT-OPTIONS : s_zdidbl FOR zmsd_freight_hdr-zdidbl ,
s_zccode FOR lfa1-lifnr ,
s_status FOR zmsd_freight_hdr-zstatus ,
s_ztype FOR zmsd_freight_hdr-ztype ,
s_erdat FOR zmsd_freight_hdr-erdat ,
s_ernam FOR zmsd_freight_hdr-ernam ,
s_zconfd FOR zmsd_freight_hdr-zconfirmdate .
PARAMETERS : p_zconf AS CHECKBOX .
SELECTION-SCREEN END OF BLOCK a0.
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-002.
PARAMETERS : p_hdr RADIOBUTTON GROUP rad DEFAULT 'X' ,
p_det RADIOBUTTON GROUP rad .
SELECTION-SCREEN END OF BLOCK a1.
INITIALIZATION.
AT SELECTION-SCREEN.
START-OF-SELECTION.
PERFORM get_data.
PERFORM process.
PERFORM display.
END-OF-SELECTION.
PERFORM fm_get_num_pages.
AT USER-COMMAND.
AT LINE-SELECTION.
TOP-OF-PAGE.
PERFORM fm_top_of_page USING '7010' sy-title space.
FORM get_data.
SELECT *
FROM zmsd_freight_hdr
INTO TABLE t_hdr
WHERE zvkorg EQ p_zvkorg
AND zdidbl IN s_zdidbl
AND zstatus IN s_status
AND ztype IN s_ztype
AND erdat IN s_erdat
AND ernam IN s_ernam
AND zconfirmdate IN s_zconfd
AND ZFCODE IN S_ZCCODE. "MADK991565
IF p_zconf = 'X'.
DELETE t_hdr WHERE zconfirm NE 'C'.
ENDIF.
CHECK NOT t_hdr[] IS INITIAL.
SELECT *
FROM zmsd_blinfo
INTO TABLE t_bl
FOR ALL ENTRIES IN t_hdr
WHERE zsammg = t_hdr-zsammg.
SORT t_bl BY zsammg.
SELECT *
FROM zmsd_diheader
INTO TABLE t_di
FOR ALL ENTRIES IN t_hdr
WHERE zsammg = t_hdr-zsammg.
SORT t_di BY zsammg.
IF P_DET = 'X'. "MADK933361
SELECT *
FROM zmsd_freight_det
INTO TABLE t_det
FOR ALL ENTRIES IN t_hdr
WHERE zsammg = t_hdr-zsammg
AND ZINVNO = T_HDR-ZINVNO . "MADK991565
SORT t_det BY zsammg zline. "MADK991565
SORT T_DET BY ZSAMMG ZINVNO ZLINE. "MADK991565
ENDIF. "MADK933361
ENDFORM.
FORM process.
REFRESH t_data.
CLEAR v_gsttotal. "MADK933361
LOOP AT t_hdr.
Start of MADK933361
CLEAR: v_target2.
v_zsammg = t_hdr-zsammg.
V_ZINVNO = T_HDR-ZINVNO. "MADK991565
AT NEW zsammg. "MADK991565
AT NEW ZINVNO. "MADK991565
PERFORM get_gst_value.
ENDAT.
End of MADK933361
PERFORM move_header.
CHECK t_data-zccode IN s_zccode.
IF p_det = 'X'.
CSF Project Changes Starts DEV34 MADK985782
LOOP AT T_DET WHERE ZSAMMG = T_HDR-ZSAMMG..
LOOP AT t_det WHERE zsammg = t_hdr-zsammg AND
zinvno = t_hdr-zinvno.
CSF Project Changes Ends DEV34 MADK985782
PERFORM move_header.
CHECK t_data-zccode IN s_zccode.
MOVE-CORRESPONDING t_det TO t_data.
t_data-zamountl = t_data-zamount * t_data-zexrate.
APPEND t_data.
CLEAR t_data.
ENDLOOP.
ELSE.
APPEND t_data.
CLEAR t_data.
ENDIF.
AT END OF zsammg.
CLEAR v_gsttotal.
ENDAT.
*Start of changes for IS090901289-PIA MADK991565
AT END OF ZINVNO.
CLEAR V_GSTTOTAL.
ENDAT.
*End of changes for IS090901289-PIA MADK991565
ENDLOOP.
ENDFORM.
FORM move_header.
MOVE-CORRESPONDING t_hdr TO t_data.
t_data-zttlamt = t_data-zttlamt + v_gsttotal. "MADK933361
t_data-waerk = 'SGD'.
IF NOT t_hdr-aedat IS INITIAL.
WRITE: t_hdr-aedat TO t_data-aedat.
ELSE.
CLEAR : t_data-aedat.
ENDIF.
READ TABLE t_bl WITH KEY zsammg = t_hdr-zsammg BINARY SEARCH.
IF sy-subrc EQ 0.
t_data-zccode = t_bl-zccode. "MADK991565
T_DATA-ZCCODE = T_HDR-ZFCODE. "MADK991565
IF NOT t_bl-zbldate IS INITIAL.
WRITE: t_bl-zbldate TO t_data-zbldate.
ENDIF.
t_data-zbl = t_bl-zbl.
t_data-type = 'DBL'.
ELSE.
READ TABLE t_di WITH KEY zsammg = t_hdr-zsammg BINARY SEARCH.
IF sy-subrc EQ 0.
t_data-zccode = t_di-zdiforcode. "MADK991565
T_DATA-ZCCODE = T_HDR-ZFCODE. "MADK991565
t_data-type = 'DI'.
ENDIF.
ENDIF.
ENDFORM.
FORM display.
IF t_data[] IS INITIAL.
MESSAGE s398(00) WITH 'No Data Selected'.
EXIT.
ENDIF.
DATA : l_repid LIKE sy-repid.
l_repid = sy-repid.
REFRESH t_catalog.
CLEAR t_catalog.
w_layout-cell_merge = 'X'.
PERFORM map_fields.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_repid
i_callback_user_command = 'ALV_USER_COMMAND'
is_layout = w_layout
it_fieldcat = t_catalog[]
i_grid_title = sy-title
i_save = 'A'
it_sort = t_sort[]
TABLES
t_outtab = t_data
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
ENDFORM.
FORM map_fields.
Sort Order
CLEAR v_count.
PERFORM sf USING 'ZDIDBL' 'X' 'X'.
Fields to be displayed
CLEAR v_count.
IF p_hdr = 'X'.
PERFORM af USING :
DESCRIPTION FIELD LEN RTABLE RFIELD
'DI/DBL ' 'ZDIDBL' '14' ' ' ' ',
'Type ' 'TYPE' '04' ' ' ' ',
'Forwarder Code ' 'ZCCODE' '14' ' ' ' ',
'BL Number ' 'ZBL' '14' ' ' ' ',
'BL Date ' 'ZBLDATE' '10' ' ' ' ',
'Invoice Number ' 'ZINVNO' '15' ' ' ' ',
'Extraction ' 'ZSTATUS' '05' 'ZMSD_FREIGHT_HDR' 'ZSTATUS ',
'Freight Type ' 'ZTYPE' '05' 'ZMSD_FREIGHT_HDR' 'ZTYPE ',
'Confirmation ' 'ZCONFIRM' '05' 'ZMSD_FREIGHT_HDR' 'ZCONFIRM',
'Confirm Date ' 'ZCONFIRMDATE' '10' 'ZMSD_FREIGHT_HDR'
'ZCONFIRMDATE',
'Total Amount ' 'ZTTLAMT' '18' ' ' ' ',
'Created On ' 'ERDAT' '10' ' ' ' ',
'Created By ' 'ERNAM' '10' ' ' ' ',
'Changed On ' 'AEDAT' '10' ' ' ' ',
'Changed By ' 'AENAM' '10' ' ' ' '.
ELSE.
PERFORM af USING :
DESCRIPTION FIELD LEN RTABLE RFIELD
'DI/DBL ' 'ZDIDBL' '14' ' ' ' ',
'Type ' 'TYPE' '04' ' ' ' ',
'Forwarder Code ' 'ZCCODE' '14' ' ' ' ',
'BL Number ' 'ZBL' '14' ' ' ' ',
'BL Date ' 'ZBLDATE' '10' ' ' ' ',
'Invoice Number ' 'ZINVNO' '15' ' ' ' ',
'Extraction ' 'ZSTATUS' '05' 'ZMSD_FREIGHT_HDR' 'ZSTATUS ',
'Freight Type ' 'ZTYPE' '05' 'ZMSD_FREIGHT_HDR' 'ZTYPE ',
'Confirmation ' 'ZCONFIRM' '05' 'ZMSD_FREIGHT_HDR' 'ZCONFIRM',
'Confirm Date ' 'ZCONFIRMDATE' '10' 'ZMSD_FREIGHT_HDR'
'ZCONFIRMDATE',
'Total Amount ' 'ZTTLAMT' '18' ' ' ' ',
'Freight Payment ' 'ZFPTYPE' '14' ' ' ' ',
'Charge Code ' 'ZCHRCODE' '10' ' ' ' ',
'Currency ' 'ZCURCODE' '08' ' ' ' ',
'Quantity ' 'ZQTY' '13' ' ' ' ',
'UoM ' 'ZUOM' '04' ' ' ' ',
'Rate ' 'ZRATE' '15' ' ' ' ',
'Amt(Foreign Curr)' 'ZAMOUNT' '16' ' ' ' ',
'Exchange Rate ' 'ZEXRATE' '13' ' ' ' ',
'Amt(Local Curr) ' 'ZAMOUNTL' '16' ' ' ' ',
'Created On ' 'ERDAT' '10' ' ' ' ',
'Created By ' 'ERNAM' '10' ' ' ' ',
'Changed On ' 'AEDAT' '10' ' ' ' ',
'Changed By ' 'AENAM' '10' ' ' ' '.
ENDIF.
ENDFORM.
FORM af USING text
field
len
table
reffield.
v_count = v_count + 1.
w_catalog-col_pos = v_count.
w_catalog-fieldname = field.
w_catalog-ref_tabname = table.
w_catalog-ref_fieldname = reffield.
w_catalog-seltext_s = text.
w_catalog-seltext_m = text.
w_catalog-seltext_l = text.
w_catalog-outputlen = len.
IF field = 'ZTTLAMT' OR field = 'ZAMOUNTL'.
w_catalog-no_zero = 'X'.
w_catalog-cfieldname = 'WAERK'.
w_catalog-datatype = 'CURR'.
ENDIF.
IF FIELD = 'ZRATE' OR FIELD = 'ZAMOUNT'.
IF field = 'ZAMOUNT'.
w_catalog-no_zero = 'X'.
w_catalog-cfieldname = 'ZCURCODE'.
w_catalog-datatype = 'CURR'.
ENDIF.
IF field = 'ZQTY' OR field = 'ZRATE'.
w_catalog-no_zero = 'X'.
w_catalog-datatype = 'DEC'.
ENDIF.
APPEND w_catalog TO t_catalog.
CLEAR w_catalog.
ENDFORM.
FORM sf USING fieldname sortup group.
v_count = v_count + 1.
CLEAR w_sort.
w_sort-fieldname = fieldname.
w_sort-spos = v_count.
w_sort-up = sortup.
w_sort-group = group.
APPEND w_sort TO t_sort.
ENDFORM.
FORM alv_user_command USING in_ucomm LIKE sy-ucomm
in_selfield TYPE slis_selfield.
DATA: lfs_data LIKE t_data.
IF in_ucomm = '&IC1'.
READ TABLE t_data INDEX in_selfield-tabindex INTO lfs_data.
CHECK NOT lfs_data-zdidbl IS INITIAL.
IF lfs_data-type = 'DBL'.
DATA: l_zdbl LIKE zmsd_diheader-zdinum.
l_zdbl = in_selfield-value.
EXPORT l_zdbl TO MEMORY ID 'VBL'.
CALL TRANSACTION 'ZMSD_BL01'.
ENDIF.
IF lfs_data-type = 'DI'.
DATA: v_dinum LIKE zmsd_diheader-zdinum.
v_dinum = in_selfield-value.
EXPORT v_dinum TO MEMORY ID 'VDI'.
CALL TRANSACTION 'ZMSD_DI01'.
ENDIF.
ENDIF.
ENDFORM.
FORM get_gst_value.
LOOP AT t_det WHERE zsammg = v_zsammg
AND ZINVNO = V_ZINVNO. "MADK991565
CHECK t_data-zccode IN s_zccode.
t_det-zamount = t_det-zamount * t_det-zexrate.
SELECT SINGLE y0mmtarget2
INTO v_target2
FROM y0mmipstranslate
WHERE y0mmdatatype = '70' AND
y0mmsource = t_det-zchrcode.
SELECT SINGLE y0mmtarget1
INTO t_det-type
FROM y0mmipstranslate
WHERE y0mmdatatype = '76' AND
y0mmsource = v_target2.
IF t_det-type NE '3Z'.
v_gsttotal = v_gsttotal +
( t_det-zamount * 5 / 100 ).
ENDIF.
ENDLOOP.
Regards,
Raj.Hello,
Following is the procedure to convert alv output to spool and then it to PDF Format.
After we display the ALV, we can check whether it is running in the background using system field u2018sy-batchu2018. Then,we call an function module named u2018GET_JOB_RUNTIME_INFOu2019 to get the current job information. Then go to spool request table tbtcp to get the spool id.
Get current job details
CALL FUNCTION u2018GET_JOB_RUNTIME_INFOu2019
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> u20180000000000u2032
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
Finally, we can call function module u2018CONVERT_ABAPSPOOLJOB_2_PDFu2018 to convert spool reqeust(which is stored in OTF format) to PDF format. Then we can call either function module u2018SO_DOCUMENT_SEND_API1u2032 or SAP BCS (Business Communication Service) to send the pdf as an email attachment.
CALL FUNCTION u2018CONVERT_ABAPSPOOLJOB_2_PDFu2019
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
Regards,
Sayali
Edited by: Sayali Paradkar on Apr 20, 2010 12:51 PM -
Error while sending PO output through mail in PDF format - Urgent
Dear friends,
Developed program to send sapscript output through mail in pdf format, the program running properly, even function module SO_NEW_DOCUMENT_ATT_SEND_API1 returning sy-subrc 0. But the external mail is not going to user lying in SAP outbox with message <b>"Wait for communications service"</b> . SCOT is properly configured, tested mails sending through SAP office.
Find below the source code:
REPORT zmm_porder_gm
NO STANDARD PAGE HEADING.
TABLES: ekko, ekpa, t161t, t052, komv, j_1imocomp, t001, esll.
Internal Tables
DATA : txt LIKE tline-tdline, "HEADER LINE
your_ref LIKE ekko-ihrez, "your ref
our_ref LIKE ekko-unsez, "our ref
mcompname LIKE t001-butxt,
itemname LIKE ekpo-txz01,
del_text LIKE tline-tdline, "delivery text
mat_po_text LIKE tline-tdline. "material po text
DATA: g_ind TYPE i.
DATA: it_esll LIKE esll OCCURS 0 WITH HEADER LINE.
DATA: sub_packno LIKE esll-sub_packno.
DATA : po_flag(1) TYPE c.
DATA : it_erev LIKE erev OCCURS 0 WITH HEADER LINE.
DATA : nmebeln LIKE thead-tdname,
obj LIKE thead-tdname.
DATA : tline LIKE tline OCCURS 0 WITH HEADER LINE. "HEADER TEXT
DATA : it_ekko LIKE ekko OCCURS 0 WITH HEADER LINE.
DATA : it_ekpo LIKE ekpo OCCURS 0 WITH HEADER LINE.
DATA : it_zmm_porder LIKE zmm_porder OCCURS 0 WITH HEADER LINE.
DATA : it_konv LIKE konv OCCURS 0 WITH HEADER LINE.
DATA : it_konv_ftr LIKE konv OCCURS 0 WITH HEADER LINE.
DATA : it_konv_rate LIKE konv OCCURS 0 WITH HEADER LINE.
DATA : it_komv_tax LIKE komv OCCURS 0 WITH HEADER LINE. " For Tax Calculation
DATA : it_zmm_house_bank LIKE zmm_house_bank OCCURS 0 WITH HEADER LINE.
*DATA : mrate TYPE konv-kbetr VALUE 0, mrate1(15). rmoved by ganes and added following logic
DATA : mrate TYPE p VALUE 0 DECIMALS 2, mrate1(15).
DATA : mrate_gm TYPE p DECIMALS 2.
DATA : BEGIN OF it_konv1 OCCURS 0,
knumv LIKE konv-knumv,
kschl LIKE konv-kschl,
END OF it_konv1.
DATA : BEGIN OF it_t052u OCCURS 0.
INCLUDE STRUCTURE t052u.
DATA : END OF it_t052u.
DATA : mpay_terms LIKE t052u-text1.
DATA : mwaers LIKE konv-waers.
DATA : BEGIN OF xt052 OCCURS 0.
INCLUDE STRUCTURE t052.
DATA : END OF xt052.
DATA : it_t16ct LIKE t16ct OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF ztext OCCURS 0.
INCLUDE STRUCTURE ttext.
DATA : END OF ztext.
DATA : it_t001 LIKE t001 OCCURS 0 WITH HEADER LINE.
DATA : mtext(15) TYPE c.
DATA : it_adrc LIKE adrc OCCURS 0 WITH HEADER LINE.
DATA : it_adrc_ven LIKE adrc OCCURS 0 WITH HEADER LINE.
DATA : it_adrc_plt LIKE adrc OCCURS 0 WITH HEADER LINE.
DATA : it_makt LIKE makt OCCURS 0 WITH HEADER LINE.
DATA : it_eket LIKE eket OCCURS 0 WITH HEADER LINE. " Schedulling
DATA : it_eikp LIKE eikp OCCURS 0 WITH HEADER LINE. " Export
DATA : it_t001w LIKE t001w OCCURS 0 WITH HEADER LINE.
DATA : it_t685t LIKE t685t OCCURS 0 WITH HEADER LINE.
DATA : it_t618t LIKE t618t OCCURS 0 WITH HEADER LINE.
DATA : it_t685t_ftr LIKE t685t OCCURS 0 WITH HEADER LINE.
DATA : it_lfa1 LIKE lfa1 OCCURS 0 WITH HEADER LINE.
DATA : it_bapi_mltx_ga LIKE bapi_mltx_ga OCCURS 0 WITH HEADER LINE. "Material long text
DATA : mfirst TYPE i VALUE 0,
mpay_flag(1) TYPE c VALUE 'X',
mwerks LIKE t001w-werks,
msr TYPE i VALUE 0,
l_rate TYPE p DECIMALS 2 VALUE 0,
l_amt TYPE p DECIMALS 2 VALUE 0,
mflag(1) TYPE c,
mlctr TYPE i VALUE 0,
mfamt TYPE p DECIMALS 2 VALUE 0,
mcfamt(15) TYPE c,
mfword(100) TYPE c,
mkschl LIKE konv-kschl,
mchgamt TYPE p DECIMALS 2 VALUE 0,
mkbetr TYPE p DECIMALS 2 VALUE 0,
mkwert TYPE p DECIMALS 2 VALUE 0.
DATA : j_1iexcd TYPE j_1imocomp-j_1iexcd,
j_1icstno TYPE j_1imocomp-j_1icstno,
j_1ilstno TYPE j_1imocomp-j_1ilstno.
DATA : mjmop_r TYPE p DECIMALS 2 VALUE 0,
mjmoq_r TYPE p DECIMALS 2 VALUE 0,
mjecs_r TYPE p DECIMALS 2 VALUE 0,
mjvcs_r TYPE p DECIMALS 2 VALUE 0,
mjvrd_r TYPE p DECIMALS 2 VALUE 0,
mjsep_r TYPE p DECIMALS 2 VALUE 0.
DATA : mjmop_a TYPE p DECIMALS 2 VALUE 0,
mjmoq_a TYPE p DECIMALS 2 VALUE 0,
mjecs_a TYPE p DECIMALS 2 VALUE 0,
mjvcs_a TYPE p DECIMALS 2 VALUE 0,
mjvrd_a TYPE p DECIMALS 2 VALUE 0,
mjsep_a TYPE p DECIMALS 2 VALUE 0.
DATA : mtitle LIKE t161t-batxt.
DATA : no_ammend(10),request_by(50),ver_txt(100),ver_reason(100),stext(200).
begin of Email data declarations**************
DATA: BEGIN OF otf OCCURS 0.
INCLUDE STRUCTURE itcoo .
DATA: END OF otf.
DATA: itcpo LIKE itcpo.
DATA: itcpp LIKE itcpp.
DATA: it_docs TYPE STANDARD TABLE OF docs,
v_bin_filesize TYPE i,
it_lines TYPE STANDARD TABLE OF tline,
wa_lines TYPE tline.
DATA : i_pdf LIKE tline OCCURS 1000 WITH HEADER LINE,
v_pdf_bytecount TYPE i,
v_pdf_spoolid TYPE tsp01-rqident,
v_otf_pagecount TYPE i,
v_btc_jobname TYPE tbtcjob-jobname,
v_btc_jobcount TYPE tbtcjob-jobcount.
DATA: objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
DATA: doc_chng LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
DATA: vafilename(100) VALUE 'po_output.pdf'.
DATA: jobdata TYPE sxjobdata.
DATA arc_params TYPE arc_params.
DATA print_params TYPE pri_params.
DATA g_send_prog TYPE syrepid VALUE 'ZVF03_TEST_PROG'.
DATA immediate TYPE btcchar1.
DATA: i_jobname TYPE tbtcp-jobname,
i_jobcount TYPE tbtcp-jobcount,
i_jobstepcount TYPE tbtcp-stepcount.
DATA recipient_obj LIKE swotobjid.
CONSTANTS: sx_true TYPE sx_boolean VALUE 'X'.
TABLES: tbtcp.
end of Email data declarations**************
SELECTION-SCREEN : BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : mebeln FOR ekko-ebeln OBLIGATORY . " 75
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 12.
SELECTION-SCREEN COMMENT (20) text-b01.
PARAMETERS: b1 AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN : END OF BLOCK block1.
SELECTION-SCREEN: BEGIN OF SCREEN 200 TITLE text-001 AS WINDOW.
PARAMETERS : p_email TYPE ad_smtpadr. "E-Mail Address
SELECTION-SCREEN: END OF SCREEN 200.
INITIALIZATION.
SET PF-STATUS 'ZMMPORD_STAT'.
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN 'EMAIL'.
PERFORM zemail.
WHEN '&IC1'.
PERFORM load_data.
PERFORM process.
IF NOT p_email IS INITIAL.
PERFORM send_mail.
ENDIF.
ENDCASE.
*START-OF-SELECTION.
PERFORM load_data.
PERFORM process.
FORM load_data .
DATA : gindex LIKE sy-tabix.
SELECT * FROM t16ct INTO TABLE it_t16ct WHERE spras = 'EN'.
SELECT * FROM ekko INTO TABLE it_ekko WHERE ebeln IN mebeln.
IF sy-subrc EQ 0.
SELECT * FROM erev INTO CORRESPONDING FIELDS OF TABLE it_erev FOR ALL ENTRIES IN it_ekko
WHERE edokn = it_ekko-ebeln AND rscod <> '' .
SORT it_erev BY edokn revno DESCENDING.
LOOP AT it_ekko.
IF NOT ( it_ekko-frgke EQ 'O' OR it_ekko-frgke EQ '0' ) .
MESSAGE e000(zsd) WITH 'Purchase Order is not Realeased'.
ENDIF.
ENDLOOP.
SELECT * FROM ekpo INTO TABLE it_ekpo WHERE ebeln IN mebeln.
IF sy-subrc EQ 0.
SELECT * INTO TABLE it_makt
FROM makt
FOR ALL ENTRIES IN it_ekpo
WHERE matnr EQ it_ekpo-matnr.
SELECT * INTO TABLE it_lfa1
FROM lfa1
FOR ALL ENTRIES IN it_ekko
WHERE lifnr EQ it_ekko-lifnr.
ENDIF.
SELECT *
INTO TABLE it_t052u
FROM t052u
FOR ALL ENTRIES IN it_ekko
WHERE zterm EQ it_ekko-zterm
AND spras EQ 'EN'.
IF sy-subrc EQ 0.
SORT it_t052u BY zterm.
ENDIF.
SELECT * FROM eket INTO TABLE it_eket WHERE ebeln IN mebeln.
IF sy-subrc EQ 0.
SORT it_eket BY ebeln ebelp.
ENDIF.
SELECT *
INTO TABLE it_eikp
FROM eikp
FOR ALL ENTRIES IN it_ekko
WHERE exnum EQ it_ekko-exnum.
IF sy-subrc EQ 0.
SORT it_eikp BY exnum.
SELECT *
INTO TABLE it_t618t
FROM t618t
FOR ALL ENTRIES IN it_eikp
WHERE expvz EQ it_eikp-expvz
AND spras EQ 'E'
AND land1 EQ 'IN'.
IF sy-subrc EQ 0.
SORT it_t618t BY expvz.
ENDIF.
ENDIF.
REFRESH : it_zmm_porder.
CLEAR : it_zmm_porder.
SELECT * INTO TABLE it_zmm_porder
FROM zmm_porder
WHERE flag EQ 'L'.
IF sy-subrc EQ 0.
SORT it_zmm_porder BY kschl.
ENDIF.
SELECT * FROM konv INTO TABLE it_konv
FOR ALL ENTRIES IN it_ekko
WHERE knumv = it_ekko-knumv
AND kwert NE 0.
LOOP AT it_konv.
gindex = sy-tabix.
READ TABLE it_zmm_porder WITH KEY kschl = it_konv-kschl BINARY SEARCH.
IF sy-subrc NE 0.
DELETE it_konv INDEX gindex.
ENDIF.
ENDLOOP.
IF sy-subrc EQ 0.
SORT it_konv BY knumv kherk kschl.
ENDIF.
REFRESH : it_zmm_porder.
CLEAR : it_zmm_porder.
SELECT * INTO TABLE it_zmm_porder
FROM zmm_porder
WHERE flag EQ 'F'.
IF sy-subrc EQ 0.
SORT it_zmm_porder BY kschl.
ENDIF.
SELECT * INTO TABLE IT_KONV_FTR FROM KONV
FOR ALL ENTRIES IN IT_EKKO
WHERE KNUMV = IT_EKKO-KNUMV
AND ( KSCHL = 'ZIN1'
OR KSCHL = 'ZIN2'
OR KSCHL = 'ZINS'
OR KSCHL = 'ZPF1'
OR KSCHL = 'ZPF2'
OR KSCHL = 'ZPF3'
OR KSCHL = 'ZPKG'
OR KSCHL = 'ZPKF'
OR KSCHL = 'FRA1'
OR KSCHL = 'FRB1'
OR KSCHL = 'FRC1'
OR KSCHL = 'FRD1'
OR KSCHL = 'FRD2'
OR KSCHL = 'FRD3'
OR KSCHL = 'FRD4'
OR KSCHL = 'FRD5'
*****Added one condition type below ZFBC as on 05.06.2007 :Rajiv as per mail of Sadiq via mathew sir(RTDK906646)
OR KSCHL = 'ZFBC' )
AND KWERT NE 0
AND KPOSN GT '000000'.
AND ( KRECH = 'B' " RTDK906167
OR KRECH = 'A' ).
SELECT * INTO TABLE it_konv_ftr FROM konv
FOR ALL ENTRIES IN it_ekko
WHERE knumv = it_ekko-knumv
AND kwert NE 0
AND kposn GT '000000'.
LOOP AT it_konv_ftr.
gindex = sy-tabix.
READ TABLE it_zmm_porder WITH KEY kschl = it_konv_ftr-kschl BINARY SEARCH.
IF sy-subrc NE 0.
DELETE it_konv_ftr INDEX gindex.
ENDIF.
ENDLOOP.
IF it_konv_ftr[] IS NOT INITIAL.
SORT it_konv_ftr BY knumv kschl.
ENDIF.
SELECT KNUMV KSCHL INTO CORRESPONDING FIELDS OF TABLE IT_KONV1 FROM KONV
FOR ALL ENTRIES IN IT_EKKO
WHERE KNUMV = IT_EKKO-KNUMV
and kherk = 'D'
AND ( KSCHL = 'ZIN1'
OR KSCHL = 'ZIN2'
OR KSCHL = 'ZINS'
OR KSCHL = 'ZPF1'
OR KSCHL = 'ZPF2'
OR KSCHL = 'ZPF3'
OR KSCHL = 'ZPKG'
OR KSCHL = 'ZPKF'
OR KSCHL = 'FRA1'
OR KSCHL = 'FRB1'
OR KSCHL = 'FRC1'
OR KSCHL = 'FRD1'
OR KSCHL = 'FRD2'
OR KSCHL = 'FRD3'
OR KSCHL = 'FRD4'
OR KSCHL = 'FRD5'
*****Added one condition type below ZFBC as on 05.06.2007 :Rajiv as per mail of Sadiq via mathew sir(RTDK906646)
OR KSCHL = 'ZFBC' )
AND KWERT NE 0.
AND ( KRECH = 'B' RTDK906167
OR KRECH = 'A' ).
SELECT knumv kschl INTO CORRESPONDING FIELDS OF TABLE it_konv1 FROM konv
FOR ALL ENTRIES IN it_ekko
WHERE knumv = it_ekko-knumv
AND kwert NE 0.
DELETE ADJACENT DUPLICATES FROM it_konv1 COMPARING knumv kschl.
LOOP AT it_konv1.
gindex = sy-tabix.
READ TABLE it_zmm_porder WITH KEY kschl = it_konv1-kschl BINARY SEARCH.
IF sy-subrc NE 0.
DELETE it_konv1 INDEX gindex.
ENDIF.
ENDLOOP.
IF sy-subrc EQ 0.
SORT it_konv1 BY knumv kschl.
ENDIF.
SELECT * INTO TABLE it_t685t
FROM t685t
FOR ALL ENTRIES IN it_konv
WHERE kschl EQ it_konv-kschl
AND kappl EQ it_konv-kappl
AND spras EQ 'E'.
SELECT * INTO TABLE it_t685t_ftr
FROM t685t
FOR ALL ENTRIES IN it_konv_ftr
WHERE kschl EQ it_konv_ftr-kschl
AND kappl EQ it_konv_ftr-kappl
AND spras EQ 'E'.
it_t685t_ftr-kschl = 'JVCS'.
it_t685t_ftr-vtext = 'IN CST in vat'.
APPEND it_t685t_ftr.
SELECT * INTO TABLE it_zmm_house_bank
FROM zmm_house_bank
WHERE ebeln IN mebeln.
ELSE.
MESSAGE e899(mm) WITH 'Data not found for selection criteria...'.
ENDIF.
ENDFORM. " Load_data
FORM process .
DATA : mctr TYPE i VALUE 1.
DATA : gindex LIKE sy-tabix.
DATA : mline(75) TYPE c.
DATA : mlifn2 LIKE ekpa-lifn2.
DATA : mv_name LIKE lfa1-name1,
madrnr LIKE lfa1-adrnr.
CLEAR itcpo.
itcpo-tdgetotf = 'X'.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'ZMM_PORDER'
language = sy-langu
OPTIONS = itcpo
dialog = ' '
EXCEPTIONS
OTHERS = 1.
LOOP AT it_ekko.
CALL FUNCTION 'START_FORM'
EXPORTING
form = 'ZMM_PORDER'.
SELECT SINGLE *
FROM t001
INTO it_t001
WHERE bukrs EQ it_ekko-bukrs.
mcompname = it_t001-butxt.
TRANSLATE mcompname TO UPPER CASE.
Document Type
SELECT SINGLE batxt
INTO mtitle
FROM t161t
WHERE bstyp EQ 'F'
AND spras EQ 'E'
AND bsart EQ it_ekko-bsart.
REFRESH it_adrc.
SELECT SINGLE werks
INTO mwerks
FROM ekpo
WHERE ebeln EQ it_ekko-ebeln.
SELECT SINGLE *
INTO it_t001w
FROM t001w
WHERE werks EQ mwerks.
REFRESH it_adrc.
SELECT SINGLE *
INTO it_adrc_plt
FROM adrc
WHERE addrnumber EQ it_t001w-adrnr.
REFRESH : xt052.
mfamt = 0.
msr = 0.
in 500c this statement failed.
SELECT SINGLE * FROM T052 INTO XT052 WHERE ZTERM = IT_EKKO-ZTERM.
CALL FUNCTION 'FI_TEXT_ZTERM'
EXPORTING
I_T052 = XT052
TABLES
T_ZTEXT = ZTEXT.
As per Preeti... Shipment address should be shown on top as purchase order company address. 27.04.
PERFORM writeform USING 'PLANT' 'PLANT'.
SELECT SINGLE name1 adrnr
INTO (mv_name,madrnr)
FROM lfa1
WHERE lifnr EQ it_ekko-lifnr.
REFRESH it_adrc[].
CLEAR it_adrc[].
FREE it_adrc[].
SELECT SINGLE *
INTO it_adrc_ven
FROM adrc
WHERE addrnumber EQ madrnr.
READ TABLE it_lfa1 WITH KEY lifnr = it_ekko-lifnr.
PERFORM writeform USING 'VENDOR' 'VENDOR'.
Shipment
SELECT SINGLE werks
INTO mwerks
FROM ekpo
WHERE ebeln EQ it_ekko-ebeln.
up to 1 rows.
SELECT SINGLE *
INTO it_t001w
FROM t001w
WHERE werks EQ mwerks.
SELECT SINGLE j_1iexcd j_1icstno j_1ilstno
INTO (j_1iexcd,j_1icstno,j_1ilstno)
FROM j_1imocomp
WHERE werks = mwerks.
REFRESH it_adrc.
SELECT SINGLE *
INTO it_adrc
FROM adrc
WHERE addrnumber EQ it_t001w-adrnr.
PERFORM writeform USING 'SHIPMNT' 'SHIPMNT'.
READ TABLE it_eikp WITH KEY exnum = it_ekko-exnum.
IF sy-subrc EQ 0.
READ TABLE it_t618t WITH KEY expvz = it_eikp-expvz.
ENDIF.
your_ref = it_ekko-ihrez.
our_ref = it_ekko-unsez.
READ TABLE it_erev WITH KEY edokn = it_ekko-ebeln.
IF sy-subrc = 0.
no_ammend = it_erev-revno.
request_by = it_erev-crnam.
ver_txt = it_erev-txz01.
READ TABLE it_t16ct WITH KEY rscod = it_erev-rscod.
IF sy-subrc = 0.
ver_reason = it_t16ct-rstxt.
ELSE.
ver_reason = ''.
ENDIF.
ELSE.
no_ammend = ''.
request_by = ''.
ver_txt = ''.
ver_reason = ''.
ENDIF.
PERFORM writeform USING 'PO_INFO' 'PO_INFO'.
IF it_zmm_house_bank[] IS NOT INITIAL.
READ TABLE it_zmm_house_bank INDEX 1.
PERFORM writeform USING 'BANKDTL' 'BANKDTL'.
ENDIF.
PERFORM writeform USING 'HDR_INFO' 'HDR_INFO'.
PERFORM writeform USING 'BRK_TTL' 'MAIN'.
msr = 1.
mlctr = 1.
*added by ganesh to prevent deleted items to appear in print out
LOOP AT IT_EKPO WHERE EBELN EQ IT_EKKO-EBELN.
LOOP AT it_ekpo WHERE ebeln EQ it_ekko-ebeln AND loekz NE 'L'.
*end of change
CLEAR: mrate, mrate1.
SELECT * FROM konv INTO TABLE it_konv_rate
WHERE knumv EQ it_ekko-knumv
AND kposn EQ it_ekpo-ebelp
AND ( kschl EQ 'PBXX' OR kschl EQ 'PB00' OR kschl EQ 'P001' ).
LOOP AT it_konv_rate.
IF it_konv_rate-kpein > 0. " added by ganesh as per sudhir 12.10.2007
mrate_gm = it_konv_rate-kbetr / it_konv_rate-kpein.
mrate = mrate + mrate_gm. " added by ganesh as per sudhir 12.10.2007
ELSE.
mrate = mrate + it_konv_rate-kbetr.
ENDIF.
IF it_konv_rate-waers IS NOT INITIAL.
mwaers = it_konv_rate-waers.
ENDIF.
ENDLOOP.
For Japanies Yen "RTDK906759
IF it_ekko-waers = 'JPY'.
mrate = mrate * 100.
ENDIF.
End for japanies Yen
mrate1 = mrate.
End rate
mfirst = 0.
MFAMT = MFAMT + ( IT_EKPO-NETPR * IT_EKPO-MENGE ).
mfamt = mfamt + ( mrate * it_ekpo-menge ).
PERFORM get_mat_long_text.
DATA: lt_ctr TYPE i VALUE 0,lt_ctr1 TYPE i, lt_count TYPE i VALUE 0. " Long text counter
DESCRIBE TABLE it_bapi_mltx_ga LINES lt_count.
CLEAR it_bapi_mltx_ga.
*Added by Rajiv 10.05.2007 Read and if condition RTDK906165
READ TABLE it_konv WITH KEY knumv = it_ekko-knumv
kposn = it_ekpo-ebelp.
mkbetr = 0.
mkwert = 0.
IF sy-subrc EQ 0.
LOOP AT it_konv WHERE knumv EQ it_ekko-knumv
AND kposn EQ it_ekpo-ebelp.
IF it_konv-krech EQ 'A'.
mkbetr = it_konv-kbetr / 10.
ELSE.
mkbetr = it_konv-kbetr.
ENDIF.
For Japanies Yen "RTDK906759
IF it_ekko-waers = 'JPY'.
mkbetr = mkbetr * 100.
ENDIF.
End for japaies Yen
IF mkbetr LT '0'.
mkbetr = mkbetr * ( -1 ).
ENDIF.
mkwert = it_konv-kwert.
For Japanies Yen "RTDK906759
IF it_ekko-waers = 'JPY'.
mkwert = mkwert * 100.
ENDIF.
End for japaies Yen
mfamt = mfamt + mkwert.
IF mkwert LT '0'.
mkwert = mkwert * ( -1 ).
ENDIF.
IF it_ekpo-matnr IS INITIAL.
itemname = it_ekpo-txz01.
ELSE.
READ TABLE it_makt WITH KEY matnr = it_ekpo-matnr.
itemname = it_makt-maktx.
ENDIF.
READ TABLE it_t685t WITH KEY kschl = it_konv-kschl BINARY SEARCH.
READ TABLE it_eket WITH KEY ebeln = it_ekpo-ebeln
ebelp = it_ekpo-ebelp BINARY SEARCH.
IF mfirst EQ 0.
PERFORM writeform USING 'BRK_INFO' 'MAIN'.
mfirst = 1.
ELSE.
ADD 1 TO lt_ctr.
CLEAR it_bapi_mltx_ga.
READ TABLE it_bapi_mltx_ga INDEX lt_ctr. "For long text
IF sy-subrc NE 0.
CLEAR it_bapi_mltx_ga.
ENDIF.
PERFORM writeform USING 'BRK_INFO1' 'MAIN'.
ENDIF.
mlctr = mlctr + 1.
ENDLOOP. " it_konv.
ELSE.
IF it_ekpo-matnr IS INITIAL.
itemname = it_ekpo-txz01.
ELSE.
READ TABLE it_makt WITH KEY matnr = it_ekpo-matnr.
itemname = it_makt-maktx.
ENDIF.
READ TABLE IT_T685T WITH KEY KSCHL = IT_KONV-KSCHL BINARY SEARCH.
READ TABLE it_eket WITH KEY ebeln = it_ekpo-ebeln
ebelp = it_ekpo-ebelp BINARY SEARCH.
mfirst = 0.
IF mfirst EQ 0.
PERFORM writeform USING 'BRK_INFO' 'MAIN'.
mfirst = 1.
ELSE.
ADD 1 TO lt_ctr.
CLEAR it_bapi_mltx_ga.
READ TABLE it_bapi_mltx_ga INDEX lt_ctr. "For long text
IF sy-subrc NE 0.CLEAR it_bapi_mltx_ga.ENDIF.
PERFORM writeform USING 'BRK_INFO1' 'MAIN'.
ENDIF.
ENDIF.
*Commented by rajiv 10.05.2007 used this code in above condition.
added by ganesh on 260407 to print record
if it_konv is initial.
READ TABLE IT_MAKT WITH KEY MATNR = IT_EKPO-MATNR.
READ TABLE IT_T685T WITH KEY KSCHL = IT_KONV-KSCHL BINARY SEARCH.
READ TABLE IT_EKET WITH KEY EBELN = IT_EKPO-EBELN
EBELP = IT_EKPO-EBELP BINARY SEARCH.
mFirst = 0.
if mFirst eq 0.
PERFORM WRITEFORM USING 'BRK_INFO' 'MAIN'.
mFirst = 1.
else.
add 1 to lt_ctr.
clear it_bapi_mltx_ga.
read table IT_BAPI_MLTX_GA index lt_ctr. "For long text
if sy-subrc ne 0.clear it_bapi_mltx_ga.endif.
PERFORM WRITEFORM USING 'BRK_INFO1' 'MAIN'.
Endif.
endif.
end of change
REFRESH it_komv_tax.
PERFORM get_tax_cal USING it_ekpo-ebeln
it_ekpo-ebelp.
Changing it_komv_tax.
REFRESH : it_zmm_porder.
CLEAR : it_zmm_porder.
SELECT * INTO TABLE it_zmm_porder
FROM zmm_porder
WHERE flag EQ 'T'.
IF sy-subrc EQ 0.
SORT it_zmm_porder BY kschl.
ENDIF.
LOOP AT it_komv_tax.
gindex = sy-tabix.
READ TABLE it_zmm_porder WITH KEY kschl = it_komv_tax-kschl BINARY SEARCH.
IF sy-subrc NE 0.
DELETE it_komv_tax INDEX gindex.
ENDIF.
ENDLOOP.
LOOP AT it_komv_tax WHERE kwert IS NOT INITIAL.
IF ( IT_KOMV_TAX-KSCHL EQ 'JMOP' OR
IT_KOMV_TAX-KSCHL EQ 'JECS' OR
IT_KOMV_TAX-KSCHL EQ 'JSEP' OR
IT_KOMV_TAX-KSCHL EQ 'JMOQ' OR
IT_KOMV_TAX-KSCHL EQ 'JVCS' OR
IT_KOMV_TAX-KSCHL EQ 'JVRD' OR
IT_KOMV_TAX-KSCHL EQ 'JMIP' OR
* IT_KOMV_TAX-KSCHL EQ 'JEIP' OR
IT_KOMV_TAX-KSCHL EQ 'JSEI' OR
IT_KOMV_TAX-KSCHL EQ 'JSRT' OR
IT_KOMV_TAX-KSCHL EQ 'JEC3' OR
IT_KOMV_TAX-KSCHL EQ 'JVRN' )
AND IT_KOMV_TAX-KWERT IS NOT INITIAL.
SELECT SINGLE vtext
INTO mtext
FROM t685t
WHERE kschl EQ it_komv_tax-kschl
AND spras EQ 'E'.
l_rate = it_komv_tax-kbetr / 10.
l_amt = it_komv_tax-kwert.
For Japanies Yen "RTDK906759
IF it_ekko-waers = 'JPY'.
l_amt = l_amt * 100.
ENDIF.
End for japaies Yen
ADD l_amt TO mfamt.
IF lt_ctr LT lt_count. "Long text
ADD 1 TO lt_ctr.
READ TABLE it_bapi_mltx_ga INDEX lt_ctr.
ELSE.
CLEAR it_bapi_mltx_ga.
ENDIF.
IF l_rate EQ 0 OR l_amt EQ 0.
l_rate = ''.
l_amt = ''.
ENDIF.
PERFORM writeform USING 'TAX_LINE_ITEM' 'MAIN'.
ENDIF.
ENDLOOP.
IF lt_ctr LT lt_count.
DATA mbal_line TYPE i.
mbal_line = ( lt_count - lt_ctr ).
DO mbal_line TIMES.
ADD 1 TO lt_ctr.
READ TABLE it_bapi_mltx_ga INDEX lt_ctr.
IF sy-subrc = 0.
PERFORM writeform USING 'LTEXT' 'MAIN'.
ENDIF.
ENDDO.
ENDIF.
CONCATENATE it_ekko-ebeln it_ekpo-ebelp INTO nmebeln.
REFRESH tline.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F04'
language = sy-langu
name = nmebeln
object = 'EKPO'
TABLES
lines = tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
LOOP AT tline.
IF tline-tdline IS NOT INITIAL.
del_text = tline-tdline.
ENDIF.
CONDENSE del_text.
ENDLOOP.
CONCATENATE it_ekko-ebeln it_ekpo-ebelp INTO nmebeln.
REFRESH tline.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F03'
language = sy-langu
name = nmebeln
object = 'EKPO'
TABLES
lines = tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 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.
refresh.
CLEAR : po_flag, mat_po_text.
LOOP AT tline.
IF tline-tdline IS NOT INITIAL.
MOVE tline-tdline TO mat_po_text.
CONDENSE mat_po_text.
PERFORM writeform USING 'MTRL_PO_TEXT' 'MAIN'.
po_flag = 'X'.
CLEAR : mat_po_text.
ENDIF.
ENDLOOP.
*Added lines below for Schedule delivery for line item on 09.05.2007:Rajiv
CLEAR g_ind.
READ TABLE it_eket WITH KEY ebeln = it_ekpo-ebeln
ebelp = it_ekpo-ebelp BINARY SEARCH.
g_ind = sy-tabix.
LOOP AT it_eket FROM g_ind.
IF it_eket-ebeln EQ it_ekpo-ebeln AND it_eket-ebelp = it_ekpo-ebelp.
PERFORM writeform USING 'SCHEDULE' 'MAIN'.
ELSE.
EXIT.
ENDIF.
ENDLOOP.
*End Addition:Rajiv
PERFORM writeform USING 'REQSLP' 'MAIN'.
mlctr = mlctr + 1.
msr = msr + 1.
CLEAR: lt_ctr, lt_ctr1.
following lines added by ganesh to add service po details as per Mr. sadiq 21.08.2007
IF it_ekpo-packno IS NOT INITIAL.
CLEAR sub_packno.
SELECT SINGLE sub_packno INTO sub_packno FROM esll WHERE packno = it_ekpo-packno.
IF sub_packno IS NOT INITIAL.
CLEAR it_esll.
REFRESH it_esll.
SELECT * FROM esll INTO CORRESPONDING FIELDS OF TABLE it_esll
WHERE packno = sub_packno.
IF sy-subrc = 0.
PERFORM writeform USING 'SERVICE_PO_TEXT' 'MAIN'.
ENDIF.
LOOP AT it_esll.
CONCATENATE sub_packno it_esll-introw INTO obj.
CALL FUNCTION 'READ_TEXT' "4500002446 C300
EXPORTING
id = 'LTXT'
language = sy-langu
name = obj
object = 'ESLL'
TABLES
lines = tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
CLEAR stext.
LOOP AT tline.
CONCATENATE stext tline-tdline INTO stext SEPARATED BY space.
ENDLOOP.
FREE tline.
CLEAR tline.
REFRESH tline.
PERFORM writeform USING 'SERVICE_PO' 'MAIN'.
PERFORM writeform USING 'SERVICE_TEXT' 'MAIN'.
ENDLOOP.
ENDIF.
ENDIF.
end of change
ENDLOOP. " it_ekpo.
IF mlctr < 15.
DO 5 TIMES.
PERFORM writeform USING 'LINEFEED' 'MAIN'.
ENDDO.
ENDIF.
added by ganesh for allding line before ECC No.
IF it_ekko-bsart NE 'ZIM'. " IF EXPORT NO NEED TO PRINT ECC.
PERFORM writeform USING 'LIN' 'MAIN'.
PERFORM writeform USING 'WERKS_TAX_DETAIL' 'MAIN'.
ENDIF.
end of change
MFLAG = 'Y'.
PERFORM writeform USING 'TERMS_VAL' 'MAIN'.
LOOP AT it_konv1 WHERE knumv EQ it_ekko-knumv.
mkschl = it_konv1-kschl.
mchgamt = 0.
LOOP AT it_konv_ftr WHERE knumv EQ it_konv1-knumv
AND kschl EQ mkschl.
mchgamt = mchgamt + it_konv_ftr-kwert.
ENDLOOP.
For Japanies Yen "RTDK906759
IF it_ekko-waers = 'JPY'.
mchgamt = mchgamt * 100.
ENDIF.
End for japaies Yen
mfamt = mfamt + mchgamt.
IF mchgamt LT '0'.
mchgamt = mchgamt * ( -1 ).
ENDIF.
READ TABLE it_t685t_ftr WITH KEY kschl = mkschl.
PERFORM writeform USING 'TERMS_FTR_VAL' 'MAIN'.
mlctr = mlctr + 1.
ENDLOOP.
mflag = 'T'.
CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
EXPORTING
amt_in_num = mfamt
IMPORTING
amt_in_words = mfword
EXCEPTIONS
data_type_mismatch = 1
OTHERS = 2.
CONDENSE mebeln.
nmebeln = it_ekko-ebeln.
REFRESH tline.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F01'
language = sy-langu
name = nmebeln
object = 'EKKO'
TABLES
lines = tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
*---- CHANGED BY MATHEW BECAUSE THIS STATMENT WORKING FINE IN 300 BUT NOT IN 500C.
LOOP AT ZTEXT.
IF ZTEXT-TEXT1 IS NOT INITIAL.
PERFORM WRITEFORM USING 'TERMS_COND_VAL_PAY' 'MAIN'.
ENDIF.
MPAY_FLAG = 'Y'.
ENDLOOP.
READ TABLE it_t052u WITH KEY zterm = it_ekko-zterm.
LOOP AT it_t052u WHERE zterm EQ it_ekko-zterm.
IF it_t052u-text1 IS NOT INITIAL.
PERFORM writeform USING 'TERMS_COND_VAL_PAY' 'MAIN'.
ENDIF.
mpay_flag = 'Y'.
ENDLOOP.
PERFORM writeform USING 'TERMS_COND_VAL' 'MAIN'.
LOOP AT tline.
IF tline-tdline IS NOT INITIAL.
PERFORM writeform USING 'TERMS_COND_VAL_HDR' 'MAIN'.
ENDIF.
CONDENSE txt.
ENDLOOP.
PERFORM writeform USING 'FTR' 'FTR_LIN3'.
PERFORM writeform USING 'FTR_LIN1' 'FTR_LIN1'.
CALL FUNCTION 'END_FORM'.
ENDLOOP. " It_ekko.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = itcpp
RDI_RESULT =
TABLES
otfdata = otf
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. " Process
*& Form WRITEFORM
text
-->P_0150 text
-->P_0151 text
FORM writeform USING value(p_0150)
value(p_0151).
CALL FUNCTION 'WRITE_FORM'Hi
I think some basis related configuartions to be done
Try like this and inform me
A cyclic job runs, which processes the messages seen in the SOST queue.
Are you sure it's not the frequency of the cyclic job, rather than the
number of messages in the queue, that you are observing? In messages
that are queued and before the cyclic job runs, "wait for comm. service"
is the normal status.
If you mean that there are always 4 items queued in SOST regardless of
the cyclic send job, then I have no ideas. I would have thought there
was no way to do that.
when the send job runs it just never
picks them up & sends them, while it picks up many others. The send job
is somehow blind to these; no error message occurs. In this case, I
'delete' them from the queue (in SOST) and then 'undelete' (drop down
menu -> /Go to /Deleted Items) them and then re-queue them. THEN they
actually get picked up & sent when the next cyclic send job executes.
Regards
Pavan -
I have tried a lot to find an app or some way in email to attach multiple of pdf files in one email. I could not find anything that sends multiple pdf file in one email and still keeping the file in simple pdf format for the recipient.
I am not aware of a way except for photos that allows you to select multiple files in an email. I even checked settings in the Adobe Reader app, and it does not show that ability.
-
Sending a pdf form through email
Hi,
I want to send a pdf form through mail for this i have to write code(given below) but my problem is that
it send a xml file to vendor. i want to send its pdf form. how it is possible.........................
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = fp_outputparams
APPEND_TO_TABLE = ' '
IMPORTING
OUTPUT_LENGTH =
TABLES
binary_tab = lt_att_content_hex.
CLASS cl_bcs DEFINITION LOAD.
DATA:
lo_send_request TYPE REF TO cl_bcs VALUE IS INITIAL.
*--Create persistent send request
lo_send_request = cl_bcs=>create_persistent( ).
Message body and subject*****************************************************************************************
DATA:
lt_message_body TYPE bcsy_text VALUE IS INITIAL,
lo_document TYPE REF TO cl_document_bcs VALUE IS INITIAL.
APPEND 'Dear Vendor,' TO lt_message_body.
APPEND ' ' TO lt_message_body.
APPEND 'Please fill the attached form and send it back to us.' TO lt_message_body.
APPEND ' ' TO lt_message_body.
APPEND 'Thank You,' TO lt_message_body.
lo_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = lt_message_body
i_subject = 'Vendor Payment Form' ).
DATA: lx_document_bcs TYPE REF TO cx_document_bcs VALUE IS INITIAL.
TRY.
lo_document->add_attachment(
EXPORTING
i_attachment_type = 'PDF'
i_attachment_subject = 'A Test Adobe Form').
i_attachment_size =
i_attachment_language = space
i_att_content_text =
i_attachment_header =
i_att_content_hex = lt_att_content_hex ).
CATCH cx_document_bcs INTO lx_document_bcs.
ENDTRY.
Add attachment
Pass the document to send request
lo_send_request->set_document( lo_document ).
Create sender
DATA:
lo_sender TYPE REF TO if_sender_bcs VALUE IS INITIAL,
l_send TYPE adr6-smtp_addr VALUE '.............'.
lo_sender = cl_cam_address_bcs=>create_internet_address( l_send ).
Set sender
lo_send_request->set_sender(
EXPORTING
i_sender = lo_sender ).
Create recipient
DATA:
lo_recipient TYPE REF TO if_recipient_bcs VALUE IS INITIAL.
lo_recipient = cl_sapuser_bcs=>create( sy-uname ).
Set recipient
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = 'X' ).
lo_send_request->add_recipient(
EXPORTING
i_recipient = lo_recipient
i_express = 'X' ).
Send email
DATA: lv_sent_to_all(1) TYPE c VALUE IS INITIAL.
lo_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = lv_sent_to_all ).
COMMIT WORK.
MESSAGE 'The payment form has been emailed to the Vendor' TYPE 'I'.
Thanks in advance
ShriTry below logic.
DATA : it_objpack TYPE STANDARD TABLE OF sopcklsti1 ,
it_objtxt TYPE STANDARD TABLE OF solisti1 ,
it_objbin TYPE STANDARD TABLE OF solisti1 ,
it_reclist TYPE STANDARD TABLE OF somlreci1 ,
wa_doc_chng TYPE sodocchgi1,
wa_objhead TYPE soli_tab,
l_attachment TYPE i,
l_testo TYPE i.
DATA: wa_objpack TYPE sopcklsti1,
wa_objtxt TYPE solisti1 ,
wa_objbin TYPE solisti1 ,
wa_reclist TYPE somlreci1 .
CLEAR: wa_reclist,
wa_objhead,
wa_objtxt, it_objtxt[],
wa_objbin, it_objbin[],
wa_objpack, it_objpack[].
Object with PDF.
CLEAR wa_objbin.
REFRESH it_objbin.
it_objbin[] = gt_mess_att[].
DESCRIBE TABLE it_objbin LINES l_attachment.
Object with main text of the mail.
LOOP AT it_message INTO wa_message.
wa_objtxt = wa_message. APPEND wa_objtxt TO it_objtxt.
ENDLOOP.
DESCRIBE TABLE it_objtxt LINES l_testo.
Document information.
wa_doc_chng-obj_name = 'test'.
wa_doc_chng-expiry_dat = sy-datum + 10.
CONCATENATE 'Amex Settlement' ' '
INTO wa_doc_chng-obj_descr .
doc_chng-sensitivty = 'F'.
wa_doc_chng-sensitivty = 'P'.
wa_doc_chng-obj_prio = '1'.
wa_doc_chng-doc_size = l_testo * 255.
CLEAR wa_objpack-transf_bin.
wa_objpack-head_start = 1.
wa_objpack-head_num = 0.
wa_objpack-body_start = 1.
wa_objpack-body_num = l_testo.
wa_objpack-doc_type = 'RAW'.
APPEND wa_objpack TO it_objpack.
CLEAR wa_reclist.
wa_reclist-copy = 'X'.
IF wa_email IS NOT INITIAL.
wa_reclist-receiver = wa_email-value1.
wa_reclist-express = 'X'.
wa_reclist-rec_type = 'U'.
wa_reclist-notif_del = 'X'.
wa_reclist-notif_ndel = 'X'.
APPEND wa_reclist TO it_reclist.
ENDLOOP.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_objpack
object_header = wa_objhead
contents_bin = it_objbin
contents_txt = it_objtxt
receivers = it_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.
WRITE 'Cannot send email'.
ENDIF.
ENDIF. -
Frequently I create a pdf and then I want to send it. After clicking send and the email pops up I compose the message. However, as I compose it, I have a question requiring me to look at the pdf. However, I can't page through the document because it's locked by Outlook. Also, I can't look at other emails while this message is open.
A workaroud is to save the document in Outlook. Then I can scroll through the pdf or view other emails but I have to go to the drafts folder and reopen the email to edit it.
What I'd really like to see is a way to set the default when sending a pdf in Outlook to have it always send a copy. That way the pdf isn't locked and I don't have to go throught this workaround. I encounter this every day. Isn't there some solution to this?Edit>Preferences>Email accounts>List of email accounts. Click the drop-down that says "add account" and select Gmail. After adding it, you can go to the account area and change it to default.
-
How to send a pdf/tiff file to spool
Hi all,
can anyone tell me how to send a pdf file to spool.
There will be forms attached to activity(the forms can be pdf/tiff format).
Thank You,
VichuThose forms(PDF or TIFF) are the attachments for the t-code crm_orders. I need to send those forms to the spool.
I have a code to create a spool request for list output.
SUBMIT (L_PROG)
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS LS_PARAMS
AND RETURN.
but for the pdf to spool i dont know how to proceed.......... in what are the way we can do......... can anyone provide me the code......... so that it will be more helpful.... -
How to send generated Spool file through e-mail
Hi,
We have a ABAP report which generates a spool file. Now there is a requirement to send this spool file to our clients external mail boxes.
Also we would like to automate this so that whenever a spool file is generated, the system should automatically send it as an attachment to user mail inboxes.
Any idea how I can achieve this. Thanks is advance!
Regards,
Vikrant.Hi Vikrant,
Have a look at this code...
z_send_email_fax_global
FUNCTION-POOL z_gfaian_mail_fax. "MESSAGE-ID ..
WORK TABLE AREAS
TABLES: tsp01.
INTERNAL TABLES
DATA: lt_rec_tab LIKE STANDARD TABLE OF soos1 WITH HEADER LINE,
lt_note_text LIKE STANDARD TABLE OF soli WITH HEADER LINE,
lt_attachments LIKE STANDARD TABLE OF sood5 WITH HEADER LINE.
DATA: lt_objcont LIKE STANDARD TABLE OF soli WITH HEADER LINE,
lt_objhead LIKE STANDARD TABLE OF soli WITH HEADER LINE.
DATA: pdf_format LIKE STANDARD TABLE OF tline WITH HEADER LINE.
TYPES: BEGIN OF y_files,
file(60) TYPE c,
END OF y_files.
DATA: lt_files TYPE STANDARD TABLE OF y_files WITH HEADER LINE.
DATA: l_objcont LIKE soli OCCURS 0 WITH HEADER LINE.
DATA: l_objhead LIKE soli OCCURS 0 WITH HEADER LINE.
STRUCTURES
DATA: folder_id LIKE soodk,
object_id LIKE soodk,
link_folder_id LIKE soodk,
g_document LIKE sood4,
g_header_data LIKE sood2,
g_folmem_data LIKE sofm2,
g_header_data LIKE sood2,
g_receive_data LIKE soos6,
g_ref_document LIKE sood4,
g_new_parent LIKE soodk,
l_folder_id LIKE sofdk,
v_email(50).
DATA: hd_dat like sood1.
VARIABLES
DATA: client LIKE tst01-dclient,
name LIKE tst01-dname,
objtype LIKE rststype-type,
type LIKE rststype-type.
DATA: numbytes TYPE i,
arc_idx LIKE toa_dara,
pdfspoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
is_otf.
DATA: outbox_flag LIKE sonv-flag VALUE 'X',
store_flag LIKE sonv-flag,
delete_flag LIKE sonv-flag,
owner LIKE soud-usrnam,
on LIKE sonv-flag VALUE 'X',
sent_to_all LIKE sonv-flag,
g_authority LIKE sofa-usracc,
w_objdes LIKE sood4-objdes.
DATA: c_file LIKE rlgrap-filename,
n_spool(6) TYPE n.
DATA: cancel.
DATA: desired_type LIKE sood-objtp,
real_type LIKE sood-objtp,
attach_type LIKE sood-objtp,
otf LIKE sood-objtp VALUE 'OTF', " SAPscript Ausgabeformat
ali LIKE sood-objtp VALUE 'ALI'. " ABAP lists
CONSTANTS
CONSTANTS: ou_fol LIKE sofh-folrg VALUE 'O',
c_objtp LIKE g_document-objtp VALUE 'RAW',
c_file_ext LIKE g_document-file_ext VALUE 'TXT'.
=================================================================================
z_send_email_fax2
FUNCTION z_faian_mail_fax2.
""Interface local:
*" IMPORTING
*" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
*" REFERENCE(FAX_MAIL_NUMBER) TYPE SO_NAME
*" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
*" REFERENCE(OBJECT_TYPE) TYPE SO_ESCAPE
*" TABLES
*" LT_BODY_EMAIL STRUCTURE SOLI
*" EXCEPTIONS
*" ERR_NO_ABAP_SPOOLJOB
Fist part: Verify if the spool really exists
SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
IF sy-subrc NE 0.
RAISE err_no_abap_spooljob. "doesn't exist
ELSE.
client = tsp01-rqclient.
name = tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
IF objtype(3) = 'OTF'.
desired_type = otf.
ELSE.
desired_type = ali.
ENDIF.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = src_spoolid
desired_type = desired_type
IMPORTING
real_type = real_type
TABLES
buffer = l_objcont
EXCEPTIONS
no_such_job = 14
type_no_match = 94
job_contains_no_data = 54
no_permission = 21
can_not_access = 21
read_error = 54.
IF sy-subrc EQ 0.
attach_type = real_type.
ENDIF.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
owner = sy-uname
region = ou_fol
IMPORTING
folder_id = l_folder_id
EXCEPTIONS
OTHERS = 5.
fill out informations about the header of the email
CLEAR: g_document.
g_document-foltp = l_folder_id-foltp.
g_document-folyr = l_folder_id-folyr.
g_document-folno = l_folder_id-folno.
g_document-objtp = c_objtp.
g_document-objdes = header_mail.
g_document-file_ext = c_file_ext.
g_header_data-objdes = header_mail.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = 'SAVE'
office_user = sy-uname
IMPORTING
authority = g_authority
TABLES
objcont = lt_body_email
attachments = lt_attachments
CHANGING
document = g_document
header_data = g_header_data
EXCEPTIONS
OTHERS = 1.
folder_id-objtp = l_folder_id-foltp.
folder_id-objyr = l_folder_id-folyr.
folder_id-objno = l_folder_id-folno.
object_id-objtp = c_objtp.
object_id-objyr = g_document-objyr.
object_id-objno = g_document-objno.
link_folder_id-objtp = l_folder_id-foltp.
link_folder_id-objyr = l_folder_id-folyr.
link_folder_id-objno = l_folder_id-folno.
REFRESH lt_rec_tab.
CLEAR lt_rec_tab.
lt_rec_tab-sel = 'X'.
lt_rec_tab-recesc = object_type. "This field for FAX/MAIL
lt_rec_tab-recnam = 'U-'.
lt_rec_tab-deliver = 'X'.
lt_rec_tab-not_deli = 'X'.
lt_rec_tab-read = 'X'.
lt_rec_tab-mailstatus = 'E'.
lt_rec_tab-adr_name = fax_mail_number.
lt_rec_tab-sortfield = fax_mail_number.
lt_rec_tab-recextnam = fax_mail_number.
lt_rec_tab-sortclass = '5'.
APPEND lt_rec_tab.
lt_rec_tab-recextnam = fax_mail_number.
lt_rec_tab-recesc = object_type.
lt_rec_tab-sndart = 'INT'.
lt_rec_tab-sndpri = 1.
APPEND lt_rec_tab.
lt_files-file = c_file.
APPEND lt_files.
begin of insertion by faianf01
hd_dat-objdes = header_mail.
CALL FUNCTION 'SO_ATTACHMENT_INSERT'
EXPORTING
object_id = object_id
attach_type = attach_type
object_hd_change = hd_dat
owner = sy-uname
TABLES
objcont = l_objcont
objhead = l_objhead
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
object_type_not_exist = 17
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
x_error = 1000.
IF sy-subrc > 0.
ENDIF.
end of insertion by faianf01
send email from SAPOFFICE
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = folder_id
object_id = object_id
outbox_flag = outbox_flag
link_folder_id = link_folder_id
owner = sy-uname
check_send_authority = 'X'
TABLES
receivers = lt_rec_tab
note_text = lt_note_text
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
component_not_available = 1
folder_no_authorization = 5
folder_not_exist = 6
forwarder_not_exist = 8
object_no_authorization = 13
object_not_exist = 14
object_not_sent = 15
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
too_much_receivers = 73
user_not_exist = 35.
ENDIF.
ENDFUNCTION.
=================================================================================
z_send_email_fax
FUNCTION ZCBFS_SEND_MAIL.
""Interface local:
*" IMPORTING
*" REFERENCE(SRC_SPOOLID) LIKE TSP01-RQIDENT
*" REFERENCE(HEADER_MAIL) TYPE SO_OBJ_DES
*" TABLES
*" LIST_FAX_MAIL_NUMBER STRUCTURE SOLI
*" EXCEPTIONS
*" ERR_NO_ABAP_SPOOLJOB
DATA: vg_achou(1) TYPE n.
Fist part: Verify if the spool really exists
vg_achou = 1.
DO 60 TIMES.
SELECT SINGLE * FROM tsp01 WHERE rqident = src_spoolid.
IF sy-subrc IS INITIAL.
CLEAR vg_achou.
EXIT.
ELSE.
WAIT UP TO 1 SECONDS.
ENDIF.
ENDDO.
IF vg_achou = 1.
RAISE err_no_abap_spooljob. "doesn't exist
ENDIF.
client = tsp01-rqclient.
name = tsp01-rqo1name.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4
OTHERS = 5.
IF objtype(3) = 'OTF'.
desired_type = otf.
ELSE.
desired_type = ali.
ENDIF.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = src_spoolid
desired_type = desired_type
IMPORTING
real_type = real_type
TABLES
buffer = l_objcont
EXCEPTIONS
no_such_job = 14
type_no_match = 94
job_contains_no_data = 54
no_permission = 21
can_not_access = 21
read_error = 54.
IF sy-subrc EQ 0.
attach_type = real_type.
ENDIF.
CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
EXPORTING
owner = sy-uname
region = ou_fol
IMPORTING
folder_id = l_folder_id
EXCEPTIONS
OTHERS = 5.
fill out informations about the header of the email
CLEAR: g_document.
g_document-foltp = l_folder_id-foltp.
g_document-folyr = l_folder_id-folyr.
g_document-folno = l_folder_id-folno.
g_document-objtp = c_objtp.
g_document-objdes = header_mail.
g_document-file_ext = c_file_ext.
g_header_data-objdes = header_mail.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
method = 'SAVE'
office_user = sy-uname
IMPORTING
authority = g_authority
TABLES
attachments = lt_attachments
CHANGING
document = g_document
header_data = g_header_data
EXCEPTIONS
OTHERS = 1.
folder_id-objtp = l_folder_id-foltp.
folder_id-objyr = l_folder_id-folyr.
folder_id-objno = l_folder_id-folno.
object_id-objtp = c_objtp.
object_id-objyr = g_document-objyr.
object_id-objno = g_document-objno.
link_folder_id-objtp = l_folder_id-foltp.
link_folder_id-objyr = l_folder_id-folyr.
link_folder_id-objno = l_folder_id-folno.
REFRESH lt_rec_tab.
LOOP AT LIST_FAX_MAIL_NUMBER.
lt_rec_tab-recextnam = LIST_FAX_MAIL_NUMBER-LINE.
lt_rec_tab-recesc = 'U'.
lt_rec_tab-sndart = 'INT'.
lt_rec_tab-sndpri = 1.
APPEND lt_rec_tab.
ENDLOOP.
lt_files-file = c_file.
APPEND lt_files.
hd_dat-objdes = header_mail.
CALL FUNCTION 'SO_ATTACHMENT_INSERT'
EXPORTING
object_id = object_id
attach_type = attach_type
object_hd_change = hd_dat
owner = sy-uname
TABLES
objcont = l_objcont
objhead = l_objhead
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
object_type_not_exist = 17
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
x_error = 1000.
IF sy-subrc > 0.
ENDIF.
send email from SAPOFFICE
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
folder_id = folder_id
object_id = object_id
outbox_flag = outbox_flag
link_folder_id = link_folder_id
owner = sy-uname
TABLES
receivers = lt_rec_tab
note_text = lt_note_text
EXCEPTIONS
active_user_not_exist = 35
communication_failure = 71
component_not_available = 1
folder_no_authorization = 5
folder_not_exist = 6
forwarder_not_exist = 8
object_no_authorization = 13
object_not_exist = 14
object_not_sent = 15
operation_no_authorization = 21
owner_not_exist = 22
parameter_error = 23
substitute_not_active = 31
substitute_not_defined = 32
system_failure = 72
too_much_receivers = 73
user_not_exist = 35.
ENDFUNCTION.
Regards,
Santosh -
Send spool id output (sap script) via email in PDF format
Dear friends,
Looking for sample program to send spool id output of sapscript via email in PDF format.
Regards,
Praveen LoboHi,
Try this code..
* Parameters.
PARAMETERS: p_email(50) LOWER CASE.
PARAMETERS: p_spool LIKE tsp01-rqident.
* Data declarations.
DATA: plist LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: document_data LIKE sodocchgi1.
DATA: so_ali LIKE soli OCCURS 100 WITH HEADER LINE.
DATA: real_type LIKE soodk-objtp.
DATA: sp_lang LIKE tst01-dlang.
DATA: line_size TYPE i VALUE 255.
DATA: v_name LIKE soextreci1-receiver.
DATA rec_tab LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
* Get the spool data.
CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
EXPORTING
rqident = p_spool
first_line = 1
last_line = 0
desired_type = ' '
IMPORTING
real_type = real_type
sp_lang = sp_lang
TABLES
buffer = so_ali
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.
* Check the return code.
IF sy-subrc <> 0.
MESSAGE s208(00) WITH 'Error'.
LEAVE LIST-PROCESSING.
ENDIF.
* Prepare the data.
plist-transf_bin = 'X'.
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 0.
plist-body_num = 0.
plist-doc_type = 'RAW'.
plist-obj_descr = 'Spool data'.
APPEND plist.
plist-transf_bin = 'X'.
plist-head_start = 0.
plist-head_num = 0.
plist-body_start = 1.
DESCRIBE TABLE so_ali LINES plist-body_num.
plist-doc_type = real_type.
* Get the size.
READ TABLE so_ali INDEX plist-body_num.
plist-doc_size = ( plist-body_num - 1 ) * line_size
+ STRLEN( so_ali ).
APPEND plist.
* Move the receiver address.
MOVE: p_email TO rec_tab-receiver,
'U' TO rec_tab-rec_type.
APPEND rec_tab.
IF NOT sp_lang IS INITIAL.
document_data-obj_langu = sp_lang.
ELSE.
document_data-obj_langu = sy-langu.
ENDIF.
v_name = sy-uname.
* Subject.
document_data-obj_descr = 'Spool attached'.
* Send the email.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = document_data
sender_address = v_name
sender_address_type = 'B'
TABLES
packing_list = plist
contents_bin = so_ali
receivers = rec_tab
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 e208(00) WITH 'Error in sending email'.
ENDIF.
COMMIT WORK.
* Send the email immediately.
SUBMIT rsconn01
WITH mode = 'INT'
AND RETURN.
* Success message.
MESSAGE s208(00) WITH 'Email sent'.
Thanks
Naren -
No signature when sending PDF through IBooks on IPhone 4GS
When sending a PDF from IBooks on my IPhone, The Email Signature appears in the body of the email as if it is going to be sent with the email. The recipent of the email will not see the signature in the body of the email. It appears like a text file in the form of an attachment. Is there a fix or work around to this?
So I sent an email from iBooks to myself and my signature came through just fine. Not sure how you might solve your missing signature. Are you running iOS 5.0.1?
You might try a reboot of your iPad. Press and hold the Home and Sleep buttons simultaneously ignoring the red slider until the Apple logo appears. Let go of the buttons and let the iPad restart.
This seems to correct numerous problems on the iPad maybe it will help you. -
Send a pdf... not through outlook etc
Hello... I was wondering if some here would know this... All I want to do is send the PDF form to email... I figure that I'd have to use a php script to relay the PDF as mailto: would try to open a program which they may not have. It needs to be the PDF not the XML or anything else as the receiver can't understand that... I thought this would be simple but I can't find anything really in Google searches... to much there to sift through lol.. anyways... I think It's go like this...
-Person opens pdf form and fills it out
-They click HTTP Submit button
-PDF file received by php
-Php then emails PDF file to email receiver...
or
- the person fills out a PDF form
- PDF form is sent to PHP script as post
- PHP sends out an email with the PDF attached which is the form filled out form the base pdf?...
(meaning that the pdf form acts as a template?)
Sounds simple... I don't want anything else.. just the PDF relayed to the php script in stead of emailed through a mail client like outlook...
thanks for the help
Jeremy
the PDF exsits...
https://www.sjrmc.org/uploads/PDF/Employment/App_pdf_distributed_0001.pdfThis is explained here:
http://avokahhh.wordpress.com/2008/10/30/submitting-from-a-from-in-pdf-format/
Howard
http://www.avoka.com
Maybe you are looking for
-
Remove credit card from account
why cant i remove credit card info from my account?
-
I provide path in String form Example: /home/fsloke/chemistry/1.txt /home/fsloke/physic/2.txt /home/fsloke/physic/general/3.txt Expected output in the tree +Home + fsloke +chemistry - 1.txt +physic -2.txt +general -3,txt I headache now. How I should
-
FRM-40011 Error on Oracle 9i AS
Hi! I have a form deployed on Oracle 9i AS Release 2. The form is compiled on forms 6i -Patchset 14 and when I try to access this form on the client PC I get FRM-40011 error that the form has been created using lower version of From builder. If I com
-
Is there anyway to auto login on my network hard drive as a guest without having to select guest & then clicking okay? I have wrote a script in automator so that it logs on automatically when Mac OS X starts up, I would like it to be fully automated
-
Hi All, I had installed Application Server 10g on one Window 2000 Server machine. It was working fine. But as all the components of Application Server were installed on one machine thats why its performance was bad. So i decided to move the Oracle AS