on 2012 Jan 15 2:29 PM
Hi All,
I need to get invoices data from archive system, and print them out.
I have got the invoices data in an internal table, and used the following code to put the internal table data to spool and print.
CALL FUNCTION 'RSPO_SX_OUTPUT_DEVICEDATA'
EXPORTING
dest = 'LOCL'
rqtitle = gc_print_title
IMPORTING
rqid = lv_spool_id
TABLES
device_data = lt_bin_pdf
The printout pages are correct on my side, but customer will get several pages of code and other stuff. So If there are any print options or settings need to be adjusted? Please advise.....
Best Regards,
Ivy
Solved! Changed the destination from LOCL to LOCW
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Mod,
Pls help me to format my above thread, i tried everything.. In Preview it is looking nice, But if Post its rubbish..
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello playsuji,
I tried to use the report rstxpdft4 mentioned by your thread, but it raised an error that no abap list exist in spool. As the binary internal table data in spool is PDF format. So i think we do not need to convert it to PDF.
It confused me why i could get correct pages from my side, but customer couldn't ?????
Thanks for your answer!
Best Regards,
Ivy
Hello playsuji
I used the following function module to get the spool number and set internal table data to spool. And the internal table data is binary data. Also i used this function to print data out.
CALL FUNCTION 'RSPO_SX_OUTPUT_DEVICEDATA'
EXPORTING
dest = 'LOCL'
rqtitle = gc_print_title
IMPORTING
rqid = lv_spool_id
TABLES
device_data = lt_bin_pdf
So i think it should not be spool id problem.
Thanks a lot.
Ivy
I built the internal table by the following approach.
LOOP AT gt_toa02 INTO ls_toa02.
CALL FUNCTION 'SCMS_AO_TABLE_GET' "this function to get the archived pdf data from archive system
EXPORTING
arc_id = ls_toa02-archive-archiv_id
doc_id = ls_toa02-archive-arc_doc_id
IMPORTING
length = lv_bin_pdf_len
TABLES
data = lt_bin_pdf_tmp
EXCEPTIONS
error_http = 1
error_archiv = 2
error_kernel = 3
error_config = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING error_contentrepository.
EXIT.
ENDIF.
APPEND LINES OF lt_bin_pdf_tmp TO lt_bin_pdf.
ENDLOOP.
*DATA: LV_TEST_DATATYPE TYPE STRING,
* LV_DEST TYPE TSP03D-PADEST.
*LV_DEST = 'POST2'.
*lv_test_datatype = 'POSTSCRIPT'.
CALL FUNCTION 'RSPO_SX_OUTPUT_DEVICEDATA'
EXPORTING
dest = 'LOCL'
rqtitle = gc_print_title
* DATATYPE = lv_test_datatype
IMPORTING
rqid = lv_spool_id
TABLES
device_data = lt_bin_pdf
EXCEPTIONS
name_missing = 1
name_twice = 2
not_found = 3
illegal_layout = 4
internal_error = 5
size_mismatch = 6
OTHERS = 7
Customer used the same code and on same system to test the print functionality, just used different printer. As i used 'LOCL' to be the dest, and system will choose the default printer for us. Due to the different localtions, the default printer must be different.
Sorry, i am not sure. But if it is the code which mentioned by you, so what we need to do? and If it is the following code showed by me, anything need to be adjusted?
%PDF-1.3##%âãÏÓ##2 0 obj##<<##/Type /XObject##/Subtype
P=þ.þ HçÕ#WÏ~#Õ#2Ú·ú/ð ü¨Ô%&#½rø#þU{À##^©#ðé¬#7*s£´¿WZw
ù¼å¤õÓG)ß6å軥õ²ªr##´#¤ÃiÒG"#ºMÏRÜ£\u00D4V#Ölj[J(Ì#J#KÉ@Wkà
#Õå##ÍA}#¹9¹##,,¬ÜlHÌÌ## ±3ÀÈÔ#)[3;#3Ó¿}##ûÿks5ut#Í# ú
îhç##ÌÐé_5##÷##PN#L#¦#¦NÀ#¥êÿ|Ð4B#ÿ#öO-#½#6,LÿÆþ#Ë#åO9É
úÄ#Ð#gl¬S®8#2¯tÈ93VZ#N#Å##'[#V\u00EF#Ñé"F/n#+Á##>#UÓ#3ã2¾
We are using the same system to test print functionality. the preview on spool looks like below. Thanks!
%PDF-1.3##%âãÏÓ##2 0 obj##<<##/Type /XObject##/Subtype
P=þ.þ HçÕ#WÏ~#Õ#2Ú·ú/ð ü¨Ô%&#½rø#þU{À##^©#ðé¬#7*s£´¿WZw
ù¼å¤õÓG)ß6å軥õ²ªr##´#¤ÃiÒG"#ºMÏRÜ£\u00D4V#Ölj[J(Ì#J#KÉ@Wkà
#Õå##ÍA}#¹9¹##,,¬ÜlHÌÌ## ±3ÀÈÔ#)[3;#3Ó¿}##ûÿks5ut#Í# ú
îhç##ÌÐé_5##÷##PN#L#¦#¦NÀ#¥êÿ|Ð4B#ÿ#öO-#½#6,LÿÆþ#Ë#åO9É
úÄ#Ð#gl¬S®8#2¯tÈ93VZ#N#Å##'[#V\u00EF#Ñé"F/n#+Á##>#UÓ#3ã2¾
'RAW'
%PDF-1.3##%######2 0 obj##<<##/Type /XObject##/Subtype /Image##/Fi
###
P=#.##H###W#~###2###/#####%&##r###U{###^######7*s###WZwN#j$#####C#
###
######G)#6#######r######i#G"##M#R###V##lj[J(##J#K#@Wk#######r#H##
##@
######A}##9###,,##lH######3####h###g#)[3;#3##}####ks5ut##########
?#j
#h######_5#####PN#L####N##### #4B####O-###6,L#######O9#;##M####O##
F#o
#####gl#S##8#2#t#93VZ#N####'[#V####"F/n#+###>#U##3#2######y###o##
'Hex'
%PDF-1.3##%######2 0 obj##<<##/Type /XObject##/Subtype /Image##/Filter 3
###
25442323002EECD0032326660033002577622546666700257677762246666002466767232
5046D1E3DA523F3DA2000F2ADACCDAF49050F8F2A534DAF35249050F9D175DAF69C452030
AC0
5C7
P=#.##H###W#~###2###/#####%&##r###U{###^######7*s###WZwN#j$#####C###U###'
###
53F2FA4ED95C70D83DBF2FAFAD228B7F1F57C915A1FEA0327ABB5574A62DCAAC4E8E5C192
0DEEE087597FE5522A7AF00C84562D281E5B0F7E9209C27A334F7A7E9A42D4A73C0C52647
FD8
'Graphical'
%PDF-1.3##%âãÏÓ##2 0 obj##<<##/Type /XObject##/Subtype
P=þ.þ HçÕ#WÏ~#Õ#2Ú·ú/ð ü¨Ô%&#½rø#þU{À##^©#ðé¬#7*s£´¿WZ
ù¼å¤õÓG)ß6å軥õ²ªr##´#¤ÃiÒG"#ºMÏRÜ£\u00D4V#Ölj[J(Ì#J#KÉ@Wk
#Õå##ÍA}#¹9¹##,,¬ÜlHÌÌ## ±3ÀÈÔ#)[3;#3Ó¿}##ûÿks5ut#Í#
îhç##ÌÐé_5##÷##PN#L#¦#¦NÀ#¥êÿ|Ð4B#ÿ#öO-#½#6,LÿÆþ#Ë#åO9
úÄ#Ð#gl¬S®8#2¯tÈ93VZ#N#Å##'[#V\u00EF#Ñé"F/n#+Á##>#UÓ#3ã2¾
"H#|TwÛn©.EÃÌbËÅfN«å[Þ#KÜjþV|ÿ¼aóÌ#Ô### #ù####"#Aö&Õ
#g##h:T)\u00A4ÄúÂ##þ¾#øk#®ä»Çµ¸xc½èükßÔ#L£åC«#ÏÓ~#nüB #(-·
I think PDF from spool can't be printed correctly on every printer , printers need some settings as a prerequisite.
Please read this
If you output the print file using the SAP functions, you must have a PCL, PostScript, or ZPL printer, since print files can currently only be created from the PDF-based forms for these printer types. You cannot use a printer with the device type SAPWIN/SWIN.
And refer these links
http://help.sap.com/saphelp_nw70/helpdata/en/25/6fa8fd27837846990a7a6813b06f80/content.htm
http://help.sap.com/saphelp_nw70/helpdata/en/c8/7f065c7363f14c84a97a3687aa7e62/content.htm
.Hi,
I just had this issue two days before and i created FM for convert to pdf, please follow the code and revert if any..
if you want to print it out just use another importing parameter to pass 'X' to print out immedieately..
or u can add your print settings in 'GET_PRINT_PARAMETERS'
FUNCTION z_convert_to_pdf.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_FILENAME) TYPE LOCALFILE OPTIONAL
*" REFERENCE(I_PAART) TYPE SYPAART DEFAULT 'X_65_132'
*" REFERENCE(I_REPID) TYPE SYREPID
*" REFERENCE(I_LINSZ) TYPE SYLINSZ OPTIONAL
*" EXPORTING
*" REFERENCE(E_SPONO) TYPE RSPOID
*"----------------------------------------------------------------------
DATA: l_params TYPE pri_params,
l_valid TYPE string,
w_spool_nr LIKE tsp01-rqident.
DATA: l_repid TYPE sy-repid.
*Internal table for Selection Screen
DATA: BEGIN OF it_rsparams OCCURS 0.
INCLUDE STRUCTURE rsparams.
DATA: END OF it_rsparams.
l_repid = i_repid.
*TO GET PRINT PARAMETERS
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
* archive_id = c_char_unknown
* archive_info = c_char_unknown
* archive_mode = c_char_unknown
* archive_text = c_char_unknown
* ar_object = c_char_unknown
* archive_report = c_char_unknown
* authority = c_char_unknown
* copies = c_num3_unknown
* cover_page = c_char_unknown
* data_set = c_char_unknown
* department = c_char_unknown
* destination = c_char_unknown
* expiration = c_num1_unknown
immediately = space
* in_archive_parameters = ' '
* in_parameters = ' '
* layout = c_char_unknown
* line_count = c_int_unknown
* line_size = c_int_unknown
* list_name = c_char_unknown
* list_text = c_char_unknown
* mode = ' '
* new_list_id = c_char_unknown
* protect_list = c_char_unknown
no_dialog = 'X'
* receiver = c_char_unknown
* release = c_char_unknown
* report = c_char_unknown
* sap_cover_page = c_char_unknown
* host_cover_page = c_char_unknown
* priority = c_num1_unknown
* sap_object = c_char_unknown
* type = c_char_unknown
* user = sy-uname
* use_old_layout = ' '
* uc_display_mode = c_char_unknown
* draft = c_char_unknown
* abap_list = ' '
* use_archivename_def = ' '
* default_spool_size = c_char_unknown
* with_structure = c_char_unknown
* suppress_shading = c_char_unknown
* po_fax_store = ' '
* no_frames = c_char_unknown
IMPORTING
* OUT_ARCHIVE_PARAMETERS =
out_parameters = l_params
valid = l_valid
* VALID_FOR_SPOOL_CREATION =
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4 .
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
IF l_valid NE 'X'.
STOP.
ENDIF.
* Store the current selection screen details
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = l_repid
TABLES
selection_table = it_rsparams.
IF i_linsz IS NOT INITIAL.
l_params-linsz = i_linsz.
ENDIF.
IF i_paart IS NOT INITIAL.
l_params-paart = i_paart.
ENDIF.
*Submit Report
SUBMIT (l_repid) WITH SELECTION-TABLE it_rsparams
TO SAP-SPOOL
SPOOL PARAMETERS l_params
WITHOUT SPOOL DYNPRO
AND RETURN.
*SELECT THE RECENTLY CREATED SPOOL
SELECT MAX( rqident ) INTO w_spool_nr FROM tsp01
WHERE rqclient = sy-mandt
AND rq0name = l_params-prdsn
AND rq1name = l_params-pdest
AND rq2name = l_params-plist
AND rqowner = l_params-prrec.
SUBMIT rstxpdft4
WITH p_file = i_filename
WITH spoolno = w_spool_nr
AND RETURN.
e_spono = w_spool_nr.
ENDFUNCTION.
Edited by: playsuji on Jan 15, 2012 5:20 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Suji's code formatted.
>Hi,
> I just had this issue two days before and i created FM for convert to pdf, please follow the code and revert if any..
> if you want to print it out just use another importing parameter to pass 'X' to print out immedieately..
> or u can add your print settings in 'GET_PRINT_PARAMETERS'
>
FUNCTION z_convert_to_pdf. > *"---------------------------------------------------------------------- > *"*"Local Interface: > *" IMPORTING > *" REFERENCE(I_FILENAME) TYPE LOCALFILE OPTIONAL > *" REFERENCE(I_PAART) TYPE SYPAART DEFAULT 'X_65_132' > *" REFERENCE(I_REPID) TYPE SYREPID > *" REFERENCE(I_LINSZ) TYPE SYLINSZ OPTIONAL > *" EXPORTING > *" REFERENCE(E_SPONO) TYPE RSPOID > *"---------------------------------------------------------------------- > > > DATA: l_params TYPE pri_params, > l_valid TYPE string, > w_spool_nr LIKE tsp01-rqident. > DATA: l_repid TYPE sy-repid. > > > *Internal table for Selection Screen > DATA: BEGIN OF it_rsparams OCCURS 0. > INCLUDE STRUCTURE rsparams. > DATA: END OF it_rsparams. > l_repid = i_repid. > > *TO GET PRINT PARAMETERS > CALL FUNCTION 'GET_PRINT_PARAMETERS' > EXPORTING > immediately = space > no_dialog = 'X' > IMPORTING > * OUT_ARCHIVE_PARAMETERS = > out_parameters = l_params > valid = l_valid > * VALID_FOR_SPOOL_CREATION = > EXCEPTIONS > archive_info_not_found = 1 > invalid_print_params = 2 > invalid_archive_params = 3 > OTHERS = 4 . > > IF sy-subrc <> 0. > MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno > WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. > ENDIF. > > IF l_valid NE 'X'. > STOP. > ENDIF. > > * Store the current selection screen details > CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS' > EXPORTING > curr_report = l_repid > TABLES > selection_table = it_rsparams. > IF i_linsz IS NOT INITIAL. > l_params-linsz = i_linsz. > ENDIF. > IF i_paart IS NOT INITIAL. > l_params-paart = i_paart. > ENDIF. > > *Submit Report > SUBMIT (l_repid) WITH SELECTION-TABLE it_rsparams > TO SAP-SPOOL > SPOOL PARAMETERS l_params > WITHOUT SPOOL DYNPRO > AND RETURN. > > *SELECT THE RECENTLY CREATED SPOOL > SELECT MAX( rqident ) INTO w_spool_nr FROM tsp01 > WHERE rqclient = sy-mandt > AND rq0name = l_params-prdsn > AND rq1name = l_params-pdest > AND rq2name = l_params-plist > AND rqowner = l_params-prrec. > SUBMIT rstxpdft4 > WITH p_file = i_filename > WITH spoolno = w_spool_nr > AND RETURN. > e_spono = w_spool_nr. > > ENDFUNCTION.
>
> Edited by: playsuji on Jan 15, 2012 5:20 PM
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.