How to store PDF spool in Application server.
Hi,
I have a requirement to send Print form spool in Application server.
For converting OTF format we have CONVERT_OTFSPOOLJOB_2_PDF.
How to convert and store Interactive print forms spool number(PDF type) in application server.
Thanks in advance.
Hi,
I have a requirement to send Print form spool in Application server.
For converting OTF format we have CONVERT_OTFSPOOLJOB_2_PDF.
How to convert and store Interactive print forms spool number(PDF type) in application server.
Thanks in advance.
Similar Messages
-
How to download from spool to application server
Hi all,
Can any one tell me how to download from spool to application server. Quick response would be appreciated.
thanks
maheshHi Kilaru,
Please find the sample code for your req,t and let me know if you found any difficulty on the same.
<b>Just copy paste the code :</b>
This will Convert spool to PDF format and download.
data: w_ident like tsp01-rqident,
w_doctype like tsp01-rqdoctype,
w_bytecount type i.
data: itab_pdf like tline occurs 0 with header line.
parameter spoolnum like tsp01-rqident obligatory.
selection-screen begin of block a2 with frame.
parameters: to_pc radiobutton group a2 default 'X',
pcfile like rlgrap-filename lower case,
to_unix radiobutton group a2,
unixfile(255) lower case.
selection-screen end of block a2.
at selection-screen on block a2.
if to_pc = 'X' and pcfile is initial.
message e398(00) with 'Enter PC File Name.'.
elseif to_unix = 'X' and unixfile is initial.
message e398(00) with 'Enter Unix File Name.'.
endif.
at selection-screen on spoolnum.
select single rqident rqdoctype
into (w_ident, w_doctype)
from tsp01
where rqident = spoolnum.
if sy-subrc ne 0.
message e398(00) with 'Spool' spoolnum 'not found'.
endif.
at selection-screen on value-request for pcfile.
call function 'WS_FILENAME_GET'
exporting
mask = ',.,..'
importing
filename = pcfile
exceptions
others = 1.
if sy-subrc <> 0.
message id sy-msgid type 'I' number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
start-of-selection.
if w_doctype = 'LIST'.
perform get_abap_spool_in_pdf.
elseif w_doctype = 'OTF'.
perform get_otf_spool_in_pdf.
endif.
if to_pc = 'X'.
perform write_pdf_spool_to_pc.
else.
perform write_pdf_spool_to_unix.
endif.
message i398(00) with 'Completed OK'.
form get_abap_spool_in_pdf.
refresh itab_pdf.
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = w_ident
importing
pdf_bytecount = w_bytecount
tables
pdf = itab_pdf
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.
if sy-subrc ne 0.
message e398(00) with 'Cannot convert to PDF. Error =' sy-subrc.
endif.
endform.
*********************************************************form get_otf_spool_in_pdf.
refresh itab_pdf.
call function 'CONVERT_OTFSPOOLJOB_2_PDF'
exporting
src_spoolid = w_ident
importing
pdf_bytecount = w_bytecount
tables
pdf = itab_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 <> 0.
message e398(00) with 'Cannot convert to PDF. Error =' sy-subrc.
endif.
endform.
*********************************************************form write_pdf_spool_to_unix.
open dataset unixfile for output in binary mode.
if sy-subrc ne 0 .
message e398(00) with 'Cannot open unix file for output:' unixfile.
endif.
loop at itab_pdf.
transfer itab_pdf to unixfile.
if sy-subrc ne 0 .
message e398(00) with 'Cannot write to unix file:' unixfile.
endif.
endloop.
close dataset unixfile.
endform.
*********************************************************form write_pdf_spool_to_pc.
call function 'WS_DOWNLOAD'
exporting
bin_filesize = w_bytecount
filename = pcfile
filetype = 'BIN'
tables
data_tab = itab_pdf
exceptions
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
others = 10.
if sy-subrc <> 0.
message e398(00) with 'Cannot download to PC. Error =' sy-subrc.
endif.
endform.
Hope this will help you.
Cheers
Sunny
Rewrd points, if found helpful -
How to store pdf files in application layer
Hi friends,
Can any body tell me how to this.when ever we give a print a spool number will be created.we can give this spool number to rstxpdft4 program and we can convert it into pdf.
how to put this pdf into application layer as a unix file.is it possible to do that.
Regards,
SasiComplete code right from spool request :
FORM convert_spool_to_pdf.
IF is_otf IS INITIAL .
List to PDF
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = p_spool
dst_device = 'LOCL'
IMPORTING
pdf_bytecount = bytes
pdf_spoolid = pdf_spool
list_pagecount = pages
btc_jobname = job_pdf
btc_jobcount = jobcount_pdf
TABLES
pdf = i_pdf
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.
ELSE .
OTF ( SAPSCRIPT ) To PDF
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = p_spool
no_dialog = ' '
IMPORTING
pdf_bytecount = bytes
pdf_spoolid = pdf_spool
otf_pagecount = pages
btc_jobname = job_pdf
btc_jobcount = jobcount_pdf
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.
ENDIF .
IF sy-subrc <> 0 OR
i_pdf[] IS INITIAL .
Error creating PDF File .
Message e000.
ELSE .
Got PDF Structure . Now transfer to App. Server.
ENDIF .
ENDFORM. " convert_spool_to_pdf
FORM send_spool_app.
OPEN DATASET p_fname FOR OUTPUT IN BINARY MODE .
IF sy-subrc = 0.
LOOP AT i_pdf .
TRANSFER i_pdf TO p_fname.
ENDLOOP.
CLOSE DATASET p_fname .
MESSAGE s000 WITH p_fname.
ELSE.
MESSAGE e502(0u) WITH p_fname .
ENDIF.
endform.
This is a working code as we are using the same concept.
Hope it helped. -
How to store a file in application server with comma as a delimiter !!
<i>Hi,
I'm Creating a file in app. server using "open dataset" statment and populating the file using Transfer stmt.
I like to store the data fields with comma delimiter, since it normally fixed length.
Please let me know Any method available.
Thank You,
Senthil</i>No problem, just concatenate all your fields into one field separated by a comma. Then transfer that field only.
data: your_dataset type localfile default '/usr/sap/TST/SYS/Data1.txt'.
data: output type string.
open dataset your_dataset for output in text mode.
loop at itab.
concatenate itab-fld1
itab-fld2
itab-fld3
into output separated by ','.
transfer output to your_dataset.
endloop.
close dataset your_dataset.
REgards,
Rich Heilman -
How to move PDF file from Spool to Application Server?
How to move PDF file from Spool to Application Server?
Cannot use RSTXPDFT4 because that converts OTF to PDF and the file is already PDF.
RSTXPDFT5 doesn't work. It picks the file up and assigns it a 'text' type and outputs a 1 line txt (1kb in size) on the server with the spool number in it!
The program which outputs the file to the spool, in the first place, uses adobe forms and outputs to a printer of type PDF.Hi Gemini ,
Please refer the below links.
[http://sap.ittoolbox.com/groups/technical-functional/sap-hr/convert-a-spool-to-pdf-and-save-on-application-server-in-background-720959]
[http://www.sapfans.com/forums/viewtopic.php?f=13&t=325628&start=15]
Edited by: Prasath Arivazhagan on Apr 13, 2010 4:48 PM -
Read PDF Formatted Spool and write PDF File to Application Server
Hi Experts,
After ECC 6.0, HR-W2 and W2C Form Spools are getting generated in PDF format.
We have a requirement wherein we want to read the PDF Spool Programatically and write the PDF file to Application server (Using OPEN DATASET and CLOSE DATASET)
PARAMETERS : p_spono LIKE tsp01-rqident.
DATA: pdf_data type FPCONTENT.
types: lt_pdf_table(1000) type x.
data: l_pdf_data type standard table of lt_pdf_table,
l_pdf_line type lt_pdf_table,
l_offset type i,
l_len type i,
p_file(100) VALUE '\sapout\DVH\pdf2.pdf'.
*Read the spool content
CALL FUNCTION 'FPCOMP_CREATE_PDF_FROM_SPOOL'
EXPORTING
i_spoolid = p_spono
i_partnum = '1'
IMPORTING
e_pdf = pdf_data
* e_pdf_file = file
EXCEPTIONS
ads_error = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
* Modify the spool contents to prepare internal table
l_len = xstrlen( pdf_data ).
while l_len >= 1000.
l_pdf_line = pdf_data+l_offset(1000).
append l_pdf_line to l_pdf_data.
add 1000 to l_offset.
subtract 1000 from l_len.
endwhile.
if l_len > 0.
l_pdf_line = pdf_data+l_offset(l_len).
append l_pdf_line to l_pdf_data.
endif.
* GUI DOWNLOAD Works Fine
* Now pdf contents is ready , lets store in local PC
*CALL FUNCTION 'GUI_DOWNLOAD'
* EXPORTING
* filename = 'C:\Documents and Settings\Desktop\shital.pdf'
* filetype = 'BIN'
* TABLES
* data_tab = l_pdf_data.
OPEN DATASET p_file FOR OUTPUT IN BINARY MODE.
IF sy-subrc <> 0.
MESSAGE ID '00' TYPE 'E' NUMBER '398' WITH 'sy-subrc:' sy-subrc
' Error opening file:'(Z03) p_file.
ENDIF.
LOOP AT l_pdf_data INTO l_pdf_line.
TRANSFER l_pdf_line TO p_file.
ENDLOOP.
CLOSE DATASET p_file.
IF sy-subrc <> 0.
MESSAGE ID '00' TYPE 'E' NUMBER '398' WITH 'sy-subrc:' sy-subrc
' Error closing file:'(Z04) p_file.
ENDIF.
Currently as you can see I have commented out GUI_DOWNLOAD Function Module, But it works perfect when I try to Download file to Local Desktop.
But when I try to pass the same Contents to Application server file and then try to open it by downloading file then it opens BLANK pdf file.
As per requirements I should be able to write the file correctly on Application server and If I dowload it from there it should open PDF file correctly.
Let me know if you require further details about the issue.
Regards
Shital
Edited by: shital phadake on Apr 8, 2009 9:39 PMThanks Selçuk for your reply and taking time for understanding the Issue,
I went thru Functionality of the program you suggested but dont think it matches my requirement.
Regards
Shital -
Smartform into PDF and store in folder of application server
Hi Gurus,
I have to solve this issue please help meu2026
1.Convert Smartform into PDF and store in folder of application server
2.print the PDF stored in folder(Application Server) automatically
Please give suggestion for the above..
Moderator message: "spec dumping", please work yourself first on your requirement.
Edited by: Thomas Zloch on Oct 7, 2011 10:39 AMhi uma,
http://www.kodyaz.com/articles/sap-smartforms-download-as-smartform-pdf-using-ws_download-and-cl_gui_frontend_services.aspx
check this out...
thanks,
ram -
How To Store pdf or doc file in Oracle Database using Java Jdbc?
can any one help me out How To Store pdf or doc file in Oracle Database using Java Jdbc in JSP/Serlet? i tried like anything. using blob also i tried. but i am able 2 store images in DB not files. please if u know or else if u have some code like this plz send that to me, and help me out plz. i need that urgent.
Hi.. i am not getting error, But i am not getting the original contents from my file. i am getting all ASCII vales, instead of my original data. here i am including my code.
for Adding PDF in DB i used image.jsp
Database table structure (table name. pictures )
Name Null? Type
ID NOT NULL NUMBER(11)
IMAGE BLOB
<%@ page language="java" import="java.util.*,java.sql.*,java.io.*" pageEncoding="ISO-8859-1"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
PreparedStatement ps,pstmt,psmnt;
ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
File file =
new File("D:/info.pdf");
FileInputStream fs = new FileInputStream(file);
ps.setInt(1,4);
ps.setBinaryStream(2,fs,fs.available());
int i = ps.executeUpdate();
if(i!=0){
out.println("<h2>PDF inserted successfully");
else{
out.println("<h2>Problem in image insertion");
catch(Exception e){
out.println("<h2>Failed Due To "+e);
%>
O/P: PDF inserted successfully
i tried to display that pdf using servlet. i am giving the code below.
import java.io.IOException;
import java.sql.*;
import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class DispPDF extends HttpServlet {
* The doGet method of the servlet. <br>
* This method is called when a form has its tag value method equals to get.
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
public void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//response.setContentType("text/html"); i commented. coz we cant use response two times.
//PrintWriter out = response.getWriter();
try{
InputStream sPdf;
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
PreparedStatement ps,pstmt,psmnt;
psmnt = con.prepareStatement("SELECT image FROM pictures WHERE id = ?");
psmnt.setString(1, "4"); // here integer number '4' is image id from the table.
ResultSet rs = psmnt.executeQuery();
if(rs.next()) {
byte[] bytearray = new byte[1048576];
//out.println(bytearray);
int size=0;
sPdf = rs.getBinaryStream(1);
response.reset();
response.setContentType("application/pdf");
while((size=sPdf.read(bytearray))!= -1 ){
//out.println(size);
response.getOutputStream().write(bytearray,0,size);
catch(Exception e){
System.out.println("Failed Due To "+e);
//out.println("<h2>Failed Due To "+e);
//out.close();
OP
PDF-1.4 %âãÏÓ 2 0 obj <>stream x+är á26S°00SIá2PÐ5´1ôÝ BÒ¸4Ü2KüsSSS4C²ê Pkø$VãGÒU×713CkW )(Ü endstream endobj 4 0 obj <>>>/MediaBox[0 0 595 842]>> endobj 1 0 obj <> endobj 3 0 obj <> endobj 5 0 obj <> endobj 6 0 obj <> endobj xref 0 7 0000000000 65535 f 0000000325 00000 n 0000000015 00000 n 0000000413 00000 n 0000000168 00000 n 0000000464 00000 n 0000000509 00000 n trailer <<01b2fa8b70ac262bfa939cc786f8770c>]/Root 5 0 R/Size 7/Info 6 0 R>> startxref 641 %%EOF
plz help me out. -
Saving PDF file into application server
Dear all,
My requirement is retrieving a PDF file from application server and modifying the document and saving it back to the application server through BSP application.
I've retrieved the data from the application server and displayed it in the frame of BSP layout and modified the same (adding signature). We got stuck in saving back the signed document into the application server.
Can anyone guide me in saving back the modified document or how to get the modified file content through BSP.
Regards
SriniHi Friend,
Hope these links will help you ,
File Upload in BSP Applications and store in Application server
Re: How to Upload .TXT, BITMAP, .PDF files into a Data base Table.
Re: sapscript - pdf
With Regards,
SHARMILA BRINDHA.M -
Write PDF file into application server.
Hi Gurus,
I have created a smartform and converted into PDF using function module as given below. Now I want to write this generated PDF file into application server. I am not generating any spool request too. How can I proceed from here? Pls advice..
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
bin_filesize = lv_bin_filesize
TABLES
otf = ls_job_output_info-otfdata
doctab_archive = lt_docs
lines = lt_lines
EXCEPTIONS
err_conv_not_possible = 1
err_otf_mc_noendmarker = 2
OTHERS = 3.
Thanks..
Sajtransfer all the data from ur itabs to one final itab declared as follow
DATA: BEGIN OF final_itab OCCURS 0,
document TYPE string,
END OF final_itab.
then finally,
OPEN DATASET 'yourfile.pdf' FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
len = strlen( final_itab-DOCUMENT ).
TRANSFER final_itab-DOCUMENT TO 'yourfile.pdf' LENGTH len.
CLOSE DATASET 'yourfile.pdf'.
This ends the coding mate.
Enjoy it n have a good day.
Cheers -
How to create a directory in application server
Hi all,
How to create a directory in application server through Progaram??
eg:\tmp - is already existing
I want to create \tmp\fi
Within \tmp\fi - i should able to store my file,,,
Kindly help me urgent...Hello San,
Either contact Basis guys at ur end for the same or u can do it dynamically via a piece of ABAP code, i hope it wll help u.
call function 'GUI_CREATE_DIRECTORY'
exporting
dirname = '//<ip_address>/qfilesvr400/<host>/usr/sap/TST/SYS/Folder1'
exceptions
failed = 1
others = 2.
Reward If Helpful.
Regards
Sasidhar Reddy Matli. -
Retrieving PDF form from Application server
hi all,
i am saving a pdf form in application server and when the user wants the same file then i want to retrive that file from application and show the user and it should not be saved to presentation server only he should see it.
iam able to save it to presentation layer using gui_download but my requirement is not to save it show only display the form.
Thanks in advance,
Sree
helpful answers will be surely rewarded pointsHi,
1st solution - use DOI (desktop office integration). This way you can open Adobe, Microsoft, and others application documents directly in the SAP windows. See SAP document how to do it. It's not a little work, but it should fulfill your requirements.
2nd solution - share the folder with the PDF documents and then with shell command (start
server\folder\xxxxxx.pdf) at the front end access it and start the associated application at the frontend. I don't recommend this one, sharing folders at the appl.server is a security threat...
You know about the points and useful answers... -
Move pdf file into application server
Hi ABAP Gurus,
i want your valuable help in solving my problem.
i tried to create PDF file in application server and its creating as
PDF file in Application server..but i am unable to see the content in text ,
instead it is displaying in binary content...but when i tried to create
in presentation server i am able to see it as text in PDF file....
Can u please let me know whats wrong in my work and how to create a PDF file
in Application server with text content
with regards,
Gowri.Hi Gowri,
Check this example....
report ztest.
data: begin of itab occurs 0,
field(256),
end of itab.
data: dsn(100) value '/usr/sap/xfr/FIS/testpdf',
length like sy-tabix,
lengthn like sy-tabix.
call function 'GUI_UPLOAD'
exporting
filename = 'c:\temp\test.pdf'
filetype = 'BIN'
importing
filelength = length
tables
data_tab = itab.
open dataset dsn for output in binary mode.
loop at itab.
transfer itab-field to dsn.
endloop.
close dataset dsn.
clear itab.
refresh itab.
*- To crosscheck if it went well
open dataset dsn for input in binary mode.
do.
read dataset dsn into itab-field.
if sy-subrc = 0.
append itab.
else.
exit.
endif.
enddo.
call function 'GUI_DOWNLOAD'
exporting
filename = 'c:\temp\testn.pdf'
filetype = 'BIN'
bin_filesize = length
importing
filelength = lengthn
tables
data_tab = itab.
Or
Use the TCode
CG3Z or CG3Y
for downloading to Application Server.
Thanks,
Reward If helpful. -
How to delete a file from application server?
Hi gurus,
i want delete a file from application server . can any one tell me the BAPI/Fm .
thanks in advanceSee the replies of the thread;
How to delete File from the Application Server,ABAP
But i can smell something fishy in both The specified item was not found. and The specified item was not found. style of posting questions. Also both of you have similar questions in your profile....
Hmmm, Mods have to take care of the Rest...
Regards
Karthik D -
How deploy 6i Forms Fmx trought Application Server 10g
Hello every one,
Situation :
In my company, we have a software developed by a team using Oracle Forms 6i, the application is connected te Oracle 9i Database and every thing works well.
Problem :
I was able to upgrade the database from 9i to 10g. But my question : is it possible to deploy all the Forms (fmx 6i version) on Application Server 10g. I want to use the 3-tiers architecture.
Take note that i have not the fmb source files. Just the FMX (about 40 files)
If yes, can you explain also how to proceed (tools to install on Application Server) and how to setup the connection between the 3 tiers throught a LOCAL NETWORK.
Regards
KiraYou will at least need to recompile all those *.fmb to *.fmx in the version of the App server you will be using.
We have a forms6 c/s application we are migrating to forms 11g and it almost that easy (except for changes in how you launch reports).
The application server is setup alot like the client/server side of forms is, it needs a tnsnames.ora that points to the database and it needs to know where you will be storing the forms and report. Looks for any *.fmx and that will be the default location.
Maybe you are looking for
-
hi - my Mu was "buggy" and would not update - so i threw the APP in the trash - but now CC will not allow me to Re-Install because it thinks i already have the APP - any advice?
-
What are the reasons why Server Assistant won't detect Auto Server Setup ?
Hi there, I've been having issues with Auto Server Setup mechanism (the mechanism that allows an administrator to install a machine without human user interaction). I actually have the answer to my post question but I post it anyway because it might
-
I want to update SAP standard tables
Hi, I want to update SAP tables using BAPI. can you please suggest me how can i do this and which BAPI i should use for that purpose. I want to update KNVV , FKKMAKO , FKKVKP table.
-
How can I change my name in mailaccount
When I send a mail my recipient sees my whole first name. Can I change this?
-
Jawin mshtml read a html page using the MS IE
is there some place I can find jawin codes to handle MSHTML.dll i'm new to jawin and seem to see a big library that is relatively empty