I made this code snippet for users to provide function like this, saving files from splooing list. You can find your own spooling list only and then choose, save it.
*********************************************************************
* Program Name : ZSDRPDF
* SAP Module : SD
* Description : PDF SAVE FROM SPOOLING LIST
* Input :
* Output :
* Initiator : Kyung Woo, Nam
* External Ref :
*********************************************************************
* Change History.
* Date Author Reason
*
*********************************************************************
Report ZSDRPDF no standard page heading
message-id zmsd
line-size 125
line-count 80.
tables: TSP01.
types: begin of ty_spool,
RQIDENT like tsp01-RQIDENT,
RQOWNER like tsp01-RQOWNER,
RQTITLE like tsp01-RQTITLE,
chk.
types: end of ty_spool.
data: wa_spool type ty_spool.
data: itb_spool type ty_spool occurs 0.data: flag type i.data: ztxt(50).
data: l_path type RLGRAP-FILENAME.
*selection-screen begin of block blk with frame title text-001.
*parameter : zuser like tsp01-RQOWNER default sy-uname.
*selection-screen end of block blk.
START-OF-SELECTION.
PERFORM get_data.
END-OF-SELECTION.
PERFORM write_data.
AT LINE-SELECTION.
CLEAR ztxt.
CLEAR l_path.
l_path = 'C:\zfile.pdf'. CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = l_path
def_path = ''
mask = ',*.*,*.txt,*.txt.'
mode = 'S'
title = 'Choose file path to save'
IMPORTING
filename = l_path
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5. IF sy-subrc = 0.
ENDIF.
CALL FUNCTION 'Z_SD_PDF_CREATE'
EXPORTING
spoolno = wa_spool-rqident
p_file = l_path
IMPORTING
msgtxt = ztxt. IF sy-subrc <> 0 OR
NOT ( ztxt IS INITIAL ).
ELSE.
MESSAGE i008(zmsd) WITH 'Fail'.
ENDIF.*&---------------------------------------------------------------------*
*& Form get_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM get_data. SELECT rqident rqowner rqtitle
into corresponding fields of table itb_spool
FROM TSP01
* WHERE rqowner = zuser.
where rqowner = sy-uname. sort itb_spool by rqident descending.
ENDFORM. " get_data
*&---------------------------------------------------------------------*
*& Form write_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM write_data. clear flag.
write sy-uline(125).
write:/ ''.
write: (15) 'Spooling Number'.
write: '', (20) 'Job Owner', '', (80) 'Job Title', ''.
write: sy-uline(125).
loop at itb_spool into wa_spool. flag = sy-tabix mod 2.
case flag.
when 1.
format color col_normal on.
when 0.
format color off.
endcase. write:/ ''.
format hotspot on.
write: (15) wa_spool-rqident.
hide wa_spool-rqident.
format hotspot off.
write: '', (20) wa_spool-rqowner, '',
(80) wa_spool-rqtitle, ''.
write: sy-uline(125).
endloop.ENDFORM. " write_data
--> Function module : Z_SD_PDF_CREATEFUNCTION z_sd_pdf_create.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(SPOOLNO) TYPE TSP01-RQIDENT
*" REFERENCE(P_FILE) TYPE RLGRAP-FILENAME DEFAULT 'C:\file.pdf'
*" EXPORTING
*" REFERENCE(MSGTXT) TYPE CHAR50
*"----------------------------------------------------------------------
*
* External Ref : RSTXPDFT4
*
DATA download VALUE 'X'.
DATA otf LIKE itcoo OCCURS 100 WITH HEADER LINE.
DATA cancel.
DATA pdf LIKE tline OCCURS 100 WITH HEADER LINE.
DATA doctab LIKE docs OCCURS 1 WITH HEADER LINE.
DATA: numbytes TYPE i,
arc_idx LIKE toa_dara,
pdfspoolid LIKE tsp01-rqident,
jobname LIKE tbtcjob-jobname,
jobcount LIKE tbtcjob-jobcount,
is_otf.
DATA: client LIKE tst01-dclient,
name LIKE tst01-dname,
objtype LIKE rststype-type,
type LIKE rststype-type.
TABLES: tsp01. SELECT SINGLE * FROM tsp01
WHERE rqident = spoolno. IF sy-subrc <> 0.
MESSAGE e001(zmsd) WITH text-001. " Fail
EXIT.
ENDIF. client = tsp01-rqclient.
name = tsp01-rqo1name. CALL FUNCTION 'RSTS_GET_ATTRIBUTES'
EXPORTING
authority = 'SP01'
client = client
name = name
part = 1
IMPORTING
type = type
objtype = objtype
EXCEPTIONS
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4.
IF objtype(3) = 'OTF'.
is_otf = 'X'.
ELSE.
is_otf = space.
ENDIF. IF is_otf = 'X'.
CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spoolno
no_dialog = ' '
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = pdf
EXCEPTIONS
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11.
CASE sy-subrc.
WHEN 0.
WHEN OTHERS.
MESSAGE e001(zmsd) WITH text-002.
"CONVERT_OTFSPOOLJOB_2_PDF Fail
EXIT.
ENDCASE.
ELSE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spoolno
no_dialog = ' '
IMPORTING
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
btc_jobname = jobname
btc_jobcount = jobcount
TABLES
pdf = pdf
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11.
CASE sy-subrc.
WHEN 0.
WHEN OTHERS.
MESSAGE e001(zmsd) WITH text-003.
"CONVERT_ABAPSPOOLJOB_2_PDF Fail
EXIT.
ENDCASE.
ENDIF.
*************** download PDF file ***********
CHECK download = 'X'.
IF NOT ( jobname IS INITIAL ).
EXIT.
ENDIF.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = p_file
filetype = 'BIN'
bin_filesize = numbytes
TABLES
data_tab = pdf
EXCEPTIONS
file_open_error = 1
file_write_error = 2
invalid_filesize = 3
invalid_table_width = 4
invalid_type = 5
no_batch = 6
unknown_error = 7
OTHERS = 8. IF sy-subrc <> 0.
msgtxt = text-004. "Fail
ENDIF.
ENDFUNCTION.
-->
see more information---https://www.sdn.sap.com/irj/sdn/wiki?path=/display/Snippets/ABAP4+Tuning+Checklist&
Tuesday, October 7, 2008
Subscribe to:
Post Comments (Atom)
Archives
-
▼
2008
(139)
-
▼
October
(139)
- free download book on abap reporting on all modules
- Submit ABAP report with SQL traces
- SAP ABAP Commonly Asked Questions I
- Difference Between LIS, Reports, Abap Query
- SAP Some ABAP/4 Query header line variable
- SAP ABAP Quick Viewer
- SAP ABAP Proxy communication
- SAP ABAP/4 Program: Describe Select-Options
- SAP ABAP/4 Program: Output Table Fields to a List
- SAP ABAP/4 Program: Outstanding PO Report
- SAP ABAP/4 Program:Un/Lock all users in a client
- SAP ABAP/4 Program: Output Table Fields to a List
- SAP ABAP Program: Output of Date Format
- free download book on abap programming Tutorial
- SAP ABAP Programming Language
- free download BC-ABA pdf book SAP ABAP prog
- BC-ABA pdf free download SAP ABAP prog
- SAP ABAP Sample Test Questions on Programming
- SAP ABAP Programming Documentation
- SAP ABAP free download abap programming pdf book
- SAP ABAP The Employee Example - step by step example
- SAP Finding the user-exits of a SAP transaction code
- SAP A comparison between enhancement techniques
- SAP Toolbar Control Object
- SAP HTML Viewer Control
- Add Button to ALV Toolbar with REUSE_ALV_LIST_DISPLAY
- Interview Question on BAPI, RFC, ABAP Objects, Tables
- OBJECTS Tutorials PDF Free downloads
- Objective Questions
- MODEL PROGRAMS ON EVERY TOPIC
- sd tables structure
- Tables structure
- purchasing tables structures
- fico tables structure
- Project Systems tables structure
- Production Planning tables structures
- PM Tables
- system tables
- Classic pdf free download
- SAP ABAP List Viewer ALV
- SAP ABAP CONSTANTS
- SAP ABAP CONDENSE
- faqs SAP ABAP Interview Tips, Questions and Answers
- SAP ABAP interview questions
- SAP Answers to some ABAP Interview Questions
- SAP ABAP Interview Questions
- What types of tables can be created in the ABAP Di...
- More SAP ABAP Interview Faq's
- What types of objects can be created in the ABAP D...
- What is the difference between Pooled tables and C...
- What is the difference between Database tables and...
- What are the different types of Views? ABAP
- What is Table Maintenance Generator? ABAP
- Real Time SAP ABAP Internal Tables
- Real Time BDC & LSMW
- performance tuning
- ABAP TAW12 3/3 ABAP Workbench Concepts
- ABAP TAW12 2/3 ABAP Workbench Concepts
- ABAP TAW12 1/3 ABAP Workbench Concepts
- ABAP TAW10 2/2 ABAP Workbench Fundamental
- SAP ABAP TAW10 1/2 ABAP Workbench Fundamentals
- SAP ABAP Creating Extract Dataset
- all interview questions sap abap faqs
- SAP free download abap
- Important SAP ABAP FAQs
- ABAP FAQs
- FAQ In ABAP
- SAP ABAP Dialog Programming
- Will there always be an implicit commit in an RFC?
- Validating table fields in SAP ABAP
- SAP ABAP The difference between field groups and i...
- SAP ABAP Unicode check error fix
- SAP ABAP Creating a screen for grid display
- SAP ABAP Migrating test programs from ECC 4.6 to 6.0
- SAP ABAP Creating a field exit for a data element
- SAP ABAO Methods for uploading SAP data
- SAP ABAP Error when reading XML files
- SAP ABAP A parameter with no record available
- ABAP Adobe Document Services ADS
- Dictionary
- What is this new transaction 'n' all about?
- What does ABAP stand for?
- What does R/3 stands for ?
- How are RANGES different from SELECT-OPTIONS?
- How to convert a date to internal or external format?
- How do I download data in my internal table in a C...
- How can I get the IP address of the system program...
- How can I download my internal table into an Excel...
- How can I read an Excel file from presentation ser...
- How can I convert numerals into the corresponding ...
- I am using a SELECT query on a database table. Sin...
- Where are the long texts of a document stored and ...
- How do I create a long text for a document?
- How do I display / add the Terms and Conditions to...
- How to convert from one currency value to other?
- How to change the deadline of the workitem program...
- In SAP ABAP How to calculate last date of the month?
- How to do the EXCISE ANNEXURE10 report?
- SAP ABAP Class ALV
- SAP ABAP ALV Articles
-
▼
October
(139)





























No comments:
Post a Comment