Sending DMS Document as Attachment thru e-mail
Hi,
I am attaching the DMS document in purchase order & I am sending the PO thru email to vendor.But while doing so the attached document shuld be sent as attachment But in my present config setting it is not doing so.
Pl suggest
Rgds
Hi,
With my solution you will be able to send the PO and all link document in a mail at the same time you print it.
First Step
Create a new message with transaction NACE , this message will use support 8 ( external program) . The print program should be a copy the same as for printing your PO but add a new form entry inside.
Second step .
In the print program , create the new form entry and add the code . bellow a sample code i wrote . Some object are specific so you have to create it . If you need i can give you te detail of thoses objects.
DATA : bin_file TYPE xstring ,
bin_filesize TYPE i ,
w_objky TYPE objky,
my_sender TYPE zcl_send_mail=>ty_sender,
mail_line TYPE LINE OF soli_tab,
w_attsub TYPE so_obj_des.
DATA: l_druvo TYPE t166k-druvo,
l_nast TYPE nast,
l_from_memory,
l_doc TYPE meein_purchase_doc_print.
DATA : v_parvw2 TYPE nast-parvw,
v_parnr2 TYPE nast-parnr,
v_lifnr TYPE konv-lifnr,
v_adrnr TYPE lfa1-adrnr,
st_address TYPE addr1_sel,
st_sadr TYPE sadr.
* definition des tables internes
DATA : it_otf TYPE STANDARD TABLE OF itcoo ,
it_line TYPE STANDARD TABLE OF tline ,
it_fill TYPE STANDARD TABLE OF drad,
it_new TYPE STANDARD TABLE OF drad ,
itb_xtkomv TYPE STANDARD TABLE OF komv WITH HEADER LINE,
itb_xekpo TYPE STANDARD TABLE OF ekpo WITH HEADER LINE,
it_ekpo TYPE HASHED TABLE OF ekpo WITH UNIQUE KEY ebeln ebelp ,
it_draw TYPE HASHED TABLE OF draw WITH UNIQUE KEY dokar
doknr
dokvr
doktl ,
it_drat TYPE HASHED TABLE OF drat WITH UNIQUE KEY dokar
doknr
dokvr
doktl
langu,
my_attachement_list TYPE zcl_send_mail=>attachement_list,
my_recipient_list TYPE zcl_send_mail=>recipient_list ,
it_hexa TYPE solix_tab ,
it_body TYPE soli_tab.
CONSTANTS : c_object TYPE dokob VALUE 'EKPO' .
FIELD-SYMBOLS : <ekpo> TYPE ekpo,
<drad> TYPE drad ,
<draw> TYPE draw,
<drat> TYPE drat .
DATA : my_mail TYPE REF TO zcl_send_mail . => Specific object
** Here write your own code like you print the PO form in order to be able to retrieve it from memory
** don't send it to the printer only in spool .
* Get OTF from Memory.
CALL FUNCTION 'READ_OTF_FROM_MEMORY'
EXPORTING
memory_key = nast-objky
TABLES
otf = it_otf
EXCEPTIONS
memory_empty = 1.
CHECK sy-subrc EQ 0.
* Transform OTF into PDF
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = bin_filesize
bin_file = bin_file
TABLES
otf = it_otf
lines = it_line
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4.
* Transform PDF as Binary Table
it_hexa = cl_document_bcs=>xstring_to_solix( ip_xstring = bin_file ).
* Add PO as PDF file to the mail
zcl_send_mail=>add_attachement_to_list(
EXPORTING
type = 'PDF'
subject = 'PO'
content_hexa = it_hexa
CHANGING
attachement_list = my_attachement_list
EXCEPTIONS
no_content_for_attachement = 1
no_application_type = 2 ).
* Get PO Item because DIR are link to item only.
SELECT * FROM ekpo
APPENDING CORRESPONDING FIELDS OF TABLE it_ekpo
WHERE ebeln = nast-objky.
* Search for DIR .
FREE : it_draw , it_drat .
LOOP AT it_ekpo ASSIGNING <ekpo>.
FREE : it_fill , it_new.
CONCATENATE <ekpo>-ebeln <ekpo>-ebelp INTO w_objky.
CALL FUNCTION 'CV140_SELECT_DRAD_DOCUMENTS'
EXPORTING
pf_key = w_objky
pf_object = c_object
TABLES
pt_fill_drad = it_fill
pt_new_drad = it_new
EXCEPTIONS
no_document = 1.
* For each DIR , retrieve physical content
LOOP AT it_fill ASSIGNING <drad>.
IF <draw> IS ASSIGNED.
UNASSIGN <draw>.
ENDIF.
READ TABLE it_draw ASSIGNING <draw>
WITH TABLE KEY dokar = <drad>-dokar
doknr = <drad>-doknr
dokvr = <drad>-dokvr
doktl = <drad>-doktl.
IF NOT <draw> IS ASSIGNED.
SELECT * FROM draw
APPENDING CORRESPONDING FIELDS OF TABLE it_draw
WHERE dokar = <drad>-dokar
AND doknr = <drad>-doknr
AND dokvr = <drad>-dokvr
AND doktl = <drad>-doktl.
SELECT * FROM drat
APPENDING CORRESPONDING FIELDS OF TABLE it_drat
WHERE dokar = <drad>-dokar
AND doknr = <drad>-doknr
AND dokvr = <drad>-dokvr
AND doktl = <drad>-doktl
AND langu = sy-langu.
READ TABLE it_draw ASSIGNING <draw>
WITH TABLE KEY dokar = <drad>-dokar
doknr = <drad>-doknr
dokvr = <drad>-dokvr
doktl = <drad>-doktl.
ENDIF.
CHECK <draw> IS ASSIGNED.
READ TABLE it_drat ASSIGNING <drat>
WITH TABLE KEY dokar = <drad>-dokar
doknr = <drad>-doknr
dokvr = <drad>-dokvr
doktl = <drad>-doktl
langu = sy-langu.
IF <drat> IS ASSIGNED.
w_attsub = <drat>-dktxt.
ELSE.
CONCATENATE <drad>-dokar <drad>-doknr <drad>-dokvr <drad>-doktl
INTO w_attsub SEPARATED BY '/'.
ENDIF.
PERFORM add_fid_to_attachement USING <draw>
w_attsub
CHANGING my_attachement_list.
CHECK <drat> IS ASSIGNED.
UNASSIGN <drat>.
ENDLOOP.
LOOP AT it_new ASSIGNING <drad>.
IF <draw> IS ASSIGNED.
UNASSIGN <draw>.
ENDIF.
READ TABLE it_draw ASSIGNING <draw>
WITH TABLE KEY dokar = <drad>-dokar
doknr = <drad>-doknr
dokvr = <drad>-dokvr
doktl = <drad>-doktl.
IF NOT <draw> IS ASSIGNED.
SELECT * FROM draw
APPENDING CORRESPONDING FIELDS OF TABLE it_draw
WHERE dokar = <drad>-dokar
AND doknr = <drad>-doknr
AND dokvr = <drad>-dokvr
AND doktl = <drad>-doktl.
SELECT * FROM drat
APPENDING CORRESPONDING FIELDS OF TABLE it_drat
WHERE dokar = <drad>-dokar
AND doknr = <drad>-doknr
AND dokvr = <drad>-dokvr
AND doktl = <drad>-doktl
AND langu = sy-langu.
READ TABLE it_draw ASSIGNING <draw>
WITH TABLE KEY dokar = <drad>-dokar
doknr = <drad>-doknr
dokvr = <drad>-dokvr
doktl = <drad>-doktl.
ENDIF.
CHECK <draw> IS ASSIGNED.
READ TABLE it_drat ASSIGNING <drat>
WITH TABLE KEY dokar = <drad>-dokar
doknr = <drad>-doknr
dokvr = <drad>-dokvr
doktl = <drad>-doktl
langu = sy-langu.
IF <drat> IS ASSIGNED.
w_attsub = <drat>-dktxt.
ELSE.
CONCATENATE <drad>-dokar <drad>-doknr <drad>-dokvr <drad>-doktl
INTO w_attsub SEPARATED BY '/'.
ENDIF.
PERFORM add_fid_to_attachement USING <draw>
w_attsub
CHANGING my_attachement_list.
CHECK <drat> IS ASSIGNED.
UNASSIGN <drat>.
ENDLOOP.
ENDLOOP.
* Send mail to PO creator
* Sender
my_sender-mail = '****' . => Set the sender mail adress
* Add Recipient
zcl_send_mail=>add_recipient_to_list(
EXPORTING
uname = sy-uname
CHANGING
recipient_list = my_recipient_list
EXCEPTIONS
no_recipient_to_add = 1 ).
* Mail body
mail_line = 'PO by mail with Attachment'.
APPEND mail_line TO it_body.
* Create send request
CREATE OBJECT my_mail.
* Send Mail
my_mail->send_mail(
sender = my_sender
mail_subject = 'E-mail PO'
mail_body = it_body
recipient_list = my_recipient_list
attachement_list = my_attachement_list ).
Bellow the code for the routine ADD_FID_TO_ATTACHEMENT
DATA : w_cout TYPE dms_checkout_def,
w_dttrg TYPE dttrg, "Name of data carrier
w_docfile TYPE dms_doc_file,
w_dappl TYPE dappl, "Application
w_tabix TYPE i ,
w_tdwa TYPE tdwa ,
w_phio TYPE dms_phio,
w_frontend TYPE dms_frontend_data.
DATA : it_drao TYPE STANDARD TABLE OF drao WITH HEADER LINE,
it_kpro TYPE dms_tbl_file .
CONSTANTS : "c_print_option TYPE apptp VALUE '3', "Print option
c_hostname TYPE ntadr VALUE 'DEFAULT', "Hostname
c_type TYPE typdt VALUE 'PC', "Type
c_system TYPE char4 VALUE 'WN32'. "System
FIELD-SYMBOLS : <kpro> TYPE LINE OF dms_tbl_file,
<phio> TYPE LINE OF dms_tbl_phio .
CLEAR : w_tdwa .
* Check if for DIR type KPRO is used
CALL FUNCTION 'CV200_DB_TDWA_SELECT'
EXPORTING
pf_dokar = in_draw-dokar
IMPORTING
psx_tdwa = w_tdwa
EXCEPTIONS
not_found = 1.
w_frontend-frontend_type = c_type. "'PC'.
w_frontend-hostname = c_hostname. "'DEFAULT'.
w_frontend-winsys = c_system. "'WN32'.
w_frontend-platform = 0.
w_cout-comp_get = abap_true.
w_cout-kpro_use = w_tdwa-kpro_use.
w_cout-batchmode = abap_true.
w_cout-content_provide = 'TBL'.
CALL FUNCTION 'CV120_KPRO_MASTER_DATA_GET'
EXPORTING
pf_dokar = in_draw-dokar
pf_doknr = in_draw-doknr
pf_dokvr = in_draw-dokvr
pf_doktl = in_draw-doktl
TABLES
ptx_data = it_kpro
EXCEPTIONS
not_found = 1
error = 2.
CASE w_tdwa-kpro_use.
WHEN abap_true.
CALL FUNCTION 'CV120_KPRO_MASTER_DATA_GET'
EXPORTING
pf_dokar = in_draw-dokar
pf_doknr = in_draw-doknr
pf_dokvr = in_draw-dokvr
pf_doktl = in_draw-doktl
TABLES
ptx_data = it_kpro
EXCEPTIONS
not_found = 1
error = 2.
w_frontend-frontend_type = 'KP'.
LOOP AT it_kpro ASSIGNING <kpro>.
FREE it_drao.
LOOP AT <kpro>-tbl_phios ASSIGNING <phio>.
MOVE-CORRESPONDING <phio> TO w_phio.
CALL FUNCTION 'CV120_DOC_CHECKOUT_VIEW'
EXPORTING
ps_cout_def = w_cout
ps_doc_file = w_docfile
ps_draw = in_draw
ps_phio = w_phio
ps_frontend = w_frontend
TABLES
ptx_content = it_drao
EXCEPTIONS
error = 1.
PERFORM transform_fid_to_binary TABLES it_drao
USING <kpro>-dappl
in_attsub
CHANGING attachement_list .
ENDLOOP.
ENDLOOP.
WHEN abap_false.
DO 2 TIMES.
CLEAR : w_docfile .
FREE : it_drao.
w_tabix = sy-index.
w_docfile-fileno = w_tabix.
CASE w_tabix.
WHEN 1.
w_dappl = in_draw-dappl.
w_dttrg = in_draw-dttrg.
WHEN 2.
w_dappl = in_draw-dappl1.
w_dttrg = in_draw-dttrg1.
ENDCASE.
w_docfile-dappl = w_dappl.
w_docfile-dttrg = w_dttrg.
CALL FUNCTION 'CV120_DOC_CHECKOUT'
EXPORTING
ps_cout_def = w_cout
ps_draw = in_draw
ps_doc_file = w_docfile
TABLES
ptx_drao = it_drao
EXCEPTIONS
error = 1
OTHERS = 2.
PERFORM transform_fid_to_binary TABLES it_drao
USING w_dappl
in_attsub
CHANGING attachement_list .
ENDDO.
ENDCASE.
Bellow the code for routine TRANSFORM_FID_TO_BINARY
FIELD-SYMBOLS : <drao> TYPE drao ,
<source> TYPE x ,
<dest> TYPE x,
<hexa> TYPE solix .
DATA : w_filelong TYPE i ,
w_long TYPE i,
w_longdes TYPE i .
DATA : it_hexa TYPE solix_tab .
CHECK it_drao[] IS NOT INITIAL.
* Transform Physical document into Binary
LOOP AT it_drao ASSIGNING <drao>.
IF w_filelong IS INITIAL.
w_filelong = <drao>-orln.
ENDIF.
ASSIGN <drao>-orblk TO <source>.
DESCRIBE FIELD <source> LENGTH w_long IN BYTE MODE.
CLEAR w_longdes.
WHILE w_long GT 0.
ASSIGN <source>+w_longdes(w_long) TO <source>.
APPEND INITIAL LINE TO it_hexa ASSIGNING <hexa>.
ASSIGN <hexa>-line TO <dest>.
DESCRIBE FIELD <dest> LENGTH w_longdes IN BYTE MODE.
MOVE <source> TO <dest>.
w_filelong = w_filelong - w_longdes.
w_long = w_long - w_longdes.
CHECK w_filelong LE w_longdes.
IF w_long NE 0.
w_long = w_filelong.
ENDIF.
CHECK w_long LE 0.
w_long = 0.
ENDWHILE.
ENDLOOP.
* Add file to list of attachment
CHECK NOT it_hexa[] IS INITIAL.
zcl_send_mail=>add_attachement_to_list(
EXPORTING
type = w_dappl
subject = in_attsub
content_hexa = it_hexa
CHANGING
attachement_list = attachement_list
EXCEPTIONS
no_content_for_attachement = 1
no_application_type = 2 ).
In my complete solution, an additionnal screen have been define in the header of PO to allow user managing recipient list . If you need so i can give you the code also .
Let me know.
Best regards
Similar Messages
-
Sending Smart forms O/P as an attachment thru e-mail...
Hi friends...
I have dveloped a new Smartform for PO reminder letter..
and I am trying to send it as an attachment thru mail...
the code I wrote for that is given...
but I am getting a runtime error like
In program "CL_TRACE_BCS==================CP ", the following syntax error
occurred
in the Include "CL_TRACE_BCS==================CU " in line 85:
"Implementation missing for method "END_FUNC". "END_FUNC"."
Plz help me....
*******CODE********
REPORT zmm_vendor_reminder_mail.
TABLES : ekko,ekpo,eket,makt,adrc,adr6,lfa1.
DATA: fm_name TYPE rs38l_fnam.
DATA: BEGIN OF itab1 OCCURS 0.
INCLUDE STRUCTURE lfa1.
DATA: END OF itab1.
DATA : BEGIN OF itab OCCURS 0.
INCLUDE STRUCTURE zmm_podetails.
DATA: END OF itab.
DATA : BEGIN OF it_pos OCCURS 0 ,
bukrs LIKE ekpo-bukrs,
werks LIKE ekpo-werks,
ebeln LIKE eket-ebeln,
ebelp LIKE eket-ebelp,
etenr LIKE eket-etenr,
bedat LIKE eket-bedat,
matnr LIKE ekpo-matnr,
meins LIKE ekpo-meins,
menge LIKE eket-menge,
wemng LIKE eket-wemng,
eindt LIKE eket-eindt,
lifnr LIKE ekko-lifnr,
END OF it_pos.
DATA : BEGIN OF it_vendor OCCURS 0 ,
lifnr LIKE lfa1-lifnr,
name1 LIKE adrc-name1,
street LIKE adrc-street,
str_suppl1 LIKE adrc-str_suppl1,
str_suppl2 LIKE adrc-str_suppl2,
city1 LIKE adrc-city1,
post_code1 LIKE adrc-post_code1,
smtp_addr LIKE adr6-smtp_addr,
adrnr LIKE lfa1-adrnr,
telf1 LIKE lfa1-telf1,
telf2 LIKE lfa1-telf2,
END OF it_vendor.
*RAMESH **********
tables: soud.
data: control_parameters TYPE ssfctrlop,
output_options TYPE ssfcompop,
EMail_Subject(50) TYPE c value 'abc'.
DATA: email_recipient TYPE SWOTOBJID,
email_sender TYPE SWOTOBJID,
g_mail_app_obj type SWOTOBJID.
*concatenate text-004 '400000124' into EMail_Subject.
control_parameters-device = 'MAIL'.
control_parameters-no_dialog = 'X'.
control_parameters-preview = space.
output_options-tdnewid = 'X'.
output_options-tdtitle = EMail_Subject.
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : s_bukrs FOR ekpo-bukrs,
s_werks FOR ekpo-werks,
s_ekgrp FOR ekko-ekgrp,
s_lifnr FOR ekko-lifnr,
s_ebeln FOR ekko-ebeln,
s_eindt FOR eket-eindt,
s_mtart FOR ekpo-mtart,
s_matkl FOR ekpo-matkl,
s_matnr FOR ekpo-matnr.
SELECTION-SCREEN : END OF BLOCK b1.
PERFORM mail_recipient_object.
PERFORM mail_sender_object.
PERFORM mail_appl_object changing g_mail_app_obj.
*RAMESH **********
*******************************SELECTION-SCREEN************
AT SELECTION-SCREEN.
Validate test for Plant in selections
LOOP AT s_werks.
IF NOT s_werks-high IS INITIAL.
SELECT SINGLE * FROM ekpo
WHERE werks = s_werks-high.
IF sy-subrc NE 0.
MESSAGE e600(fr) WITH 'This Plant'
s_werks-high ' does not exist.'
ENDIF.
ENDIF.
IF NOT s_werks-low IS INITIAL.
SELECT SINGLE * FROM ekpo
WHERE werks = s_werks-low.
IF sy-subrc NE 0.
MESSAGE e600(fr) WITH 'This Plant'
s_werks-low ' does not exist.'
ENDIF.
ENDIF.
ENDLOOP.
START-OF-SELECTION.
PERFORM get_data.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZMM_VENDOR_REMINDER_MAIL'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE: / 'ERROR 1'.
ENDIF.
CALL FUNCTION fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = control_parameters
MAIL_APPL_OBJ = g_mail_app_obj
MAIL_RECIPIENT = email_recipient
MAIL_SENDER = email_sender
OUTPUT_OPTIONS = output_options
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
itab1 = itab1
itab = itab
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.
*& Form get_data
text
FORM get_data.
SELECT a~bukrs a~werks a~ebeln a~ebelp
b~bedat a~matnr a~meins b~menge
b~wemng b~eindt c~lifnr b~etenr
FROM ekpo AS a
INNER JOIN eket AS b
ON a~ebeln = b~ebeln AND
a~ebelp = b~ebelp
INNER JOIN ekko AS c
ON a~ebeln = c~ebeln AND
a~bukrs = c~bukrs
INTO CORRESPONDING FIELDS OF TABLE it_pos
WHERE a~bukrs IN s_bukrs
AND a~werks IN s_werks
AND b~eindt IN s_eindt
AND c~lifnr IN s_lifnr
AND c~ekgrp IN s_ekgrp
AND c~ebeln IN s_ebeln
AND a~mtart IN s_mtart
AND a~matkl IN s_matkl
AND a~matnr IN s_matnr
AND c~bstyp EQ 'F'
AND c~loekz EQ space
AND a~loekz EQ space
AND b~menge > b~wemng.
SELECT DISTINCT a~lifnr b~name1 b~street b~str_suppl1 b~str_suppl2
b~city1 b~post_code1 a~adrnr a~telf1 a~telf2
FROM lfa1 AS a
INNER JOIN adrc AS b
ON a~adrnr = b~addrnumber
INTO CORRESPONDING FIELDS OF TABLE it_vendor
FOR ALL ENTRIES IN it_pos
WHERE a~lifnr = it_pos-lifnr.
LOOP AT it_vendor.
SELECT SINGLE * FROM adr6
WHERE addrnumber = it_vendor-adrnr
AND persnumber EQ space.
IF sy-subrc = 0.
it_vendor-smtp_addr = adr6-smtp_addr.
ENDIF.
MODIFY it_vendor.
SELECT SINGLE * FROM lfa1
WHERE lifnr = it_vendor-lifnr.
IF sy-subrc EQ 0.
MOVE-CORRESPONDING lfa1 TO itab1.
APPEND itab1.
ENDIF.
ENDLOOP.
LOOP AT it_pos.
itab-bukrs = it_pos-bukrs.
itab-ebeln = it_pos-ebeln.
itab-ebelp = it_pos-ebelp.
itab-matnr = it_pos-matnr.
itab-bedat = it_pos-bedat.
itab-meins = it_pos-meins.
itab-eindt = it_pos-eindt.
itab-lifnr = it_pos-lifnr.
itab-etenr = it_pos-etenr.
APPEND itab.
CLEAR itab.
ENDLOOP.
ENDFORM. "get_data
*& Form mail_recipient_object
text
--> p1 text
<-- p2 text
form mail_recipient_object .
data: email_address TYPE SO_NAME.
email_address = '[email protected]'.
CALL FUNCTION 'CREATE_RECIPIENT_OBJ_PPF'
EXPORTING
IP_COUNTRY =
IP_FAXNO =
IP_MAILADDR = email_address
IP_TYPE_ID = 'U'
IMPORTING
EP_RECIPIENT_ID = email_recipient
EP_ADDRESS =
ET_RECIPIENT =
EXCEPTIONS
INVALID_RECIPIENT = 1
OTHERS = 2
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. " mail_recipient_object
*& Form mail_sender_object
text
--> p1 text
<-- p2 text
form mail_sender_object .
CALL FUNCTION 'CREATE_SENDER_OBJECT_PPF'
EXPORTING
IP_SENDER = sy-uname
IMPORTING
EP_SENDER_ID = email_sender
EXCEPTIONS
INVALID_SENDER = 1
OTHERS = 2
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. " mail_sender_object
*& Form mail_appl_object
text
<--P_G_MAIL_APP_OBJ text
form mail_appl_object changing p_g_mail_app_obj.
include <cntn01>.
DATA: FOLDER TYPE swc_object,
BEGIN OF SOFMFOL_KEY,
FOLDERTYPE LIKE SOFM-FOLTP,
FOLDERYEAR LIKE SOFM-FOLYR,
FOLDERNUMBER LIKE SOFM-FOLNO,
TYPE LIKE SOFM-DOCTP,
YEAR LIKE SOFM-DOCYR,
NUMBER LIKE SOFM-DOCNO,
FORWARDER LIKE SOUB-USRNAM,
END OF SOFMFOL_KEY,
BOR_KEY LIKE SWOTOBJID-OBJKEY.
SELECT single * FROM soud WHERE sapnam LIKE sy-uname AND deleted = ' '.
IF sy-subrc NE 0.
CALL FUNCTION 'SO_USER_AUTOMATIC_INSERT'
EXPORTING
SAPNAME = SY-UNAME
SO_KEY = ' '
SEND_MAIL_IF_NO_ADDRESS = 'X'
IMPORTING
USRADR =
EXCEPTIONS
NO_INSERT = 1
SAP_NAME_EXIST = 2
X_ERROR = 3
SAP_NAME_NOT_EXIST = 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.
clear sofmfol_key.
sofmfol_key-type = 'FOL'.
sofmfol_key-year = soud-inbyr.
sofmfol_key-number = soud-inbno.
bor_key = sofmfol_key.
IF not bor_key is initial.
swc_create_object folder 'SOFMFOL' bor_key.
IF sy-subrc = 0.
swc_object_to_persistent folder g_mail_app_obj.
IF sy-subrc ne 0.
clear g_mail_app_obj.
ENDIF.
ENDIF.
ELSE.
clear g_mail_app_obj.
ENDIF.
endform. " mail_appl_objectHi Ramesh
Just checkout the FORM interface whether you are passing the proper parameters or not. Also, check their datatypes....
I couldnot find any error in your code by seeing it....
Regards -
How to send dms document as email attachemnt
Dear Techies
Can you share the code to send the dms document as an email attachment through abap program.
Thanks in advance.
regards
Omer HumayunHi Omer,
Please have a look into SCN document http://wiki.scn.sap.com/wiki/display/Snippets/DMS+Document+send+as+email+attachment
Send DMS Document Attachments in Mail
Hope this helps.
Regards,
Deepak Kori -
Is it possible to zip a file and send it as an attachment in a mail?
Hi,
Is it possible to zip a file and send it as an attachment in a mail?When you use OWA in something other than IE, you're using OWA lite and no--it is not possible to do either in OWA lite (well, new Exchange stuff makes my answer a little less emphatic but still: pretty much no). Thanks Microsoft. But this guy made it possible to mark unread/read and select all/none:
http://david-burger.blogspot.com/2008/07/firefox-greasemonkey-outlook-web-access_19.html -
How To send DMS(Documents cv01,cv03n,cv04n) from one sap system to othersap
Hello Experts,
I am working Document management system(CV01,cv02n,cv03n,cv04n)...
I want to send the documents from one SAP system to Other SAP system
Using ALE/Idocs....
Please Help on this any sample programs....or function module....
Thanks
PreethiHello,
Please refer to the thread:
How To send DMS(Documents cv01,cv03n,cv04n) from one sap system to othersap
Best Regards, Murugesh AS -
How to create a pdf for the URL attached to an invoice and send it as an attachment in a mail
HI,
I have requirement where i need to get the URL attached to an invoice, create the pdf and send as an attachement in a mail.
The URL attached to an invoice can be seen by following the path : VF03-> Billing document->system->Services for object ->Attachement list.
On searching through existing forums, i found that there is a table 'SRGBTBREL' which stores relationships of GOS object. On giving the invoice number in field 'INSTID_A', i could find an entry in this table.
To get the content, i used the class CL_FITV_GOS, method GET_CONTENT. To this method i passed following values:
IV_ATTA_ID = FOL21000000000521URL39000000000012 (The value if field INSTID_B from table SRGBTBREL)
IV_OBJTP = 'URL'
On execution, i get URL link but the content table is empty.
Could anybody provide some input on how i get the content? Or may be how i can create pdf from the URL link and attach it to mail as an attachment?
Thanks,Hi Amit,
Solution provided by you is working when the link length is one line but it is not working for more than one line
Eg: say link is https://......80 [80 characters long]
I will give <a href="https://...72 [in first line]
73..80">click here</a> [in second line]
I will get the output as 73...80">click here
But i want only CLICK HERE in my output..
Please suggest solution.
Thanks,
Kavya -
Hi,
For one of our users the option to send an email as attachment has disappeared in office programs such as word, excel etc
As you can see from the above these are the normal options you expect to see but for the user affected they get the option to send as a Text document, a pdf or an XPS the option to send as a attachment has gone.
I have logged into her PC with my account and it was fine, i have had a look and no one else has reported this throughout the company and looking for answers online has proven fruitless.
Any Ideas on why this option would have changed to only allow the user to send it as text.Hi,
The "Send as Attachment" option only works when Outlook and word are installed from the same suite. That is required.
Thanks,
Ethan Hua CHN
TechNet Community Support -
Sending smartforms as PDF attachement via e mail
Hello all:
I have configured PPF actions to send smartforms as PDF attchment via e mail it works fine in one client.
But when I copied the transport to another client, the entries in field 'Recipient' in the configuration step 'Define Conditions and Output Parameters for Comm. of Cust.Shipm. & Cust.Dcl' are not copied to the new client. I had maintained the name of the inbox folder that has e mail addresses in this field. Any one has a similar issue ? Or is this similar to the number ranges and not transportable and we have to maintain them in every client. Any insight into this very much appreciated.Hello:
If you want to send the smartform as a PDF attachment, configure your PPF action as described below:
Step 1: Define Techn. Medium for Msgs (PPF Actions) f. Cust. Shipm. and Cust. Decl.
In the action definition, choose processing type as 'External Communication'
form type: 'Smart Forms'
format: /SAPSLL/FORM_PROC
personalization type: 2 object specific....
Make this action definition partner function dependent and create a Z partner function. Maintain that
partner function in this definition.
Step 2: Define Conditions and Output Parameters for Comm. of Cust.Shipm. & Cust.Dcl
Select Communication Method: Internet Mail
Mail Settings: send status: 3
Configure the reamaining PFF actions as usual.
This will work if that configured partner function is maintained in the customs declaration. And for that business partner, maintain the e mail address in the address dependent section via txn BP. -
Unable to send Word document as attachment to an email
I have recently installed Microsoft Office Standard on my new laptap which runs Windows 7 Professional. When i am in Word and trying to send the document as an email attachment, I received an error dialogue box with the message "Word couldn't send
email because of MAPI failure: "Unspecified error"." I clicked on the help button and have tried all the steps but no avail.
The work around is to open Outlook and create an email with an attachment. This works BUT I would like to be able to use Word as it was designed. Anyone have a similar issue and suggested correction?
Thanks!Here is a simple solution sure to work.
1. Start
2. Search for Winword
3. Right Click Winword and choose properties ( I instead would choose open file location just to know where the rest of windows programs can be found. Once there, right click Winword again and choose properties.
4. Click compatabilty tab
5. Check run as administrator at the bottom
6. Apply
7. Do the same for all Office programs If so desired (on the same file location where you found winword just look for Excel, Powerpoint, etc. and make sure the file you choose is an application type file)
Jic, it is not obligatory to apply the above solution for to all Office programs. You can do it just to the ones you want to send email from. If you only need Word to have this functionality just do it for Winword and thats it. -
How to send more than 1 attachment thru email
Hi All,
Need to know how to send more than one attachment through email. I need the coding part of it.
Thanks in Advance.
BalajiHi Balaji,
Check this thread
Sending mail with 2 attachments
Regards,
Santosh -
Sending XML file as attachment in E-mail
Hi,
I'm facing a problem with sending e-mails with an XML-file as attachment. Scenario is as follows:
- I collect the payload from XI with FM 'SXMB_READ_MESSAGE_VERSION_RAW'.
- This payload is in the form of an xstring.
- I convert this xstring to binary content by using FM 'SCMS_XSTRING_TO_BINARY'.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lv_buffer
* APPEND_TO_TABLE = ' '
IMPORTING
output_length = lv_i
TABLES
binary_tab = lt_conhex.
The itab lt_conhex is of type solix_tab.This is used finally to send the mail via class CL_BCS following normal procedures. Now when I open the e-mail with attachments I get the error that in the last line of my xml-file some squares are placed, which causes the document to open incorrectly. When I delete the squares via e.g. notepad and open my xml-file again in my internet browser, it opens correctly.
If I look at the contents of the solix_tab I see that the last line of the hexadecimal values are zero's, probably causing the XML file to be attached/oopened incorrectly. Is there any way to replace these zero's with some hexadecimal value in order to display my XML-file correctly?
Kind regards!Thanks Sandra,
Overlooked that parameter. Indeed if you take the XSTRLEN of the document and place this in the method for creating the attachment it works fine.
CALL METHOD lo_email->add_attachment
EXPORTING
i_attachment_type = ls_email-type
i_attachment_subject = ls_email-subject
i_att_content_hex = ls_email-content_hex
i_attachment_size = ls_email-content_length.
By the way...if you're dealing with PDF documents this documentlength doesn't matter. -
Cannot send Pages document in attachment in Gmail
Hi,
I’m trying to send a Pages 5.0.1 document in Mac Mail using a Gmail adress. The document cannot be sent because of the following error:
“The server response was: This message was blocked because its content presents a potentialsecurity issue. Please visit http://support.google.com/mail/bin/answer.py?answer=6590 to review our message content and attachment contentguidelines.”
Please take notice:
1) I can send photos or PDF documents without a problem. I have successfully sent Page 09 documents as well.
2) To be sure, I have created an emtpy Pages 5.0.1 document (no character entered). 40MB. It will not send. Same error.
Thank you,
P.I get the same result here with Gmail and as you have found out, exporting the pages document to pages '09 works fine.
Sending feed back to Apple would be good. I will too.
http://www.apple.com/feedback/pages.html -
Send KM document as attachment
Hi all,
Wondering if anyone can help me with this requirement! Points awarded generously!
The "send to" command sends a link to a KM document to someone. Does anyone know if there is a way of sending the actual document as an attachment?
I know it is possible to download the document onto your client machine and then attach it, but is it possible to make a change so i can attach it straight from the KM? Or even create a custom command "send as attachment"?
Thanks!
ChrisHi Christopher,
When you use send_to command you can:
To upload a file from your computer, first locate it using "Browse", then choose "Upload". Use "Add" to attach items from the portal.
Patricio. -
DMS- How to know that the documents are attached??
Hello Guys,
This is pertaining to DMS,
We attach documents and link it to various object links.
Later when we get into that transaction we retrive the attached documents.
Suppose i attached the DIR to MARA (in object links) , and until i forcely go to document data in T code MM02 i cant know that documents are attached.....??
My question is how any one will know that the documents are linked thru DMS to Various object links in those transactions.
Is my question is valid......just put your comments...
Regards,
Murali.S
Points will be awarded for sure.Guys,
Thanks first-of all...
But i think i should be still precise little bit more....
Just consider a situation where u have 2 users ....A & B,both are in different location.just imagine user B dont have any contact to(from) User A
User A: creates the various document info record and attach to Material master .
User B is working in another plant . How user B will know that to this material documents are attached,
He(USER B) should have already got the information that documents are attached else he should go and check document data Tab forcing himself......
I felt that every time user has to check as a practice if any documents are attached thru Tab EXTRA'S but this may be critical...not every one will do that....some time u may forget to check the presence.
Is my question valid......??!?!? -
How to send ALV list report as html attachment in a mail??
Hi all,
I have an ALV report which I want to send as an HTML attachment in a mail to an external id. I know that spool can be converted to HTML attachment in a mail. But I don't want to have 2 programs - one for generating ALV and the other to send mail with the spool-converted of the first report as attachment. I want to send the mail in the same program itself. Is it possible? Helpful answers will be suitably rewarded.Hi Sandip,
In your ALV program after the alv output is build in the program do the following steps.
1). Export the list to memory
2). Import the list from mempry
3). Do a COmpress of the data
4). Send an email as an attachment using the normal FM.
Take a look at the following links which will explain how to do the above steps.
http://www.geocities.com/mpioud/Z_EMAIL_ABAP_REPORT.html
http://www.thespot4sap.com/Articles/SAP_Mail_SO_Object_Send.asp
http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm
remember to change the doc type as 'HTM' in the FM to send email.
Cheers
VJ
Maybe you are looking for
-
How do i have multiple calendars on my default calendar setting?
How do i get shared calendars onto my default calendar so i am able to view everything in one place?
-
Metacity/compiz, can't figure out what to do.
Sooo, I just installed arch linux again to play around, starting at a fresh install I installed an xserver and got it running right, then I started installing some WMs and installed lightdm and lightdm-gtk3-greeter. So far so good, when I do try to l
-
Windows 7 64 bit, Apple Mobile Device Service not found.
Hi First post, sorry sorry if this is in the wrong place I have a dell Laptop running Windows 7 X64 and Apple Mobile Device Service is not installing and cannot be found in services. note the account has Admin privildges (the logging below is wrong)
-
IBooks for Mac Doesn't Reopen Books
iBooks isn't reopening windows after I close it. Here's what I do in sequence: 1. Open iBooks. 2. Double-click a book. 3. Click the fullscreen button in the upper-right corner. 4. Quit iBooks with CMD + Q. 5. Open iBooks. No windows pop up, not even
-
Hi Gurus, I've implemented the code below for my report to display Required Start Date (MM/DD/YYYY) by searching and processing either a single Fiscal Year/Period (PPP/YYYY to PPP/YYYY) input or a range/interval Fiscal Year/Period (PPP/YYY) input. Th