Problem in Printing the Smartform in Duplex
Dear Experts,
I had an issue in printing the Smartform in Duplex Page.
I had 4 windows in the Smartform, Which i had to print the Terms & Conditions. We have the Pages as
Page1
Page2
Page3
Page4.
In my case i had to print the Terms and Conditions at the back side of the Page1. I put the print mode as D for the First Page. and also i change the print settings. Like
Page1 --> D --> Terms
Terms --> ' ' --> Page1
Page2 --> ' ' --> Page1
Page3 --> ' ' --> Page3
Page4.--> ' ' --> Page4.
But unable to print the Terms & Conditions at the back side of Page1. Will you please help me if my query is wrong.
Thanks in Advance.
Srini
why don't you close unanswered, and repost as a question in the form printing forum....probably get better response...
Similar Messages
-
Problem in Printing the ALV list
Hi,
I have one problem with printing the ALV list. While printing the ALV list(thro Print Icon on application Tool bar) ,Fist page of my print out contains some other inforamtion.
inforamtions included two tables
first table contains Sort Criteria, Ascdg, Descnd, Subtotal columns.
And second table contains Data statistics , number of
columns.
But from Second page onwards , my alv list printed correctly .
How can i avoid the First page inforamtion and
what is the Reason of coming like this?
Thanks,
Neptune.MI assume you are using function module Reuse_alv_grid_display or reuse_alv_list_display for ALV.
If this is the case, there is a parameter called IS_PRINT that you need to supply while calling the function module.
you can for exapmle declare
data:
printstruc type SLIS_PRINT_ALV.
printstruc-NO_PRINT_LISTINFOS = 'X'.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IS_PRINT = printstruc
There are many other flags in is_print structures that you can use to manipulate the printing.
Cheers! -
Problem with Printing the Billing date...
Hi Experts...
Here im facing the problem in printing the billing date.
The scenario is as follows.
The posting date of Billing is 10.10.2008
The document date of Billing is also 10.10.2008.
At the time of printing the Billing document it is taking another date otherthan 10.10.2008,where it should be 10.10.2008.
What modifications should i do to rectify the problem.
Please advice.
Regards,
Y P.Prasad,
Ask your ABAPer do debug and find out what date (Table-Field) is used in the Invoice Output program. You will know the reason and if you think that the date being used is incorrect, you can ask your ABAPer to change it to VBRK-FKDAT which is the billing date.
Chandan -
How i can print the smartform directly
hi,
my requirement is i have to print the smartform directly by skiping the dialog window.
i am using the following code but in that i have press the Print push button again .
DATA: output_options TYPE ssfcompop.
output_options-tdimmed = 'X'.
output_options-tddest = 'LOCL'.Trty something like
* Print parameters
ssfcompop-tddest = tddest.
ssfcompop-tdimmed = 'X'.
ssfcompop-tdnewid = 'X'.
ssfcompop-tddelete = 'X'.
* Control parameters
ssfctrlop-device = 'PRINTER'.
ssfctrlop-no_dialog = 'X'.
* Call driver
CALL FUNCTION fm_name
EXPORTING
control_parameters = ssfctrlop
output_options = ssfcompop
Regards -
Print the smartform to the spool
Hi all,
How to Print the smartform to the spool ?
Thanks in advance
KrupaDATA: p_out LIKE ssfcompop,
p_ctrl LIKE ssfctrlop.
CLEAR: p_out,
p_ctrl.
p_out-tdnoprev = 'X'.
p_out-tdnoprint = 'X'.
p_out-tdnoarch = 'X'.
p_out-tddelete = 'X'.
p_out-tddest = p_dest.
p_out-tdnewid = ''.
p_out-tdimmed = ' '.
p_out-tdcopies = 1.
p_out-tddataset = sy-repid.
p_out-tddelete = ' '.
CALL FUNCTION fm_name
EXPORTING
inv_header = tmp_header
output_options = p_out
control_parameters = p_ctrl
user_settings = ' '
TABLES
t_item = tmp_item
The lines in bold are the main key statements for spool.
tdnewid is the name of the spool.
awrd points if useful
Bhupal -
I have a Problem in print the long description data through EDI.
I have a Problem in print the long description data through EDI:Actually we want to print the long description data through EDI, but it not handling our huge long description data. Here is the example of that>We can print the first two lines into EDI output, but it is failing to print the below text:
<B>EPSON, TM-U590 Series: </B> Reliable 88 column slip printer. Operator friendly dot matrix impact printing. Ideal for hotel, bank, restaurant and many more applications .<br><BR> Includes: Printer, Black ribbon & a Connect-It Interface. Power Supply & interface cable sold separately. All printers are RoHS compliant & have a standard 1 year depot warranty. <BR> <BR>
-------------------------------------Failing to print this lines------------------------------------------------------------------
<b>COLORS:</b> Epson Cool White (ECW) Only<BR><BR><B><FONT COLOR=#FF0000#>Click links below for helpful Information</FONT><b><br><table border="0" bordercolor="" style="" width="100%" cellpadding="5" cellspacing="5"><tr><td><FONT SIZE="2"><CENTER><A HREF="www.sample.com"f.2605" target="_blank"><b>Spec Sheet</b></a></CENTER></FONT></td><td><FONT SIZE="2"><CENTER><A HREF="www.sample.com"f.2606" target="_blank"><b>MSRP Price List</b></a></CENTER></FONT></td><TD><FONT SIZE="2"><CENTER><A HREF="www.sample.com"f.2868" target="_blank"><b>Product Information Guide</b></a></CENTER></FONT></TD></TR><TR><td><FONT SIZE="2" COLOR=#0000FF><B>Warranty Information</B></FONT></td></tr><Tr><td><FONT SIZE="2"><CENTER><A HREF="www.sample.com"f.2554" target="_blank"><b>Depot Warranty</b></a></CENTER></FONT></td><td><FONT SIZE="2"><CENTER><A HREF="www.sample.com"f.2555" target="_blank"><b>Spare In the Air Warranty</b></a></CENTER></FONT></td><td></td></tr></table><br>
Please provide some useful thoughts on this EDI issue.
Thanks
AmeerTry using the FM:
ENQUE_READ2
Passing the follwing values:
GNAME --> VBAK (Sales Order header table)
GARG --> The lock argument
(This will be a combination of client number anb Sales Order No.
Eg: '3001210000054' where the first three digit i,e 300 is the client No
and 1210000054 is the sales order no.)
Regards,
Firoz. -
To print the Smartforms in Hindi
Dear All,
My latest requirement is to print the Smartforms in Hindi. Can anyone please guide me through this?
Thanks in advance.
Regards,
SouravHi Sourav,
This question had been discussed earlier though no concrete solution was posted.
Still you might find a few helpful posts.
Follow this link :
Re: SAPScript in different language
Regards. -
Dear all,
Iam trying to print the packing list using smarforms,
T.Code - VL74 - After providing the input for the selection screen,
eg. output_type - 0001.
outbound.deliv - 80000834.
In the "OUTPUT FROM HANDLING UNITS" screen, im getting the list of labels available for that selection.
say for eg.
HU Ob Object key Out. Med Role Name 1 City PkMtT PackMatls
1000004002 01 0080000834 0001 1 WE CALCADOS LTDA BENTO GONCALVES Z001 300026
1000004003 01 0080000834 0001 1 WE CALCADOS LTDA BENTO GONCALVES Z001 300026
1000004005 01 0080000834 0001 1 WE CALCADOS LTDA BENTO GONCALVES Z001 300026
1000004006 01 0080000834 0001 1 WE CALCADOS LTDA BENTO GONCALVES Z001 300026
with the Selection check box attached to the first field, when i
select the first and second HUs, it should be passed to the
driver program, but im getting only one HU value passed into the driver program.
In the driver program my code goes like below,
REPORT ZSDPACKDR LINE-COUNT 100 MESSAGE-ID VV.
TABLES: VBCO3, TVST.
INCLUDE ZPALIDATA_PL.
INCLUDE RVADTABL.
DATA: RETCODE LIKE SY-SUBRC, "Returncode
XSCREEN(1) TYPE C. "Ausgabe Printer/Screen
Internal table for lips
DATA: lips_wa TYPE lips.
DATA: int_lips LIKE lips_wa OCCURS 0 WITH HEADER LINE.
*& Form ENTRY
text
-->RETURN_CODE text
-->US_SCREEN text
FORM ENTRY USING RETURN_CODE US_SCREEN.
CLEAR RETCODE.
XSCREEN = US_SCREEN.
PERFORM PROCESSING USING XSCREEN.
IF RETCODE NE 0.
RETURN_CODE = 1.
ELSE.
RETURN_CODE = 0.
ENDIF.
ENDFORM. "ENTRY
FORM PROCESSING USING PROC_SCREEN.
PERFORM GET_DATA.
CHECK RETCODE = 0.
ENDFORM. "PROCESSING
FORM GET_DATA.
REFRESH: LVBPLK, LVBPLA, int_lips.
CLEAR: LVBPLK, LVBPLA, int_lips.
DATA: FM_NAME TYPE RS38L_FNAM.
VBCO3-VENUM = NAST-OBJKY. "00000.....
VBCO3-SPRAS = NAST-SPRAS. "D
VBCO3-KUNDE = NAST-PARNR. "KUNDE
VBCO3-PARVW = NAST-PARVW. "WE
VBCO3-PACKD = 'X'.
CALL FUNCTION 'SD_PACKING_PRINT_VIEW_SINGLE'
EXPORTING
COMWA = VBCO3
IMPORTING
VBPLK_WA = LVBPLK
VBPLA_WA = LVBPLA
VBADR_TVST = LVBADR "n_916660
TABLES
VBPLP_TAB = LVBPLP
EXCEPTIONS
SHIPPING_UNIT_NOT_UNIQUE = 1
SHIPPING_UNIT_NOT_FOUND = 2
OTHERS = 3.
IF SY-SUBRC NE 0.
RETCODE = 1.
PERFORM PROTOCOL_UPDATE.
ENDIF.
in the above coding, i used SD_PACKING_PRINT_VIEW_SINGLE', but i tried with SD_PACKING_PRINT_VIEW also, but no values getting loaded in the importing structures. if im doing anything wrong, pls correct me.
*CALL FUNCTION 'SD_PACKING_PRINT_VIEW'
EXPORTING
COMWA = VBCO3
AUFTRAG_NICHT_LESEN = ' '
EXPORTDATEN_NICHT_LESEN = ' '
IMPORTING
VBPLA_WA =
TABLES
VBPLK_TAB = LVBPLK
VBPLP_TAB = LVBPLP
VBPLS_TAB = LVBPLS
EXCEPTIONS
OBJECT_NOT_FOUND = 1
OTHERS = 2
*IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
The problem is:
For any of the above function call,
The VBCO3 itself im getting only one label number, hence it is processing for only one, i want to know how to pass on the multiple
label number to this function call ie, in VBC03.
meaning i would like to know, in which internal table , i can get the list of all the selected HUs, so that i shall loop this function call inorder get the appropriate output.
kindly help me to sort this issues.
Points assured.
regs,
RajaDear Srihari,
I wrote above code in first label(now i deleted do-enddo) only.
first i am moving seven lebels data into seven wa's.
after that reading the first record and moving another itab(for printing at main window i.e. 8 label).
clearly, there is no space problem..because instead puttting all the required field i put only customer name.
Now it is printing well in first page with 8 labels(main window) also.
But in the second Page it displays only 7 labels and not printing rest of the labels.
for example my itab has 20 records it displays 8 labels in first page &
next 7 labels in second page and not print the rest of the 5 labels i.e. it is not calling third page(?).
code..
CLEAR : WA1, WA2, WA3, WA4, WA5, WA6, WA7.
loop at it_final into wa_final FROM 1 TO 7.
if sy-tabix = '1'.
wa1 = wa_final.
elseif sy-tabix = '2'.
wa2 = wa_final.
elseif sy-tabix = '3'.
wa3 = wa_final.
elseif sy-tabix = '4'.
wa4 = wa_final.
elseif sy-tabix = '5'.
wa5 = wa_final.
elseif sy-tabix = '6'.
wa6 = wa_final.
elseif sy-tabix = '7'.
wa7 = wa_final.
endif.
endloop.
delete it_final from 1 to 7.
**Push every 8th row if it_final in it_main
read table it_final into wa_final index 1. "deleting 8th, 16th,... records
if sy-subrc = 0.
append wa_final to it_main.
else.
exit.
endif.
*Delete the rows from it_main which are present in it_final
loop at it_main into wa_final.
delete table it_final from wa_final. "deleting 8 th row from it_final.
endloop.
Edited by: anurag.radha on Jan 6, 2012 1:09 PM -
Smartform problem while printing the employee details
Hi,
I am creating a smartform to display the employee pay slips as the report.
the requirement is to display two employee's payslip on the single page.
Suppose:
1 ABC
2. XYZ
On the same page and so on...
How do i do it through smartform.... Any hint?Hi
there is an easy way to do that,
first u need to adapt the size of ur MAIN windows just for 2 registers, inside the MAIN a loop to the table with the data of employee and a template, so write the data there.
with that, the every 2 register the smartform will pass to another page.
It is everything on the MAIN windows,
Regards -
Problem in sending the smartform as an email in a country specific language
Hi,
I am facing a problem in sending a smartform as a email for all other Languages except english and another problem is its sending the email but the output status is still in RED in the messages tab.
the program is working fine for english.
Please do find the below code using which i would be sending the smartform as an email for a PO along with the line item attachments.
Please help.
Arun.
Determine smartform function module for purchase document
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lf_formname
IMPORTING
fm_name = lf_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
error handling
ent_retco = sy-subrc.
IF sy-subrc = 1.
MESSAGE e001(/smb40/ssfcomposer).
ENDIF.
IF sy-subrc = 2.
MESSAGE e002(/smb40/ssfcomposer) WITH tnapr-sform.
ENDIF.
PERFORM protocol_update_i.
ENDIF.
*Start of changes <Arun K Singarapu> C082493 <04/28/2008>
*for print preview
IF sy-ucomm = 'PREVOUTPUT' OR sy-ucomm = 'VIEW'.
CALL FUNCTION lf_fm_name "'/1BCDWB/SF00000197'
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_compop
user_settings = 'X'
is_ekko = l_doc-xekko
is_pekko = l_doc-xpekko
is_nast = l_nast
iv_from_mem = l_from_memory
iv_druvo = iv_druvo
iv_xfz = iv_xfz
IMPORTING
job_output_info = wa_return
TABLES
it_ekpo = l_doc-xekpo[]
it_ekpa = l_doc-xekpa[]
it_pekpo = l_doc-xpekpo[]
it_eket = l_doc-xeket[]
it_tkomv = l_doc-xtkomv[]
it_ekkn = l_doc-xekkn[]
it_ekek = l_doc-xekek[]
it_komk = l_xkomk[]
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.
EXIT.
ELSE.
wa_ctrlop-LANGU = nast-spras.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_compop-tdnoprev = 'X'.
CALL FUNCTION lf_fm_name "'/1BCDWB/SF00000197'
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_compop
user_settings = 'X'
is_ekko = l_doc-xekko
is_pekko = l_doc-xpekko
is_nast = l_nast
iv_from_mem = l_from_memory
iv_druvo = iv_druvo
iv_xfz = iv_xfz
IMPORTING
job_output_info = wa_return
TABLES
it_ekpo = l_doc-xekpo[]
it_ekpa = l_doc-xekpa[]
it_pekpo = l_doc-xpekpo[]
it_eket = l_doc-xeket[]
it_tkomv = l_doc-xtkomv[]
it_ekkn = l_doc-xekkn[]
it_ekek = l_doc-xekek[]
it_komk = l_xkomk[]
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.
*Convert the data from OTF to PDF format
it_otf[] = wa_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = l_len_in
bin_file = lp_xcontent
TABLES
otf = it_otf
lines = it_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
TRY.
---------- create persistent send request ----------------------
send_request = cl_bcs=>create_persistent( ).
len = XSTRLEN( lp_xcontent ).
transform to solix tab
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = lp_xcontent ).
Create Body to the E-mail.
APPEND Text-005 TO l_text.
Attachment Name
l_ponumber = text-004.
CONCATENATE l_ponumber l_doc-xekko-ebeln INTO l_ponumber.
Subject for the E-Mail.
l_subject = text-001.
CONCATENATE l_subject l_doc-xekko-ebeln INTO l_subject.
*create document E-Mail.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = 'RAW'
i_subject = l_subject
i_length = '13'
i_text = l_text
RECEIVING
result = l_email_object.
*Create PDF Document
bcs_doc = cl_document_bcs=>create_document(
i_type = 'PDF'
i_subject = l_ponumber
i_length = len
i_language = nast-spras
i_hex = lt_solix
*Type casting
obj_pdf_file ?= bcs_doc.
Add PDF document as an attachment
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_pdf_file.
get the attachments of the PO for each line item
SELECT ebeln
ebelp
FROM ekpo
INTO TABLE it_ekpo
WHERE ebeln = l_doc-xekko-ebeln.
concatenate PO and the Line Item Numebr to get the Object key
LOOP AT it_ekpo INTO wa_ekpo.
CONCATENATE wa_ekpo-ebeln wa_ekpo-ebelp INTO wa_temp-objky.
APPEND wa_temp TO it_temp.
CLEAR: wa_temp,wa_ekpo.
ENDLOOP.
*Get data from table DRAD
IF it_temp[] IS NOT INITIAL.
SELECT dokar
doknr
dokvr
doktl
objky
FROM drad
client specified
INTO TABLE it_drad
FOR ALL ENTRIES IN it_temp
WHERE mandt = sy-mandt
AND objky = it_temp-objky.
ENDIF.
IF NOT it_drad IS INITIAL.
SELECT * FROM dms_doc2loio
INTO TABLE it_dms_doc2loio
FOR ALL ENTRIES IN it_drad
WHERE dokar = 'SRM'
AND doknr = it_drad-doknr
AND dokvr = it_drad-dokvr
AND doktl = it_drad-doktl.
ENDIF.
Get the Physical object class and Object ID of the attachment
IF NOT it_dms_doc2loio IS INITIAL.
SELECT * FROM dms_ph_cd1
INTO TABLE it_dms_ph_cd1
FOR ALL ENTRIES IN it_dms_doc2loio
WHERE loio_id = it_dms_doc2loio-lo_objid.
ENDIF.
Get the file from the DMS server using the below function module.
LOOP AT it_dms_ph_cd1 INTO wa_dms_ph_cd1.
wa_object_id-class = wa_dms_ph_cd1-ph_class.
wa_object_id-objid = wa_dms_ph_cd1-phio_id.
CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
EXPORTING
object_id = wa_object_id
client = sy-mandt
TABLES
file_access_info = it_file_access_info
file_content_binary = it_sdokcntbin
EXCEPTIONS
not_existing = 1
not_authorized = 2
no_content = 3
bad_storage_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.
READ TABLE it_file_access_info INTO wa_file_access_info INDEX 1.
IF wa_file_access_info-mimetype = 'application/msword'.
l_doc_type = 'DOC'.
CLEAR: a_xstring,len.
LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
CONCATENATE a_xstring wa_sdokcntbin-line
INTO a_xstring IN BYTE MODE.
ENDLOOP.
len = XSTRLEN( a_xstring ).
transform to solix tab - adding additional attachments
REFRESH lt_solix.
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = a_xstring ).
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_solix
*Type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for PDF document
ELSEIF wa_file_access_info-mimetype = 'application/pdf'.
l_doc_type = 'PDF'.
file_size = wa_file_access_info-file_size.
Convert the 1022 binary data to xstring
CLEAR a_xstring.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = file_size
IMPORTING
buffer = a_xstring
TABLES
binary_tab = it_sdokcntbin
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
DATA: w_output_length TYPE i.
Convert Xstring to 255 RAW
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = a_xstring
IMPORTING
output_length = w_output_length
TABLES
binary_tab = lt_content_bin.
len = w_output_length.
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_content_bin
type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for Excel Document
ELSEIF wa_file_access_info-mimetype = 'application/msexcel'.
l_doc_type = 'XLS'.
CLEAR: a_xstring,len.
LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
CONCATENATE a_xstring wa_sdokcntbin-line
INTO a_xstring IN BYTE MODE.
ENDLOOP.
len = XSTRLEN( a_xstring ).
transform to solix tab - adding additional attachments
REFRESH lt_solix.
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = a_xstring ).
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_solix
*Type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for text doxument
ELSEIF wa_file_access_info-mimetype = 'plain/text'.
l_doc_type = 'TXT'.
file_size = wa_file_access_info-file_size.
Get the file name
l_filename = wa_file_access_info-file_name.
CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
EXPORTING
input_length = file_size
TABLES
binary_tab = it_sdokcntbin
text_tab = file_data
EXCEPTIONS
failed = 1
OTHERS = 2.
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 METHOD cl_document_bcs=>create_document
EXPORTING
i_type = l_doc_type
i_subject = l_filename
i_text = file_data
RECEIVING
result = bcs_doc1.
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
ENDIF.
CLEAR:it_file_access_info,it_sdokcntbin.
CLEAR:wa_object_id,wa_file_access_info,file_size.
ENDLOOP.
CALL METHOD send_request->set_document( l_email_object ).
*Get the address number for the vendor
SELECT SINGLE adrnr
FROM lfa1
INTO l_adrnr
WHERE lifnr = l_doc-xekko-lifnr.
MOVE l_adrnr TO l_addrno.
Get the Email Address for the vendor using address number
CALL FUNCTION 'ADDR_GET_REMOTE'
EXPORTING
addrnumber = l_addrno
TABLES
adsmtp = it_adsmtp
EXCEPTIONS
parameter_error = 1
address_not_exist = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flg_nouse = 'X'.
IF sy-subrc = 0.
LOOP AT it_adsmtp INTO wa_adsmtp WHERE flg_nouse = 'X'.
CALL METHOD cl_cam_address_bcs=>create_internet_address
EXPORTING
i_address_string = wa_adsmtp-smtp_addr
RECEIVING
result = recipient.
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
ENDLOOP.
ELSE.
READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flgdefault = 'X'.
IF sy-subrc = 0.
CALL METHOD cl_cam_address_bcs=>create_internet_address
EXPORTING
i_address_string = wa_adsmtp-smtp_addr
RECEIVING
result = recipient.
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
ENDIF.
ENDIF.
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = l_sent_to_all ).
CATCH cx_bcs INTO bcs_exception.
WRITE: 'Fehler aufgetreten.'(001).
WRITE: 'Fehlertyp:'(002), bcs_exception->error_type.
EXIT.
ENDTRY.
ENDIF.Hi,
I am facing a problem in sending a smartform as a email for all other Languages except english and another problem is its sending the email but the output status is still in RED in the messages tab.
the program is working fine for english.
Please do find the below code using which i would be sending the smartform as an email for a PO along with the line item attachments.
Please help.
Arun.
Determine smartform function module for purchase document
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = lf_formname
IMPORTING
fm_name = lf_fm_name
EXCEPTIONS
no_form = 1
no_function_module = 2
OTHERS = 3.
IF sy-subrc <> 0.
error handling
ent_retco = sy-subrc.
IF sy-subrc = 1.
MESSAGE e001(/smb40/ssfcomposer).
ENDIF.
IF sy-subrc = 2.
MESSAGE e002(/smb40/ssfcomposer) WITH tnapr-sform.
ENDIF.
PERFORM protocol_update_i.
ENDIF.
*Start of changes <Arun K Singarapu> C082493 <04/28/2008>
*for print preview
IF sy-ucomm = 'PREVOUTPUT' OR sy-ucomm = 'VIEW'.
CALL FUNCTION lf_fm_name "'/1BCDWB/SF00000197'
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_compop
user_settings = 'X'
is_ekko = l_doc-xekko
is_pekko = l_doc-xpekko
is_nast = l_nast
iv_from_mem = l_from_memory
iv_druvo = iv_druvo
iv_xfz = iv_xfz
IMPORTING
job_output_info = wa_return
TABLES
it_ekpo = l_doc-xekpo[]
it_ekpa = l_doc-xekpa[]
it_pekpo = l_doc-xpekpo[]
it_eket = l_doc-xeket[]
it_tkomv = l_doc-xtkomv[]
it_ekkn = l_doc-xekkn[]
it_ekek = l_doc-xekek[]
it_komk = l_xkomk[]
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.
EXIT.
ELSE.
wa_ctrlop-LANGU = nast-spras.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_compop-tdnoprev = 'X'.
CALL FUNCTION lf_fm_name "'/1BCDWB/SF00000197'
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_compop
user_settings = 'X'
is_ekko = l_doc-xekko
is_pekko = l_doc-xpekko
is_nast = l_nast
iv_from_mem = l_from_memory
iv_druvo = iv_druvo
iv_xfz = iv_xfz
IMPORTING
job_output_info = wa_return
TABLES
it_ekpo = l_doc-xekpo[]
it_ekpa = l_doc-xekpa[]
it_pekpo = l_doc-xpekpo[]
it_eket = l_doc-xeket[]
it_tkomv = l_doc-xtkomv[]
it_ekkn = l_doc-xekkn[]
it_ekek = l_doc-xekek[]
it_komk = l_xkomk[]
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.
*Convert the data from OTF to PDF format
it_otf[] = wa_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = l_len_in
bin_file = lp_xcontent
TABLES
otf = it_otf
lines = it_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
TRY.
---------- create persistent send request ----------------------
send_request = cl_bcs=>create_persistent( ).
len = XSTRLEN( lp_xcontent ).
transform to solix tab
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = lp_xcontent ).
Create Body to the E-mail.
APPEND Text-005 TO l_text.
Attachment Name
l_ponumber = text-004.
CONCATENATE l_ponumber l_doc-xekko-ebeln INTO l_ponumber.
Subject for the E-Mail.
l_subject = text-001.
CONCATENATE l_subject l_doc-xekko-ebeln INTO l_subject.
*create document E-Mail.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = 'RAW'
i_subject = l_subject
i_length = '13'
i_text = l_text
RECEIVING
result = l_email_object.
*Create PDF Document
bcs_doc = cl_document_bcs=>create_document(
i_type = 'PDF'
i_subject = l_ponumber
i_length = len
i_language = nast-spras
i_hex = lt_solix
*Type casting
obj_pdf_file ?= bcs_doc.
Add PDF document as an attachment
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_pdf_file.
get the attachments of the PO for each line item
SELECT ebeln
ebelp
FROM ekpo
INTO TABLE it_ekpo
WHERE ebeln = l_doc-xekko-ebeln.
concatenate PO and the Line Item Numebr to get the Object key
LOOP AT it_ekpo INTO wa_ekpo.
CONCATENATE wa_ekpo-ebeln wa_ekpo-ebelp INTO wa_temp-objky.
APPEND wa_temp TO it_temp.
CLEAR: wa_temp,wa_ekpo.
ENDLOOP.
*Get data from table DRAD
IF it_temp[] IS NOT INITIAL.
SELECT dokar
doknr
dokvr
doktl
objky
FROM drad
client specified
INTO TABLE it_drad
FOR ALL ENTRIES IN it_temp
WHERE mandt = sy-mandt
AND objky = it_temp-objky.
ENDIF.
IF NOT it_drad IS INITIAL.
SELECT * FROM dms_doc2loio
INTO TABLE it_dms_doc2loio
FOR ALL ENTRIES IN it_drad
WHERE dokar = 'SRM'
AND doknr = it_drad-doknr
AND dokvr = it_drad-dokvr
AND doktl = it_drad-doktl.
ENDIF.
Get the Physical object class and Object ID of the attachment
IF NOT it_dms_doc2loio IS INITIAL.
SELECT * FROM dms_ph_cd1
INTO TABLE it_dms_ph_cd1
FOR ALL ENTRIES IN it_dms_doc2loio
WHERE loio_id = it_dms_doc2loio-lo_objid.
ENDIF.
Get the file from the DMS server using the below function module.
LOOP AT it_dms_ph_cd1 INTO wa_dms_ph_cd1.
wa_object_id-class = wa_dms_ph_cd1-ph_class.
wa_object_id-objid = wa_dms_ph_cd1-phio_id.
CALL FUNCTION 'SDOK_PHIO_LOAD_CONTENT'
EXPORTING
object_id = wa_object_id
client = sy-mandt
TABLES
file_access_info = it_file_access_info
file_content_binary = it_sdokcntbin
EXCEPTIONS
not_existing = 1
not_authorized = 2
no_content = 3
bad_storage_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.
READ TABLE it_file_access_info INTO wa_file_access_info INDEX 1.
IF wa_file_access_info-mimetype = 'application/msword'.
l_doc_type = 'DOC'.
CLEAR: a_xstring,len.
LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
CONCATENATE a_xstring wa_sdokcntbin-line
INTO a_xstring IN BYTE MODE.
ENDLOOP.
len = XSTRLEN( a_xstring ).
transform to solix tab - adding additional attachments
REFRESH lt_solix.
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = a_xstring ).
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_solix
*Type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for PDF document
ELSEIF wa_file_access_info-mimetype = 'application/pdf'.
l_doc_type = 'PDF'.
file_size = wa_file_access_info-file_size.
Convert the 1022 binary data to xstring
CLEAR a_xstring.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = file_size
IMPORTING
buffer = a_xstring
TABLES
binary_tab = it_sdokcntbin
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
DATA: w_output_length TYPE i.
Convert Xstring to 255 RAW
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = a_xstring
IMPORTING
output_length = w_output_length
TABLES
binary_tab = lt_content_bin.
len = w_output_length.
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_content_bin
type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for Excel Document
ELSEIF wa_file_access_info-mimetype = 'application/msexcel'.
l_doc_type = 'XLS'.
CLEAR: a_xstring,len.
LOOP AT it_sdokcntbin INTO wa_sdokcntbin.
CONCATENATE a_xstring wa_sdokcntbin-line
INTO a_xstring IN BYTE MODE.
ENDLOOP.
len = XSTRLEN( a_xstring ).
transform to solix tab - adding additional attachments
REFRESH lt_solix.
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = a_xstring ).
CLEAR l_filename.
Get the file name
l_filename = wa_file_access_info-file_name.
bcs_doc1 = cl_document_bcs=>create_document(
i_type = l_doc_type
i_subject = l_filename
i_length = len
i_language = sy-langu
i_hex = lt_solix
*Type casting
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
for text doxument
ELSEIF wa_file_access_info-mimetype = 'plain/text'.
l_doc_type = 'TXT'.
file_size = wa_file_access_info-file_size.
Get the file name
l_filename = wa_file_access_info-file_name.
CALL FUNCTION 'SCMS_BINARY_TO_TEXT'
EXPORTING
input_length = file_size
TABLES
binary_tab = it_sdokcntbin
text_tab = file_data
EXCEPTIONS
failed = 1
OTHERS = 2.
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 METHOD cl_document_bcs=>create_document
EXPORTING
i_type = l_doc_type
i_subject = l_filename
i_text = file_data
RECEIVING
result = bcs_doc1.
obj_file ?= bcs_doc1.
Add Attachment as a document to the email object
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_file.
ENDIF.
CLEAR:it_file_access_info,it_sdokcntbin.
CLEAR:wa_object_id,wa_file_access_info,file_size.
ENDLOOP.
CALL METHOD send_request->set_document( l_email_object ).
*Get the address number for the vendor
SELECT SINGLE adrnr
FROM lfa1
INTO l_adrnr
WHERE lifnr = l_doc-xekko-lifnr.
MOVE l_adrnr TO l_addrno.
Get the Email Address for the vendor using address number
CALL FUNCTION 'ADDR_GET_REMOTE'
EXPORTING
addrnumber = l_addrno
TABLES
adsmtp = it_adsmtp
EXCEPTIONS
parameter_error = 1
address_not_exist = 2
internal_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flg_nouse = 'X'.
IF sy-subrc = 0.
LOOP AT it_adsmtp INTO wa_adsmtp WHERE flg_nouse = 'X'.
CALL METHOD cl_cam_address_bcs=>create_internet_address
EXPORTING
i_address_string = wa_adsmtp-smtp_addr
RECEIVING
result = recipient.
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
ENDLOOP.
ELSE.
READ TABLE it_adsmtp INTO wa_adsmtp WITH KEY flgdefault = 'X'.
IF sy-subrc = 0.
CALL METHOD cl_cam_address_bcs=>create_internet_address
EXPORTING
i_address_string = wa_adsmtp-smtp_addr
RECEIVING
result = recipient.
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
ENDIF.
ENDIF.
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = l_sent_to_all ).
CATCH cx_bcs INTO bcs_exception.
WRITE: 'Fehler aufgetreten.'(001).
WRITE: 'Fehlertyp:'(002), bcs_exception->error_type.
EXIT.
ENDTRY.
ENDIF. -
Problem in sending the smartform as email for other language except english
Hi Experts,
I could not send the smartform as an attachment for other languages, but where as i could send it in english.
The program is working fine with print priview but not when sending the SF as an attachment
(in other languages except english).
Please do find the below code which i used to send the smartform as an attachment.
Please let me know if there is any mistake in the code.
wa_ctrlop-LANGU = nast-spras.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_compop-tdnoprev = 'X'.
CALL FUNCTION lf_fm_name "'/1BCDWB/SF00000197'
EXPORTING
control_parameters = wa_ctrlop
output_options = wa_compop
user_settings = 'X'
is_ekko = l_doc-xekko
is_pekko = l_doc-xpekko
is_nast = l_nast
iv_from_mem = l_from_memory
iv_druvo = iv_druvo
iv_xfz = iv_xfz
IMPORTING
job_output_info = wa_return
TABLES
it_ekpo = l_doc-xekpo[]
it_ekpa = l_doc-xekpa[]
it_pekpo = l_doc-xpekpo[]
it_eket = l_doc-xeket[]
it_tkomv = l_doc-xtkomv[]
it_ekkn = l_doc-xekkn[]
it_ekek = l_doc-xekek[]
it_komk = l_xkomk[]
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.
*Convert the data from OTF to PDF format
it_otf[] = wa_return-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = l_len_in
bin_file = lp_xcontent
TABLES
otf = it_otf
lines = it_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
TRY.
---------- create persistent send request ----------------------
send_request = cl_bcs=>create_persistent( ).
len = XSTRLEN( lp_xcontent ).
transform to solix tab
lt_solix =
cl_document_bcs=>xstring_to_solix(
ip_xstring = lp_xcontent ).
Create Body to the E-mail.
APPEND Text-005 TO l_text.
Attachment Name
l_ponumber = text-004.
CONCATENATE l_ponumber l_doc-xekko-ebeln INTO l_ponumber.
Subject for the E-Mail.
l_subject = text-001.
CONCATENATE l_subject l_doc-xekko-ebeln INTO l_subject.
*create document E-Mail.
*TRY.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = 'RAW'
i_subject = l_subject
i_length = '13'
i_language = nast-spras
i_importance =
i_sensitivity =
i_text = l_text
i_hex =
i_header =
i_sender =
receiving
RESULT = l_email_object
CATCH cx_document_bcs .
*ENDTRY.
CALL METHOD cl_document_bcs=>create_document
EXPORTING
i_type = 'RAW'
i_subject = l_subject
i_length = '13'
i_text = l_text
RECEIVING
result = l_email_object.
*Create PDF Document
bcs_doc = cl_document_bcs=>create_document(
i_type = 'PDF'
i_subject = l_ponumber
i_length = len
i_language = nast-spras
i_hex = lt_solix
*Type casting
obj_pdf_file ?= bcs_doc.
Add PDF document as an attachment
CALL METHOD l_email_object->add_document_as_attachment
EXPORTING
im_document = obj_pdf_file.hi,
i tried with ur problem.but i am able send mail in other languages also.actaullly i wrote a msg whether the mail has been sent or not.i got success message. i am placing my code here please go thorugh it,and do relavant modifications.
*& Report ZPPS_SMARTFORM_TO_PDF
REPORT ZPPS_SMARTFORM_TO_PDF.
PARAMETER: p_date LIKE sy-datum.
PARAMETER: p_rea TYPE char255.
DATA: t_otfdata TYPE ssfcrescl,
t_lines LIKE tline OCCURS 0 WITH HEADER LINE,
t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
t_RECORD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
Objects to send mail.
DATA:T_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
T_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
T_RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.
DATA: w_filesize TYPE i,
w_bin_filesize TYPE i,
wa_ctrlop TYPE ssfctrlop,
wa_outopt TYPE ssfcompop,
WA_BUFFER TYPE STRING, "To convert from 132 to 255
WA_OBJHEAD TYPE SOLI_TAB,
WA_DOC_CHNG TYPE SODOCCHGI1,
W_DATA TYPE SODOCCHGI1.
DATA: form_name TYPE rs38l_fnam,
V_LINES_TXT TYPE I,
V_LINES_BIN TYPE I,
nast-spras type sy-langu value 'DE'.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSR_DEMO1'
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
FM_NAME = form_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.
wa_ctrlop-LANGU = nast-spras.
wa_ctrlop-getotf = 'X'.
wa_ctrlop-no_dialog = 'X'.
wa_outopt-tdnoprev = 'X'.
CALL FUNCTION form_name
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
CONTROL_PARAMETERS = wa_ctrlop
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS = wa_outopt
USER_SETTINGS = 'X'
MYDATE = p_date
REASON = p_rea
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO = t_otfdata
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.
t_otf[] = t_otfdata-otfdata[].
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
MAX_LINEWIDTH = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
PDF_DELETE_OTFTAB = ' '
IMPORTING
BIN_FILESIZE = w_bin_filesize
BIN_FILE =
TABLES
OTF = t_otf
LINES = t_lines
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.
loop at t_lines.
TRANSLATE t_lines USING '~'.
CONCATENATE WA_BUFFER T_LINES INTO WA_BUFFER.
ENDLOOP.
TRANSLATE WA_BUFFER USING '~'.
DO.
t_RECORD = WA_BUFFER.
APPEND t_RECORD.
SHIFT WA_BUFFER LEFT BY 255 PLACES.
IF WA_BUFFER IS INITIAL.
EXIT.
ENDIF.
ENDDO.
Attachment
REFRESH: T_RECLIST,
T_OBJTXT,
T_OBJBIN,
T_OBJPACK.
CLEAR WA_OBJHEAD.
T_OBJBIN[] = T_RECORD[].
Create Message Body Title and Description
T_OBJTXT = 'test with pdf-Attachment!'.
APPEND T_OBJTXT.
DESCRIBE TABLE T_OBJTXT LINES V_LINES_TXT.
READ TABLE T_OBJTXT INDEX V_LINES_TXT.
WA_DOC_CHNG-OBJ_NAME = 'smartform'.
WA_DOC_CHNG-EXPIRY_DAT = SY-DATUM + 10.
WA_DOC_CHNG-OBJ_DESCR = 'smartform'.
WA_DOC_CHNG-SENSITIVTY = 'F'.
WA_DOC_CHNG-DOC_SIZE = V_LINES_TXT * 255.
Main Text
CLEAR T_OBJPACK-TRANSF_BIN.
T_OBJPACK-HEAD_START = 1.
T_OBJPACK-HEAD_NUM = 0.
T_OBJPACK-BODY_START = 1.
T_OBJPACK-BODY_NUM = V_LINES_TXT.
T_OBJPACK-DOC_TYPE = 'RAW'.
APPEND T_OBJPACK.
Attachment (pdf-Attachment)
T_OBJPACK-TRANSF_BIN = 'X'.
T_OBJPACK-HEAD_START = 1.
T_OBJPACK-HEAD_NUM = 0.
T_OBJPACK-BODY_START = 1.
DESCRIBE TABLE T_OBJBIN LINES V_LINES_BIN.
READ TABLE T_OBJBIN INDEX V_LINES_BIN.
T_OBJPACK-DOC_SIZE = V_LINES_BIN * 255 .
T_OBJPACK-BODY_NUM = V_LINES_BIN.
T_OBJPACK-DOC_TYPE = 'PDF'.
T_OBJPACK-OBJ_NAME = 'smart'.
T_OBJPACK-OBJ_DESCR = 'test'.
APPEND T_OBJPACK.
CLEAR T_RECLIST.
T_RECLIST-RECEIVER = 'MAIL-ID'.
T_RECLIST-REC_TYPE = 'U'.
APPEND T_RECLIST.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = WA_DOC_CHNG
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
TABLES
PACKING_LIST = T_OBJPACK
OBJECT_HEADER = WA_OBJHEAD
CONTENTS_BIN = T_OBJBIN
CONTENTS_TXT = T_OBJTXT
RECEIVERS = T_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.
WRITE:/ 'Error When Sending the File', SY-SUBRC.
ELSE.
WRITE:/ 'Mail sent'.
ENDIF.
and i thought of one more soluyion u can write
wa_ctrlop-langu = T002-spras. i think it will also help for u.
revert back if any questions.
please reward me if helpful.
gupta.pullipudi -
Problem with Print of Smartforms
Hi Experts,
I am facing problem with the Smartforms related to purchase order and Request for Quotation.
when i see the print preview of these two forms the preview was coming correctly. But when i give the print the data in the footer was Truncted. I changed thepage from Letter to A4. Even then also i am facing the issue.
So can any one tell me where would be th problem.
Thanks & Regards,
RamanaDear Ramana,
there is no big issue in this just you have to
check the window at footer in which window(output option )
tick must be there at lines with
and always draw boxes and shading.
tamplet paramets must match to the window.
do this if still problem is there keep in touch
and send me the error of output.
pls keep in touch.
REWARDS expected.
vivek srivastava -
Problem with printing the sub totals
Hi,
I am having a problem with smart forms in printing the line items of invoice.
I need to print the sub total of each page and need to display the sub total in the footer, with the caption 'Balance C f/w'. It works fine in some cases.
In some cases, the sub total is getting printed wrongly, because its adding the amount of the next page's first line item also. I checked the form page by printing SFSY-PAGE along with the line item's text. It's observed that, the vlaue of SFSY-PAGE for the first line item's displayed in the second page is '1'. Due to this, the amount for this line item also is getting calculated with the sub total of the previous page.
Could you please suggest a solution for this problem?
Thanks & Regards,
JohnHi,
In smartforms, in the general attributes of the FIRST page the Mode for the page counter should be 'Initialize counter' and for the NEXT page it should be 'Increase counter'.
Please check this in your smartform.
Regards,
Ram -
Problem in Printing the PO form?
Hi all,
I have developed a PO smartform and to display the terms and conditions back side of the page.
I used CAN22 laser printer while developing the form.
The form is completed and is transported to PRD successfully. It is printing fine the printer CAN22.
But some users need to print the form with HP laser printer. While printing with this printer the font size is different . So the alignment and appearence of the texts are
Can we control the font size from SAP despite the printer?
Is there any other way tro solve the issue?
Thanks,
Aravind.Hello Aravind,
just an idea that i would share .
You can create 2 smartforms with same contents one for CAN22(format) and other for HP(format).
Now you can create a popup just before you call your SMARTFORM FM in your Print program and ask the user what kind of printer he is using based on that you can call the smartform.
Hope the discussion pulls you out of this problem.
Cheers,
Suvendu -
Problem in Printing the values in SAP Script
Hi,
I have to print the material, description, quantity and value in the invoice.. the problem i face is.. the variables which is of size 40 characters. only prints the data and gets trimmed because of which the data displayed in the invoice not in order.
can any one tell me how to find the length of the variable or is there any way to protect the variable from getting trimmed.
Advance Thanks..
Guhapriyan SHi again,
1. what problem are u facing ?
(there is no sapscript symbol / system symbol
for finding out the length )
(In abap u can use strlen)
2. data and gets trimmed
what is the meaning of it ?
3. do u mean to say that !
ABCDEF 123 45
GEF 123 45
is getting pritned like
ABCDEF 123 45 ?
GEF 123 45
4. If so , then use TABS
5. This happens because SPACE
is different in different varlues of
ABCDEF and GEF !
regards,
amit m.
Message was edited by: Amit Mittal
Maybe you are looking for
-
Dear Gurus, How to check whether the fax for Request for quotation is sent to vendor or not? Is there any place or t-code in SAP to check. Other way is to call vendor and check, but i would like to know how to check in SAP System?? Regards Saravanan
-
How to avoid invoice split due to different billing due dates?
Dear All, How to avoid invoice split due to different billing due dates for the group of outbound deliveries? Thanks in advance. Regards, Niketan
-
Integraion kit for BOBJ EDGE BI 3.1 WITH DI
Hi, can any help me out in selecting the proper SAP INTEGRATION KIT FOR BOBJ EDGE BI 3.1 WITH DI. ~ BCKUMAR
-
I gave my husband my old phone when I upgraded but its "name" is same as my new phone so iTunes does not recognize 2 diff phones so I need to change name on his phone. How do I do this!
-
New computer songs on old computer I CANT AUTHORIZE! I do not have access
to the old computer, it was the one I used at work, and I no longer work there. SO... I go into my account info and there are all the songs I've bought, an it shows I have 2 computers authorized, how do I get those songs to go into my purchased music