How Sapscript form can be send by mail
Hello all,
I want to send a Sapscript form by mail.
I think it should first be converted to PDF form and than need to be send by mail.
I have created a z form which is a copy of standard for medruck and also have changed the standard program SAPFM06P. So I need to add functionality in z program so that i can send the sapscript form by mail.
Can any body let me know the complete process how can i do it?
Thanks
Hi,
Just follow the below code . I am giving the code which starts from OPEN_FORM. After that one submit program is there u can see the code.
*& Form display_layout
text
--> p1 text
<-- p2 text
FORM display_layout.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
device = 'PRINTER'
DIALOG = 'X'
form = 'YFIL_DUNN_01'
LANGUAGE = SY-LANGU
options = itcpo
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
EXCEPTIONS
canceled = 1
device = 2
form = 3
options = 4
unclosed = 5
mail_options = 6
archive_error = 7
invalid_fax_number = 8
more_params_needed_in_batch = 9
spool_error = 10
OTHERS = 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.
LOOP AT i_tab INTO wa_tab.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = '531'
FUNCTION = 'SET'
TYPE = 'BODY'
window = 'MAIN'
IMPORTING
pending_lines = wa_tab.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
result = itcpp
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
OTHERS = 5.
IF sy-subrc = 0.
IF ( itcpp-userexit IS INITIAL AND
NOT itcpp-tdspoolid IS INITIAL ).
p_spool = itcpp-tdspoolid.
SUBMIT yfir_mailsend_pdf_attachment WITH p_spool = p_spool
WITH p_kunnr = p_kunnr.
ENDIF.
ENDIF.
ENDFORM. " display_layout
*& Form modify_duedate
text
--> p1 text
<-- p2 text
FORM modify_duedate.
SELECT SINGLE mat_rec_no
mat_rec_date FROM yfi_matno
INTO (v_mat_rec_no, v_mat_rec_date)
WHERE vbeln = wa_tab-vbeln.
CHECK sy-subrc EQ 0.
SELECT SINGLE zterm
FROM vbrk INTO v_zterm
WHERE vbeln EQ wa_tab-vbeln.
CHECK sy-subrc EQ 0.
SELECT SINGLE zdays
FROM yfi_payment INTO v_zdays
WHERE zterm EQ v_zterm.
IF sy-subrc EQ 0.
wa_tab-zfbdt_due = ( v_mat_rec_date + v_zdays ).
wa_tab-due_days = ( sy-datum - wa_tab-zfbdt_due ).
IF wa_tab-due_days LE 0.
wa_tab-due_days = 'N/A'.
ENDIF.
IF ( wa_tab-umskz = 'A' AND wa_tab-shkzg = 'H' ).
wa_tab-zfbdt = ' '.
wa_tab-zfbdt_due = ''.
wa_tab-due_days = ''.
ENDIF.
MODIFY i_tab FROM wa_tab INDEX sy-tabix.
CLEAR: v_mat_rec_no, v_mat_rec_date, v_zterm, v_zdays.
ENDIF.
ENDFORM. " modify_duedate
SUBMIT PROGRAM :
REPORT yfir_mailsend_pdf_attachment MESSAGE-ID yf.
*& Program Name : *
& Author :
*& Creation Date : *
*& Program Type : *
*& SAP Release : *
*& Description : *
*& Transport No : *
*& Transaction : *
*& Send document with OTF/ALI attachment from spool to externalreci-
*& pient. OTF/ALI document is converted to PDF/HTML format duringthe
*& SAPconnect send process.
*& This report serves as example documentation for the function
*& modules SO_NEW_DOCUMENT_ATT_SEND_API1 and SO_DOCUMENT_SEND_API1.
*& Following this example you should be able to develop your own
*& report to send documents with all kinds of attachments.
Creation of the entry for the compressed document
*& TABLES:
TABLES : kna1,
adr6.
*& INTERNAL TABLES:
***********PDF Declaration*******
DATA: BEGIN OF i_spool OCCURS 0,
rqident LIKE tsp01-rqident,
rqo1name LIKE tsp01-rqo1name,
rqclient LIKE tsp01-rqclient,
END OF i_spool.
*& VARIABLES :
DATA: client LIKE tst01-dclient,
name LIKE tst01-dname,
objtype LIKE rststype-type,
type LIKE rststype-type.
DATA: spoolno LIKE tsp01-rqident,
download TYPE c VALUE 'X', "AS CHECKBOX DEFAULT 'X',
p_file LIKE rlgrap-filename
VALUE 'C:\Invoice.pdf', "#EC NOTEXT
otf LIKE itcoo OCCURS 100 WITH HEADER LINE,
cancel,
pdf LIKE tline OCCURS 100 WITH HEADER LINE,
doctab LIKE docs OCCURS 1 WITH HEADER LINE,
numbytes TYPE i,
arc_idx LIKE toa_dara,
pdfspoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
is_otf.
Data Declaration
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.
*objpack-head_start = 1.
*objbin = ' | '. APPEND objbin.
*DATA: listobject LIKE abaplist OCCURS 1 WITH HEADER LINE.
DATA: tab_lines TYPE i,
doc_size TYPE i,
att_type LIKE soodk-objtp.
objpack-head_start = 1.
*& PARAMETERS:
PARAMETERS : p_spool LIKE tsp01-rqident NO-DISPLAY,
p_kunnr LIKE kna1-kunnr NO-DISPLAY.
*& M A I N P R O C E S S
*& START OF SELECTION.
START-OF-SELECTION.
SELECT SINGLE
adr6~addrnumber
adr6~smtp_addr
FROM adr6
INNER JOIN kna1
ON kna1~adrnr = adr6~addrnumber
INTO CORRESPONDING FIELDS OF adr6
WHERE kna1~kunnr = p_kunnr.
IF sy-subrc = 0.
Create receiver list
reclist-receiver = adr6-smtp_addr. "<-- customer address
reclist-rec_type = 'U'.
APPEND reclist.
ENDIF.
***Convert Spool request to PDF
PERFORM pdf_convert.
docdata-obj_name = 'MAIL_AEIW'.
docdata-obj_descr = 'Dunning'.
Main Text
objtxt = 'Hi,'.
APPEND objtxt.
objtxt = 'Dunning'.
APPEND objtxt.
objtxt = 'Regards'.
APPEND objtxt.
Write Packing List (Main)
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 = 'RAW'.
APPEND objpack.
Create Message Attachment
Write Packing List (Attachment)
att_type = 'PDF'.
DESCRIBE TABLE objbin LINES tab_lines.
READ TABLE objbin INDEX tab_lines.
*objpack-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objbin ).
objpack-doc_size = tab_lines * 255.
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = att_type.
objpack-obj_name = 'ATTACHMENT'.
objpack-obj_descr = 'Attached Document'.
APPEND objpack.
*check for not maintaining customer address
IF reclist IS INITIAL.
MESSAGE e000 WITH 'Please Maintain Customer e-Mail ID'.
LEAVE LIST-PROCESSING.
ELSE.
Send Message
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.
ELSE.
WRITE 'Mail sent successfully'.
ENDIF.
ENDIF.
WRITE: / 'End of Program'.
*& Form pdf_convert
text
--> p1 text
<-- p2 text
FORM pdf_convert.
DATA: date1 LIKE sy-datum,
time1 LIKE sy-uzeit,
period1 LIKE tsp01-rqcretime.
date1 = sy-datum.
time1 = sy-uzeit.
date1 = date1 - 1.
CONCATENATE date1 time1 INTO period1.
SELECT rqident
rqo1name
rqclient FROM tsp01 INTO TABLE i_spool
WHERE rqowner = sy-uname AND
rqclient = sy-mandt AND
rqident = p_spool.
IF sy-subrc <> 0.
WRITE: / 'No Spool Request created today'(003)
COLOR COL_NEGATIVE.
EXIT.
ENDIF.
SORT i_spool DESCENDING BY rqident.
READ TABLE i_spool INDEX 1.
CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = i_spool-rqclient
name = i_spool-rqo1name
part = 1
IMPORTING
CHARCO =
CREATER =
CREDATE =
DELDATE =
MAX_CREDATE =
MAX_DELDATE =
NON_UNIQ =
NOOF_PARTS =
RECTYP =
SIZE =
STOTYP =
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = i_spool-rqident
no_dialog = ' '
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
OTF_PAGECOUNT =
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11.
CASE sy-subrc.
WHEN 0.
WHEN 1.
WRITE: / 'Error On Spool Job'(002)
COLOR COL_NEGATIVE.
EXIT.
WHEN 2.
WRITE: / 'No Permission'(003)
COLOR COL_NEGATIVE.
EXIT.
WHEN 3.
WRITE: / 'Conversion Not Possible'(004)
COLOR COL_NEGATIVE.
EXIT.
WHEN OTHERS.
WRITE: / 'Incorrect Destination Device'(005)
COLOR COL_NEGATIVE.
EXIT.
ENDCASE.
CALL FUNCTION 'SX_TABLE_LINE_WIDTH_CHANGE'
EXPORTING
line_width_src = 134
line_width_dst = 255
TABLES
content_in = pdf
content_out = objbin
EXCEPTIONS
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 3
OTHERS = 4.
ENDFORM. " pdf_convert
Similar Messages
-
I can only send e-mails from home wi-fi, how do I resolve?
I can only send e-mails from my home wi-fi, when using other wi-fi's the message "The sender address was rejected by the server"
What is the problem and how do I resolve?
AndyHow many other networks have your tried? It appears that the network(s) other than the yours is blocking the ports used for sending mail.
Many businesses block sending mail. -
HT1277 can receive bat can't send yahoo mail massage could not connect to smtp what to do?
can receive but can't send yahoo mail,coffline) what to do?
please help,
thanks
RoeeSee OS X Mail: Troubleshooting sending and receiving email messages for details. on troubleshooting mail.
Your SMTP server settings are incorrect. Mail has two connections, a receive path from your mail server to your mail client, and a send path from your mail client to the mail server. The send path uses SMTP to communicate with the server.
Apple Mail.app has separate settings for the receive and send paths; each has its own server, username, password, port and SSL settings. Your send path settings are likely incorrect.
To determine the proper settings, check with Yahoo for the SMTP server settings for your account (usually a web search, but I don't know the details of how Yahoo sets up their accounts by default nor whether that varies by account), and verify that your settings match — the send-path settings are available via the accounts settings; Mail > Preferences > Accounts > select the account > Account Information > and switch the Select SMTP Server setting to Edit SMTP Server List... > select your Yahoo SMTP server, and set the account details per Yahoo requirements. -
Outgoing SMTP server says "offline" can't send e-mails
Set up new iCloud e-mail. Incoming mail works. Outgoing SMTP server says "offline." Can't send e-mails from this account. Need info on how to set it up. Thanks.
MYou might want to try signing out of your iCloud account, then back in. Go to System Preferences>iCloud, click Sign Out, choose Delete at all of the prompts, restart your Mac, then sign back in.
This deletes the account and your iCloud data from your Mac, but not from iCloud. It will reappear on your Mac when you sign back in, after a brief delay as it redownloads. -
Can't send e-mail w/new POP settings...
Hi, all,
I updated my POP & SMTP settings as demanded by Verizon and I now can't send e-mail from one of my subaccounts. I get the error message:
An error occurred while sending mail. The mail server responded: 5.7.1 Authentication is required to send mail as <r******[email protected]>. Please verify that your email address is correct in your Mail preferences and try again.
I don't use that e-mail address, which I guess is the "technical" address I got when I signed up. The address I'm trying to use is s******[email protected], and that's the e-mail address that is set up in the account on my e-mail program (Thunderbird). I never use the address the error message is referencing.
Any suggestions on how I can fix this most annoying problem?
Thanks!Without seeing your settings, it's going to be somewhat difficult to guess the problem. I would take another look at your SMTP (outgoing) settings, and verify that the server is set to authenticate with the correct username and password.
If a forum member gives an answer you like, give them the Kudos they deserve. If a member gives you the answer to your question, mark the answer as Accepted Solution so others can see the solution to the problem.
"All knowledge is worth having." -
[iPad Mini 1st Gen.] Can't send E-Mails with the normal "Mail" App
Hi,
I can't send E-Mails with the normal E-Mail App, it works only with another Mail App, but then I can't send pictures. Maybe my new router is the cause, but it works with my iPhone 5, only with my iPad mini it doesn't work.Well, how I can solve the problem?
Sorry for my bad English.
Many Greetings from Germany.Hi,
i can't change the iCloud SMTP Server settings for outgoing E-Mails.It isn't possible to make these "How to" (or how i can call it?) and the moves before i have already done and the issue haven't solved. I think my iPad mini is to old....
Many greetings,
xbdsmallwork
Edit: I have a iCloud Mail Account. -
How many emails can i send in one day with icloud
how many emails can i send out in a day using icloud.com? I want to send about 800 emails to all the parents at my children's school. I am using pho and swiftmailer to send the emails.
thanks.Up to 200 messages and 1000 recipients (see http://support.apple.com/kb/ht4863). This is because it's designed for personal rather than business use.
-
I have quickbooks software. I am traveling. I tried to send an invoice out, using the mac email (version 5.3) I can't send the mail out. I get a pop up asking for my password, I put the password in and it does not accept it. This is the 1st time I've had this problem.
slpmtnsWhilst it may not be your fault I am afraid it appears that your post is on a forum which is not the best for your OS. It will save the time of the unpaid volunteers here, and may resolve your issue faster, if you could examine the list below and see if there is a more appropriate forum to which you could direct your question.
OS X 10.9 Mavericks
OS X 10.8 Mountain Lion
OS X 10.7 Lion
OS X 10.6 Snow Leopard
OS X 10.5 Leopard
OS X 10.4 Tiger
OS X 10.3 and earlier
OS 9, OS 8 & System 7
OS X Technologies
OS X Server
iPad
iPhone
iPod
Other -
Can not send e-mail in mac os x 10.4.11
can not send e-mail in mac os x 10.4.11
non sequitur wrote:
I'm not sure I know what you mean by 'what settings are you using in the accounts part of mail preferences', but I'll give you as much information as I can in the hopes that some of it is responsive.
In "preferences" I select "accounts" and there are 3 listed:
'personal gmail' (IMAP)
'business gmail' (IMAP)
'Yahoo' (POP)
For each of the above, the "Account Information" tab gives:
description: [username]
email address: [correctly reflects my address]
full name: [my name]
Incoming mail server: imap.gmail.com
user name: [my username]
password: [*** - I've re-entered to ensure it is my true password]
outgoing mail server (SMTP): smtp.gmail.com:username
Is it all in the same format on the iphone?
This is the same information for the 2 gmail accounts, with the exception of the usernames differing. If I click "server settings" at the bottom, it reflects the outgoing mail server "smtp.gmail.com" server port 25, my correct user name and password.
Again, different names for the different accounts, right? And this is the same port etc. as you put into the iphone
All of the above information matches what I input into my iPhone, and it has worked fine since day 1, so I don't understand the malfunction.
Open /Applications/Utilities/Console. Make sure console.log and system.log are open (or see the File menu).
Try to send an email.
Look for new lines in the log files (it should scroll down automatically so the newest lines are at the end of the log at the bottom of the window). What do you see? (Erase or substitute for any personal info before posting.)
Do you use any firewall software or have you used third-party software or Terminal to configure the builtin firewall?
- cfr -
Can not send be-mail os10.9.4 server offline !!
can not send be-mail os10.9.4 server offline !!
Hey there mikeneiris,
It sounds like you are not able to send any emails because the account is showing as offline. I recommend these steps from the following article to help you get that going again:
Mail (Mavericks): If a mailbox is offline
http://support.apple.com/kb/PH14925?viewlocale=en_US
To take an account online, click the lightning bolt icon. Or choose Mailbox > Online Status > Take [account name] Online, or Mailbox > Take All Accounts Online.
If you can’t take an account online, make sure you’re connected to the Internet. If a warning icon appears after the account name, click it for more information.
Use Connection Doctor
Some mailbox names can appear dimmed if you don’t have permission to access them, such as “public” mailboxes on a server, or if the mail server is unavailable.
Thank you for using Apple Support Communities.
All the best,
Sterling -
Sql Express Edition R2 can we send alert mail
Hi There,
We are using SQL 2008 Express edition R2. Can we send alert mail using sql services in SQL 2008 Express edition R2Hello,
Database Mail is not supported in the Express Edition; see
Features Supported by the Editions of SQL Server 2012
Olaf Helper
[ Blog] [ Xing] [ MVP] -
How come I can't send Numbers via email?
how come I can't send Numbers via email?
Are you trying to send by Gmail? Gmail will not accept Numbers 3 documents as attachments. There is some incompatibility in the format.
Have you considered sharing a link via iCloud?
The recipient can either view online in a browser or download the document via the Tools menu:
SG -
Can I send a mail attachment that will automatically open
Hello,
Can I send a mail attachment that will automatically open when the recipient opens the message. Sometimes when I get attachments they are already open and sometimes I have to open them. Why is this?
Thanks
Bobejoe
PowerBook GS4 15" Mac OS X (10.4.3) Compaq PCHello Bobejoe.
Can I send a mail attachment that will automatically open
when the recipient opens the message.
No, fortunately.
Sometimes when I get attachments they are already open
This doesn’t make sense. What do you mean?
Why is this?
It isn’t. -
I can't send e mails from my me account
I can't send e mails from my me account
can you recieve them?
are your email accounts smtp settings set acording to the mail providers requirements? -
All of a sudden, I can't send e-mails on my I-phone. I can receive e-mails. My I-pad works fine for e-mails (receiving and sending) and so does my Outlook. What's the deal?
check the settings in your mail settings, outgoing server. If your ipad is ok, compare the settings with the ones on the phone
Maybe you are looking for
-
I have upgraded to 10.6.8 and have purchased Mountain Lion 10.8.2 but it will not let me install until I have 10.8.0 and I cannot find the download or a way to get it anywhere. What do I do to upgrade? Thanks for the help!
-
Is it possible to transfer a catalog from PSE4 to PSE11?
I am having difficulties in transferring my catalog from PSE4, on my old PC, to PSE11 on my new one. The main problem relates to the position of captions in images in full screen mode. In an online chat yesterday with an Adobe Technical Support guy,
-
This crossgrade is RIDICULOUS!!
Apple said that they would make this Intel transition as painless as possible. Well this crossgrade nonsense completely contradicts that! I can order an upgrade from FCP 1,2,3 online or in a store, but I can't purchase an upgrade from 4 or 5 to the U
-
How to use serial instruments as a displayer or indicator
Is there any way that I can display reading from serial ports evevy other 30 seconds? Just like I get reading from DAQ board. Now I am using serial.vi, but each time I have to send command to get the updated reading. Is there any way this can be done
-
My CS6 Photoshop launches Adobe Application Manager which launches Photoshop which launches App Manager etc, etc . Photoshop eventually crashes. HELP