.PDF attachment, workflow, FAX
I would like to attach a .PDF document to a workflow and the final result is to fax the PDF from the workflow. Does anyone have any suggestions? Thanks
Hi
May be you could try this also in future....
TRY.
lr_document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = lt_bodytext
i_length = ln_textlength
i_subject = l_subject ).
attdoctype = 'pdf'.
attsize = XSTRLEN( l_pdf ).
pdftab = cl_document_bcs=>xstring_to_solix( ip_xstring = l_pdf ).
lr_document->add_attachment( EXPORTING i_attachment_type = attdoctype
i_attachment_subject = atttitle
i_attachment_size = attsize
i_attachment_language = sy-langu
i_att_content_hex = pdftab ).
send_request = cl_bcs=>create_persistent( ).
send_request->set_document( lr_document ).
Get sender object
sender = cl_sapuser_bcs=>create( sy-uname ).
send_request->set_sender( i_sender = sender ).
recipient = cl_cam_address_bcs=>create_internet_address( ic_email_address ).
send_request->add_recipient( EXPORTING i_recipient = recipient ).
send_request->set_send_immediately( 'X' ).
send_request->send( ).
CATCH cx_bcs INTO lr_bcs_exception.
lc_text = lr_bcs_exception->get_text( ).
MESSAGE lc_text TYPE 'E'.
ENDTRY.
Regards,
Rahul
Similar Messages
-
Pdf attachment through workflow
Hi SDNers,
I need to attach a PDF to send mail in my workflow. Workflow triggers whenever PO changed or release at ME22N or ME21N.
Which PO has been changed, data PO details need to display in PDF.
For this I created a smarform by passing PO number. I created attribute for emailaddress, in this i written code. But, when executed manually it is going. but I changed or release from ME22N or ME21N just a body mail is going butwithout attachment.Please suggest me. Here is the code which I have written in the attribute.
FORM SELECT_TABLE_ADR6 USING SUBRC LIKE SY-SUBRC.
TYPES: BEGIN OF ty_ekko,
ebeln TYPE ebeln,
lifnr TYPE lifnr,
END OF ty_ekko,
BEGIN OF ty_lfa1,
lifnr TYPE lifnr,
adrnr TYPE adrnr,
END OF ty_lfa1.
DATA: it_ekko TYPE STANDARD TABLE OF ty_ekko INITIAL SIZE 0,
it_lfa1 TYPE STANDARD TABLE OF ty_lfa1 INITIAL SIZE 0,
wa_ekko TYPE ty_ekko,
wa_lfa1 TYPE ty_lfa1.
DATA: gv_form_name TYPE rs38l_fnam,
gv_bin_filesize TYPE i,
gv_pos TYPE i,
gv_len TYPE i,
gv_tab_lines TYPE i.
DATA: gc_text(11) TYPE c VALUE 'Form Output',
gc_tst(3) TYPE c VALUE 'TST',
gc_testing(20) TYPE c VALUE 'PURCHASE ORDER'.
DATA: gs_docdata TYPE sodocchgi1,
gs_ctrlop TYPE ssfctrlop,
gs_outopt TYPE ssfcompop,
gs_otfdata TYPE ssfcrescl,
gs_reclist TYPE somlreci1,
gs_copy type somlreci1,
gs_pdf_tab TYPE tline,
gs_objbin TYPE solisti1,
GS_OBJTXT TYPE SOLISTI1,
gs_objpack TYPE sopcklsti1.
DATA: gt_reclist TYPE TABLE OF somlreci1,
gt_copy type table of somlreci1,
gt_pdf_tab TYPE TABLE OF tline,
gt_otf TYPE TABLE OF itcoo,
gt_objbin TYPE TABLE OF solisti1,
GT_OBJTXT TYPE TABLE OF SOLISTI1,
gt_objpack TYPE TABLE OF sopcklsti1.
DATA: G_SMTP_ADDR type AD_SMTPADR.
DATA: p_plist(40) type C,
gc_c type C,
gc_u type C.
CLEAR : gv_form_name,
gs_ctrlop,
gs_outopt,
gs_otfdata,
gv_bin_filesize,
gv_pos,
gv_len,
gv_tab_lines.
IF OBJECT-_ADR6-CLIENT IS INITIAL
AND OBJECT-_ADR6-ADDRNUMBER IS INITIAL
AND OBJECT-_ADR6-PERSNUMBER IS INITIAL
AND OBJECT-_ADR6-DATE_FROM IS INITIAL
AND OBJECT-_ADR6-CONSNUMBER IS INITIAL.
SELECT ebeln lifnr FROM ekko INTO TABLE it_ekko
WHERE ebeln = object-key-purchaseorder.
SELECT lifnr adrnr FROM lfa1 INTO TABLE it_lfa1
FOR ALL ENTRIES IN it_ekko WHERE lifnr = it_ekko-lifnr.
READ TABLE it_lfa1 INTO wa_lfa1 INDEX 1.
SELECT SINGLE * FROM ADR6 CLIENT SPECIFIED
WHERE CLIENT = SY-MANDT
AND ADDRNUMBER = WA_LFA1-ADRNR.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = 'ZMMF_PUR_DOMESTIC001'
IMPORTING
fm_name = gv_form_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
gs_ctrlop-getotf = 'X'.
gs_ctrlop-device = 'PRINTER'.
gs_ctrlop-LANGU = SY-LANGU.
gs_ctrlop-no_dialog = 'X'.
gs_outopt-tddest = 'LP01'.
gs_outOPT-TDIMMED = 'X'.
gs_OUTOPT-TDRECEIVER = SY-UNAME.
gs_OUTOPT-TDNOPREV = 'X'.
CALL FUNCTION gv_form_name
EXPORTING
control_parameters = gs_ctrlop
output_options = gs_outopt
user_settings = us_screen
user_settings = ent_retco
customer = customer
bookings = bookings
connections = connections
i_ebeln = object-key-purchaseorder
IMPORTING
job_output_info = gs_otfdata
EXCEPTIONS
formatting_error = 1
internal_error = 2
send_error = 3
user_canceled = 4.
CLEAR gt_otf.
gt_otf[] = gs_otfdata-otfdata[].
Convert the OTF DATA to SAP Script Text lines
CLEAR gt_pdf_tab.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 200
IMPORTING
bin_filesize = gv_bin_filesize
TABLES
otf = gt_otf
lines = gt_pdf_tab
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
Data : Order(50) type c,
sep(10) type c value ' / '.
CLEAR gs_docdata.
gs_docdata-obj_name = gc_tst.
CONCATENATE gc_testing sep 'test mail' into order.
gs_docdata-obj_descr = order.
CLEAR : gt_reclist, gs_reclist.
REFRESH: GT_RECLIST, GT_OBJPACK, GT_OBJBIN.
clear: gt_copy, gs_copy.
IF internal mail id
gs_reclist-receiver = ADR6-SMTP_ADDR.
GS_RECLIST-REC_TYPE = 'U'.
APPEND gs_reclist TO gt_reclist.
APPEND gs_copy to gt_copy.
CLEAR : gs_objbin, gs_pdf_tab.
LOOP AT gt_pdf_tab INTO gs_pdf_tab.
gv_pos = 255 - gv_len.
IF gv_pos > 134. "length of pdf_table
gv_pos = 134.
ENDIF.
gs_objbin+gv_len = gs_pdf_tab(gv_pos).
gv_len = gv_len + gv_pos.
IF gv_len = 255. "length of out (contents_bin)
APPEND gs_objbin TO gt_objbin.
CLEAR: gs_objbin, gv_len.
IF gv_pos < 134.
gs_objbin = gs_pdf_tab+gv_pos.
gv_len = 134 - gv_pos.
ENDIF.
ENDIF.
ENDLOOP.
IF gv_len > 0.
APPEND gs_objbin TO gt_objbin.
ENDIF.
Filling the details in SAPoffice: Description of Imported
DESCRIBE TABLE gt_objbin LINES gv_tab_lines.
CLEAR gs_objbin.
READ TABLE gt_objbin INTO gs_objbin INDEX gv_tab_lines.
IF sy-subrc = 0.
gs_objpack-transf_bin = 'X'.
gs_objpack-head_start = 1.
gs_objpack-head_num = 0.
gs_objpack-body_start = 1.
gs_objpack-body_num = gv_tab_lines.
gs_objpack-doc_type = 'PDF'.
gs_objpack-obj_name = 'ATTACHMENT'.
gs_objpack-obj_descr = 'test'.
APPEND gs_objpack TO gt_objpack.
ENDIF.
IF p_plist IS NOT INITIAL.
gs_reclist-receiver = p_plist.
gs_reclist-rec_type = gc_c.
APPEND gs_reclist TO gt_reclist.
CLEAR gs_reclist.
ENDIF.
Populating the reciever list
gs_reclist-receiver = p_plist.
gs_reclist-rec_type = gc_c.
APPEND gs_reclist TO gt_reclist.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = gs_docdata
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
PACKING_LIST = gt_objpack
OBJECT_HEADER =
CONTENTS_BIN = gt_objbin
CONTENTS_TXT =
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
RECEIVERS = gt_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.
SUBMIT rsconn01
WITH mode EQ 'INT'
and return.
ENDIF.Hi-
You need to convert the smartform's OTF data to PDF and then create a SOFM instance. Now bind this SOFM instance to workflow container 'ATTACH_OBJECTS' in your email step and your smartform will be showed as a PDF attachment
Vinoth -
Workflow Step 'In Process'- Send mail with PDF attachment
Hi,
have to send mail with PDF attachment.
I have written a function module with following steps,
1. Convert SPOOL number to PDF using Function Module 'CONVERT_OTFSPOOLJOB_2_PDF'.
2. Send mail with PDF attachment using Function Module 'SO_DOCUMENT_SEND_API1'.
The Function Module is giving required output when tested and called in the report(Background Job).
When I call this Function Module from Method-> Workflow Task the Workflow steps status is 'In Process' and not ending.
Could you please help me on this??Hi shafath,
When you try to send mail, You need to call the function FP_JOB_OPEN before calling the function module to generate the pdf. ( /1B****) . Is it missing in your code? -
Sapscript as PDF-Attachment in Workflow
Hi Experts,
I am trying to create a new workflow for releasing purchase orders.
If the workitem passes all the controlling steps of the management, it should be sent automatically as PDF via email to our vendor.
The problem is, how to get the PDF as an attachment? We are using SAPscript for our PO formular (and of course the PDF-Attachment should look like the printed version).
I was already looking in the internet for a solution, but it is really hard to find some answers for this problem.
Many thanks for your help,
ChristophHi all,
many thanks for your help.
The workflow should run in this way. The purchaser creates an order --> supervisor gets a SAP Mail (workflow user decision step) to accept it --> the supervisor of the supervisor then gets a SAP mail to accept it --> PDF is sent to the vendor (only if everybody signed this PO before).
I will try following now: I will create a new workflow task to execute a method (for getting the PO as a PDF attachment) and a new workflow container item to store the attachment.
As next WF step I will use the standard send mail step.
Are I am right with this soulution (nothing programmed yet, still not so sure how to do it - but hope to find a solution to manage this).
Many thanks for your help again.
Chris -
How to Send mail woth pdf attachment through workflow
Hi SDNer's,
I have a problem with pdf attachment through workflow. Please anybody help me to get solve my issue.Hi Suresh,
I just tried this thing in my systtem and it is working... BADI is trigerred everytime there is a change in the PO... even when you release there is a change in the PO so this BADI will be triggerred....
I suggest you should implement BADI in your dev system and place a break point in the POST method...
After that create a PO and release it using ME29N... thereafter when you save the PO... this method will trigger and you will have access to PO details...
PS: Remember this BADI wont work for transaction ME29...
Regards
Gautam -
Want to create program which will trigger workflow with PDF attachement
Hi Expert,
I m new for work flow.
I want to create abap program which trigger work flow with PDF attachment.
Thanks in advanced.
Regards,
Laxman Sankhla.HI i have written code as per below.
Now if i m running programe i m getting error "Unable to create work item container
(CL_SWF_RUN_WIM_FLOW->_IMPORT_CONTAINER) "
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = FP_FORMOUTPUT-PDF
APPEND_TO_TABLE = ' '
IMPORTING
OUTPUT_LENGTH = ZVAR1
TABLES
BINARY_TAB = IT_SOLIX_TAB.
IF SY-SUBRC = 0 AND NOT IT_SOLIX_TAB[] IS INITIAL .
SWC_SET_TABLE CONTAINER 'IT_SOLIX_TAB' IT_SOLIX_TAB.
SWC_SET_ELEMENT CONTAINER 'ZVAR1' ZVAR1.
SWC_SET_ELEMENT CONTAINER 'YBUS2012' OBJ.
GV_INITIATOR = SY-UNAME.
CALL FUNCTION 'SWW_WI_START_SIMPLE'
EXPORTING
CREATOR = GV_INITIATOR
PRIORITY = SWFCO_NO_PRIO
TASK = 'WS99900241'
CALLED_IN_BACKGROUND = 'X'
TABLES
AGENTS = IT_AGENTS
WI_CONTAINER = CONTAINER.
COMMIT WORK.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Thanks in advanced
Laxman Sankhla. -
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 -
Reg sending Mail with PDF attachment
Hi All,
Am converting smartforms(Purchase Order Me23N) to pdf then am attaching pdf in mail,mail is going with attachment to specific id but when i try to open PDF file am getting an Error PDF File is Corrupted.
Am using these FM :CONVERT_OTF(To convert from smartforms to PDF) , SO_NEW_DOCUMENT_ATT_SEND_API1(For pdf attachment).
Please Help with ur suggestions.
Regards,
vinoth.Please post the same in Workflow forum for more inputs. are you using interactive forms.
-
Cannot open pdf attachment on Curve 9360
Hi,
I cannot open some pdf attachments on my Curve 9360.
Some pdfs are fine but our fax to email service pdfs will not open - just get a qustion mark in the file icon and when trying to open I get 'This attachment type cannot be viewed on your device'.
This is really frustrating as it means when I am away from the office and we get a fax (which comes through as a pdf attachement by email) I cannot see what it is !
The same pdf files open fine on my laptop (in outlook) and a friend has a blackberry bold and the same pdf opens fine on his bold !
I am on OS7.1 (Bundle 2494) on my Curve 9360 but I have had the problem from back since OS6.
Any suggestions guys ? Could something be missing/corrupted on my Blackberry casuing this problem ?Hello Sparpo,
Welcome to the forums.
In this case we can try to reload the software on the BlackBerry® smartphone to make sure it is running the latest version and there are no issues with the OS.
Here is how to backup your BlackBerry smartphone http://bbry.lv/oPVWXc
Once you have backed up your BlackBerry smartphone please follow the link below to complete a clean reload of the BlackBerry smartphone software.
Link: http://www.blackberry.com/btsc/KB03621
Once completed test it and proceed with a selective restore, here is how to restore http://bbry.lv/qgQxLo
Thank you
-SR
Come follow your BlackBerry Technical Team on twitter! @BlackBerryHelp
Be sure to click Kudos! for those who have helped you.Click Solution? for posts that have solved your issue(s)! -
PDF attachment not proper in Mail
Hi All,
We are facing a problem with PDF attachment through workflows.
We are using CONVERT_ABAPSPOOLJOB_2_PDF to convert SPOOL to PDF and are getting binary file into it_xstring, pdf file into it_pdf. Now we are sending it_xstring to SAP_WAPI_ATTACHMENT_ADD for mail attachment. We are getting the PDF attachment, but the data is not fitting exactly onto the page. In other words, the entire data is being shown only in half of the page which in turn made the font size very small. But when we tried saving the PDF file it_pdf onto a local file through GUI_DOWNLOAD, it's giving the data correctly, as in, the output is being exactly fit into the page.
Can we stretch the output in XSTIRNG (binaryfile)? Is there any way to show the output data properly in PDF attachment?
Thanks a lot!!Does the FM "CONVERT_ABAPSPOOLJOB_2_PDF" return string ?
The data that the FM returns if of the type "TLINE".
Convert the it_pdf using the below:
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
LINE_WIDTH_SRC = 134
LINE_WIDTH_DST = 255
TABLES
CONTENT_IN = PDF_FILE
CONTENT_OUT = PDF_FILE_OUT
EXCEPTIONS
ERR_LINE_WIDTH_SRC_TOO_LONG = 1
ERR_LINE_WIDTH_DST_TOO_LONG = 2
ERR_CONV_FAILED = 3
OTHERS = 4.
Use the method which suits you in the class "CL_BCS_CONVERT" and convert into XSTRING and pass it to the FM "SAP_WAPI_ATTACHMENT_ADD".
Regards,
PR. -
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?
-
Problem in opening up pdf attachment
Hi experts,
I have a scenario where I am sending a pdf attachment with a mail.The pdf is generated from a smartform by the function module 'CONVERT_OTF_TO_PDF' . The attachment is coming with the mail but on trying to open the attachment an error is being shown as given below:-
Adobe Reader could not open <doc1.pdf> because it is either not a supported file type or the file has been damaged (for eg:it was sent as an email attachment and wasn't correctly decoded.)
Now I have done it in one of my development servers .It is working fine .But when I have tried to create it in the other development server this error is being thrown . Please suggest some solution. this is very urgent.
Thanks & Regards,
Samrat DuttaHi Raja Sekhar,
This is the code that I am using...
FUNCTION ZSENDPDF_BASSO.
""Local Interface:
*" IMPORTING
*" VALUE(OBJECTGUID) TYPE DNOS_BOR_KEY-GUID OPTIONAL
*" VALUE(PARTNERNO) TYPE CRMT_PARTNER_NO OPTIONAL
tables: crmd_orderadm_i,crmd_schedlin,crmd_order_index.
data: i_lines TYPE tline OCCURS 0 WITH HEADER LINE.
DATA: tb_pdf LIKE tline OCCURS 0.
DATA: tb_pdf255 TYPE so_text255 OCCURS 0.
DATA: lw_subject TYPE so_obj_des.
DATA: lwa_body TYPE solisti1.
DATA: ltb_body TYPE TABLE OF solisti1.
DATA: lw_filename TYPE char100.
DATA: ltb_recipients TYPE TABLE OF somlreci1.
DATA: lwa_recipients TYPE somlreci1.
data addrnumber type but000-addrcomm.
data email type adr6-smtp_addr.
data email1 type SOMLRECI1-RECEIVER.
data p_guid type CRMT_OBJECT_GUID.
p_guid = OBJECTGUID.
*parameters: p_guid type crmd_order_index-guid.
data:
fm_name TYPE RS38L_FNAM, "Smart Forms: FM Name
*sf_name TYPE TDSFNAME
*value 'YOUR_FORM_NAME', "Smart Forms: Form Name
P_OUTPUT_OPTIONS TYPE SSFCOMPOP,
P_JOB_OUTPUT_INFO TYPE SSFCRESCL,
P_CONTROL_PARAMETERS TYPE SSFCTRLOP,
P_LANGUAGE TYPE SFLANGU value 'E',
P_E_DEVTYPE TYPE RSPOPTYPE.
data:
P_BIN_FILESIZE TYPE I,
P_BIN_FILE TYPE XSTRING,
P_OTF type table of ITCOO,
P_DOCS type table of DOCS,
P_LINES type table of TLINE,
name type string,
path type string,
fullpath type string,
filter type string,
guiobj type ref to cl_gui_frontend_services,
uact type i,
filename(128).
GET SMARTFORM FUNCTION MODULE NAME ---
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZBASO_CREATION'
IMPORTING
FM_NAME = 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.
CALL FUNCTION 'SSF_GET_DEVICE_TYPE'
EXPORTING
I_LANGUAGE = P_LANGUAGE
I_APPLICATION = 'SAPDEFAULT'
IMPORTING
E_DEVTYPE = P_E_DEVTYPE.
P_OUTPUT_OPTIONS-XSFCMODE = 'X'.
P_OUTPUT_OPTIONS-XSF = SPACE.
P_OUTPUT_OPTIONS-XDFCMODE = 'X'.
P_OUTPUT_OPTIONS-XDF = SPACE.
P_OUTPUT_OPTIONS-TDPRINTER = P_E_DEVTYPE.
P_CONTROL_PARAMETERS-NO_DIALOG = 'X'.
P_CONTROL_PARAMETERS-GETOTF = 'X'.
****...................................PRINTING.........................
*CALL FUNCTION fm_name
*EXPORTING
*CONTROL_PARAMETERS = P_CONTROL_PARAMETERS
*OUTPUT_OPTIONS = P_OUTPUT_OPTIONS
(....) <--- your form import parameters
*IMPORTING
*JOB_OUTPUT_INFO = P_JOB_OUTPUT_INFO.
*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 fm_name "'/1BCDWB/SF00000019'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = P_CONTROL_PARAMETERS
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = P_OUTPUT_OPTIONS
USER_SETTINGS = 'X'
*I_GUID = '4344382C5A9B77438A20F480E833CDF8'
I_GUID = p_guid
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = P_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.
P_OTF[] = P_JOB_OUTPUT_INFO-OTFDATA.
****...................................CONVERT TO PDF...............
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
BIN_FILESIZE = P_BIN_FILESIZE
TABLES
OTF = P_OTF
DOCTAB_ARCHIVE = P_DOCS
LINES = P_LINES
EXCEPTIONS
ERR_CONV_NOT_POSSIBLE = 1
ERR_OTF_MC_NOENDMARKER = 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.
Change the PDF format from 132 to 255.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_src =
line_width_dst =
transfer_bin = 'X'
TABLES
content_in = P_LINES
content_out = tb_pdf255
EXCEPTIONS
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 3
OTHERS = 4
lw_subject = '<Subject>'.
lwa_body-line = 'This is the email body - Line1'.
APPEND lwa_body TO ltb_body.
lwa_body-line = 'This is the email body - Line2'.
APPEND lwa_body TO ltb_body.
*lwa_body-line = 'This is the email body - Line3'.
*APPEND lwa_body TO ltb_body.
*lwa_body-line = 'This is the email body - Line4'.
*APPEND lwa_body TO ltb_body.
lw_filename = '<File Name>'.
*RECIPIENTS
lwa_recipients-rec_type = 'B'.
lwa_recipients-express = 'X'.
lwa_recipients-receiver = 'SAPUSER'.
lwa_recipients-copy = ''.
APPEND lwa_recipients TO ltb_recipients.
*RECIPIENTS
*lwa_recipients-rec_type = 'U'.
*lwa_recipients-express = 'X'.
*lwa_recipients-receiver = '<email-id1>'.
*lwa_recipients-copy = ''.
*APPEND lwa_recipients TO ltb_recipients.
RECIPIENTS
lwa_recipients-rec_type = 'U'.
lwa_recipients-express = 'X'.
lwa_recipients-receiver = <email-id2>.
lwa_recipients-copy = ''.
APPEND lwa_recipients TO ltb_recipients.
Sends the PDF by email.
PERFORM f_send_pdf_by_email
TABLES
tb_pdf255
ltb_body
ltb_recipients
USING
lw_subject
lw_filename.
ENDFUNCTION.
FORM f_send_pdf_by_email
TABLES
ptb_pdf255 STRUCTURE solisti1
ptb_body STRUCTURE solisti1
ptb_recipients STRUCTURE somlreci1
USING
pw_subject TYPE so_obj_des
pw_filename TYPE char100.
*-DATA DECLARATION----
Variables y tablas internas.
DATA: BEGIN OF ltb_objbin OCCURS 0.
INCLUDE STRUCTURE solisti1.
DATA: END OF ltb_objbin.
DATA: lwa_doc_chng LIKE sodocchgi1,
lw_tab_lines LIKE sy-tabix,
ltb_objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
ltb_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
*-MAIN PROCESSING SECTION----
clear: ltb_objbin, ltb_objtxt, ltb_objpack, lwa_doc_chng.
refresh: ltb_objbin, ltb_objtxt, ltb_objpack.
Control Data
lwa_doc_chng-obj_name = 'URGENT'.
lwa_doc_chng-sensitivty = 'P'.
lwa_doc_chng-no_change = 'X'.
lwa_doc_chng-priority = '1'.
lwa_doc_chng-obj_prio = '1'.
lwa_doc_chng-obj_langu = sy-langu.
lwa_doc_chng-no_change = 'X'.
Email Subject
lwa_doc_chng-obj_descr = pw_subject.
Email Body
ltb_objtxt[] = ptb_body[].
CLEAR ltb_objtxt.
DESCRIBE TABLE ltb_objtxt LINES lw_tab_lines.
IF lw_tab_lines GT 0.
READ TABLE ltb_objtxt INDEX lw_tab_lines.
lwa_doc_chng-doc_size =
( lw_tab_lines - 1 ) * 255 + STRLEN( ltb_objtxt ).
CLEAR ltb_objpack-transf_bin.
ltb_objpack-body_start = 1.
ltb_objpack-body_num = lw_tab_lines.
ltb_objpack-doc_type = 'RAW'.
APPEND ltb_objpack.
ENDIF.
Attachment
Move the binary attachment to other internal table.
ltb_objbin[] = ptb_pdf255[].
ltb_objpack-transf_bin = 'X'.
ltb_objpack-body_start = 1.
Get the number of lines in the Attachment (PDF FILE)
DESCRIBE TABLE ltb_objbin LINES lw_tab_lines.
ltb_objpack-body_num = lw_tab_lines.
ltb_objpack-doc_type = 'PDF'.
ltb_objpack-obj_descr = pw_filename.
ltb_objpack-obj_name = pw_filename.
ltb_objpack-doc_size = lw_tab_lines * 255.
APPEND ltb_objpack.
Call the function to send the PDF file by email
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = lwa_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = ltb_objpack
contents_bin = ltb_objbin
contents_txt = ltb_objtxt
receivers = ptb_recipients
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.
CASE sy-subrc.
WHEN 0.
WHEN 1. RAISE too_many_receivers.
WHEN 2. RAISE document_not_sent .
WHEN 3. RAISE document_type_not_exist.
WHEN 4. RAISE operation_no_authorization.
WHEN 5. RAISE parameter_error.
WHEN 7. RAISE enqueue_error .
WHEN OTHERS. RAISE x_error.
ENDCASE.
COMMIT WORK.
ENDFORM.
I am calling this function module from within a method in my workflow....
So plz tell me whether there is anything wrong with this code..
Thanks & Regards,
Samrat Dutta
Message was edited by:
Samrat Dutta
Message was edited by:
Samrat Dutta -
Hi Experts,
I have a customisation that creates an XML Publisher report. There is a custom Java program which determines how the recipient is to receive the report e.g. fax, email, print. If it is email, it then determines what file format the report should be added, in this case it is PDF and it should then attach it in the email.
The problem I have is that it appears that the Oracle default email format of HTML is overwriting the PDF attachment format. Therefore, the report is included in the email body as HTML rather than as a PDF attachment.
Has anyone else had this problem and/or have a means through java code to set the Oracle email format to PDF?
Many thanks,
Mark
Edited by: Mark_Apps_Tech on Aug 27, 2009 6:09 AMHi doytsujin, thanks for the reply. The issue is more about overwriting the default email format of HTML in Oracle.
I have got the PDF document fine and the code is working, but looking at the log file in the Concurrent Program, there is the entry that Oracle makes below:
"Since the delivery method is EMAIL, the XML Publisher output is set to html"
For my code, I'm using the following imported libraries:
import oracle.apps.xdo.common.pdf.util.PDFDocMerger;
import oracle.apps.xdo.delivery.DeliveryManager;
import oracle.apps.xdo.delivery.DeliveryPropertyDefinitions;
import oracle.apps.xdo.delivery.smtp.Attachment;
Is there a way to some how enforce that Oracle uses PDF format?
Thanks,
Mark -
Increase the resoulution of PDF attachement
Hi Friends,
I have one question.
We are sending the PDF as attachement to emails.
After that the itellas(non erp client system) sends the PDF file as fax to the perticular fax no of the customer.
But when customer gets the fax, its almost unreadable.
So is there any setting in SAP or can we code something to increase the resoltuion of PDF file before sending it to itella?
Please let me know if any1 has done this before.
Br, PrashantI don't think this would be feasible in SAP, but you might want to contact the creators of that software and see if anything could be adjusted on their side. Also you might want to consider sending faxes directly from SAP, instead of going through PDF. There is some other software for it, which works much better.
-
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
-
How to restore missing apps after a itunes sync?
Have iPhone 4 iOS 4.2.8 To install an app (Skype), my phone recommended I do it thru iTunes 10.5.2 (via usb tether) Checked the sync box, selected the Skype app after I downloaded it in iTunes. The sync process went thru a bunch of 'finding, removi
-
Unable to create the JCO connections in webdypro (JAVA) No SLD Connection
HI All, In webdynpro i am unable to create standard JCo connections. create Jco connections and Maintain Jco COnnections are disabled. when i click any of the standard content of the Jco connections it displays error message No sld check. But SLD is
-
Help. My iPad email screen went blank. I have rebooted, reset and deleted and reinstalled my email accounts to no avail. Any other suggestions?
-
How can I change a title in I books
I have a ton of PDF files in iBooks. The All have very vague titles. How can I retitle and organize? I'm on ipad2
-
Adobe Reader X shows black squares. How can I remove them?
I already tried removing the software and reinstalling it, but unfortunately it didnt work that way... Hopefully you can help me! Thank you in advance:)