Sapscript convert to pdf
Hi All ,
i want to convert sapscript to pdf .
this is standart code , i don't know very good sapscript.
Thanks..
LOOP AT it7trg01 WHERE mark EQ 'X'.
CLEAR l_counter.
READ TABLE sirket WITH KEY begda = it7trg01-begda
sskis = it7trg01-isskno.
CALL FUNCTION 'START_FORM'
EXPORTING
startpage = 'PAGE1'.
PERFORM write_form.
LOOP AT fpper WHERE isskno EQ sirket-sskis
AND begda EQ sirket-begda.
ADD 1 TO l_counter.
PERFORM write_window USING 'MAIN' 'MAIN'.
ENDLOOP.
CLEAR fpper.
IF l_counter LT 12.
l_counter = 12 - l_counter.
DO l_counter TIMES.
PERFORM write_window USING 'MAIN' 'MAIN'.
ENDDO.
ENDIF.
CALL FUNCTION 'END_FORM'.
ADD 1 TO itcpo-tdcopies.
ENDLOOP.
CALL FUNCTION 'CLOSE_FORM'.
Hi,
From the print program Call function 'END_FORM' ,the import parameter 'result' structure having "TDSPOOLID" field ,this is nothing but ,spool request no.,you have to pass this value to these function module...
plz,you can try this function module....
1.CONVERT_ABAPSPOOLJOB_2_PDF
2.CONVERT_OTFSPOOLJOB_2_PDF
3.CONVERT_OTF_2_PDF
4.CONVERT_OTF_2_PDF_ARCHIVELINK
Also,you can call the program "RSTXPDFT4" in Background Job in your print program.
I hope,it will help you...
<=<< Sharing Knowledge is a way to Innovative >=>>
By,
Yoga
Similar Messages
-
Form in SAPscript convert to PDF in the backend
Hi,
Is there a way to convert a form created in SAPscript, directly to PDF in the backend?
I am aware that there is a report RSTXPDFT4 to convert a spool output to PDF. But I do not want to create a spool for the SAPscript. I want the form to be directly downloaded as PDF.
As the program will be generated as a background job, i want it to download to pdf directly to a filepath specified on the selection screen. Also, I can only use SAPscript, not adobe form or smartforms to generate.
Thank you for your help.Hi Hm He,
Were you able to send the sapscript in pdf to specified path yet? I have the same problem here. I want to be able to send the sapscript in pdf to a unix path to be ftp'd to another server via batch.
Please advise.
Thanks
Bee Soo -
Sapscript converted to PDF throug spool and sent via email
Hello gurus, i have the following code for the requeriment and when trying to open file through transaction SOST, the system says that the file is corrupted.
What am I doing wrong please?
Help is very appreciated!!!!
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = w_spool
no_dialog = c_marca
dst_device = zcts_itcpo-tddest
IMPORTING
pdf_bytecount = w_numbytes
TABLES
pdf = i_pdf
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
If sy-subrc eq 0.
PERFORM f_convert_pdf TABLES i_pdf
i_objbin.
PERFORM f_send_mail.
endif.
FORM f_convert_pdf TABLES i_source_tab STRUCTURE tline
i_target_tab STRUCTURE zcts_objbin.
DATA: l_hfeld(1600) TYPE c,
l_offset TYPE p,
l_tabix TYPE sy-tabix,
l_linecount_source TYPE i,
l_length_source TYPE i,
l_length_target TYPE i.
CLEAR: l_hfeld,
l_offset,
l_tabix,
l_linecount_source,
l_length_source,
l_length_target,
zcts_pdf,
zcts_objbin.
DESCRIBE FIELD i_source_tab LENGTH l_length_source IN BYTE MODE.
DESCRIBE FIELD i_target_tab LENGTH l_length_target IN BYTE MODE.
DESCRIBE TABLE i_source_tab LINES l_linecount_source.
CLEAR:
i_target_tab,
zcts_pdf.
LOOP AT i_source_tab INTO zcts_pdf.
l_tabix = sy-tabix.
MOVE zcts_pdf TO l_hfeld+l_offset.
IF l_tabix EQ l_linecount_source.
l_length_source = STRLEN( zcts_pdf ).
ENDIF.
l_offset = l_offset + l_length_source.
WHILE l_offset GE l_length_target.
zcts_objbin = l_hfeld(l_length_target).
APPEND zcts_objbin TO i_target_tab.
CLEAR zcts_objbin.
SHIFT l_hfeld BY l_length_target PLACES.
l_offset = l_offset - l_length_target.
ENDWHILE.
IF l_tabix EQ l_linecount_source.
IF l_offset GT 0.
zcts_objbin = l_hfeld(l_offset).
APPEND zcts_objbin TO i_target_tab.
CLEAR zcts_objbin.
ENDIF.
ENDIF.
CLEAR:
i_source_tab,
zcts_pdf.
ENDLOOP.
ENDFORM. " f_convert_pdf
FORM f_send_mail .
DATA: l_lines_txt TYPE i,
l_lines_bod TYPE i.
CLEAR: i_reclist,
i_objpack,
l_lines_txt,
l_lines_bod.
CLEAR i_objhead.
Create here the mail body
DATA: li_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE.
CLEAR li_mess_bod.
li_mess_bod = text-012.
APPEND li_mess_bod.
IF sy-subrc EQ 0.
CLEAR zcts_objtxt.
ENDIF.
CLEAR i_materials.
READ TABLE i_materials INDEX 1.
IF sy-subrc EQ 0.
CONCATENATE text-013 i_materials-maktx INTO li_mess_bod SEPARATED BY space.
ENDIF.
APPEND li_mess_bod.
IF sy-subrc EQ 0.
CLEAR li_mess_bod.
ENDIF.
IF p_deliv IS INITIAL.
CONCATENATE text-014 p_sales INTO li_mess_bod SEPARATED BY space.
ELSE.
CONCATENATE text-014 p_deliv INTO li_mess_bod SEPARATED BY space.
ENDIF.
APPEND li_mess_bod.
IF sy-subrc EQ 0.
CLEAR li_mess_bod.
ENDIF.
DESCRIBE TABLE li_mess_bod LINES l_lines_bod.
CLEAR li_mess_bod.
READ TABLE li_mess_bod INDEX l_lines_bod.
IF sy-subrc NE 0.
CLEAR li_mess_bod.
ENDIF.
zcts_doc_chng-obj_name = 'CERTIFICATE'.
Subject
IF p_deliv IS INITIAL.
CLEAR i_delivery.
READ TABLE i_delivery INDEX 1.
IF sy-subrc EQ 0.
CONCATENATE text-011 i_delivery-vbeln sy-datum INTO zcts_doc_chng-obj_descr SEPARATED BY space.
ENDIF.
ELSE.
CONCATENATE text-011 p_deliv sy-datum INTO zcts_doc_chng-obj_descr SEPARATED BY space.
ENDIF.
Fill the document data and get size of attachment
zcts_doc_chng-sensitivty = c_sens.
zcts_doc_chng-doc_size = ( l_lines_bod - 1 ) * 255 + STRLEN( li_mess_bod ).
Body mail
CLEAR zcts_objpack-transf_bin.
zcts_objpack-head_start = 1.
zcts_objpack-head_num = 0.
zcts_objpack-body_start = 1.
zcts_objpack-body_num = l_lines_bod.
zcts_objpack-doc_type = c_doc_type.
APPEND zcts_objpack TO i_objpack.
PDF attachment
zcts_objpack-transf_bin = c_marca.
zcts_objpack-head_start = 1.
zcts_objpack-head_num = 0.
zcts_objpack-body_start = 1.
DESCRIBE TABLE i_objbin LINES l_lines_txt.
zcts_objpack-doc_size = l_lines_txt * 255.
zcts_objpack-doc_size = w_numbytes.
zcts_objpack-doc_type = c_doc_type2.
zcts_objpack-obj_name = c_obj_name.
CONCATENATE text-010 sy-datum INTO zcts_objpack-obj_descr SEPARATED BY space.
APPEND zcts_objpack TO i_objpack.
Mail destinary
zcts_reclist-receiver = text-018.
zcts_reclist-rec_type = c_rec.
zcts_reclist-com_type = c_com_type.
APPEND zcts_reclist TO i_reclist.
Call function below to sending PDF object to internet email address
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = zcts_doc_chng
put_in_outbox = c_marca
commit_work = c_marca
TABLES
packing_list = i_objpack
object_header = i_objhead
contents_bin = i_objbin
contents_txt = li_mess_bod
receivers = i_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " f_send_mailhi
good
go through this code hope this will help you to solve your problem
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8cd6adbb-0301-0010-39ba-938c601d5db9
reward point if hlepful.
thanks
mrutyun^ -
Convert SAPSCRIPT forms to PDF
We need to do a report that can generate several pdfs from a payment run (SAP-FI), so we need to have one pdf for each payment in the run (they are in SAPSCRIPT form).
The program that we use is copy of "J_1AF012" and the we use "SX_OBJECT_CONVERT_OTF_PDF" function to obtain the pdf form, but the changes that we did in the standard were:
a) in the "OPEN_SAPSCRIPT"
*& Form OPEN_SAPSCRIPT
text *
FORM OPEN_SAPSCRIPT.
ITCPO-TDIMMED = '*'. " kz sofort drucken
ITCPO-TDDELETE = '*'. " kz freigbe nach Druck
ITCPO-TDLIFETIME = '7'. " verfalltage
ITCPO-TDPREVIEW = 'X'. " druckansicht
Setting the options
w_options-tdcopies = 1 ."Number of copies
w_options-tdnoprev = c_x."No print preview
w_options-tdgetotf = c_x."Return of OTF table
w_options-tddest = c_locl."Spool: Output device
CALL FUNCTION 'OPEN_FORM' " open form for output
EXPORTING FORM = S_FORM
DIALOG = 'X'
LANGUAGE = 'S'
OPTIONS = ITCPO
OPTIONS = w_options
DEVICE = 'PRINTER'
DEVICE = c_printer
IMPORTING
RESULT = W_RES.
ENDFORM. " OPEN_SAPSCRIPT
b) In the "CLOSE_SAPSCRIPT" :
FORM CLOSE_SAPSCRIPT.
C_ORDEN = C_ORDEN + 1.
shift C_ORDEN left deleting leading space.
CONCATENATE C_PATH C_NAME1 C_ORDEN C_EXTENSION INTO C_NAME.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = w_res
TABLES
otfdata = i_otf
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
codepage = 5
OTHERS= 6.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
c) And we added these functions:
Converting OTF data to single line
LOOP AT i_otf INTO w_otf.
CONCATENATE w_otf-tdprintcom w_otf-tdprintpar
INTO w_pdf.
APPEND w_pdf TO i_content_txt.
ENDLOOP.
Converting to PDF Format
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
format_src = c_otf
format_dst = c_pdf
devtype = c_printer
CHANGING
transfer_bin = w_transfer_bin
content_txt = i_content_txt
content_bin = i_content_bin
objhead = i_objhead
len = v_len_in
EXCEPTIONS
err_conv_failed = 1
OTHERS = 2.
v_size = v_len_in.
Downloading the PDF File
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = v_size
filename = c_name
filetype = c_bin
TABLES
data_tab = i_content_bin.
When we run the program the error is a dump with:
"DBIF_RSQL_INVALID_CURSOR
CX_SY_OPEN_SQL_DB "
and aparenttly is due to the cursor in BKPF table is closed (or missing) in some of those functions.
We use the "open_form" and "close_form" for each payment document, and we could generate only the first pdf and then the program cancel (to the second pdf) with this mentioned error.
We are on R/3 4.70, 620, and Informix Database.
Please, could you kindly help us???
Best regards,Hola Grisel!
Estoy tratando de armar en pdf las órdenes de pago, pudiste hacerlo? Como lo lograste?
Gracias de antemano por cualquier info que me puedas brindar.
Saludos
Eduardo Puricelli
Hi Grisel,
I'm trying to build in pdf payment orders, could you? As you did it?
Thanks in advance for any info you can give me.
Greetings
Eduardo Puricelli -
How to convert PO sapscript layout to pdf - need VERY URGENT Help
Dear All,
Requirement: PO sapscript layout after some modifications (say, ZMEDRUCK) has to be converted to pdf. Through me9f user will be able to give ranges of PO numbers and can view the print preview for the po. After that on clicking the print button we get the printout of the pos one after another based on the user input of PO numbers.
Our requirement is that when the user will click on the "Print Preview" of po (rather than pressing the print button) it i.e. PO sapscript layout has to get converted to pdf.
If you have already encountered this scenario, could you please send me the source code regarding this at the earliest. If you want to email it to my personal id, please let me know so that I can give it to you. Thank you.
It will be very beneficial for mine if you can send me some source code in this regard. (FYI. We want only Print output of PO sapscript. So, Print Program /SMB40/FM06P [after copying it to our ZSMB40/FM06P program] need to be modified for downloading the PO into PDF where there is no FMs like OPEN_FORM, WRITE_FORM, CLOSE_FORM. So already available source code in SAP forums can not help me.)). Kindly help me at the earliest. Its VERY URGENT
Thank you.
Thanks & Regards
SudiptaHi Chaith,
Could you please provide me the source code regarding this at the earliest.
We want only Print output of PO sapscript. So we need to modify only the Print Program SAPFM06P after copying it to ZSAPFM06P for downloading of modified PO (ZMEDRUCK) sapscript layout into PDF.
I am already having some source code from sdn portral. I am attaching it herewith. But it's not working as some constants and variable values need to be given. We want to take download of PO into PDF from ME9F transaction itself.
Could you please provide necessary values in the missing constants and variables and kindly resend the corrected modified Source code to me so that I can run the same code to download the modified PO ZMEDRUCK into PDF . Need YOUR URGENT HELP...
DATA: l_druvo LIKE t166k-druvo,
l_nast LIKE nast,
aux_nast LIKE nast,
l_from_memory,
l_doc TYPE meein_purchase_doc_print,
ent_screen TYPE c,
ent_retco TYPE i,
toa_dara TYPE toa_dara,
arc_params LIKE arc_params,
aux_form LIKE tnapr-fonam.
DATA: otf LIKE itcoo OCCURS 0 WITH HEADER LINE,
lt_docs TYPE TABLE OF docs,
pdf_bytecount TYPE i,
nom_archivo TYPE string.
aux_form = 'ZMEDRUCK'.
l_from_memory = c_true.
SELECT *
FROM nast
INTO aux_nast
UP TO 1 ROWS
WHERE kappl = c_po " Purchase Order
AND objky = t_datos-ebeln
AND aktiv = space
ORDER BY erdat DESCENDING eruhr DESCENDING.
ENDSELECT.
aux_nast-sort1 = c_swp.
CLEAR ent_screen.
CLEAR ent_retco.
IF aux_nast-aende EQ space.
l_druvo = c_1.
ELSE.
l_druvo = c_2.
ENDIF.
l_druvo = '2'.
CALL FUNCTION 'ME_READ_PO_FOR_PRINTING'
EXPORTING
ix_nast = aux_nast
ix_screen = ent_screen
IMPORTING
ex_retco = ent_retco
ex_nast = l_nast
doc = l_doc
CHANGING
cx_druvo = l_druvo
cx_from_memory = l_from_memory.
CHECK ent_retco EQ 0.
CALL FUNCTION 'ECP_PRINT_PO'
EXPORTING
ix_nast = l_nast
ix_druvo = l_druvo
doc = l_doc
ix_screen = ent_screen
ix_from_memory = l_from_memory
ix_toa_dara = toa_dara
ix_arc_params = arc_params
ix_fonam = aux_form
IMPORTING
ex_retco = ent_retco.
CLEAR otf.
CALL FUNCTION 'READ_OTF_FROM_MEMORY'
EXPORTING
memory_key = l_nast-objky " PO Number
TABLES
otf = otf
EXCEPTIONS
memory_empty = 1
OTHERS = 2.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = pdf_bytecount
TABLES
otf = otf
doctab_archive = lt_docs
lines = pdfout
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
CONCATENATE c_dest t_datos-ebeln c_ext INTO nom_archivo.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = pdf_bytecount
filename = nom_archivo
filetype = c_bin
IMPORTING
filelength = pdf_bytecount
TABLES
data_tab = pdfout. -
Report output to convert to pdf and mail it to recepient
Hi
I'm using the below coding for converting the output of the program to pdf and then mail it to the recepient.The coding works for background processsing only can i do the same for online.In the write statement i'm using the sy-repid my program name and when i get the pdf mail i'm getting the name of the program but instead i need to get the output of my program.Can any one help me in correcting the coding to get the output in pdf format.I know where i'm going wrong but this is the first time i'm working with this so new to this....It would be better if i could run the program and get the convertions into pdf through mail instead of background processing.....Please change the coding below to get the same.....
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 sy-repid.
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 = 'Branch Revenue'.
gd_attachment_desc = 'Branch Revenue'.
CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Branch Revenue,Profit and Commissions'.
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
'Branch Revenue'
'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.
Thanks in advance.....Hi
Below is the code I was used to convert the sap script( Sales Order) to convert to PDf and send as an attachment.
Dev/UDD Id : EUR-770416 *
Author : M.Sreeram Kumar *
Date : 08-Apr-07 *
Request : DU1K933766
Description: Send an order confirmation to the multiple user in a *
PDF format via Email. *
Change Log *
Author : *
Date : *
Description : *
Request : *
Print of an order confirmation by SAPscript
REPORT zrep_email LINE-COUNT 100 MESSAGE-ID vn.
TABLES: komk, "Communicationarea for conditions
komp, "Communicationarea for conditions
komvd, "Communicationarea for conditions
vbco3, "Communicationarea for view
vbdka, "Headerview
vbdpa, "Itemview
vbdpau, "Subitemnumbers
conf_out, "Configuration data
sadr, "Addresses
tvag, "Reason for rejection
vedka, "Servicecontract head data
vedpa, "Servicecontract position data
vedkn, "Servicecontract head notice data
vedpn, "Servicecontract pos. notice data
vbpa, "Sales Document: Partner
kna1, "General Data in Customer Master
riserls, "Serialnumbers
komser, "Serialnumbers for print
tvbur, "Sales office
tvko, "Sales organisation
adrs, "Communicationarea for Address
fpltdr. "billing schedules
INCLUDE zrep_rvadtabl.
*INCLUDE yzrvadtabl.
*INCLUDE RVADTABL.
INCLUDE zrep_rvdirekt.
*INCLUDE yzrvdirekt.
*INCLUDE RVDIREKT.
INCLUDE zrep_vedadata.
*INCLUDE yzvedadata.
*INCLUDE VEDADATA.
DATA: retcode LIKE sy-subrc. "Returncode
DATA: repeat(1) TYPE c.
DATA: xscreen(1) TYPE c. "Output on printer or screen
DATA: BEGIN OF steu, "Controldata for output
vdkex(1) TYPE c,
vdpex(1) TYPE c,
kbkex(1) TYPE c,
kbpex(1) TYPE c,
END OF steu.
DATA: BEGIN OF tvbdpa OCCURS 0. "Internal table for items
INCLUDE STRUCTURE vbdpa.
DATA: END OF tvbdpa.
DATA: BEGIN OF tkomv OCCURS 50.
INCLUDE STRUCTURE komv.
DATA: END OF tkomv.
DATA: BEGIN OF tkomvd OCCURS 50.
INCLUDE STRUCTURE komvd.
DATA: END OF tkomvd.
DATA: BEGIN OF tvbdpau OCCURS 5.
INCLUDE STRUCTURE vbdpau.
DATA: END OF tvbdpau.
DATA: BEGIN OF tkomcon OCCURS 50.
INCLUDE STRUCTURE conf_out.
DATA: END OF tkomcon.
DATA: BEGIN OF tkomservh OCCURS 1.
INCLUDE STRUCTURE vedka.
DATA: END OF tkomservh.
DATA: BEGIN OF tkomservp OCCURS 5.
INCLUDE STRUCTURE vedpa.
DATA: END OF tkomservp.
DATA: BEGIN OF tkomservhn OCCURS 5.
INCLUDE STRUCTURE vedkn.
DATA: END OF tkomservhn.
DATA: BEGIN OF tkomservpn OCCURS 5.
INCLUDE STRUCTURE vedpn.
DATA: END OF tkomservpn.
DATA: BEGIN OF tkomser OCCURS 5.
INCLUDE STRUCTURE riserls.
DATA: END OF tkomser.
DATA: BEGIN OF tkomser_print OCCURS 5.
INCLUDE STRUCTURE komser.
DATA: END OF tkomser_print.
DATA: BEGIN OF tfpltdr OCCURS 5.
INCLUDE STRUCTURE fpltdr.
DATA: END OF tfpltdr.
DATA: pr_kappl(01) TYPE c VALUE 'V'. "Application for pricing
DATA: BEGIN OF char_val OCCURS 0,
atnam LIKE cabn-atnam,
atwrt LIKE ausp-atwrt,
END OF char_val.
FORM entry USING return_code us_screen.
CLEAR retcode.
xscreen = us_screen.
PERFORM processing.
IF retcode NE 0.
return_code = 1.
ELSE.
return_code = 0.
ENDIF.
ENDFORM. "ENTRY
FORM PROCESSING *
FORM processing.
PERFORM get_data.
CHECK retcode = 0.
PERFORM form_open USING xscreen vbdka-land1.
CHECK retcode = 0.
PERFORM logo_selection.
PERFORM form_title_print.
CHECK retcode = 0.
PERFORM write_header_info.
PERFORM validity_print.
CHECK retcode = 0.
PERFORM header_data_print.
CHECK retcode = 0.
PERFORM header_serv_print.
CHECK retcode = 0.
PERFORM header_notice_print.
CHECK retcode = 0.
PERFORM header_inter_print.
CHECK retcode = 0.
PERFORM header_text_print.
CHECK retcode = 0.
PERFORM item_print.
CHECK retcode = 0.
PERFORM end_print.
CHECK retcode = 0.
PERFORM form_close.
CHECK retcode = 0.
PERFORM zemail_process.
ENDFORM. "PROCESSING
S U B R O U T I N E S *
FORM ALTERNATIVE_ITEM *
A text is printed, if the item is an alternative item. *
FORM alternative_item.
CHECK vbdpa-grpos CN '0'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ALTERNATIVE_ITEM'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDFORM. "ALTERNATIVE_ITEM
FORM CHECK_REPEAT *
A text is printed, if it is a repeat print for the document. *
FORM check_repeat.
CLEAR repeat.
SELECT * INTO *nast FROM nast WHERE kappl = nast-kappl
AND objky = nast-objky
AND kschl = nast-kschl
AND spras = nast-spras
AND parnr = nast-parnr
AND parvw = nast-parvw
AND nacha BETWEEN '1' AND '4'.
CHECK *nast-vstat = '1'.
repeat = 'X'.
EXIT.
ENDSELECT.
ENDFORM. "CHECK_REPEAT
FORM DELIVERY_DATE *
If the delivery date in the item is different to the header *
date and there are no scheduled quantities, the delivery date *
is printed in the item block. *
FORM delivery_date.
IF vbdka-lfdat = space AND
vbdpa-lfdat NE space AND
vbdpa-etenr_da = space.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_DELIVERY_DATE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ENDFORM. "DELIVERY_DATE
FORM DIFFERENT_CONSIGNEE *
If the consignee in the item is different to the header con- *
signee, it is printed by this routine. *
FORM different_consignee.
CHECK vbdka-name1_we NE vbdpa-name1_we
OR vbdka-name2_we NE vbdpa-name2_we
OR vbdka-name3_we NE vbdpa-name3_we
OR vbdka-name4_we NE vbdpa-name4_we.
CHECK vbdpa-name1_we NE space
OR vbdpa-name2_we NE space
OR vbdpa-name3_we NE space
OR vbdpa-name4_we NE space.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_CONSIGNEE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDFORM. "DIFFERENT_CONSIGNEE
FORM DIFFERENT_REFERENCE_NO *
If the reference number in the item is different to the header*
reference number, it is printed by this routine. *
FORM different_reference_no.
CHECK vbdpa-vbeln_vang NE vbdka-vbeln_vang
OR vbdpa-vbtyp_vang NE vbdka-vbtyp_vang.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_REFERENCE_NO'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDFORM. "DIFFERENT_REFERENCE_NO
FORM DIFFERENT_TERMS *
If the terms in the item are different to the header terms, *
they are printed by this routine. *
FORM different_terms.
DATA: us_vposn LIKE vedpa-vposn.
DATA: us_text(1) TYPE c. "Flag for Noticetext was printed
IF vbdpa-zterm NE vbdka-zterm AND
vbdpa-zterm NE space.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_TERMS_OF_PAYMENT'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
IF vbdpa-inco1 NE space.
IF vbdpa-inco1 NE vbdka-inco1 OR
vbdpa-inco2 NE vbdka-inco2.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_TERMS_OF_DELIVERY'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ENDIF.
Print different validity-data for the position
READ TABLE tkomservp WITH KEY vbdpa-posnr.
IF sy-subrc EQ 0.
vedpa = tkomservp.
IF vedpa-vbegdat NE space AND
vedpa-venddat NE space AND
NOT vedpa-vbegdat IS INITIAL AND
NOT vedpa-venddat IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_TERMS_OF_SERV1'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ELSEIF vedpa-vbegdat NE space AND
NOT vedpa-vbegdat IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_TERMS_OF_SERV2'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_TERMS_OF_SERV3'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ENDIF.
Notice-rules for the positions.
MOVE vbdpa-posnr TO us_vposn.
CLEAR us_text.
LOOP AT tkomservpn WHERE vposn = us_vposn.
vedpn = tkomservpn.
IF us_text IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_TERMS_OF_NOTTXT'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
us_text = charx.
ENDIF.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_TERMS_OF_NOTICE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDLOOP.
IF NOT us_text IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'EMPTY_LINE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ENDFORM. "DIFFERENT_TERMS
FORM END_PRINT *
FORM end_print.
PERFORM get_header_prices.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
command = 'PROTECT'.
PERFORM header_price_print.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'END_VALUES'.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
command = 'ENDPROTECT'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'SUPPLEMENT_TEXT'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDFORM. "END_PRINT
FORM FORM_CLOSE *
End of printing the form *
FORM form_close.
CALL FUNCTION 'CLOSE_FORM'
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
otfdata = t_otfdata
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
CODEPAGE = 5
OTHERS = 1.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
IF sy-subrc NE 0.
PERFORM protocol_update.
retcode = 1.
ENDIF.
SET COUNTRY space.
ENDFORM. "FORM_CLOSE
FORM FORM_OPEN *
Start of printing the form *
--> US_SCREEN Output on screen *
' ' = printer *
'X' = screen *
--> US_COUNTRY County for telecommunication and SET COUNTRY *
FORM form_open USING us_screen us_country.
INCLUDE zrep_rvadopfo.
INCLUDE yzrvadopfo.
INCLUDE RVADOPFO.
ENDFORM. "FORM_OPEN
FORM FORM_TITLE_PRINT *
Printing of the form title depending of the field VBTYP *
FORM form_title_print.
CASE vbdka-vbtyp.
WHEN 'A'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_A'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'B'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_B'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'C'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_C'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'E'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_E'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'F'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_F'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'G'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_F'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'H'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_H'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'K'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_K'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN 'L'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_L'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
WHEN OTHERS.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TITLE_OTHERS'
window = 'TITLE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDCASE.
IF repeat NE space.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'REPEAT'
window = 'REPEAT'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ENDFORM. "FORM_TITLE_PRINT
FORM GET_DATA *
General provision of data for the form *
FORM get_data.
DATA: us_veda_vbeln LIKE veda-vbeln.
DATA: us_veda_posnr_low LIKE veda-vposn.
CALL FUNCTION 'RV_PRICE_PRINT_REFRESH'
TABLES
tkomv = tkomv.
CLEAR komk.
CLEAR komp.
vbco3-mandt = sy-mandt.
vbco3-spras = nast-spras.
vbco3-vbeln = nast-objky.
vbco3-kunde = nast-parnr.
vbco3-parvw = nast-parvw.
CALL FUNCTION 'RV_DOCUMENT_PRINT_VIEW'
EXPORTING
comwa = vbco3
IMPORTING
kopf = vbdka
TABLES
pos = tvbdpa.
Fetch servicecontract-data and notice-data for head and position.
us_veda_vbeln = vbdka-vbeln.
us_veda_posnr_low = posnr_low.
CALL FUNCTION 'SD_VEDA_GET_PRINT_DATA'
EXPORTING
i_document_number = us_veda_vbeln
i_language = sy-langu
i_posnr_low = us_veda_posnr_low
TABLES
print_data_pos = tkomservp
print_data_head = tkomservh
print_notice_pos = tkomservpn
print_notice_head = tkomservhn.
PERFORM get_controll_data.
PERFORM sender.
PERFORM check_repeat.
PERFORM tvbdpau_create.
ENDFORM. "GET_DATA
FORM GET_ITEM_BILLING_SCHEDULES *
In this routine the billing schedules are fetched from the *
database. *
FORM get_item_billing_schedules.
REFRESH tfpltdr.
CHECK NOT vbdpa-fplnr IS INITIAL.
CALL FUNCTION 'BILLING_SCHED_PRINTVIEW_READ'
EXPORTING
i_fplnr = vbdpa-fplnr
i_language = nast-spras
TABLES
zfpltdr = tfpltdr.
ENDFORM. "GET_ITEM_BILLING_SCHEDULES
*& Form ITEM_BILLING_SCHEDULES_PRINT
This routine prints the billing shedules of a salesdocument *
position. *
FORM item_billing_schedules_print.
DATA: first_line(1) TYPE c.
first_line = charx.
LOOP AT tfpltdr.
fpltdr = tfpltdr.
Output of the following printlines
IF NOT fpltdr-perio IS INITIAL.
periodische Fakturen
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_BILLING_SCHEDULE_PERIODIC'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
bei periodischen nur eine Zeile
EXIT.
ELSEIF fpltdr-fareg CA '14'.
prozentuale Teilfakturierung
IF NOT first_line IS INITIAL.
CLEAR first_line.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_BILLING_SCHEDULE_PERCENT_HEADER'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_BILLING_SCHEDULE_PERCENT'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ELSEIF fpltdr-fareg CA '235'.
wertmäßige Teilfakturierung
IF NOT first_line IS INITIAL.
CLEAR first_line.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_BILLING_SCHEDULE_VALUE_HEADER'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_BILLING_SCHEDULE_VALUE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ELSEIF fpltdr-fareg CA '3'.
Schlußrechnung
ENDIF.
ENDLOOP.
ENDFORM. "ITEM_BILLING_SCHEDULES_PRINT
*eject
FORM GET_ITEM_CHARACTERISTICS *
In this routine the configuration data item is fetched from *
the database. *
FORM get_item_characteristics.
REFRESH tkomcon.
CHECK NOT vbdpa-cuobj IS INITIAL.
CALL FUNCTION 'CUD0_GET_CONFIGURATION' "#EC EXISTS
EXPORTING
instance = vbdpa-cuobj
language = nast-spras
TABLES
configuration = tkomcon
EXCEPTIONS
OTHERS = 4.
ENDFORM. "GET_ITEM_CHARACTERISTICS
FORM GET_ITEM_PRICES *
In this routine the price data for the item is fetched from *
the database. *
FORM get_item_prices.
CLEAR: komp,
tkomv.
IF komk-knumv NE vbdka-knumv.
CLEAR komk.
komk-mandt = sy-mandt.
komk-kalsm = vbdka-kalsm.
komk-kappl = pr_kappl.
komk-waerk = vbdka-waerk.
komk-knumv = vbdka-knumv.
komk-vbtyp = vbdka-vbtyp.
ENDIF.
komp-kposn = vbdpa-posnr.
CALL FUNCTION 'RV_PRICE_PRINT_ITEM'
EXPORTING
comm_head_i = komk
comm_item_i = komp
language = nast-spras
IMPORTING
comm_head_e = komk
comm_item_e = komp
TABLES
tkomv = tkomv
tkomvd = tkomvd.
ENDFORM. "GET_ITEM_PRICES
FORM GET_HEADER_PRICES *
In this routine the price data for the header is fetched from *
the database. *
FORM get_header_prices.
CALL FUNCTION 'RV_PRICE_PRINT_HEAD'
EXPORTING
comm_head_i = komk
language = nast-spras
IMPORTING
comm_head_e = komk
TABLES
tkomv = tkomv
tkomvd = tkomvd.
ENDFORM. "GET_HEADER_PRICES
*& Form HEADER_DATA_PRINT
Printing of header data like terms, weights .... *
FORM header_data_print.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'HEADER_DATA'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDFORM. " HEADER_DATA_PRINT
FORM HEADER_PRICE_PRINT *
Printout of the header prices *
FORM header_price_print.
LOOP AT tkomvd.
AT FIRST.
IF komk-supos NE 0.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_SUM'.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'UNDER_LINE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ENDAT.
komvd = tkomvd.
IF komvd-koaid = 'D'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'TAX_LINE'.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'SUM_LINE'.
ENDIF.
ENDLOOP.
DESCRIBE TABLE tkomvd LINES sy-tfill.
IF sy-tfill = 0.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'UNDER_LINE'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ENDFORM. "HEADER_PRICE_PRINT
FORM HEADER_TEXT_PRINT *
Printout of the headertexts *
FORM header_text_print.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'HEADER_TEXT'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDFORM. "HEADER_TEXT_PRINT
FORM ITEM_CHARACERISTICS_PRINT *
Printout of the item characteristics -> configuration *
FORM item_characteristics_print.
LOOP AT tkomcon.
conf_out = tkomcon.
IF sy-tabix = 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_LINE_CONFIGURATION_HEADER'
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_LINE_CONFIGURATION'
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. "ITEM_CHARACTERISTICS_PRINT
FORM ITEM_DELIVERY_CONFIRMATION *
If the delivery date is not confirmed, a text is printed *
FORM item_delivery_confirmation.
CHECK vbdpa-lfdat = space.
CHECK vbdpa-kwmeng NE 0.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_DELIVERY_CONFIRMATION'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDFORM. "ITEM_DELIVERY_CONFIRMATION
FORM ITEM_PRICE_PRINT *
Printout of the item prices *
FORM item_price_print.
LOOP AT tkomvd.
komvd = tkomvd.
IF sy-tabix = 1.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_LINE_PRICE_QUANTITY'.
ELSE.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_LINE_PRICE_TEXT'.
ENDIF.
ENDLOOP.
ENDFORM. "ITEM_PRICE_PRINT
FORM ITEM_PRINT *
Printout of the items *
FORM item_print.
DATA: da_subrc LIKE sy-subrc,
da_dragr LIKE tvag-dragr.
CALL FUNCTION 'WRITE_FORM' "First header
EXPORTING element = 'ITEM_HEADER'
EXCEPTIONS OTHERS = 1.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
CALL FUNCTION 'WRITE_FORM' "Activate header
EXPORTING element = 'ITEM_HEADER'
type = 'TOP'
EXCEPTIONS OTHERS = 1.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
LOOP AT tvbdpa.
vbdpa = tvbdpa.
TVAG lesen um festzustellen ob abgesagte Positionen gedruckt werden
sollen
PERFORM tvag_select(sapmv45a) USING vbdpa-abgru
da_dragr
space
da_subrc.
IF da_dragr EQ space. "Print rejected item?
IF vbdpa-posnr_neu NE space. "Item
PERFORM get_item_serials.
PERFORM get_item_characteristics.
PERFORM get_item_billing_schedules.
PERFORM get_item_prices.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
command = 'ENDPROTECT'.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
command = 'PROTECT'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_LINE'.
PERFORM item_rejected.
PERFORM item_price_print.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
command = 'ENDPROTECT'.
PERFORM item_text_print.
PERFORM item_serials_print.
PERFORM item_characteristics_print.
PERFORM alternative_item.
PERFORM delivery_date.
PERFORM item_delivery_confirmation.
PERFORM item_billing_schedules_print.
PERFORM different_reference_no.
PERFORM different_terms.
PERFORM different_consignee.
PERFORM schedule_header.
PERFORM main_item.
ELSE.
PERFORM schedule_print.
ENDIF.
ENDIF.
ENDLOOP.
CALL FUNCTION 'WRITE_FORM' "Deactivate Header
EXPORTING element = 'ITEM_HEADER'
function = 'DELETE'
type = 'TOP'
EXCEPTIONS OTHERS = 1.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDFORM. "ITEM_PRINT
FORM ITEM_REJECTED *
A text is printed, if the item is rejected *
FORM item_rejected.
CHECK NOT vbdpa-abgru IS INITIAL.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ITEM_REJECTED'
EXCEPTIONS
element = 1
window = 2.
IF sy-subrc NE 0.
PERFORM protocol_update.
ENDIF.
ENDFORM. "ITEM_REJECTED
FORM MAIN_ITEM *
A text is printed, if the item is a main item * -
Saving SAPSCRIPT to a PDF file using ADS
Hello,
I had posted this message on thread Re: Want SAPSCRIPT Work orders to be saved as PDF via ADS. but i was adviced to post it here.
I need to know whether a SAPSCRIPT (Work Order) in SAP ECC ABAP can be saved as a PDF form if ADS is installed and Configured?
We have a 3rd party converter installed on users desktop which converts it into PDF so when user goes to IW32 to print WO, they get a print pop-up and they select this 3rd party converter which gives them the option to save it as PDF file.
We need to know (since we have ADS installed/configured), whether it is possible to save this SAPSCRIPT WO to PDF instead of using this 3rd party tool? We dont want people to install the 3rd party converter since we have over 5000 users.
Any help is appreciated.
Thanks
WRHi try this below coding
data: binfilesize type i.
data: pdftab type table of tline with header line.
data: i_itcpp like itcpp.
DATA: i_zinv_spool LIKE zinv_spool OCCURS 0 WITH HEADER LINE.
CLEAR i_zinv_spool. REFRESH i_zinv_spool.
data: g_t_otfdata type standard table of itcoo with header line.
DATA filename TYPE string.
call function 'CLOSE_FORM'
IMPORTING
RESULT = i_itcpp
tables
otfdata = g_t_otfdata[]
exceptions
others = 1.
if sy-subrc ne 0.
retcode = sy-subrc.
perform protocol_update.
endif.
call function 'CONVERT_OTF'
exporting
format = 'PDF'
MAX_LINEWIDTH = 132
ARCHIVE_INDEX = ' '
COPYNUMBER = 0
ASCII_BIDI_VIS2LOG = ' '
PDF_DELETE_OTFTAB = ' '
importing
bin_filesize = binfilesize
BIN_FILE =
tables
otf = g_t_otfdata[]
lines = pdftab[]
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 = binfilesize
filename = filename
filetype = 'BIN'
tables
data_tab = pdftab[]
Thanks & Regards,
Vallamuthu.M -
Output to be converted into PDF format
Hi,
I have a "select-options" defined for Purchase order number to which SAP Script is attached. The output can be seen in SAP Script. The requirement is to have the DIALOG BOX supressed that asks for the Print Preview option and the output that was initially generated in SAP Script should now be downloaded as PDF format.
Kinldy explain the steps to attain this feature.
Thanks & Regards,
RajeshDear Rajesh,
There is a function module: 'CONVERT_OTF' wich can convert OTF (SAPScript) documents to PDF. You simply need to call this FM, like:
CALL FUNCTION 'CONVERT_OTF'
EXPORTING FORMAT = 'PDF'
MAX_LINEWIDTH = 134
IMPORTING BIN_FILESIZE = LEN_OUT
TABLES OTF = myOTF
LINES = myPDF
EXCEPTIONS ERR_MAX_LINEWIDTH = 1
ERR_FORMAT = 2
ERR_CONV_NOT_POSSIBLE = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
* do some error handling
ENDIF.
>> In the myPDF you will have the PDF file.
I hope it helps.
Regards,
Dezso -
How can i send a Sapscript as an PDF through NACE
Hi experts,
I have an requirement that i have to send a Invoice sapscript output in pdf format on mail with
Transaction NACE.
How can it be done?
Regardsu need to configure ur output as external send (medium 5) in nace look at this coe its for smatforms but for scripts u can proceed in similar way.
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/mail%2bsend%2bthrough%2boutput%2bcontrols
also look at this code for reference
https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/converting%252bscripts%252boutput%252binto%252bpdf%252bform
кu03B1ятu03B9к
Edited by: kartik tarla on Feb 27, 2009 2:28 PM -
ALL MY DESKTOP APPS CONVERTED TO PDF FILES.
After sending an urgent email attachment in Adobe PDF to Government Offcom, all my Desktop applications in windows 7 64 bit have been converted to PDF files and cannot be opened. The attachment used was sent to me by my Secretary remotely using an old MAC.
I can return my laptop to normal operation by un installing my Adobe Reader 11 app, but the problem returns when I re Download Adobe Reader
11 again. After discussing this with Adobe Technical in London they advised me to raise this issue with your Adjudicators in this Forum.
Please assist asap as this is very urgent right now for several genuine reasons.
Many thanks. Derek Horder.See if anything in here helps: https://helpx.adobe.com/acrobat/kb/application-file-icons-change-acrobat.html
-
Error in converting a pdf document to a Word document
I have Adobe Acrobat 6 running under Win XP.
My Panasonic Lumix camera manual is a pdf file that I wish to place on my Kindle 4. I copied the pdf file across but, although Kindle is supposed to be able to handle pdf files, it wouldn't with this one - it simply froze when I opened it in the Kindle. I therefore decided to convert the pdf file to a Word document file and email it to Amazon for a free conversion to a Kindle azw file. I attempted to use Save As in Acrobat to save the pdf file as a doc file but, after a few pages, I got the error message:
Bad pdf; could not read page structure. <Bad pdf; error in processing fonts: cannot find CMap resource file> [26-27].For what it's worth I pulled in some of the product line's user guide PDFs. Those I looked over were authored with FrameMaker or InDesign.
As these both support solid PDF output and from a quick look-see I'd not attribute the core issue to a poorly created PDF.
With that said; two things are evident. They are not Tagged and, with the heavy graphics content, of a healthy file size.
Tagged PDF is more than a little important as this is what provides the essential ingredient for export of PDF content (retaining font info, format, layout, etc.).
A healthy file size associated with the significant graphics content means that what is "under the hood" of the computer in use is significant as export puts a load on these resources.
Example: A local machine having integrated graphics is hard pressed compared to a local machine having a dedicated graphics card with a comfortable amount of onboard RAM.
Due to "design" improvements over the years Acrobat X does a much better job of "export"/"save as" for untagged PDF.
But, "export"/"save as" of a well-formed Tagged PDF trumps.
Be well... -
Trying to add filename and path in footer of Word doc and it only lets me "Convert to PDF"?
I am running MS Office 03 and just installed Acrobat 9.0 Pro. When I try to insert the Filename and Path from the insert option of the footer properties, it only gives me the option to "Convert to PDF". I don't know why it's doing this, but it started after the install of Acrobat 9.0. What should I do?
To get the path ... event.target.path;
To get the file name .... event.target.documentFileName; -
How do I convert a pdf in Adobe Acrobat 9 to Microsoft Word document?
How do I convert a pdf in Acrobat 9 to a Microsoft Word document?
Hi fireatty,
In Acrobat 9, you can use the Export command (File > Export) to export your PDF to Word format.
Please let us know if you need additional assistance.
Best,
Sara -
My .jpg's have ALL suddenly been converted to .pdf's and I am unable to open them
Using Windows 8.1, when I went to view some jpg's earlier today, I found they now show as "Adobe Acrobat Documents." When I try to open one, I get the error message that they are jpg's and Adobe is unable to open a jpg.???
And it was easy -- once I went to "Properties" in Windows Explorer. That was the tough part -- finding where to make the change.
Thank you for your help.
Bob Slone
[privated information removed by moderator]
From: ~graffiti <[email protected]>
To: Robert Slone <[email protected]>
Sent: Wednesday, January 7, 2015 4:09 PM
Subject: My .jpg's have ALL suddenly been converted to .pdf's and I am unable to open them
My .jpg's have ALL suddenly been converted to .pdf's and I am unable to open them
created by ~graffiti in Adobe Reader - View the full discussionEasy enough to fix. You need to change your system file associations to whatever program you used in the past to open .jpg files. Here's how -
> Choose the apps Windows uses by default - Windows Help If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7075247#7075247 and clicking ‘Correct’ below the answer Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7075247#7075247 To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following" Start a new discussion in Adobe Reader by email or at Adobe Community For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624. -
Why won't my word document converted to PDF save?
When in word, I select the option to convert to PDF, the document is scanned and I'm prompted to save as PDF. All seems to work except it doesn't actually save! This was working previously until an update a few months ago. Any help is appreciated.
Thanks!
LFirst, have you removed from Printer Utility the Adobe PDFPrinter 9.x fom the list then close Printer Utility.
Then open Acrobat or Adobe Reader and go to help menu and choose to repair or rplace. Choose to replace the PDFPrinter only.
(One thing that we can't seem to get Aodobe to fix is that (at least in X.4.11 and I've heard some folks using X.5.x talk about.
When you go to page setup in Acrobat you can not select any Printer what so ever.
Does not even pickup choices in the Print/Fax Control panel in system preferences.
However you can choose it in the Print menu.
IF you decided to install Reader, you may or may not be able to set printer in Page setup.
However, if you can set up in Reader's page setup. It will show up in Acrobat's.
Its an obvious bug Adobe refuses to admit or can't fix. I've heard some say they've heard the problem but never seen it.)
Next, open Word 2008 or 2004 (don't remove 2004 it has far more features than 2008)
create your Document.
Save a copy as DOC or DOCX document first.
Now go to Print menu and choose Acrobat PDFPrinter 9.x(x being the most current revision).
and choose Print. with the version 9.x the pdf will automatically be set to desktop and you have no choice where it save.
All versions previous to 9.0 a window would come up giving you a chance to choose the dsired location.
9.0 does not. THis is a super major bug, that only a rank amature would committ.
One thing Apple has preached fro day one; do not save any file you want to keep to the desktop.
The desktop is a Temporary file. and in event of a crash the desktop is rebuilt and the file may go missing.
Items such a Yahoo widgets get by, by using a special Database that tells where each widget is supposed to go, and and in event of crash simply recreates them.
Maybe you are looking for
-
How to change Rowid of a row.
Hello All, I want to change a rowid of a row when somebody updates it. I put the table in partition. Table is having 47 fields and I have give "PARTITION BY HASH" on 16 fields. I only updates this fiels who are n partition so how many percent chance
-
Is there a way to check the date and time a picture was taken
I would like to be able to view the date and time a picture was taken on my iphone
-
Need to hide System.out.println output in console
class Hide{ public void test(){ System.out.println("hai"); public static void main(String[] args){ Hide obj=new Hide(); obj.test(); Output is : hai But I don't want to display hai. How i can hide this kindly help me on this........
-
I recently moved and changed my email address.
I changed my Apple ID to reflect my new address, but now I am unable to open my access to the iCloud from my Win 8 laptop. I did not notice anything until I upgraded to Win 8.1 (what a pain!) and my iCloud address book in Outlook was no longer access
-
How long can i use the iwork beta in icloud?
how long can i use iwork beta in icloud?