on 04-29-2010 6:43 PM
Hi All
I have extremely interesting situations and have been struggling with this for a past week. I have been looking everywhere but nobody seems to have an answer. This is my last resort.
Detail -
I am consuming UPS web service from my ABAP program. Everything works fine until I have to print UPS label. The label image is returned to my ABAP program via XML by the UPS reply transaction as a GIF image.
When I download this image to my PC I can see it and print it, but for the love of god I cannot print this image from my ABAP program. The GIF image is passed to me as a binary data string it looks like bunch on numbers - (2133FFDGFGFGFHHu2026..) very long string about 89800 bites. I cannot use smart forms since smart form requires to have graphic stored in SAP before smart form print, so this is not possible. I need help figuring out how print GIF image form ABAP or any other SAP method dynamically. Any ideas are extremely appreciated. I am just puzzled that I cannot find any info on something like this. I cannot be the first one who needs to print GIF image in SAP.
Hi,
Currently I am facing same issue i.e I am receiving Base 64 GIF label information from UPS.
I want to convert it into PDF. could you please let me know how do achieve this.
Best Regards
Raj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am also consuming an UPS web service and trying to print the label data received in base64 format. Please let me know, if you had any solution for converting and passing the data to a printer in SAP. I am also exploring options and will post if i have a solution. Thanks.
Regards,
Chaitu.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What SAP version are you on?
I found the way to print labels only on Zebra printer. GIF image I cannot print from SAP version 4.7.But if you are on 6.40
and you have access to Adobe Forms, this can be done in a few easy steps.
The adobe forms is the only forms tool that is designed to use graphics from the MIME Repository. The SmartForms and SAPScript technologies pre-date the Mime Repository and therefore donu2019t take it into consideration.
This is a bit of guessing on my part, but could you dynamically create a BDS document (which should be usable from forms). You would need to convert the GIF to BMP. You can do this with the IGS (Internet Graphics Server). Here is a sample:
data g_bool_result type c.
check existance of ImageConverter interpreter
call method cl_igs_data=>is_registered_type
exporting
type = cl_igs_image_converter=>interpreter_type
receiving
rval = g_bool_result
exceptions
rfc_communication_error = 1
rfc_system_error = 2
internal_error = 3
others = 4.
if sy-subrc ne 0.
raise exception type zcx_abap_bitmap
exporting
textid = zcx_abap_bitmap=>igs_error.
elseif g_bool_result is initial.
raise exception type zcx_abap_bitmap
exporting
textid = zcx_abap_bitmap=>igs_converter.
endif.
data: l_igs_imgconv type ref to cl_igs_image_converter,
l_img_blob type w3mimetabtype,
l_img_size type w3param-cont_len,
l_bmp_xstream type xstring.
create object l_igs_imgconv.
l_img_size = xstrlen( gx_content ).
call function 'SCMS_XSTRING_TO_BINARY'
exporting
buffer = gx_content
tables
binary_tab = l_img_blob.
call method l_igs_imgconv->set_image
exporting
blob = l_img_blob
blob_size = l_img_size.
data l_format type string.
l_format = i_format.
case l_format.
when 'TIF'.
l_igs_imgconv->output = 'image/tiff'.
when 'JPG'.
l_igs_imgconv->output = 'image/jpeg'.
when 'PNG'.
l_igs_imgconv->output = 'image/png'.
when 'GIF'.
l_igs_imgconv->output = 'image/gif'.
when 'BMP'.
me->get_content_bytesteam(
importing
e_bmp_xstream = e_xstream ).
exit.
when others.
raise exception type zcx_abap_bitmap.
endcase.
l_igs_imgconv->input = 'image/x-ms-bmp'.
call method l_igs_imgconv->execute
exceptions
others = 1.
if sy-subrc is initial.
call method l_igs_imgconv->get_image
importing
blob = l_img_blob
blob_size = l_img_size.
endif.
Now that it is a Bitmap in the table format, call SAPSCRIPT_CONVERT_BITMAP_BDS. This will convert to the BDS format. Now I donu2019t think there is an API to save the content back into the BDS store. However the program SAPLSTXBITMAPS has the logic. Check IMPORT_BITMPA_BDS. You can probably extract that code to use.
From that point forward you can use this new BDS document in your SmartForm.
Edited by: papick on May 18, 2010 6:28 PM
Edited by: papick on May 18, 2010 6:29 PM
Edited by: papick on May 18, 2010 6:30 PM
> You would need to convert the GIF to BMP. You can do this with the IGS (Internet Graphics Server). Here is a sample:
Just to make things clear for everyone: the sample is about converting from BMP to "any" format. It is easy to adapt it to convert from any format to BMP by switching input and output variables.
> Now I donu2019t think there is an API to save the content back into the BDS store
You can do it easily by calling RSTXLDMC program to upload a file into SE78 (file must be on frontend if called in dialog, or backend if called in background)
Another very interesting thing I tried is I wrote a PERL script and stored it in SAP application server UNIX directory (in my case) as an xxxxxx.pl file. My Perl script has no problem converting anything to anything. From ABAP program I save my *.GIF file into UNIX application server directory (or any OS level that you using) and call my PERL script from ABAP program. It works very fast. The only difficult part is that you need to figure out how to pass SAP printer parameter to Perl for printing. This can be very tricky if you donu2019t have actual IP address of the printer. Otherwise it work perfectly if your BASIS will allow.
I asked the webservice developer to send the label data in BASE64 format and then in the program converted it into string using the FM SCWM_XSTRING_TO_TEXT and passed the string to the printer. The Label printed sucessfully with the graphic image. Thanks
Edited by: CHAIITU on May 24, 2010 1:03 AM
Hi Chaiitu,
I must respond to your post, so that other people are not mistaken, because your answer is no more related to the original question.
What you say has nothing to do with the image printing problem. What you are talking about is only how to pass an already print-ready image byte stream via a web service. Base 64 is only a way of passing a binary stream, whatever it is (not related to images, not related to printers). And SCMS_XSTRING_TO_TEXT (I guess your WM is a typo error) is only a way to convert from an internal ABAP type to another ABAP type.
The issue with printing images is that printers don't accept the usual image formats like GIF, JPG, PNG, etc. For example, PCL 5 printer language can only print images passed as 1 ("print dot") and 0 ("print nothing"), and compressed (or not) by one of these compression algorithms: unencoded (simple sequence of bits where 1 means , run-length encoding, tiff, delta (and another one which is not specified).
SAP can only convert TIFF and BMP into one of these formats. It also works with PostScript, ZPL, Prescribe (and another one I don't remember; and since it is possible that vendors provide their own convertors since "Printer Vendor Program" was introduced).
Sandra
Hi Chaiitu u2013
Can you please explain, what do you mean passing to the printer? Are you passing the text string into a SmartForm or SAPSCRIPT? Also what label image format did you request to be returned from UPS web service? If it is GIF, then your conversion to text string would never work. Can you please provide more details?
Hi all,
I understand this thread was started long back. But wanted to share this solution since I see the same question in many forums without any particular conclusive answer. So the steps I am explaining here, if it helps in some way, I will be really happy. I won't say this is the perfect solution. But it definitely helps us to print the images. This solution is infact implemented successfully in my client place & works fine.
And please note there may be better solutions definitely available in ECC6 or other higher releases. This solution is mainly for lesser versions, for people don't have ADOBE forms or other special classes.
Important thing here is binary string is converted to postscript here. So you need to make sure your printer supports postscripts. (Ofcourse, if anybody is interested, they can do their R&D on PCL conversion in the same way...and pls let me know). Once the binary data is converted to postscript, we are going to write it in the binary spool. so you will still see junk characters (or numberssss) in spool. But when you print it in postscript printer , it should work.
First step, assuming you have your binary data ready from tiff or pdf based on your requirement.
Basically below compress/decompress function modules convert the binary data from lt_bin (structure TBL1024) to target_tab (structure SOLIX). From Raw 1024 to Raw 255
DATA: aux_tab LIKE soli OCCURS 10. - temp table
Compress table
CALL FUNCTION 'TABLE_COMPRESS'
TABLES
in = lt_bin
out = aux_tab
EXCEPTIONS
compress_error = 1
OTHERS = 2.
Decompress table
CALL FUNCTION 'TABLE_DECOMPRESS'
TABLES
in = aux_tab
out = target_tab
EXCEPTIONS
compress_error = 1
table_not_compressed = 2
OTHERS = 3.
In my case, since I have to get it from archived data using function module, ARCHIV_GET_TABLE which gives RAW 1024, above conversion was necessary.
Second step: Application server temporary files for tif/postscript files.
We need two file names here for tif file & for converted postscript file. Please keep in mind, if you are running it in background, user should have authorization to read/write/delete this file.
Logical file name just to make sure the file name is maintainable. Hard code the file name if you don't want to use logical file name.
CALL FUNCTION 'FILE_GET_NAME'
EXPORTING
logical_filename = 'ABCD'
parameter_1 = l_title
parameter_2 = sy-datum
parameter_3 = sy-uzeit
IMPORTING
file_name = lv_file_name_init
EXCEPTIONS
file_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Now concatenate with the different extensions to get two different files.
CONCATENATE lv_file_name_init '.tif' INTO lv_file_name_tif.
CONCATENATE lv_file_name_init '.ps' INTO lv_file_name_ps.
Third step: Write the target_tab to tif file.
Open dataset for writing the tif file.
OPEN DATASET lv_file_name_tif FOR OUTPUT IN BINARY MODE.
IF NOT sy-subrc IS INITIAL.
RAISE open_failed.
ELSE.
LOOP AT target_tab INTO w_target_tab.
CATCH SYSTEM-EXCEPTIONS dataset_write_error = 1
OTHERS = 4.
TRANSFER w_target_tab TO lv_file_name_tif.
ENDCATCH.
IF NOT sy-subrc IS INITIAL.
RAISE write_failed.
ENDIF.
ENDLOOP.
CATCH SYSTEM-EXCEPTIONS dataset_cant_close = 1
OTHERS = 4.
CLOSE DATASET lv_file_name_tif.
ENDCATCH.
ENDIF.
Fourth Step: Convert the tiff file to postscript file.
This is the critical step. Create an external command (SM49/SM69) for this conversion. In this example, Z_TIFF2PS is created. Infact, I did get help from our office basis gurus in this. so I don't have the exact code of this unix script. You can refer the below link or may get some help from unix gurus.
http://linux.about.com/library/cmd/blcmdl1_tiff2ps.htm
Since my external command needs .ps file name and .tif file name as input, concatenate it & pass it as additional parameter. Command will take care of the conversion & will generate the .ps file.
CONCATENATE lv_file_name_ps lv_file_name_tif INTO lw_add SEPARATED BY space.
Call the external command with the file paths.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'Command name'
additional_parameters = lw_add
TABLES
exec_protocol = t_comtab.
Fifth step: Read the converted ps file and convert it to RAW 255.
DATA:lw_content TYPE xstring.
Open dataset for reading the postscript (ps) file
OPEN DATASET lv_file_name_ps FOR INPUT IN BINARY MODE.
Check whether the file is opened successfully
IF NOT sy-subrc IS INITIAL.
RAISE open_failed.
ELSE.
READ DATASET lv_file_name_ps INTO lw_content.
ENDIF.
Close the dataset
CATCH SYSTEM-EXCEPTIONS dataset_cant_close = 1
OTHERS = 4.
CLOSE DATASET lv_file_name_ps.
ENDCATCH.
Make sure you delete the temporary files so that you can reuse the same names again & again for next conversions.
DELETE DATASET lv_file_name_tif.
DELETE DATASET lv_file_name_ps.
Convert the postscript file to RAW 255
REFRESH target_tab.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = lw_content
TABLES
binary_tab = target_tab.
Sixth step: Write the postscript data to binary spool by passing the correct print parameters.
IF NOT target_tab[] IS INITIAL.
PERFORM spo_job_open_cust USING l_device
l_title
l_handle
l_spoolid
lw_nast.
LOOP AT target_tab INTO w_target_tab.
PERFORM spo_job_write(saplstxw) USING l_handle
w_target_tab
l_linewidth.
ENDLOOP.
PERFORM spo_job_close(saplstxw) USING l_handle
l_pages.
IF sy-subrc EQ 0.
MESSAGE i014 WITH
'Spools for'(019) lw_final-vbeln
'created successfully.Check transaction SP01'(020).
ENDIF.
ENDIF.
Please note the parameters when calling function module RSPO_SR_OPEN. Change the print parameters according to your requirement. This is very important.
FORM spo_job_open_cust USING value(device) LIKE tsp03-padest
value(title) LIKE tsp01-rqtitle
handle LIKE sy-tabix
spoolid LIKE tsp01-rqident
lw_nast TYPE nast.
DATA: layout LIKE tsp01-rqpaper,
doctype LIKE tsp01-rqdoctype.
doctype = 'BIN'.
layout = 'G_RAW'.
CALL FUNCTION 'RSPO_SR_OPEN'
EXPORTING
dest = device "Printer name
LDEST =
layout = layout
NAME =
suffix1 = 'PDF'
SUFFIX2 =
COPIES =
prio = '5'
immediate_print = 'X'
immediate_print = lw_nast-dimme
auto_delete = ' '
titleline = title
RECEIVER =
DIVISION =
AUTHORITY =
POSNAME =
ACTTIME =
LIFETIME = '8'
append = ' '
coverpage = ' '
CODEPAGE =
doctype = doctype
ARCHMODE =
ARCHPARAMS =
TELELAND =
TELENUM =
TELENUME =
IMPORTING
handle = handle
spoolid = spoolid
EXCEPTIONS
device_missing = 1
name_twice = 2
no_such_device = 3
operation_failed = 4.
CASE sy-subrc.
WHEN 0.
PERFORM msg_v1(saplstxw) USING 'S'
'RSPO_SR_OPEN o.k., Spoolauftrag $'(128)
spoolid.
sy-subrc = 0.
WHEN 1.
PERFORM msg_v1(saplstxw) USING 'E'
'RSPO_SR_OPEN Fehler: Gerät fehlt'(129)
space.
sy-subrc = 1.
WHEN 2.
PERFORM msg_v1(saplstxw) USING 'E'
'RSPO_SR_OPEN Fehler: Ungültiges Gerät $'(130)
device.
sy-subrc = 1.
WHEN OTHERS.
PERFORM msg_v1(saplstxw) USING 'E'
'RSPO_SR_OPEN Fehler: $'(131)
sy-subrc.
sy-subrc = 1.
ENDCASE.
ENDFORM. "spo_job_open_cust
Thats it. We are done. If you open the spool, still you will see numbers/junk characters. if you print it in postscript printer, it will be printed correctly. If you try to print it PCL, you will get lot of pages wasted since it will print all junk characters. So please make sure you use postscript printer for this.
Extra step for mails (if interested):
Mails should work fine without any extra conversion/external command since it will be opened again using windows. So after the first step (compress & decompress)
Create attachment notification for each attachment
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 1.
objpack-body_start = lv_num + 1.
DESCRIBE TABLE lt_target_tab LINES objpack-body_num.
objpack-doc_size = objpack-body_num * 255.
objpack-body_num = lv_num + objpack-body_num.
lv_num = objpack-body_num.
objpack-doc_type = 'TIF'.
CONCATENATE 'Attachment_' l_object_id INTO objpack-obj_descr.
reclist-receiver = l_email.
reclist-rec_type = 'U'.
reclist-express = 'X'.
APPEND reclist.
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = docdata
put_in_outbox = 'X'
commit_work = 'X'
TABLES
packing_list = objpack
contents_txt = objtxt
contents_hex = target_tab
receivers = reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
IF sy-subrc <> 0.
RAISE email_not_sent.
ENDIF.
COMMIT WORK.
Hope this helps. I am sure this (print/email both) can be improved further by removing some conversions/by using some other methods.Please check & let me know if you have any such suggestions or any other comments.
Regards,
Gokul
Edited by: Gokul R Nair on Nov 16, 2011 2:59 AM</pre>
Edited by: Gokul R Nair on Nov 16, 2011 3:01 AM
Edited by: Gokul R Nair on Nov 16, 2011 3:15 AM
SAP is not a print server, that's why.
You may probably use IGS server to convert the image (see demo program GRAPHICS_IGS_CE_TEST, there are also blogs and sap library about that topic).
Maybe you can print the GIF image using Interactive Forms by Adobe.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sandar -
I understand that SAP is not a print server. I am on 4.7 version and dont have Adobe forms. I am looking for a way to print a label that is in raw format binary string. I just need to find a way to send it to SAP printer. i was able to dinamicaly store my GIF file MIME repocitory. But now I dont know how to print from MIME. Mybe you do?
not so easy to send it to printer. Printers don't natively understand GIF format, nor any other format (not even PDF usually). Printers only understand Page Description Languages (PCL, PostScript, Prescribe, ZPL, supported by SAP; and many others not supported by SAP). SAP provides drivers (the ones you see in device types in SPAD transaction) to convert BMP and TIFF in one of these PDL.
Well, that said, I saw that IGS can be installed in a 6.20 as a plugin (it is only provided in standard as of 6.40). I don't have the details. See sap library: "Until SAP Web Application Server 6.20, the IGS has been available only as standalone engine. The standalone IGS is a Windows application that runs standalone on a Windows IA32 machine and which is connected against several systems."
Otherwise, you should use another external application.
From my ABAP program I can call GUI_DOWNLOAD function and I can see and print my GIF image. SAP has no problems understanding my binary string format. Also PCL is supported by SAP since it's a native HP code so the print controls are stored in SAP. I just somehow need to tell the printer that I am printing binary data string that represent a GIF file, that all easy to say that done. I am stuck here. Maybe there is a way to print from SE80 MIME repository. I was able to store my file there.
> From my ABAP program I can call GUI_DOWNLOAD function and I can see and print my GIF image. SAP has no problems understanding my binary string format.
No, it doesn't "understand", it just copies the binary string (could be any weird format, for SAP, it's only bytes). SAP sends it to your desktop. Only Windows softwares can understand these bytes.
> Also PCL is supported by SAP since it's a native HP code so the print controls are stored in SAP.
It's what I said. SAP converts into either PCL, PostScript, ZPL or prescribe
> I just somehow need to tell the printer that I am printing binary data string that represent a GIF file, that all easy to say that done. I am stuck here.
I'm sorry you didn't understand what I said. On that topic, I know how it works.
> Maybe there is a way to print from SE80 MIME repository. I was able to store my file there.
Storing a sequence of bytes is not difficult. What is difficult is to convert GIF into BMP or GIF into PCL, or PostScript or whatever format you want.
> In SAP it is easy to convert my binary data to BMP there is a function fore that
A conversion can only be done between formats, a binary data is not a format. A format is BMP, GIF, etc.
> how do i print converted data string?
You must convert before printing. IGS, again. Or another external software.
OK, i don't think you follow on what i was saying. Ones again i am reviving a data string from a web service which represents a
in-coded GIF FILE in BASE64 format. I am taking this file and converting (decoding) to binary format inside my program. I have done this with hopes that i can print binary representation of a GIF file by sending to SAP printer. I wasn't successful doing that.
I am trying to find a way on how to do a print, maybe i can save my file to application server and do a native UNIX print COMMAND. I wonder if that would work? I am running out of options. I am surprised that sap cannot do it. I wonder how people printing pictures in ABAP reports or pictures of employees from HR database. There got to be the way to do this.
Yes, there is. If you have downloaded the binary data, then you can 'shell-out' to the command line and trigger the print using the EXECUTE method of CL_GUI_FRONTEND_SERVICES. You just need the correct parameters/switches for the application that you're going to trigger. For example:
DATA: lv_parameter TYPE string.
CONCATENATE '"' 'c:\mypic.gif' '"' INTO lv_parameter.
CONCATENATE '/p' lv_parameter INTO lv_parameter SEPARATED BY space.
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
application = 'c:\windows\system32\mspaint.exe'
parameter = lv_parameter
synchronous = 'X'
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
bad_parameter = 3
file_not_found = 4
path_not_found = 5
file_extension_unknown = 6
error_execute_failed = 7
synchronous_failed = 8
not_supported_by_gui = 9
OTHERS = 10.
Note that your assertion that you can't use smartforms is not correct. You can dynamically load (and destroy) images to the graphics manager (BMP's), pass the assigned name to a smartform (which just contains a single graphic node with a variable name), and print the form as required. The code for the (dynamic) image upload is in the SE78 transaction. This may be a better option formatting-wise.
OK, my bad, when you said 'download the image to my PC', I assumed a foreground-based solution was OK. I would post the code for the dynamic image upload but it's too many lines of code. I've posted it before and Rob has slapped the back of my hand for doing it. It's basically a stripped-down version of the code in SE78; if you need it, contact me at the e m a i l address on my account.
Business Document Services may also be a solution, though I haven't worked with it much. There is a print method in one of the classes but i t may require a viewer in order to trigger it. The MIME repository also requires some sort of foreground/gui-level interaction as well to print.
I'm just surprised that UPS doesn't provide PDF-based label data in their responses...
Brad -
Thanks again. Now that you said PDF... Hmm. i can probably convert my binary GIF representation to a PDF format don't you think? So let's assume i will succeed of doing that, then i will end up with another string of data but in PDF format. Then you saying i can print this?
Please advice.
Well, again I forgot that you don't have access to an ADS engine in 4.7 and you're not using a foreground-based application. We render PDF-based labels in a browser window or Adobe Reader individually; otherwise, we use SAPscript/Smartforms/Adobe Forms to render labels in the background. I guess I would still opt for the BMP to OTF approach with a Smartform, not knowing much about the print capabilites of BDS or the IGS that Sandra suggested.
> The call to CL_GUI_FRONTEND_SERVICES wonu2019t work in background.
it could in a different way: dedicate a Windows computer as a server. See that [SDN article - Communication to Presentation Server in Background Mode|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/9831750a-0801-0010-1d9e-f8c64efb2bd2].
Note: MSPaint will print directly the image to the default Windows printer, is that the goal? don't you want to print something around?
> Also IGS is not a availably in 4.7 release 6.20
Officially, it is, to be installed on a Windows 32 bits server, it seems that it used to work with 2000/NT according to some comments. But well, maybe it is not compatible with newest OS
> i can probably convert my binary GIF representation to a PDF format don't you think?
Using external software (ok I understand that my answers bother you)
Maybe you can use MS Word 2007, it allows to save in PDF format. As I said above, you can use it in background, provided you have a Windows server. I think you can call a VB Script to start a macro in MS Word.
Though, I don't think it's a good idea to not use a specialized software.
Note that SAP also provides an interface to connect SAP to an external software for converting documents of any kind. It is called BC-XDC (external data converter). There is a good documentation in an SDN article. You must purchase the external software though.
All of this not possible.I need to print not one label, but it will be a a fair amount of volume like 10 to 20 labels at the time. The windows PC will crash right away. I think I have a solution for this. I will write UNIX SHELL script that I will execute from my ABAP program. Shell script will take care of conversion and printing to network printer. It's much easier to do on OS level.
PCL documentation is at HP website. Format of images is explained there (except one format which is reserved to Microsoft). SAP's HPL driver (PCL 5 in fact) converts BMP and TIFF images into this PCL format.
Sequence of bytes for images is approximately:
<ESC>*r#S sets the width in pixels
<ESC>*r#T sets the height in pixels
<ESC>*rA starts the graphic
<ESC>*b#M sets the compression mode # of the image (0 = unencoded, 1 = run-length encoding, 2 = TIFF, 3 = delta, 1030 = undocumented/Microsoft)
<ESC>*B#W indicates how many # bytes follow
<list of bytes in the format indicated by the compression mode>
<ESC>*rC ends the graphic
See the documentation about the different compression modes. 0 is easy to understand and use.
Yes, in hexadecimal. I didn't do that but I know how it works (I decoded manually some PCL codes generated by SAP HPL driver to make sure how it works for a few things; but generating the PCL is a waste of time, we should let specialized softwares do it). The PCL codes I mentioned above are to be encoded in US-ASCII, and <ESC> corresponds to 1B. Numbers are expressed with US-ASCII digits.
<ESC>*r100S corresponds to:
/: HEX TYPE PCL
1B2A7231303053
/: ENDHEX
Sandra - Thanks again.
Unfortunately i am very light on this subject and cannot find any examples of the actual sap script with PCL commands. Do I have to use any specific command for print control inside the sap script?
Do you have any SAPSCRIPT working example that i can try to print and see if it is working on my printer. I tried some things that you suggested, but my page comes out blank on the printer. Don't know why.
it sees that you are extremely knowledgeable in this area. If it's not to much trouble can you please give me a screen print of a working SAP SCRIPT that actually prints something with PCL command in it.
That would be a lot of help.
My example that prints blank page:
/: HEX TYPE PCL
/= 1B2A72313030531B2A72353054
/= ************ TEST **********************
/: ENDHEX
I assumed it should print my ************* TEST ************ on the printer right?
Thanks.
I understand it's complex, that's why I was asking if you have done anything like that. I just wanted to see a few lined of code where it is actually working. Nothing specific, just a "Hello World" example. I am trying various things and I get a blank page all the time. This a real correct data example that has all correctly converted data into HEX and its still prints blank page.
I put this code into SAPSCRIPT and it still didnu2019t print anything.
/: HEX TYPE PCL
/= 1B2A7230461B2A743735521B2A7231411B2A62304D1B2A62343057FFFFFFFFFFFF
/= FF1B2A62343057FFFFFFFFFFFFC0007D00DFC0F7D0000000000000000000000017
/: ENDHEX
Sandar please -
if you have never done this before, please let me know and I will not waist yours or mine time anymore.
Yes, I've never done it. But I see your errors. Try this one instead (horizontal line of 7 pixels): 1B2A7230461B2A743735521B2A7230411B2A7237531B2A7231541B2A62304D1B2A623757FFFFFFFFFFFFFF1B2A7243
Notes:
- Do not print to a SAPWIN "printer" because you can't send hex code in PCL format (because it expects code in SAP proprietary SAPWIN format, described in SAP note ?). You must print to a printer with a PCL device type (which has HPL driver)
- You may create a simple smart form with a very simple BMP picture, and use Note 5799 How can you view prepared print data, to check the PCL code generated by SAP
Sandra -
i followed your advice and did look at a procedure in 5799. Well i got my output request in HEX, but now it is even more confusing. i dont see any 1B (escape sequience) values as we talk about previosly. I dont even know what part of this I have to look at. I canno tell when is PCL command starts or ends and where is the image begins and ends?
any idea.
Print request processing log
This print request was printed with extended log
The first 10000 characters in the data sent:
Character converter active when first problem oc
Data was saved with character set 1100
Data will be converted to character set 1116 (sy
#%-12345X#PJL##
122333335454400
B5D12345800ACDA
#PJL ENTER LANGUAGE=PCL##
4544244545244445444354400
00AC05E4520C1E75175D03CDA
#E#(0N#&l0L#&l26A#&l0O#&l48C#&l0E#&l0C#9##
141234126341263341263412633412634126341300
B5B80EB6C0CB6C261B6C0FB6C483B6C05B6C03B9DA
00
DA
#&a3000V#&a504H#p0P#r1U#r0F#t100R#r160s160T#r1A#b2M#b2W###b2W###b2W###b19W###?################b19W####ps
This is not a comlete file.
> #E#(0N#&l0L#&l26A#&l0O#&l48C#&l0E#&l0C#9##
> 141234126341263341263412633412634126341300
> B5B80EB6C0CB6C261B6C0FB6C483B6C05B6C03B9DA
First line represents the characters (# is a generic replacement character when character can't be displayed). 2 next lines are the hex codes vertically: # = 1B, E = 45, etc.
Image bytes start right after <ESC>*B#W (indicates how many # bytes follow)
Edited by: Sandra Rossi on May 5, 2010 10:21 AM
Two more remarks:
1) the compression mode is 2 = TIFF (<ESC>*B2M)
2) #r160s160T is an abbreviation (because of S lower case) of <ESC>r160S <ESC>*r160T
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.