Sending SAPSCRIPT in PDF through email
Hi everybody,
I'm trying to send via email a sapscript. I red more posts regarding this issue but nothing seems to run correctly.
Some posts refers to a sample program ZRICH_0003.
I've just copied the code and replaced the form's name with one of mine and run it.
The function SO_NEW_DOCUMENT_ATT_SEND_API1 return with error code 2 (document not sent). I really don't know why. I've just run it in two different SAP (4.7 and 5.0)
Both didn't work. Both systems are UNIX. Must I do something in customizing or some RFC definition?
Is there anybody that have a simple program that uses this function?
Thanks in advance
Fabrizio
i have tried the same thing. first generating spool & then convering sppol to PDF.
REPORT ZPO_PDF NO STANDARD PAGE HEADING
LINE-SIZE 254.
converts list to PDF - send via mail as attachment
TABLES: adrp, "Persons (central address administration)
bhdgd, "Common data area batch heading routine
bsik, "Accounting: Secondary Index for Vendors
usr21. "Assign user name address key
General data definition
TYPE-POOLS: icon.
TYPE-POOLS: slis.
DATA: d_linsz LIKE sy-linsz.
Constants
CONSTANTS: c_yes(1) TYPE c VALUE 'X'.
Structures
DATA: e_variant TYPE disvariant.
Selection-screen
DATA: le_parameters LIKE pri_params.
DATA: l_valid(1) TYPE c.
DATA: lt_pdf TYPE TABLE OF tline WITH HEADER LINE.
DATA: l_spool_c LIKE tsp01_sp0r-rqid_char.
DATA: l_spool_i LIKE tsp01-rqident,
_RECEIVER LIKE bsik-xref3.
Get the SPOOL number
PARAMETERS:
spoolno LIKE TSP01-RQIDENT.
l_spool_i = spoolno.
DATA: NUMBYTES TYPE I,
ARC_IDX LIKE TOA_DARA,
pdfspoolid like tsp01-rqident,
jobname like tbtcjob-jobname,
jobcount like tbtcjob-jobcount,
is_otf.
DATA PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = l_spool_i
NO_DIALOG = ' '
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
PDF_BYTECOUNT = numbytes
PDF_SPOOLID = pdfspoolid
OTF_PAGECOUNT =
BTC_JOBNAME = jobname
BTC_JOBCOUNT = jobcount
TABLES
PDF = lt_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.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Build the mail
PERFORM build_mail
TABLES lt_pdf
USING _receiver.
FORM prepare_print_format USING parameters LIKE priparams.
DATA: BEGIN OF lt_report_source OCCURS 0,
line(72) TYPE c,
END OF lt_report_source.
DATA: l_string_linsz TYPE string.
DATA: l_tabix LIKE sy-tabix.
DATA: BEGIN OF lt_sentencia OCCURS 0,
line(72) TYPE c,
END OF lt_sentencia.
DATA: lt_tsp1d TYPE TABLE OF tsp1d WITH HEADER LINE.
READ REPORT sy-repid INTO lt_report_source.
CHECK sy-subrc = 0.
CLEAR: l_tabix.
WHILE NOT l_string_linsz CS '.'.
ADD 1 TO l_tabix.
READ TABLE lt_report_source
INDEX l_tabix.
TRANSLATE lt_report_source-line TO UPPER CASE.
IF l_string_linsz CS 'REPORT'
OR lt_report_source-line CS 'REPORT'.
CONCATENATE l_string_linsz
lt_report_source-line
INTO l_string_linsz
SEPARATED BY space.
CONDENSE l_string_linsz.
ENDIF.
ENDWHILE.
TRANSLATE l_string_linsz USING '. '.
CLEAR: lt_report_source.
REFRESH: lt_report_source.
FREE: lt_report_source.
SPLIT l_string_linsz AT space INTO TABLE lt_sentencia.
LOOP AT lt_sentencia
WHERE line CS 'LINE-SIZE'.
l_tabix = sy-tabix.
EXIT.
ENDLOOP.
ADD 1 TO l_tabix.
READ TABLE lt_sentencia
INDEX l_tabix.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE lt_tsp1d
FROM tsp1d
WHERE type = 'L'
AND outcolumns >= lt_sentencia-line.
SORT lt_tsp1d
BY outcolumns.
READ TABLE lt_tsp1d
INDEX 1.
parameters-linct = lttsp1d-outrows.
parameters-linsz = ltsentencia-line.
parameters-paart = lttsp1d-papart.
ENDFORM. " prepare_print_format
FORM build_mail TABLES tpdf STRUCTURE tline
USING _receiver TYPE c.
DATA: l_length_t_pdf TYPE i.
DATA: l_string TYPE xstring.
DATA: l_string_bck TYPE string.
DATA: l_length_string TYPE i.
DATA: l_length_objbin TYPE i.
DATA: l_max_tabix TYPE i.
DATA: l_dif TYPE i.
DATA: l_hex_null TYPE x VALUE '00'.
DATA: lt_objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: l_tab_lines LIKE sy-tabix.
DATA: le_doc_chng LIKE sodocchgi1.
DATA: lt_objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: lt_objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: lt_reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: lt_contents_bin LIKE solisti1 OCCURS 0 WITH HEADER LINE.
Mail text
(...here you should fill table lt_objtxt-line)
lt_objtxt-line = 'First line of text'.
append lt_objtxt.
lt_objtxt-line = 'Second line'.
append lt_objtxt.
DESCRIBE TABLE lt_objtxt LINES l_tab_lines.
READ TABLE lt_objtxt INDEX l_tab_lines.
le_doc_chng-doc_size = ( l_tab_lines - 1 ) * 255
+ STRLEN( lt_objtxt ).
le_doc_chng-obj_descr = 'PO in PDF By mail'.
CLEAR lt_objpack-transf_bin.
lt_objpack-head_start = 1.
lt_objpack-head_num = 0.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_tab_lines.
lt_objpack-doc_type = 'RAW'.
APPEND lt_objpack.
Attached file, in PDF-format
DESCRIBE FIELD tpdf LENGTH l_length_t_pdf.
CLEAR: l_string_bck,
l_string.
LOOP AT tpdf.
CONCATENATE l_string_bck tpdf INTO l_string_bck.
l_dif = l_length_t_pdf - STRLEN( tpdf ).
DO l_dif TIMES.
CONCATENATE l_string_bck l_hex_null INTO l_string_bck.
ENDDO.
CONCATENATE l_string tpdf INTO l_string.
ENDLOOP.
sy-subrc = 0.
WHILE sy-subrc = 0.
REPLACE l_hex_null WITH space INTO l_string_bck.
ENDWHILE.
l_length_string = strlen( l_string_bck ).
DESCRIBE FIELD lt_contents_bin LENGTH l_length_objbin.
l_max_tabix = ceil( l_length_string / l_length_objbin * '1.0' ).
DO l_max_tabix TIMES.
lt_contents_bin = l_string_bck.
APPEND lt_contents_bin.
IF sy-tabix <> l_max_tabix.
l_string_bck = l_string_bck+l_length_objbin.
ENDIF.
ENDDO.
DESCRIBE TABLE lt_contents_bin LINES l_tab_lines.
APPEND lt_objhead.
lt_objpack-transf_bin = c_yes.
lt_objpack-head_start = 1.
lt_objpack-head_num = 1.
lt_objpack-body_start = 1.
lt_objpack-body_num = l_tab_lines.
lt_objpack-doc_type = 'PDF'.
lt_objpack-doc_size = ( l_tab_lines - 1 ) * 255.
LOOP AT lt_contents_bin.
ENDLOOP.
lt_objpack-doc_size = lt_objpack-doc_size + STRLEN( lt_contents_bin ).
APPEND lt_objpack.
lt_reclist-receiver = 'testmailgmail.com'.
lt_reclist-rec_type = 'U'.
APPEND lt_reclist.
Finally! we send the mail
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = le_doc_chng
put_in_outbox = c_yes
TABLES
packing_list = lt_objpack
object_header = lt_objhead
contents_bin = lt_contents_bin
contents_hex =
contents_txt = lt_objtxt
receivers = lt_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.
ENDFORM. " build_mail
Similar Messages
-
Need to Generate PDF file and send it to customer through email-ALV report
HI All,
I am having data in Internal table.
can we create PDF file with out having spool-request number.
My requirement is whenever user clicks on execute button the output is generated in PDF format automatically and then send it to customer through email.
I found few programs in SDN for generation PDF. But problem is everyone passing the spool request to the function module.
spool request will be generated whenever we click on print button.
Am I correct?.
Is there any other way to create spool request automatically. If so we can pass the this spool number to the function module.
Regards,
vinod.hi
For sending a mail, this code will help you.
Pls reward if help.
FORM send_mail_2 USING msgid msgno msgv1.
mailuser oder Gruppe like sy-uname default 'Ruckerk'.
DATA: express_hold_time LIKE sovaltime.
DATA: text LIKE sotxtinfo.
DATA: receiver LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
MESSAGE ZF100 (FTP an UDB fehlgeschlagen)
text-msgid = msgid.
text-msgno = msgno.
text-msgv1 = msgv1.
text-msgv2 = ' '.
text-msgv3 = ' '.
text-msgv4 = ' '.
express_hold_time
express_hold_time-days = 01.
express_hold_time-h_min_sec = 240000.
receiver
receiver-receiver = mreceivr.
Gruppe von Empfängern
receiver-rec_type = 'C'.
und Expressmeldung ausgeben
receiver-express = 'X'.
APPEND receiver.
CALL FUNCTION 'MESSAGE_SEND_AS_MAIL'
EXPORTING
msgid = text-msgid
msgno = text-msgno
msgv1 = text-msgv1
msgv2 = text-msgv2
msgv3 = text-msgv3
TABLES
receivers = receiver.
IF sy-subrc <> 0.
WRITE:/ 'hat nicht geklappt', 'SY-SUBRC =', sy-subrc.
ENDIF.
PERFORM print_error_report.
Fehlermeldung zum Abbrechen des Report's ausgeben.
MESSAGE e398 WITH 'Jobabbruch' msgv1.
ENDFORM. " SEND_MAIL_2
Another Program:
*& Report ZSENDEMAIL *
*& Example of sending external email via SAPCONNECT *
REPORT zsendemail .
PARAMETERS: psubject(40) type c default 'Hello',
p_email(40) type c default '[email protected]' .
data: it_packing_list like sopcklsti1 occurs 0 with header line,
it_contents like solisti1 occurs 0 with header line,
it_receivers like somlreci1 occurs 0 with header line,
it_attachment like solisti1 occurs 0 with header line,
gd_cnt type i,
gd_sent_all(1) type c,
gd_doc_data like sodocchgi1,
gd_error type sy-subrc.
data: it_message type standard table of SOLISTI1 initial size 0
with header line.
*START-OF-SELECTION.
START-OF-SELECTION.
Perform populate_message_table.
*Send email message, although is not sent from SAP until mail send
*program has been executed(rsconn01)
PERFORM send_email_message.
*Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.
*& Form POPULATE_MESSAGE_TABLE
Adds text to email text table
form populate_message_table.
Append 'Email line 1' to it_message.
Append 'Email line 2' to it_message.
Append 'Email line 3' to it_message.
Append 'Email line 4' to it_message.
endform. " POPULATE_MESSAGE_TABLE
*& Form SEND_EMAIL_MESSAGE
Send email message
form send_email_message.
Fill the document data.
gd_doc_data-doc_size = 1.
Populate the subject/generic message attributes
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'.
gd_doc_data-obj_descr = psubject.
gd_doc_data-sensitivty = 'F'.
Describe the body of the message
clear it_packing_list.
refresh it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
describe table it_message lines it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
append it_packing_list.
Add the recipients email address
clear it_receivers.
refresh it_receivers.
it_receivers-receiver = p_email.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = 'X'.
it_receivers-notif_ndel = 'X'.
append it_receivers.
Call the FM to post the message to SAPMAIL
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = gd_doc_data
put_in_outbox = 'X'
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
contents_txt = it_message
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.
Store function module return code
gd_error = sy-subrc.
Get it_receivers return code
loop at it_receivers.
endloop.
endform. " SEND_EMAIL_MESSAGE
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
form initiate_mail_execute_program.
wait up to 2 seconds.
if gd_error eq 0.
submit rsconn01 with mode = 'INT'
with output = 'X'
and return.
endif.
endform. " INITIATE_MAIL_EXECUTE_PROGRAM -
Error send a smartform PDF by Email to Vendor
Hi Expert,
Please help me.........................
I want to send a PO (Smartform) as Email to Vendor.
In SAPScript the PO send by Email is working fine, but in Smartforms it is not working.
Normally, I will use via Smartforms the Program = YBAA_FM06P, FORM routine = ENTRY_NEU, PDF/Smartform Form = ZYBAA_MMPO1.
A communication strategy has communication type as INT has been defined.
This communication strategy has been set as default in the output type ZNEU. The transmission medium has been set to 5 (External Send) and the partner function as VN (Vendor).
The e-mail address of the vendor has also been maintained.
In transaction MN04, i have also made an entry for output type ZNEU and set the document type as NB.
But message output do not create.
How to send a smartform PDF by Email to vendor?
Thanks,Hi,
I can convert the PO output in to PDF from SOST I can sent it to external vendor using the Mail triggering configuration settings but meassage output do not create.
Please tell me how can I do.
Thank, -
Sending pics and videos through email
help whenever I try to send pics or video through email I'm getting the message " Cannot send mail. the server rejected one of the recipient's addresses." I've tried sending this from my mac(mobileme) account and my yahoo account. All the smtp servers are set to "on". I'm new to using the iphone and I was hoping that i'd at least be able to send pictures and my videos through email like i was able to on verizon.... all my accounts(yahoo,mac,and gmail) are denied doing this though. yahoo completely shuts off and closes mail when i attempt to do it and mac gives me the above mentioned message. I'm running 3.1. Please help me if you can I'm not sure how to change things and I don't want to risk losing everything I have by a hard reset or changing things and screwing up the phone....
The error message provided usually indicates the SMTP server being used is being blocked by the internet service provider being used at the time, but all the email accounts you are accessing have an authenticated SMTP server, and an authenticated SMTP server is usually not blocked by an internet server provider including when connected to AT&T's cellular network.
I don't know what you are calling a hard reset, but an iPhone reset does not affect any data or settings. An iPhone reset is done by pressing and holding the home button and the sleep/wake or on/off button simultaneously until you see the Apple logo and then release - ignoring the slide to turn off prompt when doing so.
If powering your iPhone off and on doesn't make any difference, try an iPhone reset. -
Sending Invoice as PDF in email
Hello,
I have a requirement where I have to send Proforma Invoice as PDF in email.
Now, the Proforma Invoice is already using output type to Print and when I see the routines in Tcode NACE
It uses RVADAUS1 Program where it calls RV_EXPORT_DOCUMENT_PRINT function module to generate the Print document.
This works fine.
So, I created a new output type, copied the RVADAUS1 to ZRVADAUS1 and modified the code where I am capturing the Spool generated through the original code and pass it to CONVERT_ABAPSPOOLJOB_2_PDF to convert it to PDF and then send it as an email.
Now, the problem I am facing is that, I am not able to generate a Spool when I am using the medium ( '5' External Send ). So the further code of capturing Spool and convert to PDF and send as email fails.
Any guidance is appreciated.
Regards,
DNPHi Sudhanshu,
Just before calling the function module RV_EXPORT_DOCUMENT_PRINT.
I forced TNAPR-NACHA = '1'. and NAST-NACHA = '1'.
which means I forced Transmission medium as 1(Print) instead of 5(External Send)
This created a SPOOL.
Regards,
DNP
Edited by: DNP on Aug 14, 2009 11:45 AM -
Custom sapscript to PDF and email
Hi all,
I have a requirement to create a new sapscript that can be converted to PDF and emailed. I have done this for regular reports but have no idea about doing it for sapscript.
Does anybody know how I can do this?
I've search the forums here but I haven't found a definate solution.
Cheers,
TonyHere is a sample program.
REPORT ZRICH_0003.
DATA: ITCPO LIKE ITCPO,
TAB_LINES LIKE SY-TABIX.
* Variables for EMAIL functionality
DATA: MAILDATA LIKE SODOCCHGI1.
DATA: MAILPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: MAILHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: MAILBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: MAILTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: MAILREC LIKE SOMLREC90 OCCURS 0 WITH HEADER LINE.
DATA: SOLISTI1 LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
PERFORM SEND_FORM_VIA_EMAIL.
* FORM SEND_FORM_VIA_EMAIL *
FORM SEND_FORM_VIA_EMAIL.
CLEAR: MAILDATA, MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
REFRESH: MAILTXT, MAILBIN, MAILPACK, MAILHEAD, MAILREC.
* Creation of the document to be sent File Name
MAILDATA-OBJ_NAME = 'TEST'.
* Mail Subject
MAILDATA-OBJ_DESCR = 'Subject'.
* Mail Contents
MAILTXT-LINE = 'Here is your file'.
APPEND MAILTXT.
* Prepare Packing List
PERFORM PREPARE_PACKING_LIST.
* Set recipient - email address here!!!
MAILREC-RECEIVER = '[email protected]'.
MAILREC-REC_TYPE = 'U'.
APPEND MAILREC.
* Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = MAILDATA
PUT_IN_OUTBOX = ' '
TABLES
PACKING_LIST = MAILPACK
OBJECT_HEADER = MAILHEAD
CONTENTS_BIN = MAILBIN
CONTENTS_TXT = MAILTXT
RECEIVERS = MAILREC
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
ENDFORM.
* Form PREPARE_PACKING_LIST
FORM PREPARE_PACKING_LIST.
CLEAR: MAILPACK, MAILBIN, MAILHEAD.
REFRESH: MAILPACK, MAILBIN, MAILHEAD.
DESCRIBE TABLE MAILTXT LINES TAB_LINES.
READ TABLE MAILTXT INDEX TAB_LINES.
MAILDATA-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( MAILTXT ).
* Creation of the entry for the compressed document
CLEAR MAILPACK-TRANSF_BIN.
MAILPACK-HEAD_START = 1.
MAILPACK-HEAD_NUM = 0.
MAILPACK-BODY_START = 1.
MAILPACK-BODY_NUM = TAB_LINES.
MAILPACK-DOC_TYPE = 'RAW'.
APPEND MAILPACK.
* Creation of the document attachment
* This form gets the OTF code from the SAPscript form.
* If you already have your OTF code, I believe that you may
* be able to skip this form. just do the following code, looping thru
* your SOLISTI1 and updating MAILBIN.
<b> PERFORM GET_OTF_CODE.
LOOP AT SOLISTI1.
MOVE-CORRESPONDING SOLISTI1 TO MAILBIN.
APPEND MAILBIN.
ENDLOOP.</b>
DESCRIBE TABLE MAILBIN LINES TAB_LINES.
MAILHEAD = 'TEST.OTF'.
APPEND MAILHEAD.
** Creation of the entry for the compressed attachment
MAILPACK-TRANSF_BIN = 'X'.
MAILPACK-HEAD_START = 1.
MAILPACK-HEAD_NUM = 1.
MAILPACK-BODY_START = 1.
MAILPACK-BODY_NUM = TAB_LINES.
MAILPACK-DOC_TYPE = 'OTF'.
MAILPACK-OBJ_NAME = 'TEST'.
MAILPACK-OBJ_DESCR = 'Subject'.
MAILPACK-DOC_SIZE = TAB_LINES * 255.
APPEND MAILPACK.
ENDFORM.
* Form GET_OTF_CODE
FORM GET_OTF_CODE.
DATA: BEGIN OF OTF OCCURS 0.
INCLUDE STRUCTURE ITCOO .
DATA: END OF OTF.
DATA: ITCPO LIKE ITCPO.
DATA: ITCPP LIKE ITCPP.
<b> CLEAR ITCPO.
ITCPO-TDGETOTF = 'X'.</b>
* Start writing OTF code
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = 'ZTEST_FORM'
LANGUAGE = SY-LANGU
OPTIONS = ITCPO
DIALOG = ' '
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'START_FORM'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
WINDOW = 'MAIN'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.
* Close up Form and get OTF code
CALL FUNCTION 'END_FORM'
EXCEPTIONS
ERROR_MESSAGE = 01
OTHERS = 02.
MOVE-CORRESPONDING ITCPO TO ITCPP.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = ITCPP
<b> TABLES
OTFDATA = OTF</b>
EXCEPTIONS
OTHERS = 1.
* Move OTF code to structure SOLI form email
<b> CLEAR SOLISTI1. REFRESH SOLISTI1.
LOOP AT OTF.
SOLISTI1-LINE = OTF.
APPEND SOLISTI1.
ENDLOOP.</b>
ENDFORM.
Please make sure to award points for helpful answers and Welcome to SDN!!!
Regards,
Rich Heilman -
HI All,
I have a requirement to send payslip in PDF format through Email ( PE51- HR FORM EDITOR)
Converted the Payslip into PDF by using F.M BAPI_GET_PAYSLIP_PDF .
PDF got generated nd for the same am sending through Email by using the FM SO_DOCUMENT_SEND_API1.
Recieved an email but the format is not proper ..
Got hanged with this problem..
Please provide any suggestion to move furthur ...
Regards ,
Dheeraj.@ Sriram and all ..
Here is the link of the o/p :
http://i56.tinypic.com/2w3w96d.jpg
.. Have used the FM 'QCE1_CONVERT' ( i.e to make the PDF content in a compatible format) before making use of 'SO_NEW_DOCUMENT_ATT_SEND_API1' FM.
Still am facing the same probs nd am also herewith posting the code ..
First have retrieved the latest payroll result and made the below....
VARIABLES FOR SENDING EMAIL
DATA document_data TYPE STANDARD TABLE OF sodocchgi1
WITH HEADER LINE .
DATA packing_list TYPE STANDARD TABLE OF sopcklsti1
WITH HEADER LINE .
DATA object_header TYPE STANDARD TABLE OF solisti1
WITH HEADER LINE .
DATA contents_bin TYPE STANDARD TABLE OF solisti1
WITH HEADER LINE .
DATA contents_txt TYPE STANDARD TABLE OF solisti1
WITH HEADER LINE .
DATA receivers TYPE STANDARD TABLE OF somlreci1
WITH HEADER LINE .
DATA i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE .
DATA tab_lines_txt TYPE i .
DATA tab_lines TYPE i .
DATA : successfully_sent TYPE c .
CALL FUNCTION 'BAPI_GET_PAYSLIP_PDF'
EXPORTING
employeenumber = p0001-pernr
sequencenumber = number
payslipvariant = c_payslip_variant
IMPORTING
return = return
payslip = pdf_content
pdf_fsize = pdf_fsize.
IF pdf_content IS INITIAL.
it_log-count = count.
it_log-pernr = p0001-pernr.
it_log-message_type = 'E'.
it_log-message = return-message.
APPEND it_log.
ELSE.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = pdf_content
TABLES
binary_tab = binary.
ENDIF.
ENDIF.
BREAK-POINT.
CALL FUNCTION 'QCE1_CONVERT'
TABLES
t_source_tab = binary
t_target_tab = i_objbin
EXCEPTIONS
convert_not_possible = 1
OTHERS = 2.
CONCATENATE 'PAYSLIP' '_' p0001-pernr '_' INTO
gc_testing.
=================================================
NAME OF THE OBJECT TO BE SENT
=================================================
BREAK-POINT.
CLEAR document_data .
document_data-obj_name = gc_tst.
document_data-obj_descr = gc_testing.
=================================================
CALCULATING THE SIZE OF THE TEXT IN THE MESSAGE
BODY AND UPDATING THE PACKING LIST
=================================================
BREAK-POINT.
DESCRIBE TABLE binary LINES gv_tab_lines .
READ TABLE binary INDEX gv_tab_lines. .
document_data-doc_size =
( gv_tab_lines - 1 ) * 255 + STRLEN( binary ).
CLEAR packing_list.
packing_list-head_start = 1.
packing_list-head_num = 0.
packing_list-body_start = 1.
packing_list-body_num = gv_tab_lines.
packing_list-doc_type = 'RAW'.
APPEND packing_list.
* =================================================
CALCULATING THE SIZE OF THE PDF ATTACHEMENT
AND UPDATING THE PACKING LIST
=================================================
BREAK-POINT.
DESCRIBE TABLE i_objbin LINES tab_lines.
CLEAR packing_list .
packing_list-transf_bin = 'X'.
packing_list-head_start = 1.
packing_list-head_num = 1.
packing_list-body_start = 1 .
packing_list-body_num = tab_lines .
packing_list-doc_type = 'PDF'.
packing_list-obj_name = 'INFORMATION.PDF' .
packing_list-obj_descr = 'INFORMATION.PDF' .
packing_list-doc_size = tab_lines * 255.
APPEND packing_list.
=================================================
CREATING THE ATTACHMENT OF THE MESSAGE
=================================================
FREE contents_bin .
LOOP AT i_objbin .
CLEAR contents_bin .
contents_bin = i_objbin .
APPEND contents_bin .
ENDLOOP .
* =================================================
LIST OF RECEPIENTS
=================================================
FREE receivers.
CLEAR receivers.
receivers-receiver = 'email id' .
receivers-rec_type = 'U'.
APPEND receivers.
=================================================
=================================================
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = document_data
put_in_outbox = ' '
commit_work = 'X'
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = packing_list
object_header = object_header
contents_bin = contents_bin
contents_txt = contents_txt
CONTENTS_HEX =
OBJECT_PARA =
OBJECT_PARB =
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 EQ 0 .
successfully_sent = 'X' .
ENDIF .
Please suggest and let me know for furthur changes that need to be done for the above coding to resolve my problem..
Regards ,
Dheeraj -
Dear All
i have written the program for send payslip through email and its working fine
But problem is that i am not getting the correct format in PDF
Regards
ArunHi All
Plz find my code here which i am using to send Payslip through email, its working fine
But when i received the email with attachment, PDF is not coming in correct format
You can see the output of PDF given below after my code
REPORT zsendmail.
TABLES:pa0001.
DATA : BEGIN OF rgdir OCCURS 0.
INCLUDE STRUCTURE pc261.
DATA END OF rgdir.
DATA : country LIKE t001p-molga VALUE 'IN',
v_pabrj LIKE t549q-pabrj,
v_pabrp LIKE t549q-pabrp,
v_vabrj LIKE t549q-vabrj,
v_vabrp LIKE t549q-vabrp,
v_fpper1 LIKE rgdir-fpper,
v_fpper2 LIKE rgdir-fpper,
return LIKE bapireturn1,
*payslip LIKE bapi7004_payslip OCCURS 0 WITH HEADER LINE,
payslip TYPE xstring,
*slip LIKE pc408,
bin_file TYPE xstring,
pdf_fsize TYPE i,
x TYPE i,
x1 TYPE i,
v_srno LIKE pa0000-pernr.
DATA BEGIN OF slip OCCURS 0.
INCLUDE STRUCTURE pc408.
DATA END OF slip.
DATA BEGIN OF slip1 OCCURS 0.
INCLUDE STRUCTURE pc407.
DATA END OF slip1.
DATA: BEGIN OF i_pernr OCCURS 0,
pernr LIKE pa0000-pernr,
seqnr LIKE hrpy_rgdir-seqnr,
abkrs LIKE hrpy_rgdir-abkrs,
fpper LIKE hrpy_rgdir-fpper,
inper LIKE hrpy_rgdir-inper,
ipend LIKE hrpy_rgdir-ipend,
usrid_long LIKE pa0105-usrid_long,
nachn LIKE pa0002-nachn,
vorna LIKE pa0002-vorna,
anred LIKE pa0002-anred,
ename LIKE pa0001-ename,
END OF i_pernr.
DATA result TYPE pay99_result.
DATA lv_buffer TYPE xstring. " added later
DATA ihrpy LIKE hrpy_rgdir OCCURS 0.
DATA whpr TYPE hrpy_rgdir.
DATA : bt_header TYPE LINE OF hrpay99_bt,
rt_header TYPE LINE OF hrpay99_rt.
DATA : objhex LIKE solix OCCURS 0 WITH HEADER LINE,
objhex1 TYPE solix.
*************************Added Later
DATA : objbin LIKE solix OCCURS 0 WITH HEADER LINE,
objbin1 TYPE solix.
DATA: y TYPE i ,
z TYPE i,
mname TYPE string.
DATA: mail_attachment_lines TYPE i,
lv_tablines LIKE sy-tabix.
DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE.
DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: i_reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE,
wa_reclist TYPE somlreci1 .
DATA: doc_chng LIKE sodocchgi1,
l_date(10) TYPE c,
l_time(8) TYPE c.
DATA: objhead TYPE soli_tab.
DATA : w_repid LIKE sy-repid,
w_dynpro LIKE sy-dynnr.
SELECTION-SCREEN BEGIN OF BLOCK b1 .
PARAMETERS : p_bukrs LIKE pa0001-bukrs OBLIGATORY,
p_permo LIKE t549q-permo.
SELECT-OPTIONS:s_date FOR pa0001-begda NO-EXTENSION OBLIGATORY,
s_abkrs FOR pa0001-abkrs OBLIGATORY,
s_persg FOR pa0001-persg,
s_pernr FOR pa0001-pernr.
SELECTION-SCREEN END OF BLOCK b1.
LOAD-OF-PROGRAM.
MOVE sy-repid TO w_repid. MOVE sy-dynnr TO w_dynpro.
WRITE: sy-datum TO l_date, sy-uzeit TO l_time.
START-OF-SELECTION.
PERFORM select_data.
*& Form SELECT_DATA
FORM select_data .
SELECT SINGLE pabrj pabrp vabrj vabrp FROM t549q INTO (v_pabrj,v_pabrp,v_vabrj,v_vabrp) WHERE permo = p_permo AND begda >= s_date-low AND endda <= s_date-high.
CONCATENATE v_pabrj v_pabrp INTO v_fpper1.
CONCATENATE v_vabrj v_vabrp INTO v_fpper2.
CASE v_pabrp.
WHEN '01'. CONCATENATE 'APRIL' s_date-high+0(4) INTO mname SEPARATED BY space.
WHEN '02'. CONCATENATE 'MAY' s_date-high+0(4) INTO mname SEPARATED BY space.
WHEN '03'. CONCATENATE 'JUNE' s_date-high+0(4) INTO mname SEPARATED BY space.
WHEN '04'. CONCATENATE 'JULY' s_date-high+0(4) INTO mname SEPARATED BY space.
WHEN '05'. CONCATENATE 'AUGUST' s_date-high+0(4) INTO mname SEPARATED BY space.
WHEN '06'. CONCATENATE 'SEPTEMBER' s_date-high+0(4) INTO mname SEPARATED BY space.
WHEN '07'. CONCATENATE 'OCTOBER' s_date-high+0(4) INTO mname SEPARATED BY space.
WHEN '08'. CONCATENATE 'NOVEMEBR' s_date-high+0(4) INTO mname SEPARATED BY space.
WHEN '09'. CONCATENATE 'DECEMBER' s_date-high+0(4) INTO mname SEPARATED BY space.
WHEN '10'. CONCATENATE 'JANUARY' s_date-high+0(4) INTO mname SEPARATED BY space.
WHEN '11'. CONCATENATE 'FEBRUARY' s_date-high+0(4) INTO mname SEPARATED BY space.
WHEN '12'. CONCATENATE 'MARCH' s_date-high+0(4) INTO mname SEPARATED BY space.
ENDCASE.
hrpy_rgdir table is getting filled once the payroll is run.
SELECT hrpy_rgdirpernr hrpy_rgdirseqnr hrpy_rgdirabkrs hrpy_rgdirfpper hrpy_rgdirinper hrpy_rgdiripend pa0105usrid_long pa0002nachn pa0002vorna pa0002anred pa0001~ename
FROM hrpy_rgdir
JOIN pa0105 ON hrpy_rgdirpernr = pa0105pernr AND subty = '0010'
JOIN pa0002 ON hrpy_rgdirpernr = pa0002pernr
JOIN pa0001 ON hrpy_rgdirpernr = pa0001pernr
INTO CORRESPONDING FIELDS OF TABLE i_pernr
WHERE inper > v_fpper2
AND inper <= v_fpper1
AND fpper > v_fpper2
AND fpper <= v_fpper1
AND hrpy_rgdir~pernr IN s_pernr
AND srtza = 'A'
AND pa0105~endda >= s_date-high
AND pa0002~endda >= s_date-high
AND pa0001~endda >= s_date-high
AND pa0001~bukrs = p_bukrs
AND pa0001~abkrs IN s_abkrs
AND pa0001~persg IN s_persg.
LOOP AT i_pernr.
REFRESH : objhex , objpack , objtxt ,i_reclist.
CLEAR : objhex1, y,z,x1,x, mail_attachment_lines, wa_reclist, doc_chng , objhead.
CALL FUNCTION 'BAPI_GET_PAYSLIP_PDF'
EXPORTING
employeenumber = i_pernr-pernr
sequencenumber = i_pernr-seqnr
payslipvariant = 'ZOFF'
IMPORTING
RETURN =
payslip = payslip
pdf_fsize = pdf_fsize.
x = pdf_fsize / 255.
z = pdf_fsize - 255.
DO x TIMES.
IF x1 > z .
EXIT.
ENDIF.
objhex1-line = payslip+x1(255).
APPEND objhex1 TO objhex.
objbin1-line = payslip+x1(255).
APPEND objbin1 TO objbin.
x1 = x1 + 255.
ENDDO.
y = pdf_fsize - x1 .
objhex1-line = payslip+x1(y) .
APPEND objhex1 TO objhex.
DESCRIBE TABLE objhex LINES mail_attachment_lines.
doc_chng-obj_name = 'PAYSLIP'.
CONCATENATE 'PAYSLIP FOR' mname INTO doc_chng-obj_descr SEPARATED BY space .
CASE i_pernr-anred.
WHEN 1.
CONCATENATE 'Dear' 'Mr.' i_pernr-vorna i_pernr-nachn INTO objtxt-line SEPARATED BY ' '.
WHEN 2. CONCATENATE 'Dear' 'Ms.' i_pernr-vorna i_pernr-nachn INTO objtxt-line SEPARATED BY ' '.
WHEN 3. CONCATENATE 'Dear' 'Dr.' i_pernr-vorna i_pernr-nachn INTO objtxt-line SEPARATED BY ' '.
WHEN OTHERS. CONCATENATE 'Dear' i_pernr-vorna i_pernr-nachn INTO objtxt-line SEPARATED BY ' '.
ENDCASE.
CLEAR objtxt.
APPEND objtxt.
CONCATENATE 'Please find attached payslip for' mname INTO objtxt-line SEPARATED BY space.
APPEND objtxt.
CLEAR objtxt.
WRITE: sy-datum TO l_date,
sy-uzeit TO l_time.
CONCATENATE 'SAP System generated statement (on' l_date 'At' l_time 'IST) enclosed which does not REQUIRE SIGNATURE.' INTO objtxt-line SEPARATED BY space.
APPEND objtxt.
CLEAR objtxt.
*--FOR EMPTY LINE APPEND objtxt.
objtxt-line = 'Regards,'.
APPEND objtxt.
CLEAR objtxt.
objtxt-line = 'TEAM HR.'.
APPEND objtxt.
CLEAR objtxt.
CASE i_pernr-abkrs.
WHEN 'ZO'.
objtxt-line = 'ENGLISH LTD'.
WHEN 'Z2'. objtxt-line = 'ENGLISH LTD'.
WHEN 'Z8'. objtxt-line = 'ENGLISH LTD'.
WHEN 'Z5'. objtxt-line = 'ENGLISH LTD'.
WHEN OTHERS. objtxt-line = ''.
ENDCASE.
APPEND objtxt.
CLEAR objtxt.
APPEND objtxt.
DESCRIBE TABLE objtxt LINES lv_tablines.
READ TABLE objtxt INDEX lv_tablines TRANSPORTING ALL FIELDS.
doc_chng-doc_size = ( lv_tablines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = lv_tablines.
objpack-doc_type = 'RAW'.
APPEND objpack.
Pack to PDF.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = mail_attachment_lines.
objpack-doc_type = 'PDF'.
objpack-obj_name = 'Noti'.
objpack-doc_size = pdf_fsize.
objpack-doc_size = mail_attachment_lines * 255.
objpack-obj_descr = 'payslip.pdf'.
APPEND objpack.
CLEAR: wa_reclist.
REFRESH i_reclist[].
CLEAR wa_reclist.
wa_reclist-receiver = i_pernr-usrid_long.
wa_reclist-rec_type = 'U'.
APPEND wa_reclist TO i_reclist.
CLEAR wa_reclist.
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 =
contents_bin = objbin
contents_txt = objtxt
contents_hex = objhex
contents_hex = slip
receivers = i_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc = 0.
* message i000 with 'Error When Sending the File'.
ELSE.
WAIT UP TO 5 SECONDS.
SUBMIT rsconn01 WITH mode = 'INT' AND RETURN.
ENDIF.
ENDIF.
ENDLOOP.
IF sy-subrc = 0.
WRITE : / 'Sucess','Emp No',
i_pernr-pernr.
ELSE.
WRITE : 'Not Sucess','Emp No',
i_pernr-pernr.
ENDIF.
ENDFORM. " SELECT_DATA
PDF Output
Bank Name Account No. Amount = Earnings - Deductions +
Adjustment
UTI002 12112112 24,287.00 = 27,950.00 - 3,663.00
+ 0.00
|----
|Earnings |Deductions
Perks/Other income/Exemptptions/Rebates
-||--
|
Basic Salary
18,000.00
Income Tax
3,663.00 ||Agg of Chapter VI | 122,000.00 |
Children Education Allow
1,200.00
Special Allowance
5,000.00
Conveyance Allowance
3,500.00
Medical Allowance - T
250.00
Total
27,950.00
Total
3,663.00 || | |
Net Pay
24,287.00 Recovery 0.00
Form 16 summary |
Gross Salary 335,400.00 |
Balance 335,400.00 |
Incm under Hd Salary 335,400.00 |
Gross Tot Income 335,400.00 |
Agg of Chapter VI 122,000.00 |
Total Income 213,400.00 |
Tax on total Income 42,680.00 |
Tax payable and surcharg 43,960.00 |
Tax deducted so far 3,663.00 |
Income Tax 3,663.00 |
|
|
|
|
|
This is a computer generated statement and signature is not required. -
Send a printworkbench form through Email??
Hi Experts,
We have the requirement to send a bill to a customer external mailId, Which is made in Printworkbench application through EMAIL? Is anybody have a idea how to do this thing?
Moderator note - Thread locked due to rules violation. Follow Adding mail text in email - IS-U invoice through Email
Edited by: William Eastman on Jan 5, 2010 8:44 PMYes you can, you should modify the print variant, which should be asociated to the repective exp. control "MAIL".
Best regards. -
Can you send FCP project files through email?
If all of a projects original capture footage is copied to another hard drive and then opened with the copied saved project file on another computer, will the "new" copied project work correctly?
Can you send project files back and forth through email if your both working with the same exact copied footage?
powermac g5 2.0 DC; powerbook g4 Mac OS X (10.4.7)I use iChat to send project files. I've even used it to send a missing media file here and there (overnight, of course). < </div>
iChat is tremendously under-used and misunderstood application. Being able to transfer h-u-g-e files without FTP, connecting to a server, connecting to the target Shared folder or drop box or stooping to the hassles of email is only one fascinating aspect of this cool little tool.
The Macintosh OS is full of such things.
bogiesan -
How to add body text when sending output as PDF in email?
Hello,
We are using standard SAP to send SD output as PDF in an email (in output type we choose medium 5, email address is taken from customer master. In transaction SCOT is indicated that SAPscript/smartforms are converted to PDF. When the output is generated, we run rsconn01 to trigger the actual sending of the email).
Via form TEXT_SYMBOL_REPLACE we can modify the subject of the email that is send to include e.g. the order number. HOWEVER, in the body of the email that is send, we now only have the PDF, but we also would like to add a standard text in the body of the email. Does anyone know how to do this?
Thanks,
AlexHi,
Please refer to the following program and see if it helps you.
REPORT ZSAMPL_001 .
INCLUDE ZINCLUDE_01.
DATA
DATA : itab LIKE tline OCCURS 0 WITH HEADER LINE.
DATA : file_name TYPE string.
data : path like PCFILE-PATH.
data : extension(5) type c.
data : name(100) type c.
SELECTION SCREEN
PARAMETERS : receiver TYPE somlreci1-receiver lower case.
PARAMETERS : p_file LIKE rlgrap-filename
OBLIGATORY.
AT SELECTION SCREEN
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CLEAR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM ml_customize USING 'Tst' 'Testing'.
PERFORM ml_addrecp USING receiver 'U'.
PERFORM upl.
PERFORM doconv TABLES itab objbin.
PERFORM ml_prepare USING 'X' extension name.
PERFORM ml_dosend.
SUBMIT rsconn01
WITH mode EQ 'INT'
AND RETURN.
FORM
FORM upl.
file_name = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = file_name
filetype = 'BIN'
TABLES
data_tab = itab
EXCEPTIONS
*file_open_error = 1
*file_read_error = 2
*no_batch = 3
*gui_refuse_filetransfer = 4
*invalid_type = 5
*no_authority = 6
*unknown_error = 7
*bad_data_format = 8
*header_not_allowed = 9
*separator_not_allowed = 10
*header_too_long = 11
*unknown_dp_error = 12
*access_denied = 13
*dp_out_of_memory = 14
*disk_full = 15
*dp_timeout = 16
*OTHERS = 17.
path = file_name.
CALL FUNCTION 'PC_SPLIT_COMPLETE_FILENAME'
EXPORTING
complete_filename = path
CHECK_DOS_FORMAT =
IMPORTING
DRIVE =
EXTENSION = extension
NAME = name
NAME_WITH_EXT =
PATH =
EXCEPTIONS
INVALID_DRIVE = 1
INVALID_EXTENSION = 2
INVALID_NAME = 3
INVALID_PATH = 4
OTHERS = 5
ENDFORM. "upl
***INCLUDE ZINCLUDE_01 .
10.08.2005 Amit M - Created
Include For Mail (First Req F16)
Modification Log
Data
tables crmrfcpar.
DATA: docdata LIKE sodocchgi1,
objpack LIKE sopcklsti1 OCCURS 1 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objhex LIKE solix OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
data v_rfcdest LIKE crmrfcpar-rfcdest.
FORM
FORM ml_customize USING objname objdesc.
Clear Variables
CLEAR docdata.
REFRESH objpack.
CLEAR objpack.
REFRESH objhead.
REFRESH objtxt.
CLEAR objtxt.
REFRESH objbin.
CLEAR objbin.
REFRESH objhex.
CLEAR objhex.
REFRESH reclist.
CLEAR reclist.
REFRESH listobject.
CLEAR listobject.
CLEAR tab_lines.
CLEAR doc_size.
CLEAR att_type.
Set Variables
docdata-obj_name = objname.
docdata-obj_descr = objdesc.
ENDFORM. "ml_customize
FORM
FORM ml_addrecp USING preceiver prec_type.
CLEAR reclist.
reclist-receiver = preceiver.
reclist-rec_type = prec_type.
APPEND reclist.
ENDFORM. "ml_customize
FORM
FORM ml_addtxt USING ptxt.
CLEAR objtxt.
objtxt = ptxt.
APPEND objtxt.
ENDFORM. "ml_customize
FORM
FORM ml_prepare USING bypassmemory whatatt_type whatname.
IF bypassmemory = ''.
Fetch List From Memory
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = listobject
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'LIST_FROM_MEMORY'.
ENDIF.
CALL FUNCTION 'TABLE_COMPRESS'
IMPORTING
COMPRESSED_SIZE =
TABLES
in = listobject
out = objbin
EXCEPTIONS
OTHERS = 1
IF sy-subrc <> 0.
MESSAGE ID '61' TYPE 'E' NUMBER '731'
WITH 'TABLE_COMPRESS'.
ENDIF.
ENDIF.
Header Data
Already Done Thru FM
Main Text
Already Done Thru FM
Packing Info For Text Data
DESCRIBE TABLE objtxt LINES tab_lines.
READ TABLE objtxt INDEX tab_lines.
docdata-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
CLEAR objpack-transf_bin.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'TXT'.
APPEND objpack.
Packing Info Attachment
att_type = whatatt_type..
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = whatname.
APPEND objpack.
Receiver List
Already done thru fm
ENDFORM. "ml_prepare
FORM
FORM ml_dosend.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X' "used from rel. 6.10
IMPORTING
SENT_TO_ALL =
NEW_OBJECT_ID =
TABLES
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
CONTENTS_HEX = objhex
OBJECT_PARA =
object_parb =
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8
IF sy-subrc <> 0.
MESSAGE ID 'SO' TYPE 'S' NUMBER '023'
WITH docdata-obj_name.
ENDIF.
ENDFORM. "ml_customize
FORM
FORM ml_spooltopdf USING whatspoolid.
DATA : pdf LIKE tline OCCURS 0 WITH HEADER LINE.
Call Function
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = whatspoolid
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
OTHERS = 12.
Convert
PERFORM doconv TABLES pdf objbin.
ENDFORM. "ml_spooltopdf
FORM
FORM doconv TABLES
mypdf STRUCTURE tline
outbin STRUCTURE solisti1.
Data
DATA : pos TYPE i.
DATA : len TYPE i.
Loop And Put Data
LOOP AT mypdf.
pos = 255 - len.
IF pos > 134. "length of pdf_table
pos = 134.
ENDIF.
outbin+len = mypdf(pos).
len = len + pos.
IF len = 255. "length of out (contents_bin)
APPEND outbin.
CLEAR: outbin, len.
IF pos < 134.
outbin = mypdf+pos.
len = 134 - pos.
ENDIF.
ENDIF.
ENDLOOP.
IF len > 0.
APPEND outbin.
ENDIF.
ENDFORM. "doconv
FORM
FORM ml_saveforbp USING jobname jobcount.
Data
*data : yhead like yhrt_bp_head.
*DATA : ydocdata LIKE yhrt_bp_docdata,
*yobjtxt LIKE yhrt_bp_objtxt OCCURS 0 WITH HEADER LINE,
*yreclist LIKE yhrt_bp_reclist OCCURS 0 WITH HEADER LINE.
*DATA : seqnr TYPE i.
Head
*yhead-jobname = jobname.
*yhead-jobcount = jobcount..
*MODIFY yhrt_bp_head FROM yhead.
Doc Data
*ydocdata-jobname = jobname.
*ydocdata-jobcount = jobcount.
*MOVE-CORRESPONDING docdata TO ydocdata.
*MODIFY yhrt_bp_docdata FROM ydocdata.
Objtxt
*seqnr = 0.
*LOOP AT objtxt.
*seqnr = seqnr + 1.
*yobjtxt-jobname = jobname.
*yobjtxt-jobcount = jobcount.
*yobjtxt-seqnr = seqnr.
*MOVE-CORRESPONDING objtxt TO yobjtxt.
*MODIFY yhrt_bp_objtxt FROM yobjtxt.
*ENDLOOP.
RecList
*seqnr = 0.
*LOOP AT reclist.
*seqnr = seqnr + 1.
*yreclist-jobname = jobname.
*yreclist-jobcount = jobcount.
*yreclist-seqnr = seqnr.
*MOVE-CORRESPONDING reclist TO yreclist.
*MODIFY yhrt_bp_reclist FROM yreclist.
*ENDLOOP.
ENDFORM. "ml_saveforbp
FORM
FORM ml_fetchfrombp USING jobname jobcount.
*CLEAR docdata.
*REFRESH objtxt.
*REFRESH reclist.
*SELECT SINGLE * FROM yhrt_bp_docdata
*INTO corresponding fields of docdata
*WHERE jobname = jobname
*AND jobcount = jobcount.
*SELECT * FROM yhrt_bp_objtxt
*INTO corresponding fields of TABLE objtxt
*WHERE jobname = jobname
*AND jobcount = jobcount
*ORDER BY seqnr.
*SELECT * FROM yhrt_bp_reclist
*INTO corresponding fields of TABLE reclist
*WHERE jobname = jobname
*AND jobcount = jobcount
*ORDER BY seqnr.
ENDFORM. "ml_fetchfrombp
Hope this helps.
Please reward some points if it helps.
Regards,
Amit Mishra -
hi,
i am sending an adobeform as pdf in an email body to an external address.ie. i need an output in my outlook account as : an email with PDF document as the body of the Email.
Problem --> I am getting the PDF as an attachment always.
here is my code
TRY.
send_request = cl_bcs=>create_persistent( ).
lp_pdf_size = XSTRLEN( ls_formoutput-pdf ).
pdf_content = cl_document_bcs=>xstring_to_solix(
ip_xstring = ls_formoutput-pdf ).
document = cl_document_bcs=>create_document(
i_type = 'PDF'
i_hex = pdf_content
i_length = lp_pdf_size
i_subject = 'test created by BCS_EXAMPLE_6' ). "#EC NOTEXT
send_request->set_document( document ).
recipient = cl_cam_address_bcs=>create_internet_address(
i_address_string = p_email ).
send_request->add_recipient( i_recipient = recipient ).
sent_to_all = send_request->send(
i_with_error_screen = 'X' ).
can someone help here
ThanksHi,
check the link , i think u will get a solution
link :
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/convertSmartformtoPDFformat
Reards ,
Sachhi -
Can't send video or pictures through email
since 2-25-14 i can't send any videos through my email account... it keeps bringing up that the file MAY be to large and puts it in my outbox and i cannot delete from there either. the file is 141 MB and maybe about a minute long....i have sent video
from this before but it won't do it now. i have did a system restore using a previous point to no avail. and i have tried sending through a hotmail acct with the same result...it keeps telling me i need to contact my Internet provider but just out of
curiosity i sent a generic email to a friend and that went through no problem...any ideas???Hi,
In addition,please let us know your network environment.
As S.Sengupta said,you can upload your larger file to OneDrive,and then share the link and send the link to your friend.
Regards,
Kelvin Xu
TechNet Community Support -
Sending SAP Standard message through EMAIL
Hi All,
Is there any way to send the EMAIL to one dedicated person when SAP standard message get POP-UP.
I want to use this functionality in TCODE-SNRO object and want to shot email when no. range has reached on specified threshold limit.
Regards
Jalaj gargTry to create workflow ftemplate rom Tcode SWUY for workflow triggered from message.
Thanks
Arghadip -
How do I send a garageaband project through email?
I want to send my project to my iphone but I dont know how to send it.
Most projects are small enough to send by e-mail BUT you MUST highlight the file then, in the finder, File>Compress <myproject.fcp>
Failure to do that usually strips needed info from the file and it won't work on the other end. If it's bigger, put it up on the web somewhere in the same zipped condition.
Maybe you are looking for
-
Camera Raw Update funktioniert nicht
Nach jedem Update erhalte ich die Meldung: Photoshop Camera Raw 6.7-Update Installation fehlgeschlagen Fehlercode: U44M1P7 Ich nutze Photoshop Elements 12
-
plz help my nokia c5 00 dead after updating by NSU
-
Select single column but multiple rows in JTable
Hi I have a jTable and want to be able to select multiple rows but only in a single column. I've set these properties which makes selection almost the way I would like it. table1.setCellSelectionEnabled(true); table1.setSelectionMode(ListSelectionMod
-
[svn] 3706: Bug: N/A
Revision: 3706 Author: [email protected] Date: 2008-10-17 09:41:16 -0700 (Fri, 17 Oct 2008) Log Message: Bug: N/A QA: No Doc: No Details: Make AMFConnection use legacyCollection=true by default. This ensures that collections as serialized as Arrays r
-
A una macbook de15" se le puede cambiar la tarjeta lógica por una de una de 13"?
Mi macbook pron15" la compré en el 2012 y hace unos meses "se arruinó" la tarjeta lógica, compré una Macbook 13" del mismo año usada, preferiría usar la de 15", se puede poner la tarjeta lógica de la de 13" a la de 15"?