Email in SAPSCRIPT
Hi everybody,
IS healthcare intensively uses SAPSCRIPT as output variant for PMD ("Parametrierte Medizinische Dokumente"). When viewing the document, its output is processed by SAPSCRIPT and displayed as PDF. Now we want to embed an Email-Link into the PDF for further processing (mailto://someone AT somecompany.de). The only (and very restricted) possibility is to define a SUB-DOCUMENT (TA SE61, CLASS CHAP, NAMED: ) and insert the following:
* someone[AT]somecompany.de?subject=
Then, in the SAPSCRIPT this SUBDOC is included by the statement
/: INCLUDE <MYSUBDOC> OBJECT DSYS ID CHAP LANGUAGE DE
= &SUBJECT&<><><><></><><><><></>
This leads to a link like someone AT somecompany.de?subject=&SUBJECT& in the PDF.
It works, but as you can imagine it is awful. OK, whole SAPSCRIPT is awful, but has anyone any suggestion how to make it better? Any Ideas?
Best regards,
Torsten
Edited by: Torsten Schröer on Dec 9, 2009 6:12 PM
<MOVED BY MODERATOR TO THE CORRECT FORUM>
Edited by: Alvaro Tejada Galindo on Dec 9, 2009 1:29 PM
Hi Neeraj_C ,
I have also a same requirement . i don't know much about Script.Can you please send me the procedure how do u achieve this scenario . If u give the sample code of this scenario it will be very helpful for me.
Thanks & Regards,
Kumaran Duraiswamy.
Similar Messages
-
Email of SAPSCRIPT Print Output
Hi,
Can anyone please tell me steps to send an External Email from SAPSCRIPT.
let me elaborate more on this.I have a "Z" print program for printing RFQ's.Now we need to send this output thru Email as well to vendors.
Thanks in advance,Hi,
You do not need to bother with the OTF stuff - you can ditch it.
Use the code below to achieve the e-mailing :
*--- Set the recipient e-mail address
LW_COMM_VALUES-ADSMTP-SMTP_ADDR = [email protected]
*--- Set title
LW_SNAST-TDCOVTITLE = SY-TITLE
*--- Set sender and recipient details
CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
EXPORTING
PI_COMM_TYPE = 'INT'
PI_COMM_VALUES = LW_COMM_VALUES
PI_REPID = SY-REPID
PI_SNAST = LW_SNAST
PI_MAIL_SENDER = SY-UNAME
IMPORTING
PE_ITCPO = GW_ITCPO
PE_MAIL_RECIPIENT = LW_RECIPIENT
PE_MAIL_SENDER = LW_SENDER
EXCEPTIONS
COMM_TYPE_NOT_SUPPORTED = 1
RECIPIENT_CREATION_FAILED = 2
SENDER_CREATION_FAILED = 3
OTHERS = 4.
The objects used here are defined as follows :
LW_COMM_VALUES TYPE SZADR_COMM_VALUES
LW_SENDER TYPE SWOTOBJID
LW_RECIPIENT TYPE SWOTOBJID
LW_SNAST TYPE SNAST
This will give you the recipient and sender details. Now all you need to do is call the function OPEN_FORM as follows:
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'MAIL' <--- Note: Device is PRINTER for printing
DIALOG = SPACE
FORM = SAPscript form name
LANGUAGE = SY-LANGU
OPTIONS = GW_ITCPO
MAIL_SENDER = LW_SENDER
MAIL_RECIPIENT = LW_RECIPIENT
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
CODEPAGE = 11
OTHERS = 12.
This is far easier to use this method.
Any questions, please let me know.
Kind regards
Colin -
Hi experts,
I need to send the PO sapscript through email to a group of people.
I found FM SO_NEW_DOCUMENT_ATT_SEND_API1 but I do not know how to populate it to indicate the specific PO number to send.
All help is appreciated.
Monica.Hi,
Check the following to get clear idea abt functions,
OPEN_FORM
The function module OPEN_FORM opens form printing. You must call this function module before you can use any other form function (WRITE_FORM, START_FORM, CONTROL_FORM...).
You need not specify a form name. If you omit the name, you must use the function module START_FORM to open a form before starting the output.
You must end form printing by using the function module CLOSE_FORM. Otherwise, the system does not print or display anything.
Within a program, you can use several OPEN_FORM.. CLOSE_FORM pairs. This allows you to write output to several different spool requests from within one program.
CLOSE_FORM
The function module closes the form opened using OPEN_FORM. The system executes any terminating processing steps for the last opened form.
You must use this function module to close form printing. Otherwise, no output appears on printer or screen.
START_FORM
In-between the function modules OPEN_FORM and CLOSE_FORM, you can use different forms. This allows you to combine several different forms into one print output. However, you can combine only those forms that have the same page format.
To switch forms, use the function module START_FORM. If another form is still open, you must close it first using END_FORM.
If you specify no form name when calling START_FORM, the system restarts the last open form. If after OPEN_FORM no form was activated yet, the system leaves the function module with the exception UNUSED.
WRITE_FORM
The system outputs the form element specified in parameter ELEMENT into the currently opened form.
In the parameter WINDOW you can specify the name of a window for the output. Remember that the form element must be defined in this window. The parameter FUNCTION specifies how to merge the text lines to be output with any existing contents in the window. In this case, there are differences between the different window types or areas.
WRITE_FORM_LINES
The function module outputs the text lines in table LINES into the specified form window. The text lines must have the SAPscript ITF format. From the data in the text header, the system uses only the field TDSTYLE to apply the formatting attributes defined in the specified style for this text. If the field is empty, the system uses the identically named formatting attributes (character and paragraph formats) of the form.
Use parameter WINDOW to specify into which of the windows defined in the form you want to output the text. You can specify any window used in the form. The parameter FUNCTION determines how to merge the text lines to be output with any existing contents in the window. There are differences between the different window types or areas.
END_FORM
END_FORM ends the currently open form and executes the required termination processing. After calling this function module, no more form is active. For further output, you must start a new form using START_FORM.
CONTROL_FORM
Use CONTROL_FORM to pass SAPscript control statements to the form.
READ_FORM_ELEMENTS
The function module fills a table with all text elements that appear in one form.
If you specify no form name, the system includes all elements of the currently open form. If you specify a form, the system uses the information about the active version of the form, retrieved from the database.
READ_FORM_LINES
Use this function module to transfer the lines of a form element into an internal table.
If you specify no form name, the system transfers the text lines of the currently open form. If you specify a form, the system uses the text lines of the active version of the form from the database.
http://help.sap.com/saphelp_40b/helpdata/en/d6/0dc169494511d182b70000e829fbfe/frameset.htm
<b>Reward if helpful.</b> -
Hi All,
Is it possible to send a Sapscript form or a smartform form as an email,
We need to be able to email out the form using a function Module.
Even if we are able to send it as an attachment , it should be fine,
Did not find any function Module that would do this.
Appreciate any input.,
Thank you
Lalithait is possible in both smartforms and scrits
For Scripts
Retrieve the OTF table from the FM CLOSE_FORM then , convert OTF to PDF using FM 'SX_OBJECT_CONVERT_OTF_PDF' then I attach and send mail with 'SO_NEW_DOCUMENT_ATT_SEND_API1'.
For smartform check this link
Create Smartform and Email it -
Sending Email thorugh SAPSCRIPT
Hi,
we are able to send an email using a sapscript, inthe function OPEN_FORM we are passing the fields ITPCO, MAIL SENDER and MAIL RECIPENT. But now we want one line in the body also. Cann any tell us the fields we should pass for this data????Hi,
Check the code it may help u.
REPORT Z_SCRIPT .
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.
PERFORM get_otf_code.
LOOP AT solisti1.
MOVE-CORRESPONDING solisti1 TO mailbin.
APPEND mailbin.
ENDLOOP.
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.
CLEAR itcpo.
itcpo-tdgetotf = 'X'.
Start writing OTF code
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'Z08V3_COLLI'
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
TABLES
otfdata = otf
EXCEPTIONS
OTHERS = 1.
Move OTF code to structure SOLI form email
CLEAR solisti1. REFRESH solisti1.
LOOP AT otf.
solisti1-line = otf.
APPEND solisti1.
ENDLOOP.
ENDFORM.
Check out these threads ..
Re: send sap script via email or printer.
Email SapScript : Question on READ_OTF_FROM_MEMORY
Regards, -
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
Fabrizioi 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 -
Change "SAPScript" email subject/body for External Send(5) for output type?
Hello,
I'm emailing a SAPscript form (converted to PDF) generated via Transmission Medium 5 (External send) for output type (EK00) and need to change email's subject and body of email created by SAP code. Any suggestions on how to change email's subject and body?
Thanks,
BillyAlso if u want to add a body to the mail. See the below form (sub routine) which needs to be mentioned in NACE. Either u can keep this routine in the driver program or u can put in separate report program. All thing u need to is see the below code and mention the name of the program and form name in nace. Double click on output type in nace. u will find a tab stripped screen in right. In the screen u can see the first tab as 'General data' and at the bottom a block with title 'Replacement of text symbols' can be seen. There u need to pass this program name and form name.
Execute ur program and test the result.
FORM text_symbol_replace TABLES pt_lines STRUCTURE tline
USING ps_thead STRUCTURE thead
ps_nast STRUCTURE nast.
DATA:
lv_kunnr LIKE vbak-kunnr, " AN0465 Add AKKUMA1 02/19/07
lv_new_cursor_column LIKE sy-tabix," Cursor column
lv_new_cursor_line LIKE sy-tabix," Cursor row
lv_changed, " Indicator
lv_matnr LIKE vbap-matnr,
lv_vkorg LIKE vbak-vkorg,
lv_vtweg LIKE vbak-vtweg,
lv_desc(20),
lv_name TYPE thead-tdname, " Name
lt_lines LIKE tline OCCURS 0 WITH HEADER LINE,
lv_currentprogram LIKE sy-repid. " Program Name
DATA :
ps_lines LIKE tline. " Structure
CONSTANTS:
lc_int TYPE nast-nacha VALUE '5', " External Send
lc_comma TYPE c VALUE ','. " Comma Separater
DATA: BEGIN OF ls_fname,
dsnam TYPE nast-dsnam, " Spool Name
dsuf1 TYPE nast-dsuf1, " Spool Suffix1
dsuf2 TYPE nast-dsuf2, " Spool Suffix 2
END OF ls_fname.
FIELD-SYMBOLS: <lfs_nast> TYPE vnast.
IF ps_nast-kschl EQ gc_zj17.
Fetching vbak-kunnr.
SELECT SINGLE kunnr " Customer
vkorg
vtweg
INTO (lv_kunnr,lv_vkorg,
lv_vtweg)
FROM vbak
WHERE vbeln EQ ps_nast-objky.
IF sy-subrc EQ 0.
SELECT SINGLE matnr INTO lv_matnr
FROM vbap
WHERE vbeln EQ ps_nast-objky.
ELSE.
IMPORT xvbak-kunnr TO lv_kunnr FROM MEMORY ID 'YSOLDTO'.
IMPORT xvbak-vkorg TO lv_vkorg FROM MEMORY ID 'YSALESORG'.
IMPORT xvbak-vtweg TO lv_vtweg FROM MEMORY ID 'YDISTCH'.
IMPORT xvbap-matnr TO lv_matnr FROM MEMORY ID 'YMATERIAL'.
ENDIF.
IF sy-subrc EQ 0.
CONCATENATE lv_matnr lv_vkorg lv_vtweg
INTO lv_name.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = '0001'
language = ps_nast-spras
name = lv_name
object = 'MVKE'
TABLES
lines = lt_lines
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc = 0.
CLEAR lv_desc.
LOOP AT lt_lines.
CONCATENATE lv_desc lt_lines-tdline
INTO lv_desc
SEPARATED BY space.
ENDLOOP. " LOOP AT lt_desc
CONDENSE lv_desc.
ENDIF.
ENDIF. " AN0465 Add AKKUMA1 02/26/07
Fetch Region.
SELECT SINGLE name1 ort01 " City
INTO (gv_name1, gv_ort01)
FROM kna1
WHERE kunnr EQ lv_kunnr.
IF sy-subrc EQ 0.
CONDENSE gv_ort01.
CONCATENATE ':OC:'
gv_name1
gv_ort01
lv_desc
INTO ps_lines-tdline SEPARATED BY space.
LOOP AT pt_lines.
pt_lines-tdline = ps_lines-tdline.
MODIFY pt_lines.
CLEAR pt_lines.
ENDLOOP.
ENDIF. " IF ps_nast-kschl EQ gc_z..
ENDIF. " AN0465 Add AKKUMA1 02/19/07
IF NO TEXT IS PROVIDED READ TEXT USING HEADER INFO
IF pt_lines[] IS INITIAL AND NOT ps_thead IS INITIAL.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = ps_thead-tdid
language = ps_thead-tdspras
name = ps_thead-tdname
object = ps_thead-tdobject
TABLES
lines = pt_lines
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
ENDIF. " IF sy-subrc NE 0.
ENDIF. " IF pt_lines[] IS INITIAL
REPLACE VARIABLES USING DATA FROM PROGRAM YVADOR01
IF NOT pt_lines[] IS INITIAL.
lv_currentprogram = 'SAPMV45A'.
CALL FUNCTION 'TEXT_SYMBOL_REPLACE'
EXPORTING
endline = sy-tabix
header = ps_thead
program = lv_currentprogram
IMPORTING
changed = lv_changed
TABLES
lines = pt_lines.
Subrc Check not required.
CALL FUNCTION 'FORMAT_TEXTLINES'
IMPORTING
new_cursor_column = lv_new_cursor_column
new_cursor_line = lv_new_cursor_line
TABLES
lines = pt_lines
EXCEPTIONS
OTHERS = 2.
IF sy-subrc NE 0.
EXIT.
ENDIF. " IF sy-subrc NE 0.
ENDIF. " IF NOT pt_lines[] IS INITIAL
SPLIT ORDER NUMBER AND PUT THEM INTO SPOOL REQUEST NAME & SUFFIX FIELD
SAP USES THESE FIELDS TO CONSTRUCT FILENAME
FOR THE PDF ATTACHMENT IN EMAIL
IF ps_nast-nacha EQ lc_int OR ps_nast-nacha = '2'.
IF ps_nast-dsnam IS INITIAL AND ps_nast-dsuf1 IS INITIAL.
ls_fname = ps_lines-tdline.
ps_nast-dsnam = ls_fname-dsnam.
ps_nast-dsuf1 = ls_fname-dsuf1.
ps_nast-dsuf2 = ls_fname-dsuf2.
ENDIF. " IF ps_nast-dsnam IS INITIAL...
ENDIF. " IF ps_nast-nacha EQ lc_int
ENDFORM. " TEXT_SYMBOL_REPLACE
Venkat. -
Extra emails using SO_NEW_DOCUMENT_ATT_SEND_API1.
Hello,
I have a requirement to send Purchase order email to a group of people besides the vendor.
I set the configuration to send the first email to the vendor and it is working fine.
I would like to use SO_NEW_DOCUMENT_ATT_SEND_API1 to send the SAME EMAIL to a group of persons but I am not sure where to read the information of the already generated email to populate the FM.
I saw some code in the forum to read the form and send it with SO_NEW_DOCUMENT_ATT_SEND_API1, but I could not find where you enter the Purchase Order number to generate the form in base of it.
Could anybody help me to understand how to populate SO_NEW_DOCUMENT_ATT_SEND_API1 with the information of the already generated email?
Thank you.
Monica.Hi Chandra,
Thank you for your answer.
I did a little more research and realized that the email sent is not stored. This takes me to the option of emailing a SAPscript form with my PO.
I found some code in the forum to email a SAPscript but I do see where you enter the PO number or the reference to it.
Do you know?
Monica. -
Need send the sapscript in HTML format.
Hi,
I need to email the SAPScript form in HTML format to external user i mean customer.
Please help me how to send SAP data in email as HTML data with or with out script is very helpful to me .
Regards,
NaiduHi,
I need to email the SAPScript form in HTML format to external user i mean customer.
Please help me how to send SAP data in email as HTML data with or with out script is very helpful to me .
Regards,
Naidu -
I'm using the transaction ME9F to send an order by email (A sapscript in PDF).
I would like to know how to enter a subject, a body and a filename to pdf.
I have heard about using the transaction MN05 to edit the Output Type I could edit the subject, but I don't know how to change the other.
Thanks.I'm using the transaction ME9F to send an order by email (A sapscript in PDF).
I would like to know how to enter a subject, a body and a filename to pdf.
I have heard about using the transaction MN05 to edit the Output Type I could edit the subject, but I don't know how to change the other.
Thanks. -
Sapscript translated in non-english language - Garbled output as Email
Hi Experts,
I've translated a SAPscript to Chinese and Thai language.
As per my requirement, the output can either be printed, emailed or faxed.
I'm using the standard include RVADOPFO for Open form.
For the english version, I'm able to recieve the properly formatted e-mail output.
However in case of thai and chinese, the Thai and Chinese characters do not appear. Most of them are substituted with blank spaces and some are substituted with boxes and unknown characters. However, the numbers and english characters appear.
Please help in getting the correct output.
Thanks!
Nitya.Hi,
SAP 141343. PDF Conversion: Latin-2.
SAP 141901. Customer-specific fonts for PDF conversion.
SAP 163266. PDF conversion: character set for softfonts.
SAP 171698. SAPconnect: Formats, conversion, device type.
SAP 317851. Creating PDF format via spooler in 4.6C/4.6B/4.5B.
SAP 322998. PDF conversion: Cyrillic support.
SAP 323736. Restrictions with "PDF print" through spooler.
SAP 398357. PDF converter: Width of letters is incorrect.
SAP 414325. SAPconnect: Conversion of ALI to PDF.
SAP 504952. Composite note spool and print.
Find these notes, there You'll find some answers.
Regards,
Nisrin. -
Error in SAPscript pdf email attachment
Hi All,
I have implemented the functionality in ABAP where I can send SAPscript output to user via pdf-email in its inbox.The functionality is working fine in Dev n Test system with no issues.As the form is moved into Prod system, the user is complaining that after opening the mail of pdf, a mail is sent to unknown, unexisting email id indicating that user opened the mail.As the email id is unexisting, the user receives back the mail of Delivery failure.
Please help in this.Rest is working fine.Hi Neeraj_C ,
I have also a same requirement . i don't know much about Script.Can you please send me the procedure how do u achieve this scenario . If u give the sample code of this scenario it will be very helpful for me.
Thanks & Regards,
Kumaran Duraiswamy. -
How can I send a sapscript by an email?
Hi All,
A sapscript need to be send by email.
That sapscript is called in a report and from that email is to be send.
Moreover there is no spool ID generated for the sap script.
Please reply.
Regards.Hi,
There is a sample program for this, please chk this
BCS_EXAMPLE_6
Please follow the following link as well
sending a script in mail (outside SAP)
Go through the following Wiki for smartform
https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/smartform%252bas%252ba%252bpdf%252bto%252bmail%252bid
Regards,
Manish -
Dear Friends,
1. There is a standard program (for Form 16 India)
which has a normal selection screen
and outputs a sapscript report.
2. The requirement is to EMAIL the report
to each individual employees.
(Thru a Y Program)
3. I had investigated & done ::
we can email a report which outputs in
LIST FORMAT
But
How To EMail a report which is output in SAPSCRIPT !
Regards,
Amit MThanks for the reply friends.
But i could not find the exact solution
to my problem.
1. The report is a standard se38 report
whose output is in sapscript format.
2. I don't have any control over its code
of 'OPEN_FORM', 'CLOSE_FORM'. (Since
it is a standard sap report)
3. A new Z Program is required to be developed
which LOOPS and mails the sapscript report mentioned in point (1),
one by one to each individual employees email address.
Regards,
Amit M. -
Attach sapscript for email message in sales order
Hello to all.
I need some help..
I'm trying to include a sapscript form in a message on sales order in VA01. I can already send email to outside SAP, but can't include de sapscript form into the mail.
I make a copy of the standard message MAIL, and include de sapscript form that i want to attach.
Anybody have an idea how to solve this issue?
best regards,
Susana MarquesHi
I think u need to create a message type MAIL just as u done, but u should check if this kind of message is managed by your driven program.
Check the call of FM OPEN_FORM, here the parameter DEVICE has to have the value MAIL, perhaps here it's always transfered PRINT.
The second control is on master data of the partner of the message: he has to have the mail address.
The last control is on the master data of the user: he has to have the mail address.
Max
Maybe you are looking for
-
I am trying to copy photos from an iPad to a Mac Air, but iPhoto does not recognize them. Please forgive the ignorance, but we have just started moving to apple products and I know nothing about them. Do you have to use PhotoStream to do this?
-
After 3.0.1 update, edge no longer works
I upgraded to the 3.0.1 update and ever since, I no longer can use the 2G (EDGE) data network. 3G is certainly faster, but drains the battery in hours. Is this an "undocumented feature"? Am I doing something else that's disabled the EDGE data connect
-
I am currently using this script I found elsewhere on Adobe forums. However, doing this function only will stack everything with the raw files on top. I am using a 5D MKIII now and Bridge CS4 can't generate the CR2 previews, so I need JPEGs to see wh
-
Can we keep Decision workitem in two users SAP inbox after canel action ?
I have a requirement like " Decision workitem is going to two SAP Users Inbox , when one user opens the work item and choose the cancel and keep workitem in inbox in that case also its disappering in other user's SAP Inbox" is there any way to keep
-
Mrtg no longer updates, perl errors
When running mrtg, I'm getting this output: # LANG=C mrtg /home/mrtg/cfg/mrtg.cfg Constant subroutine SNMP_Session::AF_INET6 redefined at /usr/share/perl5/core_perl/Exporter.pm line 67. at /usr/bin/../lib/mrtg2/SNMP_Session.pm line 149 Prototype mism