on 11-11-2006 1:08 AM
Hi folks,
I am trying to add a barcode to represent PO number on a SAPscript form, keeping in mind I don't have barcode DIMMs on all printers that will print them (and yes, I know it's easy to do in Smartforms, but I didn't dabble with it yet and not about to start now). Now, I think I should be able to achieve my goal through the following hack:
1. Generate dynamically bitmap for a barcode.
2. Store generated bitmap somewhere on a system (temporarily, of course)
3. Include reference to generated bitmap in SAPScript using
BITMAP command.
Now, step 1 is relatively easy to do, I intend to use as a template program RSPO0031, it told me how to convert barcode data into bitmap table or OTF table, whichever I desire, using, say, PERFORM RENDERBARCODE(MSSCOFSF).
Step 2, however is what I need some help with, so I'm curious if anyone is familiar with any function modules or existing programs that can be used as a template to convert and store bitmap in a storage accessible from SAPscript?
You can convert the bitmap to ITF using Fm SAPSCRIPT_CONVERT_BITMAP and save the ITF as standatd text using SAVE_TEXT, and use INCLUDE command to insert the standard text in the sapscript.
The following test program uploads bmp file and saves as standard text.
parameters: p_file type rlgrap-filename default 'c:testbmp.bmp',
p_tdname type thead-tdname default'ZTESTBMPITF'.
data: gv_filename type string,
gv_bytecount type i.
data: gs_thead type thead,
gt_itf type table of tline.
data: begin of gt_bitmap occurs 0,
bits(128) type x,
end of gt_bitmap.
gv_filename = p_file.
call function 'GUI_UPLOAD'
exporting
filename = gv_filename
filetype = 'BIN'
importing
filelength = gv_bytecount
tables
data_tab = gt_bitmap
exceptions
file_open_error = 2
file_read_error = 3
no_batch = 1
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
others = 17.
if sy-subrc ne 0.
message 'File upload error' type 'E'.
endif.
call function 'SAPSCRIPT_CONVERT_BITMAP'
exporting
itf_header = gs_thead
old_format = 'BMP'
new_format = 'ITF'
bitmap_file_bytecount_in = gv_bytecount
importing
bitmap_file_bytecount = gv_bytecount
tables
itf_lines = gt_itf
bitmap_file = gt_bitmap
exceptions
no_bitmap_file = 1
format_not_supported = 2
bitmap_file_not_type_x = 3
no_bmp_file = 4
bmperr_invalid_format = 5
bmperr_no_colortable = 6
bmperr_unsup_compression = 7
bmperr_corrupt_rle_data = 8
bmperr_eof = 9
others = 10.
if sy-subrc ne 0.
message 'BMP to ITF conversion error' type 'E'.
endif.
gs_thead-tdspras = 'E'.
gs_thead-tdid = 'ST'.
gs_thead-tdname = p_tdname.
gs_thead-tdobject = 'TEXT'.
call function 'SAVE_TEXT'
exporting
header = gs_thead
importing
newheader = gs_thead
tables
lines = gt_itf
exceptions
others = 1.
use /: INCLUDE ZTESTBMPITF OBJECT TEXT ID ST LANGUAGE EN in the sapscript to print the image.
Instead of saving ITF using SAVE_TEXT, you can write ITF contents to sapscript directly from print program using fm WRITE_FORM_LINES.
Regards
Sridhar
Message was edited by:
Sridhar K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Check these function modules.
GUI_UPLOAD, WS_UPLOAD, UPLOAD Upload file from PC
--Ragu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
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.