How to save sap script output in pdf document
hi abapers
how to save the output of sap script in sap so that can retrieve the saved document later.
i have to save the rcia output from sap script in pdf document in sap so that it can be retrieved later
how to use dms
PDF Creation + connection to DMS
cheers
Aveek
Similar Messages
-
To convert Sap Script output to PDF format and send it via email.
Hi Friends,
Could any one please tell me, how to convert the Sap Script output to PDF format and send it via email. If any one have the code, kindly mail me to [email protected]
Thanks & Regards,
JohnPlese check this sample code from other thread.
REPORT zzz_jaytest .
Types Declaration
TYPES : BEGIN OF ty_pa0001,
pernr TYPE pa0001-pernr,
bukrs TYPE pa0001-bukrs,
werks TYPE pa0001-werks,
END OF ty_pa0001.
Internal Table Declaration
DATA : i_pa0001 TYPE STANDARD TABLE OF ty_pa0001, "For pa0001 Details
i_otf TYPE STANDARD TABLE OF itcoo, "For OTF data
i_content_txt TYPE soli_tab, "Content
i_content_bin TYPE solix_tab, "Content
i_objhead TYPE soli_tab,
Work Area Declaration
w_pa0001 TYPE ty_pa0001, "For pa0001 Details
w_res TYPE itcpp, "SAPscript output
"parameters
w_otf TYPE itcoo, "For OTF
w_pdf TYPE solisti1, "For PDF
w_transfer_bin TYPE sx_boolean, "Content
w_options TYPE itcpo, "SAPscript output
"interface
Variable Declaration
v_len_in TYPE so_obj_len,
v_size TYPE i.
Constants Declaration
CONSTANTS : c_x TYPE c VALUE 'X', "X
c_locl(4) TYPE c VALUE 'LOCL', "Local Printer
c_otf TYPE sx_format VALUE 'OTF', "OTF
c_pdf TYPE sx_format VALUE 'PDF', "PDF
c_printer TYPE sx_devtype VALUE 'PRINTER', "PRINTER
c_bin TYPE char10 VALUE 'BIN', "BIN
c_name TYPE string VALUE 'C:\ZZZ_JAYTEST.PDF',"Downloading
"File Name
c_form(11) TYPE c VALUE 'ZZZ_JAYTEST'. "Form Name
START-OF-SELECTION.
Selecting the records from pa0001
SELECT pernr bukrs werks FROM pa0001
INTO TABLE i_pa0001 UP TO 10 ROWS.
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
Opening the form
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = c_form
device = c_printer
language = sy-langu
OPTIONS = w_options
IMPORTING
RESULT = w_res.
LOOP AT i_pa0001 INTO w_pa0001.
Writting into the form
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'MAIN'
window = 'MAIN'.
ENDLOOP.
Closing the form
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.
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.
The extension is put the it_mailpack-obj_name parameter of 'SO_NEW_DOCUMENT_ATT_SEND_API1'. -
Hi All,
I have one report prg wich gives op in sap script.
I want same output in pdf and have to save on hard disk.
please suggest me wat procedure i have to follow.
It's urgentA very common requirement for programmers writing ABAP code for printing using SAPScript Forms is to redirect output to a PDF (Adobe Acrobat) file. I struggled for a few days trying to find a solution to this. Though I found quite a few examples on the web, it was difficult figuring out which technique was optimal. This tip is borne out of these struggles.
This is an example of how to use ABAP code to save output of a print routine using a SAPScript form into PDF format and also display it within the SAP frontend itself. This routine proves extremely useful to provide users the ability to save local copies of output and preview it within the user-friendly Acrobat Reader control, all without leaving the SAP frontend or your program. Since function modules are used, the code is portable and this technique can be used in any other ABAP program as well.
Two function modules, Z_DS_CREATE_LOCAL_PDF_FILE and Z_DS_CALL_PDF_VIEWER need to be created. I have used a function group called Z5_DS_PDF for this purpose. The function group contains the ABAP objects code for declaration and implementation of a class that encapsulates the Acrobat application functionality. The function group also contains a screen '0901', that epresents our PDF viewer and one PBO and one PAI block for the same screen.
Note: The following example has been stripped of essential error-handling for the sake of simplicity and the programmer is assumed to possess knowledge of creation of function groups, function modules, screens and SAPScript forms. ABAP objects or custom controls knowledge is not mandatory. Be patient when trying this out and follow all instructions thoroughly. The results will be worth the effort.
Steps to follow to get this example running:
1) Create a function group (Example : Z5_DS_PDF)
2) Define the top include and place the code listed below into it (LZ5_DS_PDFTOP)
3) Create screen '0901' in function group with three elements:
a) Pushbutton CLOSE at the top with function code 'CLO' (this is to exit preview screen)
b) Custom control container (Large- spanning entire screen) named MY_CONTAINER
c) The customary OK code field called OK_CODE
Note: The names of the elements should be exactly as described above
4) Create one output and one input module in the flow logic of screen '0901' for which the code is provided below
5) Define two function modules with the following signatures:
a) FUNCTION Z_DS_CREATE_LOCAL_PDF_FILE
EXPORTING
REFERENCE(AFILENAME) LIKE RLGRAP-FILENAME
TABLES
OTF_LINES STRUCTURE ITCOO
b) FUNCTION Z_DS_CALL_PDF_VIEWER
IMPORTING
VALUE(FILENAME) TYPE STRING
Code is provided below.
6) Compile and activate the function group
7) Create a simple SAPScript form with one page and one window
8) Define one element in the text for the main window called 'HELLO' and some static text in it
9) Check and activate the form
10) Create the example program (Example : Z5_DS_SCRIPT2PDF) with the below code
11) Run the example
NOTES: I tested this code in R/3 version 4.6C but it should work in all 4.6 setups. I'm pretty sure some of the ABAP objects code I have used may not work with R/3 4.0 versions and earlier. Also, it works perfectly only when Acrobat Reader is installed on the presentation server. I have checked it with Acrobat versions 4 and 5 but I haven't had the opportunity to check it with Acrobat Reader 6.
Code
Code inside top include LZ5_DS_PDFTOP of function group Z5_DS_PDF
FUNCTION-POOL Z5_DS_PDF. "MESSAGE-ID ..
CLASS CL_GUI_PDF DEFINITION *
CLASS CL_GUI_PDF DEFINITION
INHERITING FROM CL_GUI_CONTROL.
PUBLIC SECTION.
TYPES:
COL_TYPE TYPE INT4.
METHODS:
CONSTRUCTOR
IMPORTING
!PARENT TYPE REF TO CL_GUI_CONTAINER
VALUE(SHELLSTYLE) TYPE I OPTIONAL
VALUE(DISP_MODE) TYPE I OPTIONAL
VALUE(LIFE_TIME) TYPE I OPTIONAL
VALUE(NAME) TYPE STRING OPTIONAL
EXCEPTIONS
CNTL_ERROR
CNTL_INSTALL_ERROR.
METHODS:
LOADFILE
IMPORTING
VALUE(FILENAME) TYPE STRING
EXCEPTIONS
FILE_NOT_FOUND.
METHODS:
REFRESH.
METHODS:
DISPATCH REDEFINITION.
ENDCLASS.
DATA: MY_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
DATA: MY_PDF TYPE REF TO CL_GUI_PDF.
data: ok_code like sy-ucomm.
data: file_name type string.
custom control class implementation
CLASS CL_GUI_PDF IMPLEMENTATION.
METHOD CONSTRUCTOR.
DATA:
CTRL_NAME(80) TYPE C.
IF NOT CL_GUI_OBJECT=>ACTIVEX IS INITIAL.
CTRL_NAME = '{CA8A9780-280D-11CF-A24D-444553540000}'.
ELSE.
RAISE CNTL_ERROR.
ENDIF.
CALL METHOD SUPER->CONSTRUCTOR
EXPORTING
CLSID = CTRL_NAME
SHELLSTYLE = SHELLSTYLE
PARENT = PARENT
LIFETIME = LIFE_TIME
NAME = NAME
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
OTHERS = 2.
CASE SY-SUBRC.
WHEN 1.
RAISE CNTL_INSTALL_ERROR.
WHEN 2.
RAISE CNTL_ERROR.
ENDCASE.
CALL METHOD CL_GUI_CFW=>SUBSCRIBE
EXPORTING
REF = ME
SHELLID = ME->H_CONTROL-SHELLID
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC NE 0.
RAISE CNTL_ERROR.
ENDIF.
ENDMETHOD.
METHOD LOADFILE.
CALL METHOD ME->CALL_METHOD
EXPORTING
METHOD = 'LoadFile'
P_COUNT = 1
P1 = FILENAME.
ENDMETHOD.
METHOD REFRESH.
CALL METHOD ME->CALL_METHOD
EXPORTING
METHOD = 'Refresh'
P_COUNT = 0.
ENDMETHOD.
METHOD DISPATCH.
CALL METHOD CL_GUI_CFW=>FLUSH.
IF SY-SUBRC NE 0.
RAISE CNTL_ERROR.
ENDIF.
ENDMETHOD.
ENDCLASS.
End of code for LZ5_DS_PDFTOP
Code for Function Module Z_DS_CREATE_LOCAL_PDF_FILE
FUNCTION Z_DS_CREATE_LOCAL_PDF_FILE .
""Local interface:
*" EXPORTING
*" REFERENCE(AFILENAME) LIKE RLGRAP-FILENAME
*" TABLES
*" OTF_LINES STRUCTURE ITCOO
DATA: PDF_LINES
LIKE TLINE OCCURS 1000 WITH HEADER LINE,
ARCH LIKE TOA_DARA, NO_LINES TYPE I.
CALL FUNCTION 'CONVERT_OTF'
EXPORTING
FORMAT = 'PDF'
IMPORTING
BIN_FILESIZE = NO_LINES
TABLES
OTF = OTF_LINES
LINES = PDF_LINES.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
BIN_FILESIZE = NO_LINES
FILENAME = 'c:test.pdf'
FILETYPE = 'BIN'
IMPORTING
ACT_FILENAME = AFILENAME
TABLES
DATA_TAB = PDF_LINES.
ENDFUNCTION.
End of Code for Z_DS_CREATE_LOCAL_PDF_FILE
Code for Function Module Z_DS_CALL_PDF_VIEWER
FUNCTION Z_DS_CALL_PDF_VIEWER .
""Local interface:
*" IMPORTING
*" VALUE(FILENAME) TYPE STRING
FILE_NAME = FILENAME.
IF MY_CONTAINER IS INITIAL.
CREATE OBJECT MY_CONTAINER
EXPORTING
CONTAINER_NAME = 'MY_CONTAINER'.
CREATE OBJECT MY_PDF
EXPORTING
NAME = 'MY_PDF'
PARENT = MY_CONTAINER.
ENDIF.
CALL SCREEN 901. " Ensure screen is created as per instructions
ENDFUNCTION.
End of Code for Z_DS_CALL_PDF_VIEWER
Flow Logic for screen '0901'
PROCESS BEFORE OUTPUT.
MODULE INIT.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0901.
End of Flow Logic for screen '0901'
PBO module INIT for screen '0901'
MODULE init OUTPUT.
call method my_pdf->loadfile
exporting filename = file_name.
ENDMODULE. " init OUTPUT
End of PBO module INIT for screen '0901'
PAI module USER_COMMAND_901 for screen '0901'
MODULE USER_COMMAND_0901 INPUT.
case ok_code.
when 'CLO'.
set screen 0.
endcase.
ENDMODULE. " USER_COMMAND_0901 INPUT
End of PAI module USER_COMMAND_901 for screen '0901'
Example program Z5_DS_SCRIPT2PDF
*& Report Z5_DS_SCRIPT2PDF *
*& This report works only if the function modules *
*& Z_DS_CREATE_LOCAL_PDF_FILE and Z_DS_CALL_PDF_VIEWER already exist *
*& Also use an already existing simple SAPScript Form that contains a *
*& window "MAIN" and rework printing code if necessary, remember to *
*& change the output device name in OPTIONS-TDDEST *
REPORT Z5_DS_SCRIPT2PDF.
PARAMETERS: FORM LIKE RSSCF-TDFORM DEFAULT 'Z5_DS_HELLO2'. "your form
DATA: OTF_LINES LIKE ITCOO OCCURS 1000 WITH HEADER LINE,
OPTIONS TYPE ITCPO, FILENAME LIKE RLGRAP-FILENAME,
FILENAME_S TYPE STRING.
START-OF-SELECTION.
OPTIONS-TDDEST = 'LP01'.
Replace 'LP01' above with your default output device
OPTIONS-TDCOPIES = 1.
OPTIONS-TDGETOTF = 'X'. " the key to returning OTF data
Open the SapScript Form with the name "form" *
CALL FUNCTION 'OPEN_FORM'
EXPORTING
FORM = FORM " name of form (SE71)
OPTIONS = OPTIONS
DIALOG = ' '.
Execute the element "HELLO" in window MAIN
- Nothing happens if /E HELLO is not declared in MAIN
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'HELLO' "execute element /E HELLO
TYPE = 'BODY'. "normal output
Close the current SapScript Form
CALL FUNCTION 'CLOSE_FORM'
TABLES
OTFDATA = OTF_LINES. " Retrieve all the OTF so far
Code for PDF Formatting and creation of local File
CALL FUNCTION 'Z_DS_CREATE_LOCAL_PDF_FILE'
IMPORTING
AFILENAME = FILENAME
TABLES
OTF_LINES = OTF_LINES.
FILENAME_S = FILENAME.
Code to launch Adobe Acrobat inplace in SAPGUI
CALL FUNCTION 'Z_DS_CALL_PDF_VIEWER'
EXPORTING
FILENAME = FILENAME_S.
End of example program Z5_DS_SCRIPT2PDF -
Converting sap script output into pdf format?
Hi all,
I have modified the standard purchase order script form MEDRUCK . Now i need to generate the output into pdf format.
This is not only limited to spool requests , But also when the user creates the purchase order and clicks on print or print preview the output should be in pdf format.
Please help on where and what code has to be written for this requirement?
Thanks,
Aravind.Hi
I don't know which is your release, but I don't think it's possible to create a preview in pdf format, but u can create a pdf file instead of the spool and then open it automatically, this is an example:
- A) Open form
IF P_PDF = 'X'.
XDEVICE = 'PRINTER'.
* Get OTF
ITCPO-TDGETOTF = 'X'.
ENDIF.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = XDEVICE
DIALOG = 'X'
FORM = 'ZFI_CL_EC_MOVI'
OPTIONS = ITCPO
MAIL_SENDER = LVS_SENDER
MAIL_RECIPIENT = LVS_RECIPIENT
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
OTHERS = 11.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
B) Close FORM
CALL FUNCTION 'CLOSE_FORM'
TABLES
OTFDATA = T_OTF
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE I208(00) WITH 'Errore chiusura stampa'(A02).
ELSE.
PERFORM DOWNLOAD_PDF.
ENDIF.
C) Create PDF and open it:
FORM DOWNLOAD_PDF.
DATA: BIN_FILESIZE TYPE I.
DATA: T_FILE_PDF TYPE STANDARD TABLE OF TLINE,
DOCTAB_ARCHIVE TYPE STANDARD TABLE OF DOCS.
DATA: FILE_TABLE TYPE FILETABLE WITH HEADER LINE.
DATA: RC TYPE I,
USER_ACTION TYPE I.
DATA: TITLE TYPE STRING,
FILENAME TYPE STRING.
CHECK P_PDF = 'X'.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
BIN_FILESIZE = BIN_FILESIZE
TABLES
OTF = T_OTF
DOCTAB_ARCHIVE = DOCTAB_ARCHIVE
LINES = T_FILE_PDF
EXCEPTIONS
ERR_CONV_NOT_POSSIBLE = 1
ERR_OTF_MC_NOENDMARKER = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE I208(00) WITH 'Errore conversione PDF'(A03).
EXIT.
ENDIF.
TITLE = 'Creare File'(T02).
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = TITLE
DEFAULT_EXTENSION = '*.pdf'
CHANGING
FILE_TABLE = FILE_TABLE[]
RC = RC
USER_ACTION = USER_ACTION
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE I208(00) WITH 'Errore creazione PDF'(A04).
EXIT.
ELSE.
IF USER_ACTION = 9. EXIT. ENDIF.
IF RC = 1.
READ TABLE FILE_TABLE INDEX 1.
ENDIF.
ENDIF.
MOVE FILE_TABLE-FILENAME TO FILENAME.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
BIN_FILESIZE = BIN_FILESIZE
FILENAME = FILENAME
FILETYPE = 'BIN'
CHANGING
DATA_TAB = T_FILE_PDF
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE I208(00) WITH 'Errore creazione PDF'(A04).
EXIT.
ELSE.
MESSAGE S208(00) WITH 'File creato con successo'(S01).
ENDIF.
CHECK P_OPEN = 'X'.
CALL FUNCTION 'CALL_BROWSER'
EXPORTING
URL = FILE_TABLE-FILENAME
EXCEPTIONS
FRONTEND_NOT_SUPPORTED = 1
FRONTEND_ERROR = 2
PROG_NOT_FOUND = 3
NO_BATCH = 4
UNSPECIFIED_ERROR = 5
OTHERS = 6.
IF SY-SUBRC <> 0.
MESSAGE S208(00) WITH 'Impossibile aprire file'(A05).
ENDIF.
ENDFORM. " DOWNLOAD_PDF
Max -
SAP Script output to RTF document
Hi Team,
We have a requirement of converting the SAPSCRIPT output to RTF document.
I have seen some documents like BC - Word-Processing in the SAPscript Editor for this.
But i could not clearly understand how to do it.
Could please help me out by providing an overview of the process involved.
Thanks & Regards,
Vamsi.
Edited by: Vamsi Krishna on Jul 7, 2010 12:42 PMHi,
Check the links below it might help you.
Sending Sapscript as mail with multiple attachments
Re: send sap script to client through mail
Sending Sapscript as mail with multiple attachments
Thanks & regards,
Neela -
How to save ONE single page of pdf document?
I have a 115 page pdf document that I can open in Adobe Reader. I want to email just ONE page of this file to someone. How do I save just that one page from the file (as opposed to sending the entire pdf document)?
I know, lame question. Thanks for any help!
AngelaIf you're on a mac forget about Acrobat on Lion (maybe even Snow Leopard and Leopard too). I ran into this issue on Lion so here I am....
you have to go through the routine of "printing to",, With Acrobat go to the printer preferences panel > select pdf, select save as pdf... only to find you cannot and get some even more riduclous and useless pop up telling you to chose file save as.... which only lets you save the entire document! Utter
waste of time and space...and not what you are after.
Solution... Open the pdf with Preview, then Cmd + P will bring up the same dialog box mentioned above with pdf down bottom left... First enter the page number into the pages option's From dialog... eg From 40 to 40 (= page 40 only) then hit the pdf bitton and dave as,,, Works perfectly with Preview but no chance with Acrobat!!!! I am starting to get the feeling that this product is fast becoming redundant as it seemingly is not up to basic operations such as printing or saving off a single page anymore. Plenty of freeware solutions are now available on the net - some of which I am quite sure would handle this... but since preview is installed on mac by default.... why not?
After all this have a good think abou whether you will or even need to Upgrade Acrobat the next time round. It seems the more 'advanced' Adobe get the more useless certain products are becoming.... Don't know if it's just me...
UPDATED Sept 11
Seems there is a way to print a single page with Acrobat X.. but not at all as straightforward as mentioned above...
You need to go View>Tools> Extract, then select the page you want and save it as a seperate pdf. Then open the new pdf and print that... Wonderfully intuitive on Adobe' s part.... -
How To send SAP SCRIPT AS an email.
Hi,
Any one knows how to send sap script output to users in the form of an email.
Is there any other way to send it apart from sending the script output to spool and converting the spool to PDF and send that PDF to user?
It would it helpful for me if u can let me know any peace of code as an example for the same.
Message was edited by: NarasimhaHi,
This may be too late but here is a really easy way
Here is a snippet of code that will help you out.
You can use the OPEN_FORM of the SAPscript to have a device type of MAIL instead of PRINTER
Form OPEN_FORM
Open SAPscript form to send to user
FORM OPEN_FORM .
*--- Set recipient
GW_COMM_VALUES-ADSMTP-SMTP_ADDR = '[email protected]'.
*--- Set NAST details as these will not currently be set....
CLEAR GW_SNAST.
GW_SNAST-ANZAL = 1.
GW_TITLE = 'Mail Header Title'.
MOVE GW_TITLE TO GW_SNAST-TDCOVTITLE.
*--- Set sender and recipient details
CALL FUNCTION 'CONVERT_COMM_TYPE_DATA'
EXPORTING
PI_COMM_TYPE = 'INT'
PI_COMM_VALUES = GW_COMM_VALUES
PI_REPID = SY-REPID
PI_SNAST = GW_SNAST
PI_MAIL_SENDER = SY-UNAME
IMPORTING
PE_ITCPO = GW_ITCPO
PE_MAIL_RECIPIENT = GW_RECIPIENT
PE_MAIL_SENDER = GW_SENDER
EXCEPTIONS
COMM_TYPE_NOT_SUPPORTED = 1
RECIPIENT_CREATION_FAILED = 2
SENDER_CREATION_FAILED = 3
OTHERS = 4.
*--- Open SAPscript in MAIL mode for e-mailing
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = 'MAIL'
DIALOG = 'X'
FORM = SapScript Form Name
LANGUAGE = SY-LANGU
OPTIONS = GW_ITCPO
MAIL_SENDER = GW_SENDER
MAIL_RECIPIENT = GW_RECIPIENT
EXCEPTIONS
CANCELED = 1
DEVICE = 2
FORM = 3
OPTIONS = 4
UNCLOSED = 5
MAIL_OPTIONS = 6
ARCHIVE_ERROR = 7
INVALID_FAX_NUMBER = 8
MORE_PARAMS_NEEDED_IN_BATCH = 9
SPOOL_ERROR = 10
CODEPAGE = 11
OTHERS = 12.
When you have finished your SAPscript and call function CLOSE_FORM make sure you do a COMMI WORK after the call of this function.
You should then see the mail created in SOST.
Kind regards
Colin -
Sending SAP Script output as a PDF attachment through mail
Dear Guru,
I am using SAP 4.0B version, DATABASE Oracle 8i, OS is sun solaris 7.5.
I want to send SAP script output as a
PDF attachement through mail.Please suggest a solution.
Regards,
RajeshHi Rajesh,
In your print program, while calling OPEN_FORM, pass options-TDGETOTF = 'X'. This is used for returning print output in OTF format.
Then in CLOSE_FORM, get the table OTFDATA returned from the function module. for example
DATA: OTF_DATA LIKE ITCOO OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = RESULT
TABLES
OTFDATA = OTF_DATA.
now you can convert this OTF data to PDF using function module CONVERT_OTF
Then send this data as attachment to a mail using function module SO_NEW_DOCUMENT_ATT_SEND_API1
Regards,
Komal. -
Reg: Script Output in PDF form
Hai..
Can anybody tell me how we will get script output
(P.order output) in PDF format and we need to downlaod this PDF to our local drives. plz tell me the function modules to be used for this requirement and paste the code if any of you worked on this earlier..
RegardsCheck this link for sample program.
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/49e15474-0e01-0010-9cba-e62df8244556
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/downloadSAPScriptoutputtoPDF+file.&
Function Module: CONVERT_OTF
Regards,
Maha -
Convert SAP spool output to PDF
I have created program running in background to convert SAP spool output to PDF using function CONVERT_ABAPSPOOLJOB_2_PDF .
It has been working fine untill I have SAP spool contained > 99 pages. It has a dialog pop up asking to run it in background.
If I clicked YES, the function generated another background job and another spool.
Also the returned table PDF contained no data.
But it is ok when click NO. The program can generate PDF file.
My problem is I want to set this program as job, so it will not generate PDF file when SAP spool contained > 99 pages.
Has anyone experienced about this problem? or know how to convert to PDF from SAP spool (>99 pages)?
Thank you in Advance.Hi,
Use the FM convert_otfspooljob_2_pdf
see this link for example Re: Download in PDF format
"Do not use CONVERT_ABAPSPOOLJOB_2_PDF for script or Smartforms
Prabhudas -
How to download the script data into pdf file
how to download the script data into pdf file
i have one option to download the script data to pdf file --->rstxpdft4 program.
i have one doubt how to use this proogram.or any function module to download the script data to pdf file.
Thanks and regards,
Sri.Hi Sri Sai,
I know one method to convert the sapscript to pdf file :
first generate a Spool Request for the required Sapscript
then goto transaction SP01 and copy the generated Spool Request number
now execute the SAP report RSTXPDFT4
here enter the copied Spool request number and the target directory into the parameters
execute the report
required pdf file will be generated into the target directory
i hope it will help you out
Please refer this simple program:
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
Reward points if found helpful....
Cheers,
Eshwar. -
How to create sap scripts? script is a language how to create script ?
how to create sap scripts?
script is a language how to create script ?hi ,
step by step procedure.
SAP Scripts
http://www.sap-img.com/sapscripts.htm
http://sappoint.com/abap/
http://www.henrikfrank.dk/abapexamples/SapScript/sapscript.htm
http://help.sap.com/saphelp_crm40/helpdata/en/16/c832857cc111d686e0000086568e5f/content.htm
http://www.sap-basis-abap.com/sapabap01.htm
http://www.sap-img.com/sapscripts.htm
http://searchsap.techtarget.com/tip/1,289483,sid21_gci943419,00.html
http://sap.ittoolbox.com/topics/t.asp?t=303&p=452&h2=452&h1=303
http://www.sapgenie.com/phpBB2/viewtopic.php?t=14007&sid=09eec5147a0dbeee1b5edd21af8ebc6a
Other Links
http://www.virtuosollc.com/PDF/Get_Reporter.pdf
http://help.sap.com/saphelp_47x200/helpdata/en/da/6ada3889432f48e10000000a114084/frameset.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/66/bc7d2543c211d182b30000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/5b/d22cee43c611d182b30000e829fbfe/frameset.htm
http://www.virtuosollc.com/PDF/Get_Reporter.pdf
http://help.sap.com/saphelp_47x200/helpdata/en/da/6ada3889432f48e10000000a114084/frameset.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/66/bc7d2543c211d182b30000e829fbfe/frameset.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/5b/d22cee43c611d182b30000e829fbfe/frameset.htm
http://www.thespot4sap.com/Articles/Code_CostCentreReport.asp
http://www.allsaplinks.com/dialog_programming.html
http://help.sap.com/saphelp_webas630/helpdata/en/9f/db9cdc35c111d1829f0000e829fbfe/frameset.htm
http://www.allsaplinks.com/files/using_table_in_screen.pdf
http://www.geocities.com/ZSAPcHAT
http://www.sappoint.com/abap/ssintro.pdf
http://www.sappoint.com/abap/sscript.pdf
http://www.sappoint.com/abap/sscript.pdf
http://www.sappoint.com/abap/lsetssap.pdf
http://www.sappoint.com/abap/sscrtpex1.pdf
http://www.sap-img.com/sapscripts.htm
http://www.thespot4sap.com/Articles/SAPscript_Introduction.asp
http://www.sapbrain.com/TUTORIALS/TECHNICAL/SAPSCRIPTS_tutorial.html
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCRPROG/BCSRVSCRPROG.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCRRDI/BCSRVSCRRDI.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVSCREDIT/BCSRVSCREDIT.pdf
http://www.sappoint.com/abap/sscrtpex1.pdf
http://www.sap-img.com/sapscripts.htm
http://www.esnips.com/doc/1ff9f8e8-0a4c-42a7-8819-6e3ff9e7ab44/sapscripts.pdf
sri -
How to Migrate SAP Scripts to Adobe form
Hi,
Can yo uplease tell me step by step how to convert/migrate SAP Script to Adobe forms.
Thanks,
Rajeev GuptaHi
Transforming SAP Scripts - > Smartform -> Adobe Forms is the right way.
refer this thread...
[Re: Convert SAP Scripts to Adobe PDF Forms|Re: Convert SAP Scripts to Adobe PDF Forms]
Regards
Raj
Edited by: Rajasekhar Dinavahi on Dec 9, 2008 5:25 AM -
Regarding SAP Script Output validation in Layout set
Hi All,
I have a issue in SAP Script Output.
I have a <b>Standard Print Program</b>. and layout set.
I can do validations only in Layout set.
The actual issue is i have a <b>internal table field</b> in <b>print program</b> that i am displaying in <b>layout set</b>. Now i want it to be subtracted with number <b>20</b>, since i can not edit code in <b>Print Program</b>. i want to subtract that internal table field with 20 in layout set itself.
Can anybody tell me how can i solve this issue.
<b>Note:</b> I need to do calculation only in layout set.
Can anybody give me the solution.
Thanks in advance.
Thanks & Regards,
Rayeez.Hi,
Thanks for that reply.
so with <b>SUMMING</b> command i can do calculation.
I am already having <b>i_tab1-sum</b> coming from print program and i have declared one symbol using
DEFINE &v_val& = 20 in layout set.
Then i want to subtract &v_val& with &i_tab1-sum&.
using the follow syntax tell me wether syntax is correct or not.
SUMMING &i_tab1-sum&-&v_val& INTO &i_tab1-sum&.
will it work.
once again thanks for that reply.
Thanks & Regards,
Rayeez. -
Download Sap script output in XL.
hi all,
can anybody plz tell me that is there any possibility to download SAP script output in editable XL format? actually i got a new requirement in my company so plz can anybody help me for this?
regards saurabh.Hi, Below code used for convert output into PDF format. May be you can convert into XL.
In close form, collect output data into OTF format.
call function 'CLOSE_FORM'
TABLES
otfdata = it_otfdata
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
others = 4.
if sy-subrc <> 0.
PERFORM protocol_update.
retcode = 1.
endif.
call function 'CONVERT_OTF'
EXPORTING
format = c_pdf
IMPORTING
bin_filesize = h_size
TABLES
otf = it_otfdata
lines = it_pdf
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
others = 4.
if sy-subrc <> 0.
MOVE sy-subrc TO h_retcode.
endif.
perform table_shift.
form table_shift.
describe table it_pdf lines hltlines.
DESCRIBE FIELD IT_PDF LENGTH FLE1 in character mode.
DESCRIBE FIELD X_OBJCONT LENGTH FLE2 in character mode.
clear x_objcont.
refresh x_objcont.
clear off1.
clear hfeld.
loop at it_pdf.
htabix = sy-tabix.
move it_pdf to hfeld+off1.
if htabix = hltlines.
fle1 = strlen( it_pdf ).
endif.
off1 = off1 + fle1.
if off1 ge fle2.
clear x_objcont.
x_objcont = hfeld(fle2).
append x_objcont.
shift hfeld by fle2 places.
off1 = off1 - fle2.
endif.
if htabix = hltlines.
if off1 gt 0.
clear x_objcont.
x_objcont = hfeld(off1).
append x_objcont.
endif.
endif.
endloop.
endform. " TABLE_SHIFT
Maybe you are looking for
-
Can no longer send mail with Airport Extr
I can no longer send e-mail with Mac Mail.This problem cropped up all of sudden this morning. The problem appears to be with my Airport Extreme. If I bypass the router and go straight to the modem, I am able to send mail. After I connect the Extreme
-
Brand new Ipod Touch can't been seen in Itunes
Hi there, I hope someone can help as this is driving me mad! I have just received a brand new Ipod TOuch but when I connect it to my PC per the installation instructions I get the following message "Itunes could not connect to the Iphone because an i
-
How do I get QT movies into iMovie 8 ?
I captured some screen video using Snapz Pro X, edited them in QT Pro. I have tried to import and drag them into iMovie 8 and have not been . What am I doing wrong?
-
Acrobat 7-how to keep author name in Note Tool permanently blank?
One of my main uses for Acrobat is to review academic documents, which is meant to be done anonomously. When I use Tools>Commenting>NoteTool, my login name appears in the Note Tool box, even though I have deselected "Always use Log-in name for author
-
Hi, I always thought that I would never get to play Battlefield 2 on a Mac. However, I almost bricked my pants when I saw the title of this 4min movie. http://video.google.com/videoplay?docid=8761684797348166748&q=battlefield+2 Can any Techies out th