Send a remuneration statement (paystub) as a PDF attachment by e-mail
Hi,
Does anybody send to their employees remuneration statement (paystub) as a PDF attachment by e-mail?
Could you please share the method that you using for it and advice why you choose this method?
I need to analyse at least two options:
u2022 Sending standard SAP Remuneration FORM
u2022 Sending custom made Remuneration FORM (more relevant to my situation)
Thank you in advance,
Yutah
Thank you Rohan,
It may work for standard SAP payslip form but still need to find out how to send it out by e-mail automatically after pay-run is done to a bunch of employees.
Is there any standard solution or I need to create custom program to do it?
Any idea about custom made payslip form.
Right now we create a text file which we send to third party for payslip printing and have a custom made report which reads this file if we need to display/print payslip in house.
Similar Messages
-
How to open a pdf attachment in imac mail
I am unable to open a PDF attachment in Mac Mail. There is not a PDF Icon in the email message. Is there a setting that should be checked?
I have a new iMac (less than a month old) with Mountain Lion.
Help would be greatly appreciated. ThanksIt is an actual PDF that is an attachment to an email. There is not a link to click on to open the attachment.
The attachment is a statement that I normally open, then print..
What I am seeing on the monitor is the heading portion of the email with the statement image, all on one page..It prints exactly as seen on the screen.
I have checked my Mail>Preferences>Viewing Tab."Display remote images in HTML" messages is checked..
Thanks for the help. -
Smartform - PDF attachment through E-mail issue
Hi,
A custom form and custom program was created to print the Purchase order information through ME21N, 22n and 23n.
It also has E-mail option. when output medium 5(Simple mail) and 7(External send), email will be send to respective mail-id's with the PDF attachment.
I have issue at the time of saving PO which processed with medium 5. when i save A popup appears "Express document update was terminated received from author". Brief message about it is
"Error Info... 00 671: ABAP/4 processor: COMMIT_IN_POSTING"
In Smartform driver program i am using below function modules to convert OTF into PDF and send through e-mail.
Function Module: CONVERT_OTF.
Function Module: SO_DOCUMENT_SEND_API1.
I am not sure, what i missed out. Can you guys tell is this the correct way to send PDF attachment through E-mail or i missed out any function module for commit.
Regards,
Hemanth.
Edited by: keerthipati hemanth on Jul 31, 2008 1:15 PM
<MOVED BY MODERATOR TO THE CORRECT FORUM>
Edited by: Alvaro Tejada Galindo on Jul 31, 2008 3:14 PMHi Hemant,
Below is the code for the downloading of the smartform into the PDF Format.
* Program Name : ZPPREP_SHOPFLOOR_VIEWER_ZOOM
REPORT zppeerep_shorepfloor_viewer_zoom.
* T A B L E S D E C L A R A T I O N
*---Tables Used.
TABLES: afpo,
mara,
marc,
aufk,
afko,
itcoo,
nast, "Messages
*nast, "Messages
tnapr, "Programs & Forms
addr_key,
arc_params, "Archive parameters
toa_dara. "Archive parameters
* I N T E R N A L T A B L E S D E C L A R A T I O N
*--Internal Tables Used.
* D A T A D E C L A R A T I O N
*--Global Variables Used.
DATA: ws_matnr LIKE afpo-matnr,
ws_werks LIKE aufk-werks,
ws_mtart LIKE mara-mtart,
ws_wrkst LIKE mara-wrkst,
ws_fname TYPE rs38l_fnam,
ws_ctrlp TYPE ssfctrlop,
ws_optns TYPE ssfcompop,
w_padest LIKE tsp03l-padest. "BMC01+
DATA: da_message_printed(1) TYPE c,
da_preview_processed(1) TYPE c,
repeat(1) TYPE c,
da_subrc LIKE sy-subrc.
DATA: w_otfdata TYPE ssfcrescl.
DATA: BEGIN OF it_itcoo OCCURS 0.
INCLUDE STRUCTURE itcoo.
DATA: END OF it_itcoo.
DATA: w_otf TYPE itcoo.
*--Data Declaration for Printing Layout
DATA: ls_itcpo TYPE itcpo.
DATA: lf_repid TYPE sy-repid.
DATA: lf_device TYPE tddevice.
DATA: cf_retcode TYPE sy-subrc.
DATA: ls_recipient TYPE swotobjid.
DATA: ls_sender TYPE swotobjid.
DATA: ls_control_param TYPE ssfctrlop.
DATA: ls_composer_param TYPE ssfcompop.
DATA: ls_addr_key LIKE addr_key.
DATA: w_screen(1) TYPE c.
DATA: xscreen(1) TYPE c.
DATA: da_mess LIKE vbfs OCCURS 0 WITH HEADER LINE.
* C O N S T A N T S
CONSTANTS: c_fas1(8) TYPE c VALUE 'PRINTFAS',
c_fas2(15) TYPE c VALUE 'PRINTFASDRAWING',
c_wip1(8) TYPE c VALUE 'PRINTWIP',
c_wip2(15) TYPE c VALUE 'PRINTWIPDRAWING'.
* S E L E C T I O N - S C R E E N.
SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-bl1.
* Production order
PARAMETERS: p_aufnr LIKE afpo-aufnr OBLIGATORY.
SELECTION-SCREEN END OF BLOCK bl1.
START-OF-SELECTION.
*--Begin of Commenting "
*--Get Partially processed orders
MOVE: sy-mandt TO nast-mandt,
'V1' TO nast-kappl,
p_aufnr TO nast-objky,
p_aufnr TO nast-parnr,
sy-langu TO nast-spras,
sy-datum TO nast-erdat,
'1' TO nast-nacha,
'3' TO nast-vsztp,
'X' TO nast-manue,
sy-uname TO nast-usnam,
'DFLT' TO nast-ldest,
sy-langu TO nast-tdspras,
'Shop Floor Papers' TO nast-tdcovtitle,
'1' TO nast-tdarmod,
'BUS2032' TO nast-objtype.
*--Printer settings
CALL FUNCTION 'WFMC_PREPARE_SMART_FORM'
EXPORTING
pi_nast = nast
pi_repid = sy-repid
IMPORTING
pe_returncode = cf_retcode
pe_itcpo = ls_itcpo
pe_device = lf_device
pe_recipient = ls_recipient
pe_sender = ls_sender.
MOVE-CORRESPONDING ls_itcpo TO ls_composer_param.
ls_control_param-device = 'PRINTER'.
ls_control_param-no_dialog = 'X'.
ls_control_param-preview = 'X'.
ls_control_param-getotf = ls_itcpo-tdgetotf.
ls_control_param-langu = sy-langu.
*--End of Commenting "
*--Start of Addition "
CLEAR: ws_werks.
SELECT SINGLE werks
INTO ws_werks
FROM aufk
WHERE aufnr = p_aufnr.
CLEAR: ws_matnr.
SELECT SINGLE plnbez
INTO ws_matnr
FROM afko
WHERE aufnr = p_aufnr.
CLEAR: marc.
SELECT SINGLE matgr
INTO marc-matgr
FROM marc
WHERE matnr = ws_matnr
AND werks = ws_werks.
*--End of Addition "
* CHECK NOT ws_matnr IS INITIAL.
IF NOT ws_matnr IS INITIAL.
*--Start of Addition
SELECT SINGLE matgr
INTO marc-matgr
FROM marc
WHERE matnr = ws_matnr
AND werks = ws_werks.
*--Start of Addition BY Rapidigm01_01+
ELSE.
marc-matgr = c_wip1.
ENDIF.
*--End Of Addition BY Rapidigm01_01+
*--End of Addition "
END-OF-SELECTION.
PERFORM call_smartform.
* F O R M R O U T I N E S
*& Form call_smartform
* text
FORM call_smartform.
CLEAR: ws_ctrlp, ws_optns, ws_fname.
*--Start of Addition "
TRANSLATE marc-matgr TO UPPER CASE.
IF marc-matgr = c_fas1 OR
marc-matgr = c_fas2.
PERFORM call_paper_a.
ELSEIF marc-matgr = c_wip1 OR
marc-matgr = c_wip2.
PERFORM call_paper_b.
ENDIF.
*--End of Addition "
ENDFORM. "call_smartform
*& Form call_paper_a
* text
FORM call_paper_a.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
*>>BC SPARTA03 DATE: 19/05/2008
* formname = 'ZPPSF_SHOP_FLOOR_PAPER_A' "Rapidigm03_01-
formname = 'ZPPSF_SHOP_FLOOR_PAPER_C' "Rapidigm03_01-
*<<EC SPARTA03 DATE: 19/05/2008
* formname = 'ZPPSF_SHOP_FLOOR_PAPER_A_2893' "Rapidigm03_01+
IMPORTING
fm_name = ws_fname
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
CHECK NOT ws_fname IS INITIAL.
CLEAR w_otfdata.
ls_control_param-getotf = 'X'.
CALL FUNCTION ws_fname
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = ' '
is_nast = nast
aufnr = p_aufnr
flag_orig = 'X'
IMPORTING
job_output_info = w_otfdata
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
LOOP AT w_otfdata-otfdata INTO w_otf.
APPEND w_otf TO it_itcoo.
ENDLOOP.
CALL FUNCTION 'HR_IT_DISPLAY_WITH_PDF'
TABLES
otf_table = it_itcoo.
ENDFORM. "call_paper_a
*& Form call_paper_b
* text
FORM call_paper_b.
DATA: ws_doknr TYPE draw-doknr,
ws_dokvr TYPE draw-dokvr.
CLEAR: ws_doknr, ws_dokvr.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZPPSF_SHOP_FLOOR_PAPER_B'
IMPORTING
fm_name = ws_fname
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
CHECK NOT ws_fname IS INITIAL.
CLEAR w_otfdata.
ls_control_param-getotf = 'X'.
CALL FUNCTION ws_fname
EXPORTING
archive_index = toa_dara
archive_parameters = arc_params
control_parameters = ls_control_param
mail_recipient = ls_recipient
mail_sender = ls_sender
output_options = ls_composer_param
user_settings = ' '
is_nast = nast
aufnr = p_aufnr
doknr = ws_doknr
dokvr = ws_dokvr
flag_orig = 'X'
IMPORTING
job_output_info = w_otfdata
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4
OTHERS = 5.
LOOP AT w_otfdata-otfdata INTO w_otf.
APPEND w_otf TO it_itcoo.
ENDLOOP.
CALL FUNCTION 'HR_IT_DISPLAY_WITH_PDF'
TABLES
otf_table = it_itcoo.
ENDFORM. "call_paper_b -
Sending an email of the layout in PDF attachement
Hello All,
I have written a program to send the layout in PDF format to send in a mail to the customer.
The email is going fne with the PDF attachement in the development box, but it is not working in Quality box.
In the Quality box the email is going but the attachement is not opening.
I have used CONVERT_OTF function module for converting OTF format to PDF format. As per my analysis it is returning the PDF format properly in Developement box but not the same in Quality. In Quality the the data returning in PDF format is not in proper manner. It is giving some junk data with symbols like traingle, rectange..etc..
I am using FM SO_OBJECT_SEND for sending an email.
Can you please suggest me what may be problem?
Valuable answers will be rewarded.
Thanks & Regards,
Satish.Hi,
you need to save the File in PDF format not in the text format.
check whether the file is saved in pdf format or not.
Regards,
Raj. -
Problem in sending online interactive form in email as PDF attachment
Hi,
I am trying to send online intercative forms as PDF attachment once user fills it and click on send button. But this mail i am trying to send from SAP workflow. For this am using one function module which is accepting the pdfsource context attribute of binary type as Xstring. Once i run the webdynpro application i am getting mail in out look but when i open the attachment i am getting error file is damaged.
Can you pls help me in solving this, Or any other way for doing the same.
Here is the code i am using for triggering the RFC from WD
Zsend_Mail_Attachment_Sev_Input mail = new Zsend_Mail_Attachment_Sev_Input();
//to capture the outplacement level entered in the form
mail.setI_Out_Place_Level(wdContext.currentVn_severancedetailsElement().getVa_outplacement_level().getBytes());
mail.setI_Bin_Data(wdContext.currentContextElement().getPdfSource());
wdContext.nodeZsend_Mail_Attachment_Sev_Input().bind(mail);
try
wdContext.currentZsend_Mail_Attachment_Sev_InputElement().modelObject().execute();
wdComponentAPI.getMessageManager().reportSuccess("Notification Sent Successfully.");
catch (WDDynamicRFCExecuteException e)
// TODO Auto-generated catch block
wdComponentAPI.getMessageManager().reportSuccess(" This is inside the mail exception!!"+e);
e.printStackTrace();
Here is the function module code
FUNCTION ZSEND_MAIL_ATTACHMENT_SEV.
""Local Interface:
*" IMPORTING
*" VALUE(I_OUT_PLACE_LEVEL) TYPE XSTRING OPTIONAL
*" VALUE(I_BIN_DATA) TYPE XSTRING OPTIONAL
*" TABLES
*" T_V_BIN_DATA STRUCTURE SOLISTI1
*" IT_MESSAGE STRUCTURE SOLISTI1
Data Declaration
DATA: gd_cnt TYPE i,
gd_sent_all(1) TYPE c,
gd_error TYPE sy-subrc,
tab_lines LIKE sy-tabix,
v_subject(255) VALUE 'HI'.
Structure Declaration
DATA : BEGIN OF it_file OCCURS 0,
row(255),
END OF it_file.
DATA : BEGIN OF i_split OCCURS 0,
row(50),
END OF i_split.
DESCRIBE TABLE it_message LINES tab_lines.
READ TABLE it_message INDEX tab_lines.
Internal Table Declaration
data : it_receivers like table of SOMLRECI1 with header line."occurs 0.
DATA : objbin LIKE SOLIX OCCURS 0 WITH HEADER LINE.
DATA : it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
data : wa_receiver like table of SOMLRECI1 with header line.
data : it_receiver like table of SOMLRECI1 with header line.
DATA : gd_doc_data LIKE sodocchgi1 OCCURS 0 WITH HEADER LINE.
REFRESH : objbin, it_packing_list, it_receivers, wa_receiver.
CLEAR : objbin, it_packing_list, wa_receiver, it_receivers.
gd_doc_data-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_message ).
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SENDFILE'.
gd_doc_data-obj_descr = v_subject.
gd_doc_data-sensitivty = 'O'.
APPEND GD_DOC_DATA.
Appending The Internal Table it_packing_list
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
it_packing_list-doc_type = 'RAW'.
it_packing_list-body_num = tab_lines.
APPEND it_packing_list.
move i_bin_data to t_v_bin_data.
********Add By Anuj
APPEND t_v_bin_data.
********End Add By Anuj
LOOP AT t_v_bin_data.
MOVE t_v_bin_data TO objbin-line.
APPEND objbin.
ENDLOOP.
CLEAR it_packing_list.
DESCRIBE TABLE objbin LINES tab_lines.
it_packing_list-transf_bin = 'X'.
it_packing_list-head_start = 1.
it_packing_list-head_num = 1.
it_packing_list-body_start = 1.
it_packing_list-doc_type = 'PDF'.
it_packing_list-body_num = tab_lines.
it_packing_list-doc_size = tab_lines * 255.
APPEND it_packing_list.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
*Appending The Internal Table it_receivers
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver to it_receiver.
append it_receiver.
Move wa_receiver[] to it_receivers[].
Clear it_receivers.
if i_OUT_PLACE_LEVEL NE 0.
loop at it_receivers into wa_receiver.
loop at it_receivers into wa_receiver.
*Function Module To Post The Message To Externa Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_packing_list
contents_hex = objbin
receivers = it_receivers
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.
clear wa_receiver.
endloop.
elseif i_OUT_PLACE_LEVEL eq 0.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_packing_list
contents_hex = objbin
receivers = it_receiver
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.
clear wa_receiver.
endif.
ENDFUNCTION.
Regards
RavindraHi,
I am trying to send online intercative forms as PDF attachment once user fills it and click on send button. But this mail i am trying to send from SAP workflow. For this am using one function module which is accepting the pdfsource context attribute of binary type as Xstring. Once i run the webdynpro application i am getting mail in out look but when i open the attachment i am getting error file is damaged.
Can you pls help me in solving this, Or any other way for doing the same.
Here is the code i am using for triggering the RFC from WD
Zsend_Mail_Attachment_Sev_Input mail = new Zsend_Mail_Attachment_Sev_Input();
//to capture the outplacement level entered in the form
mail.setI_Out_Place_Level(wdContext.currentVn_severancedetailsElement().getVa_outplacement_level().getBytes());
mail.setI_Bin_Data(wdContext.currentContextElement().getPdfSource());
wdContext.nodeZsend_Mail_Attachment_Sev_Input().bind(mail);
try
wdContext.currentZsend_Mail_Attachment_Sev_InputElement().modelObject().execute();
wdComponentAPI.getMessageManager().reportSuccess("Notification Sent Successfully.");
catch (WDDynamicRFCExecuteException e)
// TODO Auto-generated catch block
wdComponentAPI.getMessageManager().reportSuccess(" This is inside the mail exception!!"+e);
e.printStackTrace();
Here is the function module code
FUNCTION ZSEND_MAIL_ATTACHMENT_SEV.
""Local Interface:
*" IMPORTING
*" VALUE(I_OUT_PLACE_LEVEL) TYPE XSTRING OPTIONAL
*" VALUE(I_BIN_DATA) TYPE XSTRING OPTIONAL
*" TABLES
*" T_V_BIN_DATA STRUCTURE SOLISTI1
*" IT_MESSAGE STRUCTURE SOLISTI1
Data Declaration
DATA: gd_cnt TYPE i,
gd_sent_all(1) TYPE c,
gd_error TYPE sy-subrc,
tab_lines LIKE sy-tabix,
v_subject(255) VALUE 'HI'.
Structure Declaration
DATA : BEGIN OF it_file OCCURS 0,
row(255),
END OF it_file.
DATA : BEGIN OF i_split OCCURS 0,
row(50),
END OF i_split.
DESCRIBE TABLE it_message LINES tab_lines.
READ TABLE it_message INDEX tab_lines.
Internal Table Declaration
data : it_receivers like table of SOMLRECI1 with header line."occurs 0.
DATA : objbin LIKE SOLIX OCCURS 0 WITH HEADER LINE.
DATA : it_packing_list LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
data : wa_receiver like table of SOMLRECI1 with header line.
data : it_receiver like table of SOMLRECI1 with header line.
DATA : gd_doc_data LIKE sodocchgi1 OCCURS 0 WITH HEADER LINE.
REFRESH : objbin, it_packing_list, it_receivers, wa_receiver.
CLEAR : objbin, it_packing_list, wa_receiver, it_receivers.
gd_doc_data-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( it_message ).
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SENDFILE'.
gd_doc_data-obj_descr = v_subject.
gd_doc_data-sensitivty = 'O'.
APPEND GD_DOC_DATA.
Appending The Internal Table it_packing_list
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
it_packing_list-doc_type = 'RAW'.
it_packing_list-body_num = tab_lines.
APPEND it_packing_list.
move i_bin_data to t_v_bin_data.
********Add By Anuj
APPEND t_v_bin_data.
********End Add By Anuj
LOOP AT t_v_bin_data.
MOVE t_v_bin_data TO objbin-line.
APPEND objbin.
ENDLOOP.
CLEAR it_packing_list.
DESCRIBE TABLE objbin LINES tab_lines.
it_packing_list-transf_bin = 'X'.
it_packing_list-head_start = 1.
it_packing_list-head_num = 1.
it_packing_list-body_start = 1.
it_packing_list-doc_type = 'PDF'.
it_packing_list-body_num = tab_lines.
it_packing_list-doc_size = tab_lines * 255.
APPEND it_packing_list.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
*Appending The Internal Table it_receivers
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver[] to it_receiver[].
append it_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
wa_receiver-receiver = '[email protected]'.
wa_receiver-rec_type = 'U'.
wa_receiver-com_type = 'INT'.
APPEND wa_receiver.
move wa_receiver to it_receiver.
append it_receiver.
Move wa_receiver[] to it_receivers[].
Clear it_receivers.
if i_OUT_PLACE_LEVEL NE 0.
loop at it_receivers into wa_receiver.
loop at it_receivers into wa_receiver.
*Function Module To Post The Message To Externa Mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_packing_list
contents_hex = objbin
receivers = it_receivers
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.
clear wa_receiver.
endloop.
elseif i_OUT_PLACE_LEVEL eq 0.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_packing_list
contents_hex = objbin
receivers = it_receiver
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.
clear wa_receiver.
endif.
ENDFUNCTION.
Regards
Ravindra -
Can I edit an Adobe Acrobat .pdf attachment in Mac Mail before I hit send?
I have numerous .pdf approval sheets that I attach to a client’s ad in order for each client to approve, sign and fax back to me. I have many different .pdfs made up with only different counties the client will advertise in already in the .pdf. Now the publisher wants the name of each client to appear on each sheet (I have 130 clients). Is there a way of editing the text (to add client name) in .pdf attachment before hitting send in Mac Mail? I don’t want to have to redo so many different .pdf approval sheets each time in order to keep changing just client’s name on the .pdf.
Thanks,
Mickie
Here’s what the body looks like:
Client ___________________________________________________
County PALM BEACH_______________________________________________
Signature _________________________________________________
Date ______________________________________________________You can only edit PDF file in PDF editor, If you are using Adobe Acrobat PDF editor then follow this video tutorial to know how to edit PDF file?
-
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. -
Sending Purchase Order by Email as an PDF Attachment.
Dear Experts,
I would like to make use of the Standard Functionality Provided by SAP to Send PO by Email. I Reffered to SAP note 191470. And made sure that everything is Done.
Now the Problem is We are getting the Mail. But There is no attachment to the Mail.
Anyone can give some light to this issue?
Regards,
Lijo Josephhi Lijo,
Check these below threads it might help you.
PDF form as email attachment for purchase order
To send PDF file as an email
Error opening the PDF file while sending the PDF as an attachment
unable to e-mail a pdf through FM 'SO_NEW_DOCUMENT_ATT_SEND_API1'
Hope this helps!
Cheers
Alfred -
Send PDF Attachment to SAP Mail Inbox.
Dear all,
I have problem please help me out.
i have to create an PDF file with
my own data and that created PDF file
i have to send it to SAP mail inbox
(Transaction code : so01).hi sudheer,
Let the data be populated into ur itab ,
Now in the code just concentrate on
Perform fill structure.
the process u need to do is from ur layout convert from
itab o/p format itab>OTF/OTF->PDF .
see the function modules .
on execution of this a mail will be in ur outbox .
regards,
vijay.
tables : vbak.
type-pools:slis.
data: begin of it_t1 occurs 0,
vbeln like vbak-vbeln,
erdat like vbak-erdat,
ernam like vbak-ernam,
netwr like vbak-netwr,
waerk like vbak-waerk,
end of it_t1.
select-options : so_vbeln for vbak-vbeln.
DATA : it_fieldcat TYPE slis_t_fieldcat_alv,
it_sort TYPE slis_t_sortinfo_alv,
it_listheader TYPE slis_t_listheader,
it_alvevent TYPE slis_t_event.
DATA : wa_fieldcat TYPE slis_fieldcat_alv,
w_pos TYPE i VALUE 1,
wa_listheader TYPE slis_listheader,
wa_alvevent TYPE slis_alv_event,
wa_sort TYPE slis_sortinfo_alv.
Data: it_outtab like it_t1 occurs 0 with header line.
DATA : MAILREC LIKE SOMLRECI1 occurs 0 WITH HEADER LINE,
MAILBIN LIKE SOLISTI1 occurs 0 WITH HEADER LINE,
MAILBIN2 LIKE SOLISTI1 occurs 0 WITH HEADER LINE,
MAILTXT LIKE SOLISTI1 occurs 0 WITH HEADER LINE,
MAILHEAD LIKE SOLISTI1 occurs 0 WITH HEADER LINE,
MAILSTRUC LIKE SOPCKLSTI1 occurs 0 WITH HEADER LINE,
MAILDATA LIKE SODOCCHGI1 occurs 0 WITH HEADER LINE.
DATA: BEGIN OF GT_OTF OCCURS 0.
INCLUDE STRUCTURE ITCOO .
DATA: END OF GT_OTF.
DATA: ITCPO LIKE ITCPO,
ITCPP LIKE ITCPP.
DATA: tlines type i,
len_in like SOOD-OBJLEN,
len_out like SOOD-OBJLEN.
data: gt_pdf like solisti1 occurs 0 with header line.
DATA: gt_otfdata LIKE SOLISTI1 occurs 0 WITH HEADER LINE.
CONSTANTS: c_formname_top_of_page TYPE slis_formname
VALUE 'F_TOP_OF_PAGE'.
select vbeln
erdat
ernam
netwr
waerk into corresponding fields of table
it_outtab from vbak where vbeln in so_vbeln.
loop at it_t1.
write:/ it_t1-vbeln,
it_t1-erdat,
it_t1-ernam,
it_t1-netwr,
it_t1-waerk.
endloop.
perform alv_disp.
*& Form alv_disp
text
--> p1 text
<-- p2 text
FORM alv_disp.
PERFORM build_fcat USING '1' 'VBELN' 'IT_OUTTAB' ' ' ' ' ' '
'SALESNO'.
PERFORM build_fcat USING '2' 'ERDAT' 'IT_OUTTAB' ' ' ' ' ' '
'CRTNDATE'.
PERFORM build_fcat USING '3' 'ERNAM' 'IT_OUTTAB' ' ' ' ' ' '
'CRNAME'.
PERFORM build_fcat USING '4' 'NETWR' 'IT_OUTTAB' ' ' ' ' ' '
'NETPRICE'.
PERFORM build_fcat USING '5' 'WAERK' 'IT_OUTTAB' ' ' ' ' ' '
'CURRENCY'.
***Top of Page Heading purpose " u can add the date and column over here
PERFORM buildtop USING it_listheader[].
perform top_of_page.
*------Sort The Catalog
PERFORM sort_cat TABLES it_outtab USING it_sort[].
*------Display Table In GRID
PERFORM disp_grid TABLES it_outtab[].
**For email stuff follow the perform
perform fill_struct.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = MAILDATA
PUT_IN_OUTBOX = 'X'
TABLES
PACKING_LIST = MAILSTRUC
OBJECT_HEADER = MAILHEAD
CONTENTS_BIN = MAILBIN
CONTENTS_TXT = MAILTXT
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
RECEIVERS = MAILREC
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
DOCUMENT_TYPE_NOT_EXIST = 3
OPERATION_NO_AUTHORIZATION = 4
PARAMETER_ERROR = 5
X_ERROR = 6
ENQUEUE_ERROR = 7
OTHERS = 8
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " alv_disp
*& Form build_fcat
text
-->P_0104 text
-->P_0105 text
-->P_0106 text
-->P_0107 text
-->P_0108 text
-->P_0109 text
-->P_0110 text
FORM build_fcat USING value(col_pos)
value(fieldname)
value(tabname)
value(key)
value(no_zero)
value(do_sum)
value(reptext_ddic).
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = col_pos.
wa_fieldcat-fieldname = fieldname.
wa_fieldcat-tabname = tabname.
wa_fieldcat-key = key.
wa_fieldcat-no_zero = no_zero.
wa_fieldcat-do_sum = do_sum.
wa_fieldcat-reptext_ddic = reptext_ddic.
APPEND wa_fieldcat TO it_fieldcat.
ENDFORM. " build_fcat
*& Form Top_Of_Page
Top of page for Grid.
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader
I_LOGO = 'MY_SAP_ENJOY'.
ENDFORM. "top_of_page
text
-->P_IT_LISTHEADER[] text
FORM buildtop USING IT_LISTHEADER type slis_t_listheader.
DATA : text(100) TYPE c.
CLEAR it_listheader.
CLEAR wa_listheader.
wa_listheader-typ = 'H'.
wa_listheader-info = 'Sales Details' .
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
wa_listheader-typ = 'S'.
wa_listheader-info = 'Demo'.
APPEND wa_listheader TO it_listheader.
*CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = it_listheader
I_LOGO =
I_END_OF_LIST_GRID =
ENDFORM. " Top_Of_Page
*& Form sort_cat
text
-->P_IT_OUTTAB text
-->P_IT_SORT[] text
FORM sort_cat TABLES IT_OUTTAB STRUCTURE IT_OUTTAB USING IT_SORT
TYPE
slis_t_sortinfo_alv.
CLEAR wa_sort.
wa_sort-fieldname = 'VBELN'.
wa_sort-tabname = 'IT_OUTTAB'.
wa_sort-spos = 1.
wa_sort-up = 'X'.
wa_sort-subtot = ' '.
APPEND wa_sort TO it_sort.
ENDFORM. " sort_cat
*& Form disp_grid
text
-->P_IT_OUTTAB[] text
FORM disp_grid TABLES IT_OUTTAB STRUCTURE IT_OUTTAB.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = 'ZEX2' "sy-repid
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
IT_FIELDCAT = IT_FIELDCAT
IT_SORT = IT_SORT
TABLES
T_OUTTAB = IT_OUTTAB
EXCEPTIONS
PROGRAM_ERROR = 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. " disp_grid
*& Form fill_struct
text
--> p1 text
<-- p2 text
FORM fill_struct.
Text
MOVE 'Hi vijay ' TO MAILTXT-LINE.
APPEND MAILTXT.
Data
MAILDATA-OBJ_NAME = 'Document'.
MAILDATA-OBJ_DESCR = 'E-maiL From vij'.
MAILDATA-OBJ_PRIO = '1'.
MAILDATA-DOC_SIZE = strlen( MAILTXT ).
Structure
MAILSTRUC-HEAD_START = 1.
MAILSTRUC-HEAD_NUM = 0.
MAILSTRUC-BODY_START = 1.
MAILSTRUC-BODY_NUM = 1.
mailstruc-obj_name = 'Vijay Simha'.
MAILSTRUC-DOC_TYPE = 'RAW'.
APPEND MAILSTRUC.
Receivers
**u can use ur mail id(s) overhere
MOVE '[email protected]' TO MAILREC-RECEIVER.
MAILREC-REC_TYPE = 'U'.
APPEND MAILREC.
CLEAR ITCPO.
ITCPO-TDGETOTF = 'X'.
***moving to the output/format of the attachment.
final pdf format in the mail attachemnt
LOOP AT it_outtab.
MOVE it_outtab-vbeln TO MAILBIN.
MOVE it_outtab-erdat TO MAILBIN+18.
MOVE it_outtab-ernam TO MAILBIN+40.
MOVE it_outtab-netwr TO MAILBIN+70.
MOVE it_outtab-waerk TO MAILBIN+78.
APPEND MAILBIN.
CLEAR MAILBIN.
ENDLOOP.
**convert the scrap to otf.
CALL FUNCTION 'SX_OBJECT_CONVERT_SCR_OTF'
EXPORTING
format_src = 'RAW'
format_dst = 'OTF'
devtype = 'POSTSCPT'
funcpara = ' '
len_in = LEN_IN
IMPORTING
LEN_OUT = LEN_OUT
tables
content_in = MAILBIN
content_out = MAILBIN2
EXCEPTIONS
ERR_CONV_FAILED = 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.
REFRESH MAILBIN.
CONVERT OTF to PDF
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
FORMAT_SRC = 'OTF'
FORMAT_DST = 'PDF'
DEVTYPE = 'POSTSCPT'
FUNCPARA =
LEN_IN = LEN_IN
IMPORTING
LEN_OUT = LEN_OUT
TABLES
CONTENT_IN = MAILBIN2
CONTENT_OUT = MAILBIN
EXCEPTIONS
ERR_CONV_FAILED = 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.
REFRESH MAILBIN2.
DESCRIBE TABLE MAILBIN LINES TLINES.
Structure
MAILSTRUC-HEAD_START = 1.
MAILSTRUC-HEAD_NUM = 1.
MAILSTRUC-BODY_START = 1.
MAILSTRUC-BODY_NUM = TLINES.
MAILSTRUC-TRANSF_BIN = 'X'.
MAILSTRUC-DOC_TYPE = 'PDF'.
MAILSTRUC-DOC_TYPE = 'XLS'.
mailstruc-obj_name = 'Vijay.S.Reddy'.
MAILSTRUC-DOC_SIZE = tlines * 255.
APPEND MAILSTRUC.
ENDFORM. " fill_struct -
Error during sending a PDF attachment of a mail
Hi everebody,
I'm using a custom program [ see below ] ( in which there is the call to the std function SO_DOCUMENT_SEND_API1) to send a PDF attachment to an user's SAPOFFICE: in release 4.6C it works correctly but the same programm in ECC6 it doesn't work correctly. I mean: the mail is sent correctly with the attachment, but when I try to open the attachment this one doesn't open correctly showing a PDF error message.
Any help?
gino bonfiglioli
*& Report Z_UT_CONVERT_SPOOL_PDF
REPORT z_ut_convert_spool_pdf.
TABLES: tsp01.
variabili globali
*data: fm_name type rs38l_fnam,
output_options type ssfcompop,
control_parameters type ssfctrlop,
job_output_info type ssfcrescl,
job_output_options type ssfcresop,
DATA: spoolno LIKE tsp01-rqident,
dir_pdf LIKE rlgrap-filename,
numbytes TYPE i,
pagecount TYPE i,
w_cnt TYPE i,
wk_subrc LIKE sy-subrc,
pdfspoolid LIKE tsp01-rqident,
gd_buffer TYPE string,
pdf LIKE tline OCCURS 100 WITH HEADER LINE,
stampante LIKE usr01-spld,
tot_line TYPE sy-tabix,
tot_line2 TYPE sy-tabix,
start_line TYPE sy-tabix.
tabelle interne per 1a mail
DATA: BEGIN OF it_email OCCURS 100.
INCLUDE STRUCTURE solisti1.
DATA: END OF it_email.
DATA: BEGIN OF email_data.
INCLUDE STRUCTURE sodocchgi1.
DATA: END OF email_data.
DATA: BEGIN OF email_send OCCURS 10.
INCLUDE STRUCTURE somlreci1.
DATA: END OF email_send.
DATA: packing_list TYPE STANDARD TABLE OF sopcklsti1 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
receivers TYPE STANDARD TABLE OF somlreci1 WITH HEADER LINE.
fine tabelle interne per 1a mail
PARAMETER: p_spool LIKE tsp01-rqident.
START-OF-SELECTION.
PERFORM conversione_spool_pdf USING wk_subrc.
IF wk_subrc EQ 0.
PERFORM invio_mail.
ENDIF.
*& Form CONVERSIONE_SPOOL_PDF
text
-->P_P_SUBRC text
FORM conversione_spool_pdf USING p_subrc.
**- Conversione in PDF
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = p_spool
no_dialog = ' '
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
otf_pagecount = pagecount
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 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.
p_subrc = sy-subrc.
ENDFORM. " CONVERSIONE_SPOOL_PDF
*& Form invio_mail
text
--> p1 text
<-- p2 text
FORM invio_mail .
Transfer the 132-long strings to 255-long strings
LOOP AT pdf.
TRANSLATE pdf USING ' ~'.
CONCATENATE gd_buffer pdf INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Testo della mail
CLEAR it_email. REFRESH it_email.
it_email-line = 'Testo della mail'.
APPEND it_email.
Creazione messaggio
email_data-obj_name = 'MESSAGE'.
email_data-obj_descr = 'Conversione spool n.'.
email_data-obj_descr+26 = p_spool.
email_data-obj_langu = 'I'.
email_data-sensitivty = 'F'.
READ TABLE it_mess_att INDEX w_cnt.
email_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_mess_att ).
start_line = 1.
DESCRIBE TABLE it_email LINES tot_line.
packing_list-transf_bin = ' '.
packing_list-doc_type = 'RAW'.
packing_list-head_start = 1.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = tot_line.
packing_list-obj_langu = sy-langu.
APPEND packing_list.
APPEND LINES OF it_mess_att TO it_email.
CLEAR packing_list.
Riga iniziale = ultima riga messaggio precedente + 1
start_line = tot_line + 1.
DESCRIBE TABLE it_mess_att LINES tot_line.
packing_list-transf_bin = 'X'.
packing_list-head_start = 1.
packing_list-head_num = 1.
packing_list-body_start = 1.
DESCRIBE TABLE it_mess_att LINES packing_list-body_num.
packing_list-doc_type = 'PDF'.
packing_list-obj_descr = 'Allegato PDF.'.
packing_list-doc_size = packing_list-body_num * 255.
packing_list-obj_langu = sy-langu.
APPEND packing_list.
destinatario interno a SAP
receivers-receiver = sy-uname.
receivers-rec_type = 'B'.
receivers-express = 'X'.
APPEND receivers.
destinatario esterno a SAP: deve essere un idirizzo email:
receivers-receiver = '[email protected]'.
receivers-rec_type = 'U'.
APPEND receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = email_data
put_in_outbox = 'X'
SENDER_ADDRESS = SY-UNAME
sender_address_type = 'B'
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
SENDER_ID =
TABLES
packing_list = packing_list
contents_bin = it_mess_att
contents_txt = it_email
receivers = receivers
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.
errore invio mail
ENDIF.Hi,
Try to use fm 'SO_NEW_DOCUMENT_ATT_SEND_API1' instead of SO_DOCUMENT_SEND_API1.
Please check documentation of fm SO_DOCUMENT_SEND_API1 in ECC 6.
a® -
Sending java web dynpro interactive form as pdf attachment from Business WF
Hi,
I have a java web dynpro application with interactive form(online), on send button click i need to send the filled form as an PDF attchment to internet mail id. I am using SO_NEW_DOCUMENT_ATT_SEND_API1 inside workflow to send attachment. My custom RFC which is interacting with WD app is getting the pdf source context attribute(simply i set the import parameter with that attribute and no juggling is done) as import parameter which is of type XTSRING. Once i execute the application i am getting mail with attachment as pdf but i am not able to open the pdf. It is of just 1 KB size. It seems my pdf source context attribute is not sending data. Can some one suggest how can i solve this.DO i need to convert the data to pdf format before sending or any otgher thing i need to do.
Regards
RavindraI did that before posting the question itself (enables = false), it doesn't work. It just disable the extra features like digital signature and stuff. Interesting thing is all our HCM forms developed for HR actions works fine with out any issues. Why the interactive form developed with WDJ is not working and it requires credentials??. The same form works fine if I deploy the application directly into server but it throws the error if I check in through NWDI ..
If you look at the server location it has the file but it throws the error:
Caused by: com.sap.tc.webdynpro.clientserver.adobe.pdfdocument.base.core.PDFDocumentRuntimeException: IOException occured while creating template stream from the TemplateSource : .\temp\webdynpro\public\sap.com\ess~ben\webdynpro\Components\com.sap.xss.hr.ben.reviewtable.VcBenefitsReviewTable\ReviewTableView_InteractiveForm_Review.xdp (The system cannot find the file specified)
Please advise.
Thank You,
Hari. -
Error while opening PDF attachment sent via mail
Hi,
I am attaching PDF file to PO in me22n and sending the same file as attachment in the mail to the vendor using class CL_BCS.
The mail is sent to the vendor successfully and they are able to successfully open the PDF attachment. But in some cases the mail is successfully received but while opening the attachment it is giving the error as file is corrupted.
Please help me to resolve this issue.
Thanks and regards,
JayashreeHi,
I would like to know what font type, you are using in the forms.
Ideally it should be HELVETICA .
If you are using any other font in your style/form,try changing it to HELVETICA & Test.
Also Check the OTF data at the call of gen. FM,before converting it to PDF.
Regds,
AS
Edited by: abheesawant on Oct 12, 2011 7:48 AM -
Change Font Size with PDF attachment via e--mail
Hi experts,
I want to send mail with PDF attachment . Now the attachment is ok but only the font size in PDF is a little small.
Is that possible to Change the font size of PDF
Below is my code:
first the data comes from an internal table, then changed to an ABAP Pool.
* Create a new spool from the data in gt_data_pdf
new-page print on
destination c_local "<<== my printer
cover text text-027 "<<== Title or Spool req. name
list name space
list dataset space
immediately space " X means print now
keep in spool c_checked " X means keep spool
new list identification c_checked
line-size 255
line-count 65
no dialog .
loop at gt_data_pdf.
write: / gt_data_pdf-line.
endloop.
new-page print off.
lv_spoolid = lv_spdel-rqident = sy-spono.
lv_spdel-sys = sy-sysid.
*Convert ABAP Spool to PDF
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = lv_spoolid
no_dialog = c_checked
importing
pdf_bytecount = lv_pdf_fsize
tables
pdf = lt_pdf_table
exceptions
others = 0.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = lv_doc_chng
put_in_outbox = space
commit_work = c_checked
tables
packing_list = lt_objpack
object_header = lt_objhead
contents_bin = lt_objbin
contents_txt = lt_objtxt
receivers = lt_reclist
exceptions
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
others = 99.
Anyone could help me?
Thanks a lot.
Sincerely
JulieHi,
we don´t have many options for setting the font type and size in an ABAP list. One option is that you print the output using either SmartForms or AdobeForms, where you can control font type as well as size. This one requires additional work.
Another option is to use the instruction Print-Control:
NEW-PAGE PRINT ON.
PRINT-CONTROL FONT 1 SIZE 1 LPI 6 CPI 10.
WRITE: /10 'FONT 1 size 1 LPI 6 cpi 10'.
SKIP.
PRINT-CONTROL FONT 1 SIZE 5 LPI 6 CPI 5.
WRITE: /10 'FONT 1 size 5 LPI 6 cpi 5'.
SKIP.
PRINT-CONTROL FONT 2 SIZE 5 LPI 6 CPI 10.
WRITE: /10 'FONT 2 size 5 LPI 6 cpi 10'.
SKIP.
NEW-PAGE PRINT OFF. -
Smartform as PDF attachment to a mail.
Hi,
Can anyonce briefly explain me how the output of a smartform can be attached as a PDF file to a mail.
Ques 1: Do we need to pass any explicit value to the smart form generated function module. If so, what is the value and to which parameter do we need to pass.
Ques 2: As far as i know OTF is converted to PDF. If this is so please explain how this is done.
Ques 3: How can a PDF document be made as an attachment, to a mail.
If anyone can provide me an example it would be very great.
Thanks & Regards,
Goutham.Hi,
Go through the following code:
REPORT z_smtf_pdf_and_email_aks01.
DATA: x_ctrl_p TYPE ssfctrlop,
x_output_data TYPE ssfcrescl.
DATA: it_docs LIKE docs OCCURS 0 WITH HEADER LINE,
it_lines LIKE tline OCCURS 0 WITH HEADER LINE,
it_packing LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
*-----Initialisation
x_ctrl_p-no_dialog = 'X'.
x_ctrl_p-getotf = 'X'.
x_ctrl_p-langu = sy-langu.
Internal Tables Declaration *
DATA: it_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_pcklist LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
it_mess LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_receivers LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
it_table LIKE solix OCCURS 0 WITH HEADER LINE.
DATA: it_soli LIKE soli OCCURS 0 WITH HEADER LINE.
*-----Work area declaration
DATA: wa_doc_data TYPE sodocchgi1.
Variable Declaration *
DATA: v_lines_txt TYPE i,
v_lines_bin TYPE i,
v_lines TYPE i,
v_fname TYPE rs38l_fnam,
v_size TYPE i,
v_filename TYPE rlgrap-filename.
Start of selection event *
START-OF-SELECTION.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'Z_SMTF_TEST_AKS01'
IMPORTING
fm_name = v_fname.
CALL FUNCTION v_fname
EXPORTING
control_parameters = x_ctrl_p
IMPORTING
job_output_info = x_output_data.
*-----Calling fumction module to convert output to pdf.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = v_size
TABLES
otf = x_output_data-otfdata
doctab_archive = it_docs
lines = it_lines.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 134
IMPORTING
bin_filesize = v_size
TABLES
otf = x_output_data-otfdata
lines = it_lines
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_dst = 255
TABLES
content_in = it_lines
content_out = it_soli
EXCEPTIONS
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 3
OTHERS = 4.
CALL FUNCTION 'ZFUNC_CONVERT_DATA_ODC01'
EXPORTING
iv_byte_mode = 'X'
TABLES
it_data = it_lines
et_data = it_table.
*-----To caluculate total number of lines of internal table
DESCRIBE TABLE it_table LINES v_lines.
*-----Function module to download the output file.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
bin_filesize = v_size
filename = ' '
filetype = 'BIN'
IMPORTING
act_filename = v_filename
TABLES
data_tab = it_lines.
*-----Create Message Body and Title and Description
it_mess =
'i have successfully converted smartform from otf format to pdf' .
" and i have attached that in mail'.
APPEND it_mess.
wa_doc_data-obj_name = 'smartform'.
wa_doc_data-expiry_dat = sy-datum + 10.
wa_doc_data-obj_descr = 'smartform'.
wa_doc_data-sensitivty = 'F'.
wa_doc_data-doc_size = v_lines * 255.
APPEND it_pcklist.
*-----PDF Attachment
it_pcklist-transf_bin = 'X'.
it_pcklist-head_start = 1.
it_pcklist-head_num = 0.
it_pcklist-body_start = 1.
it_pcklist-doc_size = v_lines_bin * 255 .
it_pcklist-body_num = v_lines.
it_pcklist-doc_type = 'PDF'.
it_pcklist-obj_name = 'smartform'.
it_pcklist-obj_descr = 'smart_desc'.
it_pcklist-obj_langu = 'E'.
it_pcklist-doc_size = v_lines * 255.
APPEND it_pcklist.
*-----Giving the receiver email-id
CLEAR it_receivers.
it_receivers-receiver = '[email protected]'
it_receivers-rec_type = 'U'.
APPEND it_receivers.
CLEAR it_receivers.
it_receivers-receiver = '[email protected]'.
it_receivers-rec_type = 'U'.
APPEND it_receivers.
CLEAR it_receivers.
it_receivers-receiver = '[email protected]'.
it_receivers-rec_type = 'U'.
APPEND it_receivers.
*-----Calling the function module to sending email
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_data
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = it_pcklist
contents_txt = it_mess
contents_hex = it_table
receivers = it_receivers
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.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
WITH rfcgroup = 'iwdf7ytc_YD3_94'
AND RETURN.
REFRESH: it_receivers,
it_mess,
it_pcklist.
ENDIF.
Reward points if helpful answer.
Ashvender -
Create pdf attachment to the mail
Hi folks,
My requirement is to attach pdf document to the mail step in workflow programatically and document is on presentation server.
i have tried with SOFM object type, but it is asking for document number , but i could not provide it because it is not in SAP system.
how to acheive this.
Thanks,
janakiram.try this copy and paste is and make changes as required
Enjoy.............
To create pdf from internal table.
Two steps
1. get spool no.
2. create pdf.
1. get spool no.
SELECT *
FROM zwftrack
INTO TABLE it_zwftrack
WHERE wf_id = p_wf_id
AND action = 'FYA'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING destination = 'LP01' " 'LT50'
copies = 1
list_name = g_rq2name
list_text = 'COMM-PDF NEW-PAGE PRINT ON'
immediately = ' '
release = ' '
new_list_id = 'X'
expiration = g_days
line_size = g_ln_size " 255 ZTG12
line_count = g_ln_count " 65 ZTG12
layout = g_layout " 'X_PAPER'ZTG12
SAP_COVER_PAGE = 'X'
RECEIVER = 'SAP*'
DEPARTMENT = 'System'
SAP_OBJECT = 'RS'
AR_OBJECT = 'TEST'
ARCHIVE_ID = 'XX'
ARCHIVE_INFO = 'III'
ARCHIVE_TEXT = 'Description'
no_dialog = 'X'
IMPORTING out_parameters = g_params
out_archive_parameters = g_arparams
valid = g_valid.
"end of get
NEW-PAGE PRINT ON
NEW-SECTION
NO-TITLE
PARAMETERS g_params
ARCHIVE PARAMETERS g_arparams
NO DIALOG.
***add at top of comments list
WRITE:/ 'Contract Analysis Worksheet', 150 'Current Data ( ', l_date, ' ', l_time, ' )'.
WRITE:/150 'Run # :', wa_zzbedsheet-bdshnum.
WRITE:/ 'Project ID :',g_object_no.
WRITE:/ 'Project :',g_psr_desc.
WRITE:/ 'Profit Center :',g_prctr.
WRITE:/ 'Project Manager :',g_final_abb_contact.
WRITE:/ 'RA key :',g_abgsl.
WRITE:/ 'Customer :',l_cust.
WRITE:/ 'Project Start :',l_proj_start.
SKIP 3.
SORT it_zwftrack BY approver_level.
LOOP AT it_zwftrack INTO wa_zwftrack.
AT FIRST.
WRITE:/ 'Approvers Comments:'.
SKIP 1.
WRITE:/1 'Role', 35 'Approved By', 50 'Signature', 75 'Comments'.
ULINE.
ENDAT.
IF wa_zwftrack IS INITIAL.
SKIP.
ELSE.
PERFORM f_get_name USING wa_zwftrack-approved_by
CHANGING g_final_abb_contact.
WRITE :/ wa_zwftrack-role UNDER 'Role',
g_final_abb_contact UNDER 'Approved By',
wa_zwftrack-signature UNDER 'Signature',
wa_zwftrack-comments UNDER 'Comments'.
ENDIF.
CLEAR: g_final_abb_contact.
insert page break
IF sy-tabix = w_lines .
NEW-PAGE .
w_lines = 2 * w_lines.
ENDIF.
ENDLOOP.
NEW-PAGE PRINT OFF .
CLEAR w_tsp01.
SELECT SINGLE *
FROM tsp01
INTO w_tsp01
WHERE rqowner = sy-uname
AND rq2name = g_rq2name. "'COMM-PDF' .
g_spool_comm = w_tsp01-rqident.
2. create pdf
CLEAR g_lines .
REFRESH it_tab1 .
****get comments page from spool
CALL FUNCTION 'RSPO_RETURN_ABAP_SPOOLJOB'
EXPORTING
rqident = g_spool_comm "spool1
TABLES
buffer = it_tab1
EXCEPTIONS
no_such_job = 1
job_contains_no_data = 2
selection_empty = 3
no_permission = 4
can_not_access = 5
read_error = 6
OTHERS = 8.
IF sy-subrc = 0.
ENDIF.
to record line no for page break .
DESCRIBE TABLE it_tab1 LINES g_lines.
MOVE g_lines TO wa_eof-line .
APPEND wa_eof TO it_eof .
CLEAR g_lines .
APPEND LINES OF it_tab1 TO it_tab.
REFRESH it_tab1 .
SELECT SINGLE spld INTO w_spld FROM usr01 WHERE bname = sy-uname.
SHIFT g_wf_id LEFT DELETING LEADING '0'.
CONCATENATE g_wf_id '-ONEPDF' INTO g_list_name.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING destination = w_spld " 'LT50'
copies = 1
list_name = g_list_name
list_text = 'PM-PDF NEW-PAGE PRINT ON'
immediately = ' '
release = ' '
new_list_id = 'X'
expiration = g_days
line_size = g_ln_size " 255 ZTG12
line_count = g_ln_count " 65 ZTG12
layout = g_layout " 'X_PAPER'ZTG12
SAP_COVER_PAGE = 'X'
RECEIVER = 'SAP*'
DEPARTMENT = 'System'
SAP_OBJECT = 'RS'
AR_OBJECT = 'TEST'
ARCHIVE_ID = 'XX'
ARCHIVE_INFO = 'III'
ARCHIVE_TEXT = 'Description'
no_dialog = 'X'
IMPORTING out_parameters = g_params
out_archive_parameters = g_arparams
valid = g_valid.
NEW-PAGE PRINT ON
NEW-SECTION
NO-TITLE
PARAMETERS g_params
ARCHIVE PARAMETERS g_arparams
NO DIALOG.
w_idx = 1 . " for reading EOF line no .
w_tabix = 0 .
READ TABLE it_eof INTO wa_eof INDEX w_idx .
MOVE wa_eof-line TO g_lines .
w_lines = w_tabix + g_lines .
DATA: w_linestr LIKE sy-tabix . "#EC NEEDED
LOOP AT it_tab INTO wa_tab.
IF wa_tab-line CP 'Current Budget' .
w_linestr = sy-tabix .
ENDIF .
IF wa_tab IS INITIAL OR wa_tab-line CA '?' . " ZTG15
SKIP . " ZTG15
ELSE . " ZTXX
WRITE / wa_tab .
ENDIF . " ZTG15
insert page break
IF sy-tabix = w_lines .
NEW-PAGE .
w_idx = w_idx + 1 .
w_tabix = sy-tabix + w_tabix .
READ TABLE it_eof INTO wa_eof INDEX w_idx .
MOVE wa_eof-line TO g_lines .
w_lines = w_tabix + g_lines .
CLEAR: w_tabix.
ENDIF .
ENDLOOP .
NEW-PAGE PRINT OFF .
CLEAR w_tsp01.
SELECT * INTO TABLE t_tsp01 FROM tsp01
WHERE rqowner = sy-uname
AND rq2name = g_list_name .
IF sy-subrc = 0 .
SORT t_tsp01 BY rqcretime DESCENDING . "RBE24 rqident DESCENDING .
ENDIF .
READ TABLE t_tsp01 INTO W_TSP01 INDEX 1 .
CLEAR w_tsp01.
SELECT SINGLE *
FROM tsp01
INTO w_tsp01
WHERE rqowner = sy-uname
AND rq2name = g_list_name. "'COMM-PDF' .
WHILE g_numbytes = 0 .
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = w_tsp01-rqident "spoolno
no_dialog = ' '
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
pdf_bytecount = g_numbytes
pdf_spoolid = g_pdfspoolid
LIST_PAGECOUNT =
btc_jobname = g_jobname
btc_jobcount = g_jobcount
TABLES
pdf = it_pdf
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.
ENDWHILE.
**DATA : DATA_TAB TYPE TABLE.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = g_numbytes
filename = g_lv_file
filetype = 'BIN'
IMPORTING
filelength = g_numbytes
TABLES
data_tab = it_pdf
FIELDNAMES =
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
report ZTEST12345678.
tables:
tsp01.
*STRUCTURES
parameters:
p_repid like sy-repid, " Report to execute
p_linsz like sy-linsz default 255, " Line size
p_paart like sy-paart default 'X_65_132'. " Paper Format
data:
mstr_print_parms like pri_params,
mc_valid(1) type c,
mi_bytecount type i,
mi_length type i,
mi_rqident like tsp01-rqident.
*INTERNAL TABLES
data:
mtab_pdf like tline occurs 0 with header line,
mc_filename TYPE string.
*----Data for Mail
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: TAB_LINES LIKE SY-TABIX.
DATA: V_MAILID(241) TYPE C .
DATA: BEGIN OF DATA_TAB OCCURS 20,
LINE(255),
END OF DATA_TAB.
start-of-selection.
concatenate 'c:\abap\'
p_repid
'.pdf'
into mc_filename.
*Setup the Print Parmaters
call function 'GET_PRINT_PARAMETERS'
exporting
authority = space
copies = '1'
cover_page = space
data_set = space
department = space
destination = space
expiration = '1'
immediately = space
*in_archive_parameters = space
*in_parameters = space
layout = space
mode = space
new_list_id = 'X'
no_dialog = 'X'
user = sy-uname
importing
out_parameters = mstr_print_parms
valid = mc_valid
exceptions
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
others = 4.
*Make sure that a printer destination has been set up
*If this is not done the PDF function module ABENDS
if mstr_print_parms-pdest = space.
mstr_print_parms-pdest = 'LP01'.
endif.
*Explicitly set line width, and output format so that
*the PDF conversion comes out OK
mstr_print_parms-linsz = p_linsz.
mstr_print_parms-paart = p_paart.
submit (p_repid) to sap-spool without spool dynpro
spool parameters mstr_print_parms
via selection-screen
and return.
CALL FUNCTION 'ENQUE_SLEEP'
EXPORTING
seconds = 2.
*Find out what the spool number is that was just created
P_REPID = SY-REPID.
perform get_spool_number using p_repid sy-uname
changing mi_rqident.
*Convert Spool to PDF
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = mi_rqident
no_dialog = space
dst_device = mstr_print_parms-pdest
importing
pdf_bytecount = mi_bytecount
tables
pdf = mtab_pdf
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.
perform create_mail_data.
PERFORM SEND_MAIL.
*FORM get_spool_number
*Get the most recent spool created by user/report *
*--> F_REPID *
*--> F_UNAME *
*--> F_RQIDENT *
form get_spool_number using f_repid
f_uname changing f_rqident.
data: lc_rq2name like tsp01-rq2name.
concatenate f_repid+0(8)
f_uname+0(3)
into lc_rq2name separated by '_'.
concatenate f_repid+0(9)
f_uname+0(3)
into lc_rq2name.
select * from tsp01 where rq2name = lc_rq2name
order by rqcretime descending.
f_rqident = tsp01-rqident.
exit.
endselect.
if sy-subrc ne 0.
clear f_rqident.
endif.
endform." get_spool_number
**& Form create_mail_data
form create_mail_data.
*Creation of the document to be sent
DOC_CHNG-OBJ_NAME = 'TEST MAIL ATTACHMENTS'.
DOC_CHNG-OBJ_DESCR = 'Test for PDF'.
OBJTXT = 'Contents of mail'.
APPEND OBJTXT.
OBJTXT = 'PDF'.
APPEND OBJTXT.
OBJTXT = 'PDF'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
*Creation of the entry for the compressed document
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
*-DOWNLOADING AND AGAIN UPLOADINGIN BIN FORMAT TO TRANSFER TO OBJBIN
*MC_FILENAME = 'c:\test.doc' .
*--pdf--
*MC_FILENAME = 'c:\test.pdf'.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = MI_BYTECOUNT
filename = MC_FILENAME
FILETYPE = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
WRITE_LF_AFTER_LAST_LINE = ABAP_TRUE
SHOW_TRANSFER_STATUS = ABAP_TRUE
IMPORTING
FILELENGTH =
tables
data_tab = MTAB_PDF[]
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 'GUI_DOWNLOAD'
*EXPORTING
*BIN_FILESIZE = MI_BYTECOUNT
*FILENAME = MC_FILENAME
*FILETYPE = 'BIN'
*TABLES
*DATA_TAB = MTAB_PDF
*EXCEPTIONS
*FILE_OPEN_ERROR = 1
*FILE_WRITE_ERROR = 2
*INVALID_FILESIZE = 3
*INVALID_TYPE = 4
*NO_BATCH = 5
*UNKNOWN_ERROR = 6
*INVALID_TABLE_WIDTH = 7
*GUI_REFUSE_FILETRANSFER = 8
*CUSTOMER_ERROR = 9
*OTHERS = 10.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = MC_FILENAME
FILETYPE = 'BIN'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = OBJBIN
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 'GUI_UPLOAD'
*EXPORTING
*FILENAME = MC_FILENAME
*FILETYPE = 'BIN'
*TABLES
*DATA_TAB = OBJBIN.
*--uncommnet this for pdf--
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
OBJHEAD = 'TEST.pdf'. APPEND OBJHEAD.
*Creation of the entry for the compressed attachment
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 1.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'PDF'.
OBJPACK-OBJ_NAME = 'Testing PDF Attachment'.
OBJPACK-OBJ_DESCR = 'Customes Ageing report PDF Output Attachment'.
OBJPACK-DOC_SIZE = TAB_LINES * 255.
APPEND OBJPACK.
CLEAR V_MAILID.
V_MAILID = <mail id>.
RECLIST-RECEIVER = V_MAILID.
RECLIST-REC_TYPE = 'U'. "B for SAP Inbox
APPEND RECLIST.
endform. " create_mail_data
**& Form SEND_MAIL
form SEND_MAIL.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = 'X'
commit_work = 'X'
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
*EXCEPTION HANDLING
CASE SY-SUBRC.
WHEN 0.
WRITE: / 'Mail sent with attachment'.
WHEN 1.
WRITE: / 'No authorization for sending to the specified number',
'of recipients'.
WHEN 2.
WRITE: / 'Document could not be sent to any recipient'.
WHEN 4.
WRITE: / 'No send authorization'.
WHEN OTHERS.
WRITE: / 'Error occurred while sending'.
ENDCASE.
endform. " SEND_MAIL
Maybe you are looking for
-
I have a strange problem. I just got a new Intel iMac. I moved all my files over tot he new system, no problem. On my old system, I kept some files out side of the users folder so my wife and I can both access them (iTunes, iDVD, iMove, etc) I have b
-
After my computer is asleep and the screen goes dark, I move the mouse and the blurred picture comes on. I can't get a cursor to appear by moving the mouse or with the keyboard. (Even though both are on and working). In order to get the cursor to app
-
Intermittent Disconnects for clients of 2008 R2 Remote Desktop Services
Hello, I have an issue that I am trying to work on for a client who is experiencing intermittent disconnected sessions when logged into a Windows 2008 R2 Remote Desktop Services (RDS) server. As I mentioned, the disconnect is intermittent in nature a
-
Randomly a blue bar scans across the screen when apps are open, how can I stop that?
After updating a blue bar scans across the screen. It does it in most of my apps and even when viewing my pix. This never happened before the latest update I installed. It's very annoying. Does anyone have an idea to stop this blue bar?
-
Http Bad Request when using /_vti_bin/listdata.svc in excel or tableau
hi all, I followed a guide from tableau that teaches us how to connect odata(sharepoint list data) but it keeps giving me HTTP bad request. When i tried to access my list using http://myserverIP/_vti_bin/ListData.svc from the browser with credential