cancel
Showing results for 
Search instead for 
Did you mean: 

How to download the sapscript layout into excel like its pdf output

Former Member
0 Kudos

Dear All,

Is there any way to download the sapscript layout into excel like its pdf output?

If so, how to implement it so that allignment of logo and texts will be maintained properly same as pdf download of sapscript layout.

Thanks very much in advance anticipating your quick fruitful solution.

Have a very nice time ahead.

Thanks & Regards

Sudipta Malakar

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Yes, I have resolved this issue.

Former Member
0 Kudos

Hi

Could you pls share how u downloaded the form in excel format?

Thanks in Advance.

Saranya

former_member207835
Participant
0 Kudos

Hi Sudipta,

Can you please tell me the procedure what you did to solve this issue.

I also got the same requirement.

Awaiting your help.

Thanks

Nagesh

Former Member
0 Kudos

i am not sure about your exact requirement but same can be also done as

SE71->give form name ->ENTER->UTILITIES->FORM INFO->SYSTEM->LIST->SAVE->Local File->....

former_member207835
Participant
0 Kudos

Hi nitin,

My requirement is i want to download my script output to excel, since my client want to edit that output in need basis, they particularly asking excel format.

as u said if i save the output the alignment is not perfect, i tried those options.

Earlier Sudipta faced similar issue and he posted it is solved that's why i mentioned as same.

Thanks

Nagesh

former_member207835
Participant
0 Kudos

Any help will be highly appriciated. It is urgent for me.

Thanks

Nagesh

Former Member
0 Kudos

Hi

Welcome to SDN forum

see the following sample code to download the PDF form of script

after converting to PDF you can either use the std program or GUI_DOWNLOAD fun module

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.

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

call function 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

IMPORTING

bin_filesize = 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

<b>Reward points for useful Answers</b>

Regards

Anji

Former Member
0 Kudos

Hi,

Thank you so much.

I have been intimated by Client that after modification of some standard forms (say, for example PO) they want to download it into excel only, but not in PDF.

Could you please tell me sharing your documents (Codes as well as steps) URGENTLY how it is possible. It's VERY URGENT.... It will be very beneficial for mine...

Awaiting your help & fruitful valuable solution for this at the earliest.

Thanks & Regards

Sudipta Malakar

Former Member
0 Kudos

Sudipta,

It seems quite difficult as PDF generation uses Printer Driver and Just like printed out-put it generates pages of the Spool out put in form of PDF.

If you are looking for an option of having xls file for further editing or processing. Please share your requirements. I will try to help.

Darshan

<i><b>Please reward points to helpful answer. It Motivates us to Help Others.</b></i>

Former Member
0 Kudos

Darshan,

Thank you so much for your input.

I have been intimated by Client in the Business Blueprint phase that after modification of some standard forms (say, for example PO) they want to download

it into excel only.

Could you please tell me sharing your documents (Codes as well as steps) URGENTLY how it is possible. It's VERY URGENT.... It will be very beneficial for mine...

I have already tried with the following steps:

the following steps.

1.View the print preview of the layout.

2.Use the menu Goto->List Display

3.Then use System->List->Save->Local file

4.Finally select the option Spreadsheet to download to Excel.

But the allignments of Texts are differing than that from the standard Sapscript layout out.Also, the logo is not coming in the Excel output as in output we are getting the List output.

Awaiting your help & fruitful valuable solution for this at the earliest.

Thanks & Regards

Sudipta Malakar