Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
ASinha
Newcomer

This is a blog on a topic which I assume has been discussed numerous times before as well. Since it took some digging on my side to find the solution to the requirement; I wanted to accumulate my findings.

I got a requirement to transfer a SAP SCRIPT to FTP Server as a PDF file. This should also hold true for Smart-forms as well.

 

  1. The SAP Script is generated using FMs OPEN_FORM / CLOSE_FORM.

The CLOSE_FORM has a exporting parameter 'RESULT' as shown below.

ASinha_0-1709111970170.png

 

The result parameter is of type ITCPP.  We will use the ITCPP-TDSPOOLID value, which carries the spool request number.

 

  1. To convert the Spool request number to PDF data we will use  CONVERT_OTFSPOOLJOB_2_PDF Function module as shown below:

ASinha_1-1709111970171.png

At this moment , the LT_PDF_DATA contents can be used to download the form in PDF format.

However, we will stick to our requirement and proceed to transfer the file to FTP Server.

 

  1. We will use OPEN/CLOSE DATASET to create the file into Application Server. And SUBMIT report RSFTP002 for uploading the file to desired FTP destination.

Here do not forget to use BINARY MODE , since TEXT MODE will not work.

ASinha_2-1709111970173.png

 

  1. Next I had created a variant for calling the report mentioned above via SUBMIT keyword. Details are as shown below:

ASinha_3-1709111970173.png

 

 

Command 3 should be dynamically determined before SUBMIT is called which carries the 'put' command with both the target and source file. Eg:

 

put /usr/tmp/source.pdf destination.pdf

ASinha_4-1709112147163.png

 

---------------------------------------------------------------------------------------------------------------------------------------------

NOTE: Since I had to generate the file in background, I used the RFC destination as SAPFTPA instead of SAPFTP.

Also, I had tried to upload the file from presentation server to FTP after downloading using GUI_DOWNLOAD; unfortunately the approach did not work since SAPFTPA expects data(source file) to be present in the application server(AL11 Folder).

Labels in this area