Regarding SAP SCRIPT output
Hi,
I have some requirement in SAP SCRIPT.
When i will generate print preview for some specific document Ex:Purchase Order using its respective Transaction Code[ME22N], That Print Preview[output] need to be stored other formats such as [PDF,.doc,... etc].
How can we do it!
By using some settings!
Without writing any code[Function Module] from ABAP[SE38].
Can any body solve my problem!
Thanks & Regards,
Rayeez.
Hi,
You can convert a spool request to pdf format using report RSTXPDFT4 without writing any code.
Svetlin
Similar Messages
-
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. -
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'. -
Dispalying SAP script output in landscape format
Hello All,
Could anyone please tell me the step by step process to display a SAP Script output in landscape format?
Also is it possible to display a column name in 2 lines if it does not fit into 1 line.
Regards
Indrajit.Hi,
Here is the way to print the SAPSCRIPT in landscape ..
Goto SE71, then give you layout name then press change, then press the Header button(CAP ICON), then you will get the Header infomation, then select the Basic Settings pushbutton, then there we have an option to Print the Layout in Portrait format or Landscapr format, then select the LANDSCAPR format Radio button then activate it
Regards
Sudheer -
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. -
Hi!
can any one help me regarding SAP SCRIPT. i unable to write a print program for sap script . can any one can send me sample code using ITCSY structure.
Thanks in advance.
Thanks & Regads,
DurgaPrasad.kHi,
refer this to write print program:
<b>The Print Program</b>
Structure of a print program
OPEN_FORM function
CLOSE_FORM function
WRITE_FORM
START_FORM function
END_FORM function
CONTROL_FORM function
The print program is used to print forms. The program retieves the necesary data from datbase
tables, defines the order of in which text elements are printed, chooses a form for printing and
selects an output device and print options.
<b>Function modules in a printprogram:</b>
When you print a form you must used the staments OPEN_FORM and CLOSE_FORM. To combine
forms into a single spool request use START_FORM and END_FORM.
To print textelements in a form use WRITE_FORM. The order in which the textelements are printed,
is determined by the order of the WRITE_FORM statements. Note: for printing lines in the body, you
can also use the WRITE_FORM_LINES function module.
To transfer control command to a form use CONTROL_FORM.
<b>Structure of a print program</b>
Read data
Tables: xxx.
SELECT *
FROM xxx.
Open form printing - Must be called before working with any of the other form function modules.
Must be ended with function module CLOSE FORM
call function 'OPEN_FORM'.....
To begin several indentical forms containing different data within a single spool request, begin each
form using START_FORM, and end it using END_FORM
call funtion 'START_FORM'.....
Write text elements to a window of the form
call function 'WRITE_FORM'.....
Ends spool request started with START_FORM
call funtion 'END_FORM'.....
Closes form printing
call function 'CLOSE_FORM'...
OPEN_FORM function
Syntax:
CALL FUNCTION 'OPEN_FORM'
EXPORTING
APPLICATION = 'TX'
ARCHIVE_INDEX =
ARCHIVE_PARAMS =
DEVICE = 'PRINTER'
DIALOG = 'X'
FORM = ' '
LANGUAGE = SY-LANGU
OPTIONS =
MAIL_SENDER =
MAIL_RECIPIENT =
MAIL_APPL_OBJECT =
RAW_DATA_INTERFACE = '*'
IMPORTING
LANGUAGE =
NEW_ARCHIVE_PARAMS =
RESULT =
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
<b>Some important parameters:</b>
FORM Name of the form
DEVICE PRINTER : Print output using spool
TELEFAX: Fax output
SCREEN: Output to screen
OPTIONS Used to control attrubutes for printing or faxing (Number of copies, immediate output....
The input for the parameter is structure ITCPO.
CLOSE_FORM function
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT =
RDI_RESULT =
TABLES
OTFDATA =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 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.
Paramerters:
RESULT Returns status information and print/fax parameters after the form has been printed.
RESULT is of structure ITCPP.
WRITE_FORM function
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = ' '
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
IMPORTING
PENDING_LINES =
EXCEPTIONS
ELEMENT = 1
FUNCTION = 2
TYPE = 3
UNOPENED = 4
UNSTARTED = 5
WINDOW = 6
BAD_PAGEFORMAT_FOR_PRINT = 7
SPOOL_ERROR = 8
OTHERS = 9
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Some important parameters:
ELEMENT Specifies which textelement is printed
WINDOW Specifies which window is printed
TYPE Specifies the output area of the main window. This can be:
TOP - Used for headers
BODY
BOTTOM - Used for footers
FUNCTION Specifies whether text is to be appended, replaced or added
Example of how to use the WRITE_FORM function module together with a script.
Form layout of the MAIN window
/E INTRODUCTION
Dear Customer
/E ITEM_HEADER
IH Carrier, Departure
/E ITEM_LINE
IL &SBOOK-CARRID&, &SPFLI-DEPTIME&
/E CLOSING_REMARK
<b>The print program</b>
Writing INTRODUCTION
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'INTRODUCTION'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
Writing ITEM_HEADER
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_HEADER'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
Set ITEM_HEADER into TOP area of main window for subsequent pages
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_HEADER'
FUNCTION = 'SET'
TYPE = 'TOP'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
Write ITEM_LINE
LOOP AT .....
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_LINE'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8.
ENDLOOP.
Delete ITEM_HEADER from TOP area of main window
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'ITEM_HEADER'
FUNCTION = 'DELETE'
TYPE = 'TOP'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
Print CLOSING_REMARK
CALL FUNCTION 'WRITE_FORM'
EXPORTING
ELEMENT = 'CLOSING_REMARK'
FUNCTION = 'SET'
TYPE = 'BODY'
WINDOW = 'MAIN'
EXCEPTIONS
OTHERS = 8
START_FORM function
CALL FUNCTION 'START_FORM'
EXPORTING
ARCHIVE_INDEX =
FORM = ' '
LANGUAGE = ' '
STARTPAGE = ' '
PROGRAM = ' '
MAIL_APPL_OBJECT =
IMPORTING
LANGUAGE =
EXCEPTIONS
FORM = 1
FORMAT = 2
UNENDED = 3
UNOPENED = 4
UNUSED = 5
SPOOL_ERROR = 6
OTHERS = 7
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
END_FORM function
CALL FUNCTION 'END_FORM'
RESULT =
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SPOOL_ERROR = 3
OTHERS = 4
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CONTROL_FORM function
The CONTROL_FORM function module alows you to create SapScript control statements from within
an APAB program.
Syntax:
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
command =
EXCEPTIONS
UNOPENED = 1
UNSTARTED = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Example:
Protecting the text element ITEM_LINE
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'PROTECT'.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
TEXELEMENT = 'ITEM_LINE'.
CALL FUNCTION 'CONTROL_FORM'
EXPORTING
COMMAND = 'ENDPROTECT'.
rgds,
latheesh
Message was edited by: Latheesh Kaduthara -
SAP Script output extra page is coming
Dear friends
In my sap script output i m getting one extra page with empty main window. Even i have not used NEW-PAGE Command,
No Empty lines and window size also correct. Can anyone solute for this issue.
Regards
Balamurugan NHi,
check those details:
1) In your SAPSCRIPT contains one page or two pages?
2) In the sapscript check did u assign any nextpage as different page?
Regards,
Dhina.. -
Displaying Page number in all pages of sap script output
Hi All,
I have a issues in displaying page number in all pages of sap script output.
I have created a seperate window just above main window to display page number.
I have given &PAGE& in the layout editor.
Now in the sap script output i am getting page number as 1 in all the pages page number is not changing for pages-2,3, etc..
Can anybody tell me the reason for the same!
In some other objects same syntax is working fine. For this object it is not working!
Is there any setting changes!
Thanks i
Thanks,
Deep.Hi,
Just check the Page Counter of the Next or Second Page which you defined.
First page
Mode START
Numbering Type ARABIC
Second Page
Mode INC
Numbering Type ARABIC
Regards
Bala Krishna
Edited by: Bala Krishna on Oct 17, 2008 11:23 AM -
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 -
can anyone send me a sample program for downloading sapscript into pdf ?
in detailsHello,
please try out the Code in Topic: Regarding Converting Report Outputs & SAP Script Outputs to PDF Format.
Regards
Gregor -
Regarding Multiple pages in SAP Script Output
Hi All,
I have a requirement in SAP Script where i need to print data in multiple pages. I had created 1 page - FIRST with properties <b>Next Page</b> as FIRST , <b>Mode</b> as INC.
In the output i have multiple line items, the data will carry upto 3 pages.
Now In the output First page data is printing correctly.
In the second page all the windows are carried forward to print all the data correctly except in MAIN WINDOW.
In Second page in MAIN Window i have ITEM HEADER which i want to print on every page as it is printing in First page of output, but i am not been able print ITEM HEADER though i am able to print all the ITEM DETAILS correctly on every page.
Can anybody tell how can i print ITEM HEADER on every page which is in MAIN Window.
Thanks in advance.
Thanks & Regards,
Rayeezuddin.Hi Shaik,
If you are only printing Item Details in the Main Window, why don't you create a saperate window just above your main window for Item Headers.
Hope this should solve your problem or Please elobarate your query.
Thanks,
Vinod. -
SAP Script output not displayed
Hello,
Print preview of purchase document does not show the output. Only "test print only" is displayed on all pages.
I can see the data passed to SAP Script in debug. The print is created using output control, ( Save or create of PO ).
What could be the possible reason for the same?
Even if i try to use the option of "printing test" direct from script no text elements/language are displayed.. "test print only" is displayed.
kindly help.Hi,
I am not sure what your current support pack is. This sounds like the problem described in the SAP Note:
1243485 - Unprinted variables and lines of a SAPscript form
Can you apply the code correction of Note #1243485?
Regards,
Aidan -
SAP Script Output in Arabic Language
Hi,
I am running Transaction FBCJ, I am getting the output in a SAP Script in English Language. I want the same output in Arabic Language.
Please suggest me what do I need to do, in order to get the form output in Arabic Language?
Thanks and Regards,
Ishaq.Hi
Have you created the Script form in ARABIC language or English Language
While creating the form in SE71 you can create in your own language and see the outputs
or use the SE63 for texts transformation into other languages.
If the Arabic Language is activated in the system it should come.
Reward points if useful
Regards
Anji -
Smartform or SAP Script output
Hi,
Iam trying to use the email functionality for PO and RFQ smartforms. or SAP Scripts. How can I enable or disable the email acknowledgement for POs and RFQs.
Regards
MS
<MOVED BY MODERATOR TO THE CORRECT FORUM>
Edited by: Alvaro Tejada Galindo on Jan 12, 2010 10:58 AMHi,
The email functionality is already available in the print program of PO and RFQ. For PO(Output type MAHN) the program is SAPFM06P. We are passing the sender and receipient in OPEN_FORM (Include LMEDRUCKF1O). So no need to write the mail functionality again.
My problem is after the email is sent to the recipient then an acknowledgement is also sent to the sender saying the "mail sent to Vendor". I want to disable this acknowledgement feature.
Same with RFQ. The RFQ(output type NEU) is using the the smartform and we are passing sender and recipient details in the CALL FUNCTION lf_fm_name.
How to disable the acknowledgement feature.
Best Regards
MS -
I have a normal report output with a field "HIDE" to make it interactive. When clicked on any of the values of this field(s), the value (say VBELN) has to be passed to SAP SCRIPT and all the SELECT QUERIES needs to be written in SAP SCRIPT to get the desired output.
How do i get this feature?hi
U have to call perform in SAP script '/:'.
In that u have to pass parameter and get(changing) parameter.
FORM get_value TABLES inpar STRUCTURE itcsy
outpar STRUCTURE itcsy.
u have to read value from inpar and append value in outpar into the form.
Hope thiw will be useful.
regards
vinod
Maybe you are looking for
-
So.. you're saying no to Win 8/8.1?
Good evening all! Well, I'm still about a week or two (or maybe more depending on the trucker strike) from having all my components here for my build. My question is, what's with all the recommendations for Windows 7 PRO 64bit vs Windows 8.1? I have
-
How to place the components dynamically in page facets.
I have created a page template Logo | Header | User Area | | | | Menu| Content Area 1 | Content Area 2 | | | | | | | | | | | | | | | | | | | | Content Area 3 | Content Area 4 | | | | | | | | | | Footer I am a new bee. i need to create a system that c
-
Retrieving random key-value pair
I am storing a large number of items I want to randomly select from. Say for example I want to store a massive list of competition entrants (10-100 million) and I want to keep randomly pulling out winners (and removing them ideally). At the moment I'
-
When i click on messages the application opens a white screen and don't open it.
when i click on messages the application opens a white screen and don't open it.
-
Init / Nav Flag in Technical Content Query 0TCT_MCA1_Q0142
Hi Experts, In the technical content query 0TCT_MCA1_Q0142, there is a field Init / Nav Flag. I am not able to figure out the meaning of X and #, what does 'X' and '#' stand for, my understanding is that Init / Nav = '#' signify that it is a initiali