Вы находитесь на странице: 1из 11

Community

(http://www.sap.com/)
(https://community.sap.com)
(/users/login.html?
redirect_to=%2Fquestions%2F2760855%2Fneed-to-
download-po-sapscript-in-pdf-format-withou.html)
Ask a Question (https://answers.sap.com/questions/ask.html) Write a Blog Post (https://blogs.sap.com/wp-admin/post-new.php) Login (/users

Search the SAP Community

(/users/559426/swaminathanpj3.html) Swaminathan PJ ( https://people.sap.com/swaminathan.pj3)


Need to Download PO SAPSCRIPT in PDF Format without Printing
Aug 02, 2007 at 05:48 PM | 411 Views
stions%2F2760855%2Fneed-to-download-po-sapscript-
ata%3D2760855%26s_csrf%3D1607321571986.9707)
pdf-format-
0
stions%2F2760855%2Fneed-to-download-po-sapscript-
data%3D2760855%26s_csrf%3D1607321571986.9707)
pdf-format-
(/users/login.html?redirect_to=%2Fquestions%2F2760855%2Fneed-to-download-po-sapscript-in-pdf-format-
Follow
withou.html%3Fs_action%3Dfollow%26s_csrf%3D1607321571986.9707) RSS Feed

Hi all,

Iam working on a PO SAPSCRIPT, My requirement is to download the PO in PDF format without printing.

I know one SAP program called RSTXPDFT4.In (http://RSTXPDFT4.In) this program i need to specify the Spool number.

Hence without giving Print option how can i get the spool no:, or do we have any other way to get the Spool no: when PO gets saved.

So in Message control which output medium i should give. Do i need to create Z program and then should i need to insert in my output type and declare the Output medium as
Special Function.

Thanks in Advance...

Add a Comment (/users/login.html?redirect_to=%2Fquestions%2F2760855%2Fneed-to-download-po-sapscript-in-pdf-format-


withou.html%3Fs_action%3Dcomment%26s_data%3D2760855%26s_csrf%3D1607321571986.9707) |
Alert Moderator (/users/login.html?redirect_to=%2Fquestions%2F2760855%2Fneed-to-download-po-sapscript-in-pdf-format-
withou.html%3Fs_action%3DreportQuestion%26s_data%3D2760855%26s_csrf%3D1607321571986.9707)

Assigned Tags

NW ABAP Print and Output Management (/tags/334558737810127171897316045257708) |

Related questions

Need to Download PO Sapscript in PDF fromat (https://answers.sap.com/questions/2772993/need-to-download-po-sapscript-in-pdf-fromat.html)


By Swaminathan PJ ( https://people.sap.com/swaminathan.pj3) Aug 06, 2007

logo printing issue in PO print output. (https://answers.sap.com/questions/8325148/logo-printing-issue-in-po-print-output.html)


By Former Member ( https://people.sap.com/former.member) May 03, 2011

3 Answers

Sort by: Votes | Newest | Oldest

Sai Ram Reddy Neelapu ( https://people.sap.com/sairamreddy.neelapu)


(/users/323223/sairamreddyneelapu.html)
Aug 03, 2007 at 02:43 AM

Rough idea how to download into PDF format, follow the below steps and paa your own parameters
2Fquestions%2F2760855%2Fneed-to-download-po-
data%3D2761805%26s_csrf%3D1607321571986.9707)
tml%3FchildToView%3D2761805%23answer-
2
**Set printer parameters
2Fquestions%2F2760855%2Fneed-to-download-po-
_data%3D2761805%26s_csrf%3D1607321571986.9707)
tml%3FchildToView%3D2761805%23answer-

control_param-no_dialog = 'X'.

control_param-preview = ''.

control_param-getotf = 'X'. /
output_opt-tddest = 'LOCL'.

output_opt-tdimmed = ''.

output_opt-tdnewid = ''.

output_opt-tdnoprint = ''.

output_opt-tdnoprev = 'X'.

Get smartform name

call function 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = formname

variant = ' '

direct_call = ' '

IMPORTING

fm_name = fm_name

EXCEPTIONS

no_form = 1

no_function_module = 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.

Call smartform

call function fm_name

EXPORTING

control_parameters = control_param

output_options = output_opt

user_settings = ' '

wa_head = wa_head

IMPORTING

job_output_info = job_info

TABLES

int_detail = int_detail

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

others = 5.

Note pass the job info le you got from above function module

data: int_docs type standard table of docs,


/
int_line type standard table of tline.

call function 'CONVERT_OTF_2_PDF'

IMPORTING

bin_ lesize = lesize

TABLES

otf = job_info-otfdata

doctab_archive = int_docs

lines = int_line

EXCEPTIONS

err_conv_not_possible = 1

err_otf_mc_noendmarker = 2

others = 3.

USE below function module

all method cl_gui_frontend_services=>gui_download

exporting

bin_ lesize = lesize

lename = lename

letype = 'BIN'

changing

data_tab = int_line

Regards,

SaiRam
Add a Comment (/users/login.html?redirect_to=%2Fquestions%2F2760855%2Fneed-to-download-po-sapscript-in-pdf-format-
withou.html%3Fs_action%3Dcomment%26s_data%3D2761805%26s_csrf%3D1607321571986.9707) |
Alert Moderator (/users/login.html?redirect_to=%2Fquestions%2F2760855%2Fneed-to-download-po-sapscript-in-pdf-format-
withou.html%3Fs_action%3Dreport%26s_data%3D2761805%26s_csrf%3D1607321571986.9707) |
Share

Former Member

Aug 03, 2007 at 05:00 AM

Hi
2Fquestions%2F2760855%2Fneed-to-download-po-
data%3D2762327%26s_csrf%3D1607321571986.9707)
tml%3FchildToView%3D2762327%23answer-
0
See the sample code to download the Script in PDF format
2Fquestions%2F2760855%2Fneed-to-download-po-
_data%3D2762327%26s_csrf%3D1607321571986.9707)
tml%3FchildToView%3D2762327%23answer-

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 (http://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_ lesize = v_size

lename = c_name

letype = c_bin

TABLES

data_tab = i_content_bin.

If you r using this function module check it once....

call function 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

IMPORTING

bin_ lesize = v_len_in

TABLES

otf = i_otf

lines = i_tline

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

others = 4.

Fehlerhandling

if sy-subrc <> 0.

endif.

or u can use the standard program RSTXPDFT4 to download the script into PDF format onto a particular location

follow this link for sample program.

http://searchsap.techtarget.com/tip/0,289483,sid21_gci1121833,00.html (http://searchsap.techtarget.com/tip/0,289483,sid21_gci1121833,00.html)

Regards

Anji

Add a Comment (/users/login.html?redirect_to=%2Fquestions%2F2760855%2Fneed-to-download-po-sapscript-in-pdf-format- /


withou.html%3Fs_action%3Dcomment%26s_data%3D2762327%26s_csrf%3D1607321571986.9707) |
Alert Moderator (/users/login.html?redirect_to=%2Fquestions%2F2760855%2Fneed-to-download-po-sapscript-in-pdf-format-
withou.html%3Fs_action%3Dreport%26s_data%3D2762327%26s_csrf%3D1607321571986.9707) |
Share

Former Member

Aug 03, 2007 at 05:06 AM

Hi,
2Fquestions%2F2760855%2Fneed-to-download-po-
data%3D2762342%26s_csrf%3D1607321571986.9707)
tml%3FchildToView%3D2762342%23answer-
0
Here is the sample code of converting smartform output to pdf.
2Fquestions%2F2760855%2Fneed-to-download-po-
_data%3D2762342%26s_csrf%3D1607321571986.9707)
tml%3FchildToView%3D2762342%23answer-

REPORT zswar.

SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME.

PARAMETER: p_date LIKE sy-datum.

PARAMETER: p_rea TYPE char255.

SELECTION-SCREEN: END OF BLOCK b1.

DATA: ws_ucomm LIKE sy-ucomm.

INITIALIZATION.

SET PF-STATUS 'STANDARD' OF PROGRAM 'ZSWAR'.

AT SELECTION-SCREEN.

ws_ucomm = sy-ucomm.

CASE ws_ucomm.

WHEN '&PDF'.

PERFORM f1000_download_form.

EXIT.

WHEN '&BACK'.

SET SCREEN 0.

EXIT.

WHEN '&EXIT'.

SET SCREEN 0.

EXIT.

WHEN '&canc'.

SET SCREEN 0.

LEAVE TO SCREEN 0.

ENDCASE.

&----

*& Form F1000_DOWNLOAD_FORM

&----

text

----

--> p1 text
<-- p2 text
/
----

FORM f1000_download_form.

DATA: form_name TYPE rs38l_fnam.

DATA: wa_ctrlop TYPE ssfctrlop,

wa_outopt TYPE ssfcompop.

DATA: t_otfdata TYPE ssfcrescl,

t_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.

DATA: t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE.

DATA: w_ lesize TYPE i.

DATA: w_bin_ lesize TYPE i.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZSMARTFORM_SWAR'

VARIANT = ' '


DIRECT_CALL = ' '

IMPORTING

fm_name = form_name

EXCEPTIONS

no_form = 1

no_function_module = 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.

wa_ctrlop-getotf = 'X'.

wa_ctrlop-no_dialog = 'X'.

wa_outopt-tdnoprev = 'X'.

CALL FUNCTION form_name

EXPORTING

ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =

control_parameters = wa_ctrlop

MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =

output_options = wa_outopt

user_settings = 'X'

mydate = p_date

reason = p_rea
/
IMPORTING

DOCUMENT_OUTPUT_INFO =

job_output_info = t_otfdata

JOB_OUTPUT_OPTIONS =

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 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.

t_otf[] = t_otfdata-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

ARCHIVE_INDEX = ' '

IMPORTING

bin_ lesize = w_bin_ lesize

TABLES

otf = t_otf

lines = t_pdf_tab

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 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.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

bin_ lesize = w_bin_ lesize

CODEPAGE = ' '

lename = 'd:\test.PDF (http://test.PDF)'

/
letype = 'BIN'

MODE = ' '


WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
COL_SELECT = ' '
COL_SELECTMASK = ' '
NO_AUTH_CHECK = ' '

IMPORTING

lelength = w_ lesize

TABLES

data_tab = t_pdf_tab

FIELDNAMES =

EXCEPTIONS

le_open_error = 1

le_write_error = 2

invalid_ lesize = 3

invalid_type = 4

no_batch = 5

unknown_error = 6

invalid_table_width = 7

gui_refuse_ letransfer = 8

customer_error = 9

OTHERS = 10

IF sy-subrc <> 0.

MESSAGE i003(z00) WITH 'File not downloaded succesfully'.

ELSE.

MESSAGE i003(z00) WITH 'File Test.pdf (http://Test.pdf) downloaded succesfully '

'under D drive'.

ENDIF.

ENDFORM. " F1000_DOWNLOAD_FORM

Regards
Add a Comment (/users/login.html?redirect_to=%2Fquestions%2F2760855%2Fneed-to-download-po-sapscript-in-pdf-format-
withou.html%3Fs_action%3Dcomment%26s_data%3D2762342%26s_csrf%3D1607321571986.9707) |
Alert Moderator (/users/login.html?redirect_to=%2Fquestions%2F2760855%2Fneed-to-download-po-sapscript-in-pdf-format-
withou.html%3Fs_action%3Dreport%26s_data%3D2762342%26s_csrf%3D1607321571986.9707) |
Share

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please
leave a comment instead, requesting additional details. When answering, please include speci cs, such as step-by-step instructions, context for the solution, and links to
useful resources. Also, please make sure that you answer complies with our Rules of Engagement. /
Rules of Engagement (https://www.sap.com/community/resources/rules-of-engagement.html)

Know someone who can answer? Share a link to this question.

You must be Logged in (/users/login.html?redirect_to=%2Fquestions%2F2760855%2Fneed-to-download-po-sapscript-


in-pdf-format-withou.html%3Fs_action%3DanswerQuestion%26s_csrf%3D1607321571986.9707) to submit an answer.

Please provide a distinct answer and use the comment option for clarifying purposes.

Submit your Answer

Find us on

(https://www.facebook.com/sapcommunity) (https://twitter.com/SAPCommunity) (https://www.youtube.com/c/SAPCommunities)

(https://www.linkedin.com/company/sap) (https://instagram.com/sap/) (http://www.slideshare.net/SAP) (mailto:?subject='SAP Community')

Privacy (http://sap.com/about/legal/privacy.html) Terms of Use (http://sap.com/corporate/en/legal/terms-of-use.html)

Legal Disclosure (http://sap.com/about/legal/impressum.html) Copyright (http://sap.com/about/legal/copyright.html)

Trademark (http://sap.com/about/legal/trademark.html) Cookie Preferences

Newsletter (https://www.sap.com/cmp/nl/sap-community-voice/index.html) Support (mailto:sapnetwork@sap.com)

Вам также может понравиться