Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Print pdf file in a list

Former Member
0 Kudos
184

hi,

i am uploading a flat file to a database table and displaying the no.of records inserted, updated etc in a list.

now my requirement is to display the flat file(pdf) in the list when a check box 'Display_File' is checked.

please help

thanks.

1 ACCEPTED SOLUTION

former_member181962
Active Contributor
0 Kudos
126

Once you upload the file into an internal table, instead of updating the z table with it,use write statements to display it as a list.

open dataset file for input in text mode encoding default.

if sy-subrc = 0.

do.

read dataset file into it_file.

if sy-subrc = 0.

append it_file.

else.

exit.

endif.

enddo.

close dataset file.

loop at it_file.

write:/ it_file-field1,

it_file-field2..

endloop.

endif.

Regards,

Ravi

7 REPLIES 7

Former Member
0 Kudos
126

hi Radhika,

WELCOME TO SDN

Check

Regards,

Santosh

Former Member
0 Kudos
126

I didnt understand what ur requirement.

But as i far as i understood if u want to convert to pdf format,

There is a FM called

CONVERT_OTF_2_PDF.

former_member181962
Active Contributor
0 Kudos
127

Once you upload the file into an internal table, instead of updating the z table with it,use write statements to display it as a list.

open dataset file for input in text mode encoding default.

if sy-subrc = 0.

do.

read dataset file into it_file.

if sy-subrc = 0.

append it_file.

else.

exit.

endif.

enddo.

close dataset file.

loop at it_file.

write:/ it_file-field1,

it_file-field2..

endloop.

endif.

Regards,

Ravi

0 Kudos
126

hi Mr.Ravi,

thanks for ur reply thats exactly what i wanted. and i've done that already but have'nt used a dataset... instead just printed the internal table into which the file is uploaded.

thanks for ur reply.

0 Kudos
126

thanks everybody for ur posts i appreciate it.

athavanraja
Active Contributor
0 Kudos
126

flat file(pdf) ?

Welcome to SDN

Are you saying you are uploading PDF files and storing them db table and you wanted to display the pdf file in SAPGUI screen. if yes you can use CL_GUI_PDFVIEWER control to do the same.

Regards

Raja

rajeshkumar_kaveti
Participant
0 Kudos
126

Hi,

Go through the following steps:

1. Set Print Attributes : Populate the structure for print parameter

PRI_PARAMS-PDEST = 'BHG3'. " Setting a Printer

2. Write the following statement before displaying the list.

NEW-PAGE PRINT ON PARAMETERS PRI_PARMS NO DIALOG.

3. Display List . Now a spool request will get generated.

4. Write the following statement after displaying the list.

NEW-PAGE PRINT OFF.

5. Get the spool number from TSP01 table.

CONCATENATE SY_REPID0(8) SY_UNAME0(3) INTO SPOOL_NAME SEPARATED BY '_'.

SELECT * FROM TSP01 WHERE RQ2NAME = SPOOL_NAME

ORDER BY RQCRETIME DESCENDING.

SPOOL_NO = TSP01-RQIDENT.

EXIT.

ENDSELECT.

6. Upload Spool to Internal table:

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'.

This Function Module imports Spool number and Printer Destination and returns an internal table.

7. Download Internal table to local PDF file: Give the local file name with extension 'PDF'.

CALL FUNCTION 'DOWNLOAD' passing file type as 'BIN'

Reply back for further clarification.

Regards,

Rajesh