Skip to Content
0
Former Member
Mar 10, 2015 at 11:04 AM

Converted BMP(Using IGS) problem with Image upload in SE78

2567 Views

Hi experts,

I converted a PNG imagem to BMP using the IGS Class. It works fine. The problem occurs when I use the FM 'SAPSCRIPT_CONVERT_BITMAP_BDS', to convert the BMP to BDS(for upload in SE78). I receive a shordump:

Runtime error : COMPUTE_INT_TIMES_OVERFLOW

Exception : CX_SY_ARITHMETIC_OVERFLOW

I know the problem is the calculation of DPI value that is with a too large value, but I don`t know what is causing this. And finally, here is the case: When I run once, all the program works very well. But always when I execute the second time, I receive the shordump.

Here my routine to convert the PNG to BMP:

FORM convert_image using p_width

p_height

p_content_length.

CREATE OBJECT i_igs_image_converter .

i_igs_image_converter->input = 'image/png'.

i_igs_image_converter->output = 'image/x-ms-bmp'.

i_igs_image_converter->width = p_width.

i_igs_image_converter->height = p_height.

CALL METHOD i_igs_image_converter->set_image

EXPORTING

blob = mime

blob_size = p_content_length.

CALL METHOD i_igs_image_converter->execute

EXCEPTIONS

communication_error = 1

internal_error = 2

external_error = 3

OTHERS = 4.

IF sy-subrc = 0.

CALL METHOD i_igs_image_converter->get_image

IMPORTING

blob = blob

blob_size = blob_size

blob_type = blob_type.

l_bytecount = blob_size.

ENDIF.

ENDFORM.



Here the routine to pass this BMP to the function:


* Bitmap conversion

CALL FUNCTION 'SAPSCRIPT_CONVERT_BITMAP_BDS'

EXPORTING

color = 'X'

format = p_format "BMP

resident = p_resident " ' '

bitmap_bytecount = l_bytecount

* compress_bitmap = p_bmcomp

IMPORTING

width_tw = l_width_tw

height_tw = l_height_tw

width_pix = l_width_pix

height_pix = l_height_pix

dpi = p_resolution

bds_bytecount = l_bds_bytecount

TABLES

bitmap_file = p_blob

bitmap_file_bds = l_bds_content

EXCEPTIONS

format_not_supported = 1

no_bmp_file = 2

bmperr_invalid_format = 3

bmperr_no_colortable = 4

bmperr_unsup_compression = 5

bmperr_corrupt_rle_data = 6

OTHERS = 7.



Here the part of the standard program that are causing the shordump:


Category ABAP Programming Error

Runtime Errors COMPUTE_INT_TIMES_OVERFLOW

Except. CX_SY_ARITHMETIC_OVERFLOW

ABAP Program SAPLSTXBITMAPS

Application Component BC-SRV-SCR

1946 * pix per meter Y

1947 perform bmptab_getlong_ofs tables bitmap_file

1948 using ofs bmp_ypelspermeter.

1949 * colors used

1950 perform bmptab_getdword_ofs tables bitmap_file

1951 using ofs word.

1952 * colors important

1953 perform bmptab_getdword_ofs tables bitmap_file

1954 using ofs word.

1955 ofs_rgbquad = ofs_bitmapinfoheader + bmp_bisize.

1956 * now we have OFS_RGBQUAD -> color table

1957 * OFS_BITMAPDATA -> bitmap bytes

1958 otf_bminfo-new_rd_format = c_false.

1959 otf_bminfo-is_resident = c_false.

>>>>> otf_bminfo-dpi = ( bmp_xpelspermeter * 100 ) / 3937.

1961 perform bmp_adjust_dpi using otf_bminfo-dpi.

1962 otf_bminfo-w_pix = bmp_width.

1963 otf_bminfo-h_pix = abs( bmp_height ).

1964 otf_bminfo-w_tw = ( 1440 * otf_bminfo-w_pix ) / otf_bminfo-dpi.

1965 otf_bminfo-h_tw = ( 1440 * otf_bminfo-h_pix ) / otf_bminfo-dpi.

1966 case bmp_bitcount.

1967 when 1.

1968 otf_bminfo-bitsperpix = 1.

1969 otf_bminfo-bytes_per_row = otf_bminfo-w_pix div 8.

1970 rest = otf_bminfo-w_pix mod 8.

1971 when 4.

Thanks.