2006 Oct 16 11:15 AM
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.
2006 Oct 16 11:19 AM
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
2006 Oct 16 11:17 AM
2006 Oct 16 11:19 AM
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.
2006 Oct 16 11:19 AM
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
2006 Oct 17 10:06 AM
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.
2006 Oct 17 10:07 AM
2006 Oct 16 11:22 AM
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
2006 Oct 16 11:27 AM
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