‎2006 Mar 14 3:42 AM
Hi,
Is there any function module to upload image into SAP. I know TCODE se78 and OAER but i want to use a function module.
-Siddharth.S
‎2006 Mar 14 3:59 AM
hi,
i think this will help u out.
data: begin of plant occurs 200,
MATNR(18),
WERKS(4),
VKORG(4),
VTWEG(2),
end of plant.
.Next, lets define the input file name and tell the program to prompt for input:
parameters: wsfile(132) lower case.
One of the problems with the way we have defined the parameters is that the dialog box that is presented by SAP starts deep within the SAP libraries on the presentation server. Another is that the fully qualified filename can not exceed the 132 character limit. Most people will want to use a file on C:, on a Windows platform. Here's how to tell the dialog box to start in C:
parameters: wsfile(132) default 'C:\input.txt'
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME =wsfile
FILETYPE = 'DAT'
TABLES
DATA_TAB = plant
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
WRITE: / 'Error Uploading', wsfile, SY-SUBRC.
STOP.
ENDIF.
Thanks,
Sreevani
‎2006 Mar 14 3:46 AM
I think you can use GUI_UPLOAD to upload images...
This is an excerpt from the SE78. Check the program <b>LSTXBITMAPSF05</b>. This is how the image is uploaded there with <b>'SAPSCRIPT_CONVERT_BITMAP'</b>.
data: begin of l_bitmap occurs 0,
l(64) type x,
end of l_bitmap.
call function 'GUI_UPLOAD'
exporting
filename = l_filename
filetype = 'BIN'
importing
filelength = l_bytecount
tables
data_tab = l_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.
call function 'SAPSCRIPT_CONVERT_BITMAP'
exporting
itf_header = l_textheader
old_format = 'BMP'
new_format = 'ITF'
bitmap_file_bytecount_in = l_bytecount
itf_bitmap_type_in = l_type_in
importing
bitmap_file_bytecount = l_bytecount
itf_bitmap_type_out = l_type_out
tables
itf_lines = l_itflines
bitmap_file = l_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 <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
raising conversion_failed.
endif.
‎2006 Mar 14 3:55 AM
Using the function module will throw a dialog, not sure that you want this. Actually I have used the FORM routine from SE78 to do this. Here is an example program.
************************************************************************
*
* This program imports a .BMP or .TIF image into the SAPScript graphics
*
*
************************************************************************
report zrich_0004 .
parameters: p_file type localfile default 'C:file.bmp'.
parameters: p_image type stxbitmaps-tdname.
data: imagename type stxbitmaps-tdname.
at selection-screen on value-request for p_file.
call function 'KD_GET_FILENAME_ON_F4'
exporting
static = 'X'
changing
file_name = p_file.
start-of-selection.
imagename = p_image.
perform import_bitmap using p_file
imagename
'Test Image'.
************************************************************************
* FORM import_Bitmap *
************************************************************************
form import_bitmap using filename
name
title.
data: l_resolution type stxbitmaps-resolution.
data: l_docid type stxbitmaps-docid.
perform import_bitmap_bds
in program saplstxbitmaps
using filename
name
'GRAPHICS' "Object
'BMAP' "ID
'BMON' "B/W
'BMP' "Extension
title
space
'X'
changing l_docid
l_resolution.
imagename = name.
endform.
Regards,
Rich Heilman
‎2006 Mar 14 3:57 AM
Hi Sidharth,
if you want to do it programatically use..
REPORT ZSAT_UPLOAD.
submit RSTXLDMC via selection-screen and return.regards
satesh
‎2006 Mar 14 3:59 AM
hi,
i think this will help u out.
data: begin of plant occurs 200,
MATNR(18),
WERKS(4),
VKORG(4),
VTWEG(2),
end of plant.
.Next, lets define the input file name and tell the program to prompt for input:
parameters: wsfile(132) lower case.
One of the problems with the way we have defined the parameters is that the dialog box that is presented by SAP starts deep within the SAP libraries on the presentation server. Another is that the fully qualified filename can not exceed the 132 character limit. Most people will want to use a file on C:, on a Windows platform. Here's how to tell the dialog box to start in C:
parameters: wsfile(132) default 'C:\input.txt'
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME =wsfile
FILETYPE = 'DAT'
TABLES
DATA_TAB = plant
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
WRITE: / 'Error Uploading', wsfile, SY-SUBRC.
STOP.
ENDIF.
Thanks,
Sreevani
‎2006 Mar 14 4:09 AM
‎2006 Mar 14 4:22 AM