Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- * --------------------------------------------------------------------
- * Merge two ABAP lists given in spool jobs,
- * and convert the result to one pdf document
- * Works only for ABAP lists (not OTF or others)
- * Just to prove it's possible...
- * --------------------------------------------------------------------
- * Works on SAP_BASIS 702, but lower releases should do, too
- * --------------------------------------------------------------------
- report zz_get_list line-size 1023.
- parameters: p_list1 type rspoid obligatory,
- p_list2 type rspoid obligatory,
- p_submit type flag default 'X' no-display.
- start-of-selection.
- perform start.
- * ---
- form start.
- data: lv_spoolid type rspoid,
- lt_pdf type tline_tab,
- lv_pdf_length type i.
- if p_submit eq 'X'.
- perform conv_2_abap_spool_lists_to_pdf
- using p_list1 p_list2
- changing lt_pdf lv_pdf_length.
- perform download using lt_pdf lv_pdf_length.
- else.
- new-page print on. " line-size 1023.
- perform write_to_current using :
- p_list1,
- p_list2.
- lv_spoolid = sy-spono.
- export spoolid from lv_spoolid to memory id 'SPOOLID'.
- new-page print off.
- endif.
- endform. "start
- * ---
- form conv_2_abap_spool_lists_to_pdf
- using iv_list1 type rspoid
- iv_list2 type rspoid
- changing et_pdf type tline_tab
- ev_pdf_length type i.
- data: lv_spoolid type rspoid.
- submit zz_get_list
- exporting list to memory and return
- with p_list1 eq iv_list1
- with p_list2 eq iv_list2
- with p_submit eq space.
- import spoolid to lv_spoolid from memory id 'SPOOLID'.
- check lv_spoolid is not initial.
- call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
- exporting
- src_spoolid = lv_spoolid
- no_dialog = 'X'
- importing
- pdf_bytecount = ev_pdf_length
- tables
- pdf = et_pdf
- exceptions
- others = 1.
- endform. "conv_2_abapspoollists_to_pdf
- * ---
- form write_to_current using iv_id type rspoid.
- data: lt_list type table_abaplist.
- submit rspolist exporting list to memory and return
- with rqident = iv_id.
- call function 'LIST_FROM_MEMORY'
- tables
- listobject = lt_list
- exceptions
- not_found = 1
- others = 2.
- check sy-subrc eq 0.
- call function 'WRITE_LIST'
- tables
- listobject = lt_list
- exceptions
- empty_list = 1
- others = 2.
- endform. "write_to_current
- * ---
- form download using it_pdf type tline_tab
- iv_pdf_length type i.
- data: lv_filename type string.
- call function 'GUI_FILE_SAVE_DIALOG'
- exporting
- window_title = 'Save pdf'
- default_file_name = 'test.pdf'
- importing
- fullpath = lv_filename.
- call function 'GUI_DOWNLOAD'
- exporting
- bin_filesize = iv_pdf_length
- filename = lv_filename
- filetype = 'BIN'
- tables
- data_tab = it_pdf
- exceptions
- others = 1.
- endform. "download
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement