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_object
Hi 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
Similar Messages
-
Need to send Smart form via email through Driver program
Hi All,
We need to send smart form via email through a new driver program (z program). Can you please guide me on this.
I have used the following code to achieve this. We are getting message saying 'Mail request has created' when executed, but the mail is not sent.
lvs_comm_type = 'INT'.
lvs_comm_values-adsmtp-SMTP_ADDR = e_mail.
lvs_comm_values-adsmtp-R3_USER = 'X'.
lvs_comm_values-adsmtp-ENCODE = '0'.
call function 'CONVERT_COMM_TYPE_DATA'
exporting
pi_comm_type = lvs_comm_type
pi_comm_values = lvs_comm_values
pi_screen = ' '
pi_newid = 'X'
importing
pe_itcpo = lvs_itcpo
pe_device = lvf_device
pe_mail_recipient = p_mail_recipient
pe_mail_sender = p_mail_sender
exceptions
comm_type_not_supported = 1
recipient_creation_failed = 2
sender_creation_failed = 3
others = 4.
if sy-subrc ne 0.
raise COMMUNICATION_ERROR.
endif.
control_parameters-device = 'MAIL'.
output_options-TDIMMED = 'X'.
output_options-TDDELETE = 'X'.
CALL FUNCTION fm_name
exporting
CONTROL_PARAMETERS = control_parameters
MAIL_RECIPIENT = mail_recipient
MAIL_SENDER = mail_sender
OUTPUT_OPTIONS = output_options
USER_SETTINGS = space
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
Thank youHi,
For sending smartform output into mail you first have to generate spool request and convert it into PDF and then
only it can be sended into mail, please find the sample code in the mail below:
http://wiki.sdn.sap.com/wiki/display/sandbox/ConversionofSpoolRequestDataintoPDFandExcelFormatandSenditintoMail
Mansi
Edited by: Matt on Jan 29, 2010 8:25 AM - removed code, instead point to wiki that Mansi authored. -
Send Smart Forms within emails (html) Problems with format
Dear all,
the ABAP report SF_XSF_DEMO1 is a demo report which converts a certain smart form into HTML and then sends it as an email in html format.
Sending the email is possible without any problems but I am wondering about the email format.
<a href="http://www.imgbox.de/show/img/e4QvgzsS4L.jpg" title="Bilder hochladen">This screenshot shows how the email looks like.</a>
I am not happy with the email layout as the Smart Form "SF_XSF_DEMO1" is designed in a different way.
What do I have to adapt within the report in order to send an email that really looks like the Smart Form? Or is it a customizing issue?
(I would like to avoid having to send the Smart Form as PDF attachment...)
Thanks for you help!
Kristian KindlerHi Kristian,
When ever you send a smartform output as an HTML email, the system generates automatic style sheets which are not supported in many email clients such as Outlook 2007, hence you will face a formatting issue. We faced the same issue and had do it it like this:
Build a BSP page similar to the output which you want to send as an email. Now you can use the BSP URL to send the html email using cl_bcs class.
I have documented this in my article below-
http://divulgesap.com/blog.php?p=NDA=
Hope it helps.
Regards,
Ravikiran -
Sending Smart form to Printer in SRM
Hi All,
I am trying to send a smartform to Printer in SRM ITS. I gave output options and control parameters . When i see the Print dialog box i dont see the Front end printers in that. Normally when we pass LOCL we should see default printer in Print dialog.
When i do print, spool is creating but its not printing at local printer .
I am doing this in SRM ITS ... could you kindly any one tell me what steps need to take to print a smart form at local printer when we call form ?
ThanksHi
Please elaborat, when you need this SMARTFORM to get triggered.
By the way, Have you tried implementaing the following BADIs ?
BBP_CHANGE_SF_BID Smartform for E-Mails to Bidder
BBP_CHANGE_SF_CTR Change Smart Form for Contract Output
BBP_CHANGE_SF_ERS Change Smart Form
BBP_CHANGE_SF_SC Smart Form Shopping Cart Print
BBP_CHANGE_SF_VERS Change Smart Form for Version Comparison
BBP_PROCESS_AUC Process Smart Form with Changed Interface
BBP_PROCESS_BID Process Smart Form with Changed Interface
BBP_PROCESS_CTR Process Smart Form with Changed Interface
BBP_PROCESS_PO Process Smart Form with Changed Interface
BBP_PROCESS_QUOT Process Smart Form with Changed Interface
Hope this will help.
Please rewards suitable points.
Regards
- Atul -
Hi,
We are working on WebAS 6.20.
We are trying to send a smart form directly to a fax machine.
We have SAPConnect configured and are using the SMTP server to communicate to the fax machine.
I want to know what fax server needs to be installed and how to complete the process to send a fax through SAP.
If any one has any inputs in this regard, I would really appreciate it if you could share it in the group.
Regards
Maninder SawhneyHi Maninder,
You may get some help from here.
http://help.sap.com/saphelp_nw04/helpdata/en/af/73563c1e734f0fe10000000a114084/frameset.htm
Thanks
Vinod -
Hi,
I need to send a smart form to spool only. It's not to be printed. I have set the following:
no_dialog = 'X'.
tdnoprev = 'X'.
tdnewid = 'X'
tdimmed = ''.
and it's sending the smart form to the spool and printing it at the same time.
Anybody can advised me which parameters should I set? Points will be rewarded for useful replies. Thanks.hi,
use <b>ssf_function_module_name</b>
and
<b>ws_formname</b>
the below link contains all the declarations and function module information.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/452ea204-0701-0010-cb88-8cc50fa287f0
regards,
Ashok Reddy -
Issue in External send - smart forms
hi All,
i have written a new print program for smart form and have assigned it to zoutput type.
The print preview and spool are perfectly fine.
when i give the medium as external send, it is not sending any attachmnet to the external mail id i gave.
my code is as follows.
PERFORM set_print_param USING ls_addr_key
ls_dlv-land
CHANGING ls_control_param
ls_composer_param
ls_recipient
ls_sender
ret.
FORM SET_PRINT_PARAM USING IS_ADDR_KEY LIKE ADDR_KEY
IS_DLV-LAND LIKE VBRK-LAND1
CHANGING CS_CONTROL_PARAM TYPE SSFCTRLOP
CS_COMPOSER_PARAM TYPE SSFCOMPOP
CS_RECIPIENT TYPE SWOTOBJID
CS_SENDER TYPE SWOTOBJID
RET TYPE SY-SUBRC.
DATA: LS_ITCPO TYPE ITCPO.
DATA: LF_REPID TYPE SY-REPID.
DATA: LF_DEVICE TYPE TDDEVICE.
DATA: LS_RECIPIENT TYPE SWOTOBJID.
DATA: LS_SENDER TYPE SWOTOBJID.
LF_REPID = SY-REPID.
CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'
EXPORTING
PI_NAST = NAST
PI_COUNTRY = IS_DLV-LAND
PI_ADDR_KEY = IS_ADDR_KEY
PI_REPID = LF_REPID
PI_SCREEN = XSCREEN
IMPORTING
PE_RETURNCODE = RET
PE_ITCPO = LS_ITCPO
PE_DEVICE = LF_DEVICE
PE_RECIPIENT = CS_RECIPIENT
PE_SENDER = CS_SENDER.
IF RET = 0.
MOVE-CORRESPONDING LS_ITCPO TO CS_COMPOSER_PARAM.
CS_CONTROL_PARAM-NO_OPEN
CS_CONTROL_PARAM-NO_CLOSE
CS_CONTROL_PARAM-DEVICE = LF_DEVICE.
CS_CONTROL_PARAM-NO_DIALOG = 'X'.
CS_CONTROL_PARAM-PREVIEW = XSCREEN.
CS_CONTROL_PARAM-GETOTF = LS_ITCPO-TDGETOTF.
CS_CONTROL_PARAM-LANGU = NAST-SPRAS.
CS_CONTROL_PARAM-REPLANGU1
CS_CONTROL_PARAM-REPLANGU2
CS_CONTROL_PARAM-REPLANGU3
CS_CONTROL_PARAM-STARTPAGE
ENDIF.
ENDFORM.
after this i am calling smart form with all the required parameters.
CALL FUNCTION gv_function
EXPORTING
control_parameters = ls_control_param
output_options = ls_composer_param
archive_index = toa_dara
archive_parameters = arc_params
mail_recipient = ls_recipient
mail_sender = ls_sender
user_settings = space
IMPORTING
JOB_OUTPUT_INFO = ls_job_info
TABLES
zmm_purord_at = zmm_purord_at
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
i am not getting any mail to the desired mail id.
Any pointers to this would be highly appreciated.
Regards,
Sreekanthhi All,
i have written a new print program for smart form and have assigned it to zoutput type.
The print preview and spool are perfectly fine.
when i give the medium as external send, it is not sending any attachmnet to the external mail id i gave.
my code is as follows.
PERFORM set_print_param USING ls_addr_key
ls_dlv-land
CHANGING ls_control_param
ls_composer_param
ls_recipient
ls_sender
ret.
FORM SET_PRINT_PARAM USING IS_ADDR_KEY LIKE ADDR_KEY
IS_DLV-LAND LIKE VBRK-LAND1
CHANGING CS_CONTROL_PARAM TYPE SSFCTRLOP
CS_COMPOSER_PARAM TYPE SSFCOMPOP
CS_RECIPIENT TYPE SWOTOBJID
CS_SENDER TYPE SWOTOBJID
RET TYPE SY-SUBRC.
DATA: LS_ITCPO TYPE ITCPO.
DATA: LF_REPID TYPE SY-REPID.
DATA: LF_DEVICE TYPE TDDEVICE.
DATA: LS_RECIPIENT TYPE SWOTOBJID.
DATA: LS_SENDER TYPE SWOTOBJID.
LF_REPID = SY-REPID.
CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'
EXPORTING
PI_NAST = NAST
PI_COUNTRY = IS_DLV-LAND
PI_ADDR_KEY = IS_ADDR_KEY
PI_REPID = LF_REPID
PI_SCREEN = XSCREEN
IMPORTING
PE_RETURNCODE = RET
PE_ITCPO = LS_ITCPO
PE_DEVICE = LF_DEVICE
PE_RECIPIENT = CS_RECIPIENT
PE_SENDER = CS_SENDER.
IF RET = 0.
MOVE-CORRESPONDING LS_ITCPO TO CS_COMPOSER_PARAM.
* CS_CONTROL_PARAM-NO_OPEN
* CS_CONTROL_PARAM-NO_CLOSE
CS_CONTROL_PARAM-DEVICE = LF_DEVICE.
CS_CONTROL_PARAM-NO_DIALOG = 'X'.
CS_CONTROL_PARAM-PREVIEW = XSCREEN.
CS_CONTROL_PARAM-GETOTF = LS_ITCPO-TDGETOTF.
CS_CONTROL_PARAM-LANGU = NAST-SPRAS.
* CS_CONTROL_PARAM-REPLANGU1
* CS_CONTROL_PARAM-REPLANGU2
* CS_CONTROL_PARAM-REPLANGU3
* CS_CONTROL_PARAM-STARTPAGE
ENDIF.
ENDFORM.
after this i am calling smart form with all the required parameters.
CALL FUNCTION gv_function
EXPORTING
control_parameters = ls_control_param
output_options = ls_composer_param
archive_index = toa_dara
archive_parameters = arc_params
mail_recipient = ls_recipient
mail_sender = ls_sender
user_settings = space
IMPORTING
JOB_OUTPUT_INFO = ls_job_info
TABLES
zmm_purord_at = zmm_purord_at
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
i am not getting any mail to the desired mail id.
Any pointers to this would be highly appreciated.
Regards,
Sreekanth -
Can't send or recieve email via gmail or yahoo thru apple mail
I applied the update this morning, now I can't send or receive mail thru apple mail on any of my updated computers. Just shows gmail and yahoo "offline". try to take online, just get failure notice. Am on Yosemite 10.10.1
iOS: Unable to send or receive email
http://support.apple.com/kb/TS3899
Can’t Send Emails on iPad – Troubleshooting Steps
http://ipadhelp.com/ipad-help/ipad-cant-send-emails-troubleshooting-steps/
iPad Mail
http://www.apple.com/support/ipad/mail/
Try this: Delete the account in Mail and then set it up again.
Cheers, Tom -
How to send smart form as mail?
Hello everybody,
I have used the following code to send a smartform in PDF format through email.
I m able to view the contents of the mail in SAP Bussiness Workplace but UNABLE TO TRANSFER THE MAIL to an INTERNET ID (like gmail id or yahoo id).
Can anybody suggest me about what might have gone wrong?
Helpful answers will surely be rewarded.
code
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
wa_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
wa_doc_chng TYPE sodocchgi1,
w_data TYPE sodocchgi1,
wa_buffer TYPE string,"To convert from 132 to 255
Variables declarations
*v_form_name TYPE rs38l_fnam, " L_FM_NAME
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
DATA: l_fm_name TYPE rs38l_fnam.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = p_l_formname
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = l_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF g_it3 = 'M'.
g_it3 = 'Mr'.
ENDIF.
IF g_it3 = 'F'.
g_it3 = 'Ms'.
ENDIF.
CALL FUNCTION l_fm_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS =
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
it = g_it
it1 = g_it1
it3 = g_it3
it4 = g_it4
it5 = g_it5
it6 = g_it6
it7 = g_it7
it8 = g_it8
it10 = g_it10
it14 = g_it14
it15 = g_it15
it36 = g_it36
it18 = g_it18
it37 = g_it37
it19 = g_it19
it9 = g_it9
it11 = g_it11
it13 = g_it13
it39 = g_it39
it40 = g_it40
it20 = g_it20
it21 = g_it21
it22 = g_it22
it23 = g_it23
it25 = g_it25
it26 = g_it26
it27 = g_it27
it28 = g_it28
it29 = g_it29
it30 = g_it30
it31 = g_it31
it32 = g_it32
it33 = g_it33
total = g_total
it34 = g_it34
it35 = g_it35
it2 = pa0006-begda
it12 = pa0001-begda
it16 = pa0015-begda
it17 = pa0001-endda
it24 = pa0002-endda
it38 = pa0002-begda
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
g_semail = 'X'.
IF g_semail = 'X'.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION l_fm_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
IMPORTING
job_output_info = w_return
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
i_otf[] = w_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
otf = i_otf
lines = i_tline
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*convert PDF from 132 to 255
LOOP AT i_tline.
*Replacing space by '~'.
TRANSLATE i_tline USING '~'.
CONCATENATE wa_buffer i_tline INTO wa_buffer.
ENDLOOP.
*Repalacing '~' by space.
TRANSLATE wa_buffer USING '~'.
DO.
i_record = wa_buffer.
*Appending 255 characters as a record.
APPEND i_record.
SHIFT wa_buffer LEFT BY 255 PLACES.
IF wa_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Attachment
REFRESH:
i_reclist,
i_objtxt,
i_objbin,
i_objpack.
CLEAR wa_objhead.
*Object with PDF.
i_objbin[] = i_record[].
DESCRIBE TABLE i_objbin LINES v_lines_bin.
Create Message Body
Title and Description
*Object with main text of the mail.
i_objtxt = 'Find attached the output of the smartform'.
APPEND i_objtxt.
i_objtxt = 'Regards'.
APPEND i_objtxt.
i_objtxt = 'Lokesh'.
APPEND i_objtxt.
DESCRIBE TABLE i_objtxt LINES v_lines_txt.
READ TABLE i_objtxt INDEX v_lines_txt.
*Document information.
wa_doc_chng-obj_name = 'Offer Letter'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = 'Offer Letter'.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
Main Text
*Pack to main body as RAW.
*Object to be transported not in binary form.
wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + STRLEN( i_objtxt ).
CLEAR i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
APPEND i_objpack.
Attachment
(pdf-Attachment)
*Packing as PDF
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 1.
i_objpack-body_start = 1.
Länge des Attachment ermitteln
DESCRIBE TABLE i_objbin LINES v_lines_bin.
READ TABLE i_objbin INDEX v_lines_bin.
i_objpack-doc_size = v_lines_bin * 255 .
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'smart'.
i_objpack-obj_descr = 'test'.
APPEND i_objpack.
CLEAR i_reclist.
i_reclist-receiver = '[email protected]'.
i_reclist-express = 'X'.
i_reclist-rec_type = 'U'.
APPEND i_reclist.
*CALL FUNCTION 'LXE_SEND_MAIL_ATTMNT'
EXPORTING
description =
SENSITIVITY = 'O'
IN_OUTBOX = ' '
tables
receivers =
document_text =
DOCUMENT_ATTMNT =
DOCUMENT_ATTMNT_ATTR =
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
NO_AUTHORIZATION = 3
OTHERS = 4
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = i_objpack
object_header = wa_objhead
contents_bin = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
MESSAGE 'success' TYPE 'I'.
ENDIF.
ENDIF.
ENDFORM. " GET_OFFER_LETTERHere is the code to send the Smartform to mail as PDF attachment.
*& Report ZTEST_PDF_MAIL
REPORT ZTEST_PDF_MAIL.
Internal Table declarations
DATA: I_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,
I_TLINE TYPE TABLE OF TLINE WITH HEADER LINE,
I_RECEIVERS TYPE TABLE OF SOMLRECI1 WITH HEADER LINE,
I_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
I_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
I_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
I_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
I_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
WA_OBJHEAD TYPE SOLI_TAB,
W_CTRLOP TYPE SSFCTRLOP,
W_COMPOP TYPE SSFCOMPOP,
W_RETURN TYPE SSFCRESCL,
WA_DOC_CHNG TYPE SODOCCHGI1,
W_DATA TYPE SODOCCHGI1,
WA_BUFFER TYPE STRING, "To convert from 132 to 255
Variables declarations
V_FORM_NAME TYPE RS38L_FNAM,
V_LEN_IN LIKE SOOD-OBJLEN,
V_LEN_OUT LIKE SOOD-OBJLEN,
V_LEN_OUTN TYPE I,
V_LINES_TXT TYPE I,
V_LINES_BIN TYPE I.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZTEST'
IMPORTING
FM_NAME = V_FORM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
W_CTRLOP-GETOTF = 'X'.
W_CTRLOP-NO_DIALOG = 'X'.
W_COMPOP-TDNOPREV = 'X'.
CALL FUNCTION V_FORM_NAME
EXPORTING
CONTROL_PARAMETERS = W_CTRLOP
OUTPUT_OPTIONS = W_COMPOP
USER_SETTINGS = 'X'
IMPORTING
JOB_OUTPUT_INFO = W_RETURN
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I_OTF[] = W_RETURN-OTFDATA[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
IMPORTING
BIN_FILESIZE = V_LEN_IN
TABLES
OTF = I_OTF
LINES = I_TLINE
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
ENDIF.
LOOP AT I_TLINE.
TRANSLATE I_TLINE USING '~'.
CONCATENATE WA_BUFFER I_TLINE INTO WA_BUFFER.
ENDLOOP.
TRANSLATE WA_BUFFER USING '~'.
DO.
I_RECORD = WA_BUFFER.
APPEND I_RECORD.
SHIFT WA_BUFFER LEFT BY 255 PLACES.
IF WA_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Attachment
REFRESH: I_RECLIST,
I_OBJTXT,
I_OBJBIN,
I_OBJPACK.
CLEAR WA_OBJHEAD.
I_OBJBIN[] = I_RECORD[].
Create Message Body Title and Description
I_OBJTXT = 'test with pdf-Attachment!'.
APPEND I_OBJTXT.
DESCRIBE TABLE I_OBJTXT LINES V_LINES_TXT.
READ TABLE I_OBJTXT INDEX V_LINES_TXT.
WA_DOC_CHNG-OBJ_NAME = 'smartform'.
WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
WA_DOC_CHNG-SENSITIVTY = 'F'.
WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
Main Text
CLEAR I_OBJPACK-TRANSF_BIN.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
I_OBJPACK-BODY_START = 1.
I_OBJPACK-BODY_NUM = V_LINES_TXT.
I_OBJPACK-DOC_TYPE = 'RAW'.
APPEND I_OBJPACK.
Attachment (pdf-Attachment)
I_OBJPACK-TRANSF_BIN = 'X'.
I_OBJPACK-HEAD_START = 1.
I_OBJPACK-HEAD_NUM = 0.
I_OBJPACK-BODY_START = 1.
DESCRIBE TABLE I_OBJBIN LINES V_LINES_BIN.
READ TABLE I_OBJBIN INDEX V_LINES_BIN.
I_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
I_OBJPACK-BODY_NUM = V_LINES_BIN.
I_OBJPACK-DOC_TYPE = 'PDF'.
I_OBJPACK-OBJ_NAME = 'smart'.
I_OBJPACK-OBJ_DESCR = 'test'.
APPEND I_OBJPACK.
CLEAR I_RECLIST.
I_RECLIST-RECEIVER = '[email protected]'.
I_RECLIST-REC_TYPE = 'U'.
APPEND I_RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = WA_OBJHEAD
CONTENTS_BIN = I_OBJBIN
CONTENTS_TXT = I_OBJTXT
RECEIVERS = I_RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
WRITE:/ 'Error When Sending the File', SY-SUBRC.
ELSE.
WRITE:/ 'Mail sent'.
ENDIF.
If you want to send some text as Body of the Mail then follow this once
when u r callin the FM'SO_NEW_DOCUMENT_ATT_SEND_API1'.. points to remember
1.u have to pass the body of content in table CONTENTS_TXT(ia m using I_OBJBIN) (each line a record) then. suppose i have appended 11 records to the table CONTENTS_TXT .
2.PACKING_LIST(iam usign I_OBJPACK) table u ahve to append a redord as follows
I_OBJPACK-TRANSF_BIN = ' '.
I_OBJPACK-HEAD_START = 000000000000001.
I_OBJPACK-HEAD_NUM = 000000000000001.
I_OBJPACK-BODY_START = 000000000000002
I_OBJPACK-BODY_NUM = 000000000000010.
I_OBJPACK-DOC_TYPE = 'RAW'.
append I_OBJPACK-.
by the above code system treat the first line in table I_OBJBIN as header and the 2nd line to 10 lines tread as body.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = I_OBJPACK
OBJECT_HEADER = WA_OBJHEAD
CONTENTS_BIN = I_OBJBIN
CONTENTS_TXT = I_OBJTXT
RECEIVERS = I_RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8.
regards,
srinivas -
Dear all
When the document is Printed 2 Messages will be created:
- First, will send the document to the Printer
- Second, we need to convert the message to PDF and to send this message to a specified Folder that is located in a different server.
At this point my problem is who to configured the Scot transaction to send the message to the folder.
Best Regards.
Thanks in advancedHi
You should set two different output devices for those two message.
- First: a normal printer;
- Second: ZPDF device.
Infact it's possible to create a ZPDF device that convert automatically the spool in pdf format and save the file in a certain folder.
If you want I can send to you a little document to create that particula PDF device, but it's written in Italian.
Anayway that document is based on these notes:
161516, 576973, 17054, 437696, 317851, 6753.
Max -
Default settings for sending smart forms via mail saving it in pdf
do we have to do any default settings in any trasaction code like scot for solving the above problem
hi thanku very much durga prasad
my mail id is [email protected] -
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
RgdsHi,
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 -
Sending a formatted Excel sheet as an attachment in a mail.
Hi ,
I have been using following code to to send formatted excel sheet as attachment in email.
in the below code I want to change the format of cell from Bold to Underline.
I have replaced Bold with Underline for below code but it is not working can anyone suggest on this.
Department
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ).
r_data = l_document->create_simple_element( name = 'Data' value = 'MATNR' parent = r_cell ).
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
r_format->set_attribute_ns( name = 'Bold' prefix = 'ss' value = '1' ).
Creating a ixml Factory
l_ixml = cl_ixml=>create( ).
Creating the DOM Object Model
l_document = l_ixml->create_document( ).
Create Root Node 'Workbook'
l_element_root = l_document->create_simple_element( name = 'Workbook' parent = l_document ). l_element_root->set_attribute( name = 'xmlns' value = 'urn:schemas-microsoft-com:office:spreadsheet' ). ns_attribute = l_document->create_namespace_decl( name = 'ss' prefix = 'xmlns' uri = 'urn:schemas-microsoft-com:office:spreadsheet' ). l_element_root->set_attribute_node( ns_attribute ). ns_attribute = l_document->create_namespace_decl( name = 'x' prefix = 'xmlns' uri = 'urn:schemas-microsoft-com:office:excel' ). l_element_root->set_attribute_node( ns_attribute ).
Create node for document properties.
r_element_properties = l_document->create_simple_element( name = 'TEST_REPORT' parent = l_element_root ). l_value = sy-uname. l_document->create_simple_element( name = 'Author' value = l_value parent = r_element_properties ).
Styles
r_styles = l_document->create_simple_element( name = 'Styles' parent = l_element_root ).
Style for Header
r_style = l_document->create_simple_element( name = 'Style' parent = r_styles ). r_style->set_attribute_ns( name = 'ID' prefix = 'ss' value = 'Header' ). r_format = l_document->create_simple_element( name = 'Font' parent = r_style ).
Worksheet
r_worksheet = l_document->create_simple_element( name = 'Worksheet' parent = l_element_root ). r_worksheet->set_attribute_ns( name = 'Name' prefix = 'ss' value = 'PO Details' ).
Table
r_table = l_document->create_simple_element( name = 'Table' parent = r_worksheet ). r_table->set_attribute_ns( name = 'FullColumns' prefix = 'x' value = '1' ). r_table->set_attribute_ns( name = 'FullRows' prefix = 'x' value = '1' ).
Column Formatting
r_column = l_document->create_simple_element( name = 'Column' parent = r_table ). r_column->set_attribute_ns( name = 'Width' prefix = 'ss' value = '70' ). r_column = l_document->create_simple_element( name = 'Column' parent = r_table ). r_column->set_attribute_ns( name = 'Width' prefix = 'ss' value = '70' ). r_column = l_document->create_simple_element( name = 'Column' parent = r_table ). r_column->set_attribute_ns( name = 'Width' prefix = 'ss' value = '70' ). r_column = l_document->create_simple_element( name = 'Column' parent = r_table ). r_column->set_attribute_ns( name = 'Width' prefix = 'ss' value = '70' ). r_column = l_document->create_simple_element( name = 'Column' parent = r_table ). r_column->set_attribute_ns( name = 'Width' prefix = 'ss' value = '70' ).
Blank Row
r_row = l_document->create_simple_element( name = 'Row' parent = r_table ).
Column Headers Row
r_row = l_document->create_simple_element( name = 'Row' parent = r_table ). r_row->set_attribute_ns( name = 'AutoFitHeight' prefix = 'ss' value = '1' ).
Sr. No.
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ). r_data = l_document->create_simple_element( name = 'Data' value = 'EBELN' parent = r_cell ). r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
User Name
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ). r_data = l_document->create_simple_element( name = 'Data' value = 'EBELP' parent = r_cell ). r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
Full Name
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ). r_data = l_document->create_simple_element( name = 'Data' value = 'AEDAT' parent = r_cell ). r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ).
Department
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Header' ). r_data = l_document->create_simple_element( name = 'Data' value = 'MATNR' parent = r_cell ). r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). r_format->set_attribute_ns( name = 'Bold' prefix = 'ss' value = '1' ). r_format = l_document->create_simple_element( name = 'Interior' parent = r_style ). r_format->set_attribute_ns( name = 'Color' prefix = 'ss' value = '#C0C0C0' ). r_format->set_attribute_ns( name = 'Pattern' prefix = 'ss' value = 'Solid' ). r_format = l_document->create_simple_element( name = 'Alignment' parent = r_style ). r_format->set_attribute_ns( name = 'Vertical' prefix = 'ss' value = 'Center' ). r_format->set_attribute_ns( name = 'WrapText' prefix = 'ss' value = '1' ).
Data Table
LOOP AT it_ekpo INTO wa_ekpo. r_row = l_document->create_simple_element( name = 'Row' parent = r_table ).
Sr. No.
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ).
r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ).
l_value = sy-tabix.
CONDENSE l_value NO-GAPS.
r_data = l_document->create_simple_element( name = 'Data' value = l_value parent = r_cell ). " Data
r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'Number' ). " Cell format
EBELN
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ). l_value = wa_ekpo-ebeln. r_data = l_document->create_simple_element( name = 'Data' value = l_value parent = r_cell ). " Data r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). " Cell format
EBELP
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ). l_value = wa_ekpo-ebelp. r_data = l_document->create_simple_element( name = 'Data' value = l_value parent = r_cell ). " Data r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). " Cell format
AEDAT
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ). l_value = wa_ekpo-aedat. r_data = l_document->create_simple_element( name = 'Data' value = l_value parent = r_cell ). " Data r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). " Cell format
MATNR
r_cell = l_document->create_simple_element( name = 'Cell' parent = r_row ). r_cell->set_attribute_ns( name = 'StyleID' prefix = 'ss' value = 'Data' ). l_value = wa_ekpo-matnr. r_data = l_document->create_simple_element( name = 'Data' value = l_value parent = r_cell ). " Data r_data->set_attribute_ns( name = 'Type' prefix = 'ss' value = 'String' ). " Cell format ENDLOOP.
Creating a Stream Factory
l_streamfactory = l_ixml->create_stream_factory( ).
Connect Internal XML Table to Stream Factory
l_ostream = l_streamfactory->create_ostream_itable( table = l_xml_table ).
Rendering the Document
l_renderer = l_ixml->create_renderer( ostream = l_ostream document = l_document ). l_rc = l_renderer->render( ).
Saving the XML Document
l_xml_size = l_ostream->get_num_written_raw( ).
Before sending the mail,
LOOP AT l_xml_table INTO wa_xml.
CLEAR objbin.
objbin-line = wa_xml-data.
APPEND objbin to BINARY_CONTENT.
ENDLOOP.
Here, objbin is of type SOLIX and BINARY_CONTENT is of type SOLIX_TAB.
Now, call the method,
CALL METHOD DOCUMENT->ADD_ATTACHMENT
EXPORTING I_ATTACHMENT_TYPE = 'XLS'
I_ATTACHMENT_SUBJECT = 'My attachment'
I_ATT_CONTENT_HEX = BINARY_CONTENT .Try this..
r_format->set_attribute_ns( name = 'Underline' prefix = 'ss' value = 'Single' ). -
Can we send the documents in oracle portal as attachment to a mail ?
Hi,
Our Client using Oracle APPlication Server Portal 10.1.2 for data management and employee portal purpose.
our users used to attach or store the files/documents in Portal i.e. like a file item.
They want to send some selected files/documents as attachments to a group of people via email
Is there any possiblity to achieve this please let me know.
Regards,
RajeshHi Rajesh,
If you are just have one email procedure which you want to use to send files from both your desktop and from the Portal repository, you could consider to connect the Portal repository to your desktop through WebDAV. I assume however that you are looking for a sort of 'Email This' button next to file items.
I have not programmed this before but I guess you can do this with a custom item based on file item. Add an attribute based on PL/SQL which will do the email for you. The PL/SQL procedure in the custom attribute can use wwsbr_all_items view to retrieve the content of the item and send it with utl_smtp. Easier said than done - have not programmed it myself. But then, I am not a programmer, so I reckon Portal developers on this forum would be able to help.
Regards,
Erik -
Smart form as the body of the email
Hi Experts,
I have a requirement where in i have a smart form which consists of some text and company logos in it.
Now, i need to send one email to the respective person and that smart form should come in the body of the email,but not as attachment.I know how to send that smart form as an PDF attachment.But i am not sure on how to include it in the body of the email.Please suggest me.I have tried searching in SDN but could not get any information abt it.
Regards,
Lakshman.HI Laxman,
Go through the following link:
How to send smart form to email as a body and not in attachments?
Regards,
Nitin.
Maybe you are looking for
-
Recording hd video on iphone 4, better in imovie app, or desktop?
For some reason, my imovie recordedo on my iphone and imported looks worse on the desktop version than on the app. Anyone know what parameters or settings should be used to import the iphone 4 hd videos into the desktop version? I would rather use th
-
Running Thunderbolt Drive and Monitor Adapter on a Macbook Air
Do they make any type of Y adapter for the single Thunderbolt port ?
-
Oracle SQL with IN condition - bad performance
Hi, I have a table like this ID COL1 COL2 COL3 I have to delete all records in a table where COL1 in ('A','B','C','D') and COL2 in ('K','V','N') and COL3 in ('Y','T','I') which means I will have to delete all combination of records for these three co
-
Disconnect WSUS server and Process of Approving Updates via Metadata.
Hi Folks: I have recently setup 2 WSUS servers. The first one has connectivity to the Internet and of course has access to Microsoft updates. The second WSUS server is part of a disconnected network. Both WSUS servers are supporting client work
-
How to resize window keeping relative width and hieght
Ok as usual I do not want this done for me but I could use a pointer. Simply put I wish to set a JFrame so that when it is resized by the user it holds its relative width and height. Could somebody point me to where it is at in the API or a generic s