Smartform output different
Hello,
I have some smartforms, the output is different in my two systems. In the developpement system everything is ok, when I go in the consolidation system ... the text is not align, the gray is not the same, the tabulation are sometimes different ...
I have no idea how to check if the smartforms in the two system are the both, and what could be different ..
Any help are welcome
Regards
Frédéric
PS: I have check the request order.
Hi Wojtek,
I have check the form style, but I see something strange in the table STXSADM, there is the same creation date, but not the same modification date (with the same version number).
So I ask a new request order for this form style. I'm waiting the result.
I have check the output device also, it's the same, I use local device of my Windows.
Thanks for your answer
Frédéric
Message was edited by: Frédéric Girod
Similar Messages
-
Smartforms output different in two systems
Hi Gurus,
I've a smartform in Q and Prd. Versions are same but the font and style look different in both systems. In Q, the form is in bold, but not in Prd. Is it related to printer settings? What to check in SPAD? Both systems use LOCL printer. I also noticed the device type in SPAD is different. Does it impact the font?
Regards,
Raj.Hello Raju.
1) If you have used smartstyle for font, check if it is transported to PRD. It may still be in QAS.
2) Get the smartform backup from PRD and upload it in DVT and transport to QAS.
Now check the output in QAS.
Regards. -
Need smartform output in different languages
Hi expert,
Can you please let me know how can I see the output of a smartform in different languages. I'm seeing the output of a sales order. I have three output types . ZZAC,ZZ00, ZZ01. The smarform is developed with the language attributes of Translate into all languages. Is it required to convert the forms in SE63? or there are other ways we can see it.
I need the output in all the languages like FR,EN,DE,IT,ES ,EN etc.
Thanks in Advance,
AbhiHI,
Try This... hope it will solve your problem....
To maintain the translations:
1. Go to transaction SE63 in R/3. Go to menu Translation->R/3 Enterprise->Other Long Texts.
2. Select the object type in the pop up. Smartform (SSF) object type is found under Forms and Styles(FS).
3. Enter the name of the Smart form and choose the source and target language(Let the Source Language be 'EN'). Now Click on 'EDIT'.
4. This would open a screen with the Smartform code in Source language on the top and an editor with the same code in the bottom. Find the text for which you need to maintain the translation and insert the translation in that place.
As usual after required texts are maintained Save and Activate.
To see the translated Smartform create an output type and assign the smartform and the driver program to this output type. In the transaction that sends output to this smartform, select the output type and select the language in which the smartform has to be displayed (translations have to be maintained in this language).This will give the smartform in the required language.
Regards,
Shri -
Smartform output in two different printers
Hi Experts,
I want to take the Smartform output in two different printers. printers has been added in the table <b>pkhd</b> .
please anyone suggest how to pass these two in the smartform function module?
Thanks in Advance
Kavya DevaHi Kavya,
You can execute the Smart form Function Module. It will then pop-up a dialog box asking for an output device. There you can specify the Output device type and go for Print or Print Preview as necessary.
Manoj -
Download Smartform output in word document
Hi All,
I had a requirement to download the smartform output in ".doc" format.
I had run FM CONVERT_OTF with parameter value format = 'ASCII', and downloaded using .doc format
I was able to download but the output is not having logo and some different symbols are added.
Can any suggest what would be the exact procedure to download the output in word document.
Regards,
Dinakar.Hi Dinakar,
Please check the link provided:
Help with Smartform download - unwanted items showing in file
The solution provided in this link is very relevant for your question, so hope you will get the solution.
Thanks & regards,
Sarita Singh Rathour -
Logo in Smartform output to pdf format is coming as Junk Character
Hi All,
I have a requirement to generate the Smartform output in PDF file. But when i am doing that i am getting the LOGO as Junk character in the PDF file. Can any one help me to resolve this issue?.
Thanks,
Muruganand.KYes check the spool and the output displayed correctly in the spool it means there is a problem when you convert OTF to PDF. Check that part of the code and try different options.
-
Text and table structure getting jumbled up in the smartform output
Hi all ,
While viewing the print preview of a smartform output , i am facing a strange issue.
The hardcoded text is getting jumbled up .For eg:"As soon as possible" becomes " as possible . soon as"
The structure of the table is also getting reversed.That is the table is now getting displayed with the last couloum first.The data in the table is also coming in the reverse order.
While executing the smartform directly , the layout is coming in the proper order.But while executing this through a transaction (FINT) , this issue is coming up.The print program is a standard program.
I have tried deleting the window , copying it to a new smartform etc.I have also tried in different systems to check whether if it is an issue with the system.
If anyone has faced a similar issue , please let me know how to solve it.Thanks a lot in advance.
Regards,
RashmiHi
Please check the Printout rather the print Preview. and also check the Structure/table entries also that u printing and also if u r using template, then check the assignment 1 of 1 , etc to the texts.
surya -
Sending smartform output as PDF attachment, Error opening PDF attachment
Hi Experts,
I am using the code form the following link to send a smartform output as PDF attachment. I can able to see the message, but can not open PDF document.
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/convertSmartformtoPDFformat&
The information should be on my smartform are some text, company logo and a barcode.
With all of these received error: "There was an error opening this document. The file is damaged and could not be repaired."
I tried different ways like only text, text with company logo, text with barcode. I got the following errors:
An unrecognized token 'Td0' was found
There was problem reading this document(16).
There was problem reading this document(111).
Does anyone have idea of these ? Your help is greatly appreciated.
Thank you,
Suryaplease see this code ... for sending the Email as PDF attach file,
*& Report ZSPOOLTOPDF *
*& Converts spool request into PDF document and emails it to *
*& recipicant. *
*& Execution *
*& This program must be run as a background job in-order for the write *
*& commands to create a Spool request rather than be displayed on *
*& screen *
REPORT zspooltopdf.
PARAMETER: p_email1 LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_sender LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_delspl AS CHECKBOX.
*DATA DECLARATION
DATA: gd_recsize TYPE i.
* Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
* Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: w_recsize TYPE i.
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
* Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
* Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.
CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV',
c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL'.
*START-OF-SELECTION.
START-OF-SELECTION.
* Write statement to represent report output. Spool request is created
* if write statement is executed in background. This could also be an
* ALV grid which would be converted to PDF without any extra effort
WRITE 'Hello World'.
new-page.
commit work.
new-page print off.
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
*** Alternative way could be to submit another program and store spool
*** id into memory, will be stored in sy-spono.
*submit ZSPOOLTOPDF2
* to sap-spool
* spool parameters %_print
* archive parameters %_print
* without spool dynpro
* and return.
* Get spool id from program called above
* IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
if p_delspl EQ 'X'.
PERFORM delete_spool.
endif.
IF sy-sysid = c_dev.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool',
'request to be created.'.
ENDIF.
* FORM obtain_spool_id *
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM.
* FORM get_job_details *
FORM get_job_details.
* Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM.
* FORM convert_spool_to_pdf *
FORM convert_spool_to_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
CHECK sy-subrc = 0.
* Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
* FORM process_email *
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
* perform send_email using p_email2.
ENDFORM.
* FORM send_email *
* --> p_email *
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
* Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachname'.
* CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
* If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
* Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
'Example .xls documnet attachment'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM.
* FORM delete_spool *
FORM delete_spool.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
ld_spool_nr = gd_spool_nr.
CHECK p_delspl <> c_no.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = ld_spool_nr.
ENDFORM.
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
* Send email
FORM send_file_as_email_attachment tables it_message
it_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
* Fill the document data.
w_doc_data-doc_size = 1.
* Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
* Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
* Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
* Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
* Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_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.
* Populate zerror return code
ld_error = sy-subrc.
* Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
reward points if it is usefull ....
Girish -
Smartforms output as HTML in email
Hi,
I want to send the output of a smartform as html in email body.
I found and used this bolg: :<a href="/people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp HTML Email from SAP CRM/ERP</a>
I did everything as per the blog.
However I am getting the email as:
sf @media print {.xsfnoprint{ display : none ;}}/* Default css layout information for SAP Smart Forms (XSF Output) Last modified: 12.05.2003 /@media screen { body { background-color : #EFEFEF ; }}@media screen { .page { border-style : outset ; border-width : 2pt ; background-color : white ; }}/@media print { .page { overflow: hidden; }}// unification browser-dependent settings /table { border-spacing: 0pt; empty-cells: show;}tr { vertical-align: top; }td input img img.icon / End of default.css */.SYSTEM div#B.par{ font-family : "Courier New" ; font-size : 12pt ; font-weight : normal ; line-height : 4.23mm ; text-decoration : none ; text-align : justify ; clear : both ;}.SYSTEM div#L.par{ font-family : "Courier New" ; font-size : 12pt ; font-weight : normal ; line-height : 4.23mm ; text-decoration : none ; text-align : left ; clear : both ;}.SYSTEM a.SYSTEM span#H.char{ font-weight : bold ;}.SYSTEM span#I.char{ font-style : italic ;}.SYSTEM span#U.char{ text-decoration : underline ;}#sfPAGE1-001.page@media screen {#MAIN.win{ overflow : auto ;}}@media print {#MAIN.win{ overflow : hidden ;}}#sfPAGE1-001.page #MAIN.win
Welcome
<IMG src="https://www.sdn.sap.com/sd/img/logo_header.gif" border="0" aligh="left" width="559" height="48">
I am using: Lotus notes client for email and my smartform contains only two text elements: one containing text Welcome and other containing text
<IMG src="https://www.sdn.sap.com/sd/img/logo_header.gif" border="0" aligh="left" width="559" height="48">
When I display the document using SOST, I get the output as
Address bar has this: C:\Documents and Settings\EDC LTIL02\SapWorkDir\TESTHTMLEMAILFROMSMARTFORMOUTPUT_20070928154506.046_X.MHT
and window contains:
Welcome
<IMG src="https://www.sdn.sap.com/sd/img/logo_header.gif" border="0" aligh="left" width="559" height="48"> "
Regards,
Reema
Message was edited by:
Reema Shahbazkar
In case anyone needs to have a look at my code:
REPORT ZSMARTFORM_2_HTML_EMAIL.
get generated function module for the smartform
DATA: FM_NAME TYPE RS38L_FNAM.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSF_SAMPLE_HTML'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
get smartform contetnt
set smartform output options
data:
control_parameters type SSFCTRLOP,
OUTPUT_OPTIONS TYPE SSFCOMPOP,
DOCUMENT_OUTPUT_INFO TYPE SSFCRESPD,
JOB_OUTPUT_INFO TYPE SSFCRESCL,
JOB_OUTPUT_OPTIONS TYPE SSFCRESOP,
XSFPARAM_LINE TYPE SSFXSFP,
P_HTML TYPE TRFRESULT,
P_GRAPHICS TYPE TSF_XSF_GR,
WA_RETURN TYPE BAPIRET2.
CONSTANTS: C_GR_DIR TYPE TDTEXT VALUE '/MYGRAPHICS'.
control_parameters-NO_DIALOG = 'X'.
*control_parameters-GETOTF = 'X'.
OUTPUT_OPTIONS-TDNEWID = SPACE.
OUTPUT_OPTIONS-TDIMMED = SPACE.
OUTPUT_OPTIONS-XSFCMODE = 'X'. "RUNTIME SETTINGS FROM SMARTFORM HEADER TO BE USED
OUTPUT_OPTIONS-XSF = 'X'. "XSF OUTPUT ACTIVATED
OUTPUT_OPTIONS-XSFOUTMODE = 'A'. "XSF OUTPUT STREAM PASSED DIRECTLY TO CALLING PROGRAM AS AN INTERNAL TABLE.
CLEAR: OUTPUT_OPTIONS-XSFOUTDEV. "OUTPUT SPOOL DEVICE
OUTPUT_OPTIONS-XSFFORMAT = 'X'. "ADDITIONALLLY TO XSF, HTML AND CSS LAYOUT INFORMATION IS ALSO PASSED TO CALLING PROGRAM
XSFPARAM_LINE-NAME = 'GRAPHICS'.
XSFPARAM_LINE-VALUE = 'EXTRACT'.
APPEND XSFPARAM_LINE TO OUTPUT_OPTIONS-XSFPARS.
XSFPARAM_LINE-NAME = 'GRAPHICS-DIRECTORY'.
XSFPARAM_LINE-VALUE = C_GR_DIR.
APPEND XSFPARAM_LINE TO OUTPUT_OPTIONS-XSFPARS.
XSFPARAM_LINE-NAME = 'CONTENT-ID'.
XSFPARAM_LINE-VALUE = 'ENABLE'.
APPEND XSFPARAM_LINE TO OUTPUT_OPTIONS-XSFPARS.
CALL GENERATED FUNCTION MODULE TO GET FORM CONTENTS
CALL FUNCTION FM_NAME
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = CONTROL_PARAMETERS
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = OUTPUT_OPTIONS
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO = DOCUMENT_OUTPUT_INFO
JOB_OUTPUT_INFO = JOB_OUTPUT_INFO
JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SEPARATE HTML GRAPHICAL N CSS LAYOUT CONTENT
P_HTML = JOB_OUTPUT_INFO-XMLOUTPUT-TRFRESULT.
P_GRAPHICS[] = JOB_OUTPUT_INFO-XMLOUTPUT-XSFGR[].
PROCEED TO SEND EMAIL
DATA: HTML_DATA TYPE TRFRESULT,
L_HTML_RAW LIKE LINE OF HTML_DATA-CONTENT,
HTML_XSTR TYPE XSTRING.
CLEAR: HTML_XSTR.
LOOP AT P_HTML-CONTENT INTO L_HTML_RAW.
CONCATENATE HTML_XSTR L_HTML_RAW INTO HTML_XSTR IN BYTE MODE.
ENDLOOP.
HTML_XSTR = HTML_XSTR(P_HTML-LENGTH).
SPECIAL CHARACTER CONVERSION
DATA: HTML_STR TYPE STRING,
HTML_LEN TYPE I.
CALL FUNCTION 'SCP_TRANSLATE_CHARS'
EXPORTING
INBUFF = HTML_XSTR
INBUFFLG = 0
INCODE = '4110' "utf-8
OUTBUFFLG = 0
OUTCODE = '0000'
CSUBST = 'X'
SUBSTC_HASH = ' '
SUBSTC_DOT = ' '
SUBSTC_SPACE = 'x'
SUBSTC = '00035'
IMPORTING
INUSED =
OUTBUFF = HTML_STR
OUTOVERFLOW =
OUTUSED = HTML_LEN
SUBSTED =
INPUT_ENDS_IN_CHAR =
ERRMSG =
EXCEPTIONS
INVALID_CODEPAGE = 1
INTERNAL_ERROR = 2
CANNOT_CONVERT = 3
FIELDS_BAD_TYPE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CHANGE ENCODING UTF-8 TO LATIN1
REPLACE ALL OCCURRENCES OF 'UTF-8' IN HTML_STR WITH 'iso-8859-1' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '<IMG' IN HTML_STR WITH '<IMG' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '/>' IN HTML_STR WITH '/>' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '<A>' IN HTML_STR WITH '' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '<' IN HTML_STR WITH '<' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '>' IN HTML_STR WITH '>' IGNORING CASE.
HTML_LEN = STRLEN( HTML_STR ).
DATA: L_OFFSET TYPE I,
L_LENGTH TYPE I,
L_DIFF TYPE I,
LT_SOLI TYPE SOLI_TAB,
LS_SOLI TYPE SOLI.
L_OFFSET = 0.
L_LENGTH = 255.
WHILE L_OFFSET < HTML_LEN.
L_DIFF = HTML_LEN - L_OFFSET.
IF L_DIFF > L_LENGTH.
LS_SOLI-LINE = HTML_STR+L_OFFSET(L_LENGTH).
ELSE.
LS_SOLI-LINE = HTML_STR+L_OFFSET(L_DIFF).
ENDIF.
APPEND LS_SOLI TO LT_SOLI.
ADD L_LENGTH TO L_OFFSET.
ENDWHILE.
DATA: LO_MIME_HELPER TYPE REF TO CL_GBT_MULTIRELATED_SERVICE.
CREATE OBJECT LO_MIME_HELPER
EXPORTING
CODEPAGE = '1133'.
CALL METHOD LO_MIME_HELPER->SET_MAIN_HTML
EXPORTING
CONTENT = LT_SOLI
FILENAME =
DESCRIPTION =
HANDLE GRAPHICS
DATA: L_GRAPHIC TYPE SSF_XSF_GR,
GR_XSTR TYPE XSTRING,
L_GR_RAW TYPE BAPICONTEN,
L_CONTENT_ID TYPE STRING,
L_CONTENT_TYPE TYPE W3CONTTYPE,
L_OBJ_LEN TYPE SO_OBJ_LEN,
L_FILENAME TYPE STRING,
LT_SOLIX TYPE SOLIX_TAB,
LS_SOLIX TYPE SOLIX.
LOOP AT P_GRAPHICS INTO L_GRAPHIC.
CLEAR: GR_XSTR.
LOOP AT L_GRAPHIC-CONTENT INTO L_GR_RAW.
CONCATENATE GR_XSTR L_GR_RAW-LINE INTO GR_XSTR IN BYTE MODE.
ENDLOOP.
GR_XSTR = GR_XSTR(L_GRAPHIC-LENGTH).
L_OFFSET = 0.
L_LENGTH = 255.
CLEAR LT_SOLIX[].
WHILE L_OFFSET < L_GRAPHIC-LENGTH.
L_DIFF = L_GRAPHIC-LENGTH - L_OFFSET.
IF L_DIFF > L_LENGTH.
LS_SOLIX-LINE = GR_XSTR+L_OFFSET(L_LENGTH).
ELSE.
LS_SOLIX-LINE = GR_XSTR+L_OFFSET(L_DIFF).
ENDIF.
APPEND LS_SOLIX TO LT_SOLIX.
ADD L_LENGTH TO L_OFFSET.
ENDWHILE.
CONCATENATE C_GR_DIR L_GRAPHIC-GRAPHICS '.BMP' INTO L_FILENAME.
CONCATENATE C_GR_DIR L_GRAPHIC-GRAPHICS '.BMP' INTO L_CONTENT_ID.
L_CONTENT_TYPE = L_GRAPHIC-HTTPTYPE.
L_OBJ_LEN = L_GRAPHIC-LENGTH.
ADD IMAGES TO EMAIL
CALL METHOD LO_MIME_HELPER->ADD_BINARY_PART
EXPORTING
CONTENT = LT_SOLIX
FILENAME =
EXTENSION =
DESCRIPTION =
CONTENT_TYPE = L_CONTENT_TYPE
LENGTH = L_OBJ_LEN
CONTENT_ID = L_CONTENT_ID
ENDLOOP.
DATA: LO_DOC_BCS TYPE REF TO CL_DOCUMENT_BCS,
P_SUBJECT TYPE SO_OBJ_DES,
LV_GBT_MIME TYPE REF TO CX_GBT_MIME,
LV_BCOM_MIME TYPE REF TO CX_BCOM_MIME,
LV_DOCUMENT_BCS TYPE REF TO CX_DOCUMENT_BCS.
P_SUBJECT = 'TEST HTML EMAIL FROM SMARTFORM OUTPUT'.
TRY.
CALL METHOD CL_DOCUMENT_BCS=>CREATE_FROM_MULTIRELATED
EXPORTING
I_SUBJECT = P_SUBJECT
I_LANGUAGE = SY-LANGU
I_IMPORTANCE = '5'
I_SENSITIVITY = 'F'
I_MULTIREL_SERVICE = LO_MIME_HELPER
RECEIVING
RESULT = LO_DOC_BCS
CATCH CX_DOCUMENT_BCS INTO LV_DOCUMENT_BCS.
CATCH CX_BCOM_MIME INTO LV_BCOM_MIME.
CATCH CX_GBT_MIME INTO LV_GBT_MIME.
ENDTRY.
RECEIVERS
DATA: P_RECEIVERS TYPE TABLE OF SOMLRECI1,
RECEIVER TYPE SOMLRECI1,
L_MAIL_ADDRESS TYPE AD_SMTPADR,
LO_BCS TYPE REF TO CL_BCS,
LV_SEND_REQ_BCS TYPE REF TO CX_SEND_REQ_BCS,
L_USERNAME TYPE UNAME,
SEND_PARTNER TYPE BU_PARTNER,
LI_SENDER TYPE REF TO IF_SENDER_BCS,
LV_ADDRESS_BCS TYPE REF TO CX_ADDRESS_BCS,
LV_SENT_TO_ALL TYPE BOOLEAN.
CLEAR RECEIVER.
RECEIVER-RECEIVER = '[email protected]'.
RECEIVER-REC_TYPE = 'U'.
RECEIVER-COM_TYPE = 'INT'.
APPEND RECEIVER TO P_RECEIVERS.
L_USERNAME = SY-UNAME.
CLEAR RECEIVER.
LOOP AT P_RECEIVERS INTO RECEIVER.
L_MAIL_ADDRESS = RECEIVER-RECEIVER.
TRY.
CALL METHOD CL_BCS=>CREATE_PERSISTENT
RECEIVING
RESULT = LO_BCS
CALL METHOD LO_BCS->SET_DOCUMENT
EXPORTING
I_DOCUMENT = LO_DOC_BCS
CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
ENDTRY.
CREATE SENDER
CLASS CL_CAM_ADDRESS_BCS DEFINITION LOAD.
TRY.
IF L_USERNAME NS '@'.
L_USERNAME = SEND_PARTNER.
TRANSLATE L_USERNAME TO UPPER CASE.
LI_SENDER ?= CL_SAPUSER_BCS=>CREATE( L_USERNAME ).
ELSE.
DATA: L_FROM_MAIL_ADDRESS TYPE AD_SMTPADR.
L_FROM_MAIL_ADDRESS = L_USERNAME.
LI_SENDER ?= CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( I_ADDRESS_STRING = L_FROM_MAIL_ADDRESS ).
ENDIF.
CALL METHOD LO_BCS->SET_SENDER
EXPORTING
I_SENDER = LI_SENDER
CATCH CX_ADDRESS_BCS INTO LV_ADDRESS_BCS.
CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
ENDTRY.
create recepient
data: LO_RECEPIENT TYPE REF TO IF_RECIPIENT_BCS.
TRY.
CALL METHOD CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS
EXPORTING
I_ADDRESS_STRING = L_MAIL_ADDRESS
I_ADDRESS_NAME =
I_INCL_SAPUSER =
RECEIVING
RESULT = LO_RECEPIENT
CATCH CX_ADDRESS_BCS INTO LV_ADDRESS_BCS.
ENDTRY.
TRY.
CALL METHOD LO_BCS->ADD_RECIPIENT
EXPORTING
I_RECIPIENT = LO_RECEPIENT
I_EXPRESS =
I_COPY =
I_BLIND_COPY =
I_NO_FORWARD =
CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
ENDTRY.
SEND EMAIL DOCUMENT
TRY.
CALL METHOD LO_BCS->SEND_REQUEST->SET_REQUESTED_STATUS
EXPORTING
I_REQUESTED_STATUS = 'N'
TRY.
CALL METHOD LO_BCS->SEND
EXPORTING
I_WITH_ERROR_SCREEN = SPACE
RECEIVING
RESULT = LV_SENT_TO_ALL
CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
ENDTRY.
ENDTRY.
ENDLOOP.
COMMIT WORK.Hi,
I want to send the output of a smartform as html in email body.
I found and used this bolg: :<a href="/people/pavan.bayyapu/blog/2005/08/30/sending-html-email-from-sap-crmerp HTML Email from SAP CRM/ERP</a>
I did everything as per the blog.
However I am getting the email as:
sf @media print {.xsfnoprint{ display : none ;}}/* Default css layout information for SAP Smart Forms (XSF Output) Last modified: 12.05.2003 /@media screen { body { background-color : #EFEFEF ; }}@media screen { .page { border-style : outset ; border-width : 2pt ; background-color : white ; }}/@media print { .page { overflow: hidden; }}// unification browser-dependent settings /table { border-spacing: 0pt; empty-cells: show;}tr { vertical-align: top; }td input img img.icon / End of default.css */.SYSTEM div#B.par{ font-family : "Courier New" ; font-size : 12pt ; font-weight : normal ; line-height : 4.23mm ; text-decoration : none ; text-align : justify ; clear : both ;}.SYSTEM div#L.par{ font-family : "Courier New" ; font-size : 12pt ; font-weight : normal ; line-height : 4.23mm ; text-decoration : none ; text-align : left ; clear : both ;}.SYSTEM a.SYSTEM span#H.char{ font-weight : bold ;}.SYSTEM span#I.char{ font-style : italic ;}.SYSTEM span#U.char{ text-decoration : underline ;}#sfPAGE1-001.page@media screen {#MAIN.win{ overflow : auto ;}}@media print {#MAIN.win{ overflow : hidden ;}}#sfPAGE1-001.page #MAIN.win
Welcome
<IMG src="https://www.sdn.sap.com/sd/img/logo_header.gif" border="0" aligh="left" width="559" height="48">
I am using: Lotus notes client for email and my smartform contains only two text elements: one containing text Welcome and other containing text
<IMG src="https://www.sdn.sap.com/sd/img/logo_header.gif" border="0" aligh="left" width="559" height="48">
When I display the document using SOST, I get the output as
Address bar has this: C:\Documents and Settings\EDC LTIL02\SapWorkDir\TESTHTMLEMAILFROMSMARTFORMOUTPUT_20070928154506.046_X.MHT
and window contains:
Welcome
<IMG src="https://www.sdn.sap.com/sd/img/logo_header.gif" border="0" aligh="left" width="559" height="48"> "
Regards,
Reema
Message was edited by:
Reema Shahbazkar
In case anyone needs to have a look at my code:
REPORT ZSMARTFORM_2_HTML_EMAIL.
get generated function module for the smartform
DATA: FM_NAME TYPE RS38L_FNAM.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSF_SAMPLE_HTML'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
get smartform contetnt
set smartform output options
data:
control_parameters type SSFCTRLOP,
OUTPUT_OPTIONS TYPE SSFCOMPOP,
DOCUMENT_OUTPUT_INFO TYPE SSFCRESPD,
JOB_OUTPUT_INFO TYPE SSFCRESCL,
JOB_OUTPUT_OPTIONS TYPE SSFCRESOP,
XSFPARAM_LINE TYPE SSFXSFP,
P_HTML TYPE TRFRESULT,
P_GRAPHICS TYPE TSF_XSF_GR,
WA_RETURN TYPE BAPIRET2.
CONSTANTS: C_GR_DIR TYPE TDTEXT VALUE '/MYGRAPHICS'.
control_parameters-NO_DIALOG = 'X'.
*control_parameters-GETOTF = 'X'.
OUTPUT_OPTIONS-TDNEWID = SPACE.
OUTPUT_OPTIONS-TDIMMED = SPACE.
OUTPUT_OPTIONS-XSFCMODE = 'X'. "RUNTIME SETTINGS FROM SMARTFORM HEADER TO BE USED
OUTPUT_OPTIONS-XSF = 'X'. "XSF OUTPUT ACTIVATED
OUTPUT_OPTIONS-XSFOUTMODE = 'A'. "XSF OUTPUT STREAM PASSED DIRECTLY TO CALLING PROGRAM AS AN INTERNAL TABLE.
CLEAR: OUTPUT_OPTIONS-XSFOUTDEV. "OUTPUT SPOOL DEVICE
OUTPUT_OPTIONS-XSFFORMAT = 'X'. "ADDITIONALLLY TO XSF, HTML AND CSS LAYOUT INFORMATION IS ALSO PASSED TO CALLING PROGRAM
XSFPARAM_LINE-NAME = 'GRAPHICS'.
XSFPARAM_LINE-VALUE = 'EXTRACT'.
APPEND XSFPARAM_LINE TO OUTPUT_OPTIONS-XSFPARS.
XSFPARAM_LINE-NAME = 'GRAPHICS-DIRECTORY'.
XSFPARAM_LINE-VALUE = C_GR_DIR.
APPEND XSFPARAM_LINE TO OUTPUT_OPTIONS-XSFPARS.
XSFPARAM_LINE-NAME = 'CONTENT-ID'.
XSFPARAM_LINE-VALUE = 'ENABLE'.
APPEND XSFPARAM_LINE TO OUTPUT_OPTIONS-XSFPARS.
CALL GENERATED FUNCTION MODULE TO GET FORM CONTENTS
CALL FUNCTION FM_NAME
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = CONTROL_PARAMETERS
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = OUTPUT_OPTIONS
USER_SETTINGS = 'X'
IMPORTING
DOCUMENT_OUTPUT_INFO = DOCUMENT_OUTPUT_INFO
JOB_OUTPUT_INFO = JOB_OUTPUT_INFO
JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
SEPARATE HTML GRAPHICAL N CSS LAYOUT CONTENT
P_HTML = JOB_OUTPUT_INFO-XMLOUTPUT-TRFRESULT.
P_GRAPHICS[] = JOB_OUTPUT_INFO-XMLOUTPUT-XSFGR[].
PROCEED TO SEND EMAIL
DATA: HTML_DATA TYPE TRFRESULT,
L_HTML_RAW LIKE LINE OF HTML_DATA-CONTENT,
HTML_XSTR TYPE XSTRING.
CLEAR: HTML_XSTR.
LOOP AT P_HTML-CONTENT INTO L_HTML_RAW.
CONCATENATE HTML_XSTR L_HTML_RAW INTO HTML_XSTR IN BYTE MODE.
ENDLOOP.
HTML_XSTR = HTML_XSTR(P_HTML-LENGTH).
SPECIAL CHARACTER CONVERSION
DATA: HTML_STR TYPE STRING,
HTML_LEN TYPE I.
CALL FUNCTION 'SCP_TRANSLATE_CHARS'
EXPORTING
INBUFF = HTML_XSTR
INBUFFLG = 0
INCODE = '4110' "utf-8
OUTBUFFLG = 0
OUTCODE = '0000'
CSUBST = 'X'
SUBSTC_HASH = ' '
SUBSTC_DOT = ' '
SUBSTC_SPACE = 'x'
SUBSTC = '00035'
IMPORTING
INUSED =
OUTBUFF = HTML_STR
OUTOVERFLOW =
OUTUSED = HTML_LEN
SUBSTED =
INPUT_ENDS_IN_CHAR =
ERRMSG =
EXCEPTIONS
INVALID_CODEPAGE = 1
INTERNAL_ERROR = 2
CANNOT_CONVERT = 3
FIELDS_BAD_TYPE = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CHANGE ENCODING UTF-8 TO LATIN1
REPLACE ALL OCCURRENCES OF 'UTF-8' IN HTML_STR WITH 'iso-8859-1' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '<IMG' IN HTML_STR WITH '<IMG' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '/>' IN HTML_STR WITH '/>' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '<A>' IN HTML_STR WITH '' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '<' IN HTML_STR WITH '<' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '>' IN HTML_STR WITH '>' IGNORING CASE.
HTML_LEN = STRLEN( HTML_STR ).
DATA: L_OFFSET TYPE I,
L_LENGTH TYPE I,
L_DIFF TYPE I,
LT_SOLI TYPE SOLI_TAB,
LS_SOLI TYPE SOLI.
L_OFFSET = 0.
L_LENGTH = 255.
WHILE L_OFFSET < HTML_LEN.
L_DIFF = HTML_LEN - L_OFFSET.
IF L_DIFF > L_LENGTH.
LS_SOLI-LINE = HTML_STR+L_OFFSET(L_LENGTH).
ELSE.
LS_SOLI-LINE = HTML_STR+L_OFFSET(L_DIFF).
ENDIF.
APPEND LS_SOLI TO LT_SOLI.
ADD L_LENGTH TO L_OFFSET.
ENDWHILE.
DATA: LO_MIME_HELPER TYPE REF TO CL_GBT_MULTIRELATED_SERVICE.
CREATE OBJECT LO_MIME_HELPER
EXPORTING
CODEPAGE = '1133'.
CALL METHOD LO_MIME_HELPER->SET_MAIN_HTML
EXPORTING
CONTENT = LT_SOLI
FILENAME =
DESCRIPTION =
HANDLE GRAPHICS
DATA: L_GRAPHIC TYPE SSF_XSF_GR,
GR_XSTR TYPE XSTRING,
L_GR_RAW TYPE BAPICONTEN,
L_CONTENT_ID TYPE STRING,
L_CONTENT_TYPE TYPE W3CONTTYPE,
L_OBJ_LEN TYPE SO_OBJ_LEN,
L_FILENAME TYPE STRING,
LT_SOLIX TYPE SOLIX_TAB,
LS_SOLIX TYPE SOLIX.
LOOP AT P_GRAPHICS INTO L_GRAPHIC.
CLEAR: GR_XSTR.
LOOP AT L_GRAPHIC-CONTENT INTO L_GR_RAW.
CONCATENATE GR_XSTR L_GR_RAW-LINE INTO GR_XSTR IN BYTE MODE.
ENDLOOP.
GR_XSTR = GR_XSTR(L_GRAPHIC-LENGTH).
L_OFFSET = 0.
L_LENGTH = 255.
CLEAR LT_SOLIX[].
WHILE L_OFFSET < L_GRAPHIC-LENGTH.
L_DIFF = L_GRAPHIC-LENGTH - L_OFFSET.
IF L_DIFF > L_LENGTH.
LS_SOLIX-LINE = GR_XSTR+L_OFFSET(L_LENGTH).
ELSE.
LS_SOLIX-LINE = GR_XSTR+L_OFFSET(L_DIFF).
ENDIF.
APPEND LS_SOLIX TO LT_SOLIX.
ADD L_LENGTH TO L_OFFSET.
ENDWHILE.
CONCATENATE C_GR_DIR L_GRAPHIC-GRAPHICS '.BMP' INTO L_FILENAME.
CONCATENATE C_GR_DIR L_GRAPHIC-GRAPHICS '.BMP' INTO L_CONTENT_ID.
L_CONTENT_TYPE = L_GRAPHIC-HTTPTYPE.
L_OBJ_LEN = L_GRAPHIC-LENGTH.
ADD IMAGES TO EMAIL
CALL METHOD LO_MIME_HELPER->ADD_BINARY_PART
EXPORTING
CONTENT = LT_SOLIX
FILENAME =
EXTENSION =
DESCRIPTION =
CONTENT_TYPE = L_CONTENT_TYPE
LENGTH = L_OBJ_LEN
CONTENT_ID = L_CONTENT_ID
ENDLOOP.
DATA: LO_DOC_BCS TYPE REF TO CL_DOCUMENT_BCS,
P_SUBJECT TYPE SO_OBJ_DES,
LV_GBT_MIME TYPE REF TO CX_GBT_MIME,
LV_BCOM_MIME TYPE REF TO CX_BCOM_MIME,
LV_DOCUMENT_BCS TYPE REF TO CX_DOCUMENT_BCS.
P_SUBJECT = 'TEST HTML EMAIL FROM SMARTFORM OUTPUT'.
TRY.
CALL METHOD CL_DOCUMENT_BCS=>CREATE_FROM_MULTIRELATED
EXPORTING
I_SUBJECT = P_SUBJECT
I_LANGUAGE = SY-LANGU
I_IMPORTANCE = '5'
I_SENSITIVITY = 'F'
I_MULTIREL_SERVICE = LO_MIME_HELPER
RECEIVING
RESULT = LO_DOC_BCS
CATCH CX_DOCUMENT_BCS INTO LV_DOCUMENT_BCS.
CATCH CX_BCOM_MIME INTO LV_BCOM_MIME.
CATCH CX_GBT_MIME INTO LV_GBT_MIME.
ENDTRY.
RECEIVERS
DATA: P_RECEIVERS TYPE TABLE OF SOMLRECI1,
RECEIVER TYPE SOMLRECI1,
L_MAIL_ADDRESS TYPE AD_SMTPADR,
LO_BCS TYPE REF TO CL_BCS,
LV_SEND_REQ_BCS TYPE REF TO CX_SEND_REQ_BCS,
L_USERNAME TYPE UNAME,
SEND_PARTNER TYPE BU_PARTNER,
LI_SENDER TYPE REF TO IF_SENDER_BCS,
LV_ADDRESS_BCS TYPE REF TO CX_ADDRESS_BCS,
LV_SENT_TO_ALL TYPE BOOLEAN.
CLEAR RECEIVER.
RECEIVER-RECEIVER = '[email protected]'.
RECEIVER-REC_TYPE = 'U'.
RECEIVER-COM_TYPE = 'INT'.
APPEND RECEIVER TO P_RECEIVERS.
L_USERNAME = SY-UNAME.
CLEAR RECEIVER.
LOOP AT P_RECEIVERS INTO RECEIVER.
L_MAIL_ADDRESS = RECEIVER-RECEIVER.
TRY.
CALL METHOD CL_BCS=>CREATE_PERSISTENT
RECEIVING
RESULT = LO_BCS
CALL METHOD LO_BCS->SET_DOCUMENT
EXPORTING
I_DOCUMENT = LO_DOC_BCS
CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
ENDTRY.
CREATE SENDER
CLASS CL_CAM_ADDRESS_BCS DEFINITION LOAD.
TRY.
IF L_USERNAME NS '@'.
L_USERNAME = SEND_PARTNER.
TRANSLATE L_USERNAME TO UPPER CASE.
LI_SENDER ?= CL_SAPUSER_BCS=>CREATE( L_USERNAME ).
ELSE.
DATA: L_FROM_MAIL_ADDRESS TYPE AD_SMTPADR.
L_FROM_MAIL_ADDRESS = L_USERNAME.
LI_SENDER ?= CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS( I_ADDRESS_STRING = L_FROM_MAIL_ADDRESS ).
ENDIF.
CALL METHOD LO_BCS->SET_SENDER
EXPORTING
I_SENDER = LI_SENDER
CATCH CX_ADDRESS_BCS INTO LV_ADDRESS_BCS.
CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
ENDTRY.
create recepient
data: LO_RECEPIENT TYPE REF TO IF_RECIPIENT_BCS.
TRY.
CALL METHOD CL_CAM_ADDRESS_BCS=>CREATE_INTERNET_ADDRESS
EXPORTING
I_ADDRESS_STRING = L_MAIL_ADDRESS
I_ADDRESS_NAME =
I_INCL_SAPUSER =
RECEIVING
RESULT = LO_RECEPIENT
CATCH CX_ADDRESS_BCS INTO LV_ADDRESS_BCS.
ENDTRY.
TRY.
CALL METHOD LO_BCS->ADD_RECIPIENT
EXPORTING
I_RECIPIENT = LO_RECEPIENT
I_EXPRESS =
I_COPY =
I_BLIND_COPY =
I_NO_FORWARD =
CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
ENDTRY.
SEND EMAIL DOCUMENT
TRY.
CALL METHOD LO_BCS->SEND_REQUEST->SET_REQUESTED_STATUS
EXPORTING
I_REQUESTED_STATUS = 'N'
TRY.
CALL METHOD LO_BCS->SEND
EXPORTING
I_WITH_ERROR_SCREEN = SPACE
RECEIVING
RESULT = LV_SENT_TO_ALL
CATCH CX_SEND_REQ_BCS INTO LV_SEND_REQ_BCS.
ENDTRY.
ENDTRY.
ENDLOOP.
COMMIT WORK. -
Convert smartform output in to PDF using CONVERT_OTF function how to do it
Hi Anil , and Hi All
I am trying to display smartforms output in java webdynpro
for that i have got the following code in sdn.
can anybody please clarify these doubts in the below code
1) What are the mandatory input and output parameters
I have to pass here in this code to my application
2) please check my previous post also in this regards please
. Please reply at the very earliest. Check the below code
Convert smartform output in to PDF using CONVERT_OTF function module and you can write pdf using parameter 'binfile' of this function in WebDynpro using the following code:
It is copied from my prg. I hope you understand it.
public void onActionGetQuote(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
//@@begin onActionGetQuote(ServerEvent)
wdThis.wdGetOppt_QwriterCustController().executeZquote_Writer_Input();
String fileName = wdContext.currentZquote_Writer_InputElement().getOrder().toString().trim() + System.currentTimeMillis() + ".pdf";
String pdfOutput = new String(wdContext.currentOutputElement().getBinfile());
if (pdfOutput != null)
try
String pdfResoucePath = WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(), fileName);
FileOutputStream fileOutputStream = new FileOutputStream(new File(pdfResoucePath));
PrintStream ps = new PrintStream(fileOutputStream);
ps.print(pdfOutput);
ps.close();
//Display the PDF to the browser
String fileURL = WDURLGenerator.getAbsoluteWebResourceURL(wdComponentAPI.getDeployableObjectPart(), fileName);
IWDWindow window = wdComponentAPI.getWindowManager().createExternalWindow(fileURL, "Pdf Browser", false);
window.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
window.removeWindowFeature(WDWindowFeature.MENU_BAR);
window.removeWindowFeature(WDWindowFeature.STATUS_BAR);
window.removeWindowFeature(WDWindowFeature.TOOL_BAR);
window.open();
// To collect all the file created in the server by user
quoteFiles.add(quoteFiles.size(), pdfResoucePath);
} catch (Exception e)
throw new WDRuntimeException(e);
//@@endHi
ABAPers prepared a BAPI function module which calls Smart form , how can i execute it from java Webdynpro, so that I can display the smart form in Webdynpro. Pleas reply at the very earliest. Every answer will be rewarded.
regards
jalandhar -
Smartforms output in Duplex mode
Hello Gems,
I have defined 3 pages and i had set all the pages to duplex mode.
I need to print set of instructions in my smartform output in duplex mode (front & back of page)
Page1 : next window is Page 2 and i have a command to print Instructions (page INST)
Page2 : next window is blank(or page 2) and i have a command to print conditions (page INST)
Page INST : Does not has main window and next page is Page 2.
My pages flow in the following way:
page1>Page INST>Page2
Page 1 & 2 have main windows.
I need to see the INSTRUCTONS on every page that is printed with data. But i am getting an extra page that is blank
with no INSTRUCTIONS at the back.
when i print, i am 1st page properly but also getting an xtra blank page with no INSTRUCTIONS on the back.
Can some one suggest me ?
Thanks
DanHi,
Define a first page named FIRST for a form to be printed in duplex mode. You therefore set the Print mode in FIRST to D.
To make the duplex printing work correctly, you must define a second page FOLLOWER in which Print mode is left empty. In the form definition, you specify FOLLOWER as the follow-on page for FIRST and for itself as well.
Your text is then printed in duplex mode. FIRST switches the printer to duplex mode and forces printing of the first page on the front side of a new sheet. FOLLOWER accepts the duplex mode and sends no further mode print controls to the printer. The printer therefore alternately prints FOLLOWER pages on the fronts and backs of sheets.
For more details please refer to the below limk
http://help.sap.com/saphelp_nw70/helpdata/en/d1/802e77454211d189710000e8322d00/frameset.htm
Thank U,
Jay.... -
SAPFM06P - Can this program be used for triggering a Smartform Output??
Hi Experts!
I researched a lot and came to a conclusion that Program SAPFM06P can only be used trigger either a SAP SRIPT Output or a PDF FORM output. It cannot be used to trigger a SMARTFORM output directly as there is no code in it to trigger a SMARTFORM.
My understanding:
I will have to either create an Enhancement to the Program or a Zcopy of SAPFM06P where I need to write the logic in form routine ENTRY_NEU to call a SMARTFORM.
Please tell me if my understanding is correct and please guide me if there is any easier way to achieve the same functionality.
Thanks for help!
Greetings,
AmitHi,
U can Copy this standard Program to ZProgram and Insert the FM SSF_FUNCTIONMODULE_NAME and call ur smartform and assign the same combination to the Output type Given to u in NACE Transaction..
This is the Driver Program which I used for PO Smartform
[http://vjkvijaya.blogspot.com/2009/03/puchace-order-smartform-driver-program.html]
Regards,
Vijaya Lakshmi.T -
How to send smartform output in body of email?
Hi all ,
I have to send smartform output in body of email (not as an attachement in mail) .PLease help me in this regard.
Thanks,
Ananth S.Hi Ananth
See these threads.
[https://forums.sdn.sap.com/click.jspa?searchID=23497094&messageID=6889194]
[https://forums.sdn.sap.com/click.jspa?searchID=23497094&messageID=6861330]
[https://forums.sdn.sap.com/click.jspa?searchID=23497094&messageID=6855364]
Regards
Hareesh Menon -
Smartform Output to PDF conversion
Hi experts,
i want to convert the smartform output to PDF Format and stored it in system level.But i got the following information message "OTF end command // missing in OTF data".
I used "CONVERT_OTF" for conversion of smartform output and "WS_DOWNLOAD & GUI_DOWNLOAD".
wt it means,can i make any changes,if tl me why it shows the message.
points wl be rewarded.
Thank you
chandu
Edited by: Chandu Valluri on Jan 4, 2008 12:56 PMhi,
*& Report ZPDF_DNLD_TEST2 *
*& DEVK904540 *
REPORT ZPDF_DNLD_TEST2 .
data: i_otf LIKE itcoo OCCURS 100 WITH HEADER LINE,
i_pdf LIKE tline OCCURS 100 WITH HEADER LINE.
data: op_option type SSFCTRLOP,
job_output type SSFCRESCL.
op_option-getotf = 'X'.
CALL FUNCTION '/1BCDWB/SF00000005'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = op_option
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
itab1 = itab1
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = job_output
JOB_OUTPUT_OPTIONS =
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
PDF_DELETE_OTFTAB = ' '
IMPORTING
BIN_FILESIZE =
BIN_FILE =
TABLES
otf = job_output-otfdata
lines = i_pdf
EXCEPTIONS
ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
ERR_BAD_OTF = 4
OTHERS = 5
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = 'c:\test_pdf_sf.pdf'
FILETYPE = 'BIN'
tables
data_tab = i_pdf
FIELDNAMES =
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
Dear all ,
I want to take smartform output in html format . the logos are not coming as well as the header template the records are coming in next line not side by side .my code is :
gs_output_options-xsfcmode = 'X'.
gs_output_options-xsf = 'X'.
gs_output_options-xsfoutmode = 'A'.
gs_output_options-xsfformat = 'X'.
xsfparam_line-name = 'GRAPHICS'.
xsfparam_line-value = 'EXTRACT'.
APPEND xsfparam_line TO gs_output_options-xsfpars.
xsfparam_line-name = 'GRAPHICS-DIRECTORY'.
xsfparam_line-value = c_gr_dir.
APPEND xsfparam_line TO gs_output_options-xsfpars.
xsfparam_line-name = 'CONTENT-ID'.
xsfparam_line-value = 'ENABLE'.
APPEND xsfparam_line TO gs_output_options-xsfpars.
CALL FUNCTION fm_name
EXPORTING
control_parameters = gs_ssfctrlop
output_options = gs_output_options
p_graphics[] = gs_job_output_info-xmloutput-xsfgr[].
p_html = gs_job_output_info-xmloutput-trfresult
CONCATENATE 'C:\TEST\TC1_' p_vbeln '.html' INTO p_file.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = html_len
filename = p_file
filetype = 'BIN'"'ASC'
trunc_trailing_blanks = 'X'
TABLES
data_tab = p_html-content
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
document = p_fileThis question (logos and html smartform output) has been discussed several times related to email sending. Try searching the forum. You may find some relevant info in other posts. Have you tried reaching the url that's generated for the logo?
Maybe you are looking for
-
Best way to parse a subtitle file (.srt) ?
Hey there! I'm a total newbie with Cocoa and I'm currently trying to improve my knowledge in parsing files through a simple TableView. More precisely, I'd like to parse .srt files. Those are subtitle files that can be opened with a basic text-editor.
-
Problem with Logic Pro 7 Academic Version
I've been using my academic version of logic pro 7 for about a year, and just recently it hasn't been starting up the way it used to. Usually when it launches, it says logic pro 7: academic version. But now it just says logic pro 7 and tries to run i
-
Get the Encoder Data from NI Robotics Starter Kit 1.0
I want to make a perfect 90 degree turn using the encoder Data from Robotics Starter Kit 1.0. Now I am doing it giving the angular velocity and controlling the time. But, the problem is, it's not perfect all the time. It is not repeatable. So, I want
-
I can't install JMF on Red Hat Linux . Please help
Dear All, I want to use webcam on linux. But the JMF on linux is unable. I have follow the instructions on Sun. But there were always errors. Then i used JMFDIAGNOSTICS to test my JMF. It reported: JMF Diagnostics: Java 1.1 compliant browser.....Mayb
-
This was working just fine until the update. I did the reset password. It says it is reset, but when I exit firefox and restart, I get the same error. I've put in the new password and get the same error. This almost looks like my account was deleted