*&---------------------------------------------------------------------*
*& Report YGRAPHIC_FILTER
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
TYPES: pict_line
&#
40;
256&#
41;
TYPE c
.
TYPES: BEGIN OF ty_graphic_table
, line(255) TYPE x,
END OF ty_graphic_table.
DATA: pict_tab
TYPE TABLE OF pict_line
, line TYPE string,
in_line TYPE string,
new_line TYPE string,
url(255) TYPE c,
lines TYPE i,
w_div TYPE i,
w_counter TYPE i.
DATA: container1
TYPE REF TO cl_gui_custom_container
, picture TYPE REF TO cl_gui_picture.
DATA: l_bytecount
TYPE i
, l_tdbtype LIKE stxbitmaps-tdbtype,
l_content TYPE STANDARD TABLE OF bapiconten
INITIAL SIZE 0.
DATA: graphic_size
TYPE i
.
DATA: graphic_table
TYPE STANDARD TABLE OF ty_graphic_table
WITH HEADER LINE,
graphic_table_new TYPE STANDARD TABLE OF ty_graphic_table
WITH HEADER LINE.
DATA ok_code
TYPE sy
-ucomm
.
*&-----------------------------------------------------------&*
*& START-OF-SELECTION &*
*&-----------------------------------------------------------&*
CALL SCREEN 100.
*&-----------------------------------------------------------*
*& Module STATUS_0100 OUTPUT *
*&-----------------------------------------------------------*
MODULE status_0100 OUTPUT.
SET PF-STATUS 'S1'.
* SET TITLEBAR 'xxx'.
*------------------------------------------------------------*
* FORM LOAD_IMAGE *
*------------------------------------------------------------*
CREATE OBJECT: container1 EXPORTING container_name = 'PICTURE' ,
picture EXPORTING parent = container1.
CALL FUNCTION 'SAPSCRIPT_GET_GRAPHIC_BDS'
EXPORTING
i_object = 'GRAPHICS'
i_name = 'LOGO'
i_id = 'BMAP'
i_btype = 'BCOL'
IMPORTING
e_bytecount = l_bytecount
content = l_content
EXCEPTIONS
not_found = 1
bds_get_failed = 2
bds_no_content = 3
OTHERS = 4.
CALL FUNCTION 'SAPSCRIPT_CONVERT_BITMAP'
EXPORTING
old_format = 'BDS'
new_format = 'BMP'
bitmap_file_bytecount_in = l_bytecount
IMPORTING
bitmap_file_bytecount = graphic_size
bds_bitmap_file = l_content
bitmap_file = graphic_table
EXCEPTIONS
OTHERS = 1.
DESCRIBE TABLE graphic_table LINES lines.
lines = lines.
w_counter = lines - 1.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = graphic_size
IMPORTING
buffer = x_bmp
binary_tab = graphic_table
EXCEPTIONS
failed = 1
OTHERS = 2.
DATA : w2
&#
40;
2&#
41;
TYPE x
, w4
&#
40;
4&#
41;
TYPE x
, xstr
TYPE xstring. DEFINE read2
. "#EC NEEDED read two bytes as integer and move offset w2 = &1.
concatenate w2
+1&#
40;
1&#
41; w2
+0&#
40;
1&#
41;
into xstr
in byte mode . &2 = xstr.
DEFINE read4
. "#EC NEEDED read four bytes as integer and move offset w4 = &1 .
concatenate w4
+3&#
40;
1&#
41; w4
+2&#
40;
1&#
41; w4
+1&#
40;
1&#
41; w4
+0&#
40;
1&#
41;
into xstr
in byte mode .
&2 = xstr.
DATA magic_number
&#
40;
2&#
41;
TYPE x
. magic_number = x_bmp+0(2).
DATA size
&#
40;
4&#
41;
TYPE x
. size = x_bmp+2(4).
DATA data_offset
&#
40;
4&#
41;
TYPE x
. DATA i_data_offset
TYPE i
. data_offset = x_bmp+10(4).
read4 size i_size.
read4 data_offset i_data_offset.
DATA header_size
&#
40;
4&#
41;
TYPE x
. DATA i_header_size
TYPE i
. header_size = x_bmp+14(4).
read4 header_size i_header_size.
DATA : width
&#
40;
4&#
41;
TYPE x
, height(4) TYPE x,
i_width TYPE i,
i_height TYPE i,
bpp(2) TYPE x,
i_bpp TYPE i,
compression(4) TYPE x,
i_compression TYPE i,
s_compression TYPE string.
IF i_header_size
= 40. "Windows V3 Format width = x_bmp+18(4).
height = x_bmp+22(4).
bpp = x_bmp+28(2).
compression = x_bmp+30(4).
read4 width i_width.
read4 height i_height.
read2 bpp i_bpp.
read4 compression i_compression.
s_compression = 'RGB - None'.
s_compression = 'RLE 8-bit/pixel'.
s_compression = 'RLE 4-bit/pixel'.
s_compression = 'Bit Field'.
s_compression = 'JPEG'.
s_compression = 'PNG'.
DATA x_data
TYPE xstring. DATA x_new_data
TYPE xstring. DATA i_num_pixels
TYPE i
.
x_data = x_bmp+i_data_offset.
* i_num_pixels = XSTRLEN( x_data ).
i_num_pixels = i_width. "i_num_pixels / 3 / i_height.
DATA i_width_in_bytes
TYPE i
. i_width_in_bytes = i_width * 3.
DATA x_new_row
TYPE xstring. x_row = x_data+i_counter(i_width).
CONCATENATE x_row
+i_counter2
&#
40;
1&#
41; x_new_row
INTO x_new_row
IN BYTE MODE.
i_counter2 = i_counter2 + 1.
CONCATENATE x_new_row x_new_data
INTO x_new_data
IN BYTE MODE. i_counter = i_counter + i_width.
DATA x_new_image
TYPE xstring. CONCATENATE x_bmp
&#
40;i_data_offset
&#
41; x_new_data
INTO x_new_image
IN BYTE MODE.
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = x_new_image
binary_tab = graphic_table_new.
CALL FUNCTION 'DP_CREATE_URL'
EXPORTING
type = 'IMAGE'
subtype = 'BMP'
CHANGING
url = url.
CALL METHOD picture->load_picture_from_url
EXPORTING
url = url.
CALL METHOD picture->set_display_mode
EXPORTING
display_mode = picture->display_mode_normal.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100
INPUT.