Professional Documents
Culture Documents
*
*constants:
* c_true type ty_boolean value 'X',
* c_false type ty_boolean value space.
* BDS handling
constants:
c_bds_classname type sbdst_classname value 'DEVC_STXD_BITMAP',
c_bds_classtype type sbdst_classtype value 'OT', " others
c_bds_mimetype type bds_mimetp value 'application/octet-stream',
c_bds_original type sbdst_doc_var_tg value 'OR'.
* Graphic handling
constants:
*data:
c_stdtext type thead-tdobject value 'TEXT',
c_graphics like thead-tdobject value 'GRAPHICS',
c_bmon like thead-tdid value 'BMON',
c_bcol like thead-tdid value 'BCOL'.
"Picture Control
DATA: picture_container TYPE REF TO cl_gui_custom_container,
picture_control TYPE REF TO cl_gui_picture.
START-OF-SELECTION.
PERFORM download_qrcode.
PERFORM convert_image.
*&———————————————————————*
*& Form DOWNLOAD_QRCODE
*&———————————————————————*
* text
*———————————————————————-*
* -> p1 text
* <- p2 text
*———————————————————————-*
FORM download_qrcode .
CONCATENATE 'http://chart.apis.google.com/chart?chs=200×200&cht=qr&chld=|1&chl='
qr_text '/chart.png' INTO url.
IF sy-subrc = 0.
http_client->send( ).
http_client->receive( ).
content = http_client->response->get_data( ).
http_client->close( ).
ENDIF.
*&———————————————————————*
*& Form CONVERT_IMAGE
*&———————————————————————*
* text
*———————————————————————-*
* -> p1 text
* <- p2 text
*———————————————————————-*
FORM convert_image .
i_igs_image_converter->input = 'image/png'.
i_igs_image_converter->output = 'image/bmp'.
i_igs_image_converter->width = width.
i_igs_image_converter->height = height.
IF sy-subrc = 0.
ENDIF.
IF sy-subrc = 0.
IF p_rad1 = 'X'.
ELSE.
PERFORM show_smart_form. "calling the smartform for qrcode display
ENDIF.
ENDIF.
*&———————————————————————*
*& Module STATUS_9000 OUTPUT
*&———————————————————————*
* text
*———————————————————————-*
PERFORM call_screen.
*&———————————————————————*
*& Form CALL_SCREEN
*&———————————————————————*
* text
*———————————————————————-*
* -> p1 text
* <- p2 text
*———————————————————————-*
FORM call_screen .
"Creating the url of the image for the display in the container in the screen
SPLIT blob_type AT '/' INTO blob_type l_img_subtype.
*&———————————————————————*
*& Module USER_COMMAND_9000 INPUT
*&———————————————————————*
* text
*———————————————————————-*
MODULE user_command_9000 INPUT.
IF sy-ucomm = 'BACK'.
LEAVE TO SCREEN 0.
ENDIF.
*&———————————————————————*
*& Form SHOW_SMART_FORM
*&———————————————————————*
* text
*———————————————————————-*
* -> p1 text
* <- p2 text
*———————————————————————-*
FORM show_smart_form .
gi_name = 'QRCODE10'. "name of the qrcode will be in se78 after one time
running this program
gi_object = 'GRAPHICS'.
gi_id = 'BMAP'.
gi_btype = 'BCOL'. "If u want black and white pass BMON
gi_resident = ' '.
gi_autoheight = 'X'.
gi_bmcomp = 'X'.
l_extension = 'BMP'.
IF sy-subrc = 0.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
*&———————————————————————*
*& Form IMPORT_BITMAP_BDS (Copied from standard program and modified it as
per the requirement)
*&———————————————————————*
form import_bitmap_bds
using p_blob type w3mimetabtype
p_name type stxbitmaps-tdname
p_object type stxbitmaps-tdobject
p_id type stxbitmaps-tdid
p_btype type stxbitmaps-tdbtype
p_format type c
p_title LIKE bds_description
p_resident type stxbitmaps-resident
p_autoheight type stxbitmaps-autoheight
p_bmcomp type stxbitmaps-bmcomp
changing p_docid type stxbitmaps-docid
p_resolution type stxbitmaps-resolution.
* Enqueue
perform enqueue_graphic using p_object
p_name
p_id
p_btype.
* Bitmap conversion
call function 'SAPSCRIPT_CONVERT_BITMAP_BDS'
exporting
color = 'X'
format = p_format
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.
if sy-subrc <> 0.
endif.
wa_bds_components-doc_count = '1'.
wa_bds_components-comp_count = '1'.
wa_bds_components-mimetype = c_bds_mimetype.
wa_bds_components-comp_size = l_bds_bytecount.
append wa_bds_components to l_bds_components.
wa_bds_signature-doc_count = '1'.
append wa_bds_signature to l_bds_signature.
if sy-subrc <> 0.
if sy-subrc = 0.
p_docid = wa_bds_signature-doc_id.
else.
endif.
if sy-subrc = 0.
endif.
wa_bds_signature-doc_count = '1'.
append wa_bds_signature to l_bds_signature.
if sy-subrc <> 0.
perform dequeue_graphic using p_object
p_name
p_id
p_btype.
* message e285 with p_name 'BDS'.
endif.
endif.
elseif sy-subrc = 2.
endif.
endif.
if sy-subrc <> 0.
if sy-subrc <> 0.
endif.
endif.
wa_bds_properties-prop_name = 'DESCRIPTION'.
wa_bds_properties-prop_value = p_title.
append wa_bds_properties to l_bds_properties.
endform.
*&———————————————————————*
*& Form ENQUEUE_GRAPHIC
*&———————————————————————*
* Enqueue of graphics stored in BDS
*———————————————————————-*
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
raising enqueue_failed.
endif.
*&———————————————————————*
*& Form DEQUEUE_GRAPHIC
*&———————————————————————*
* Dequeue of graphics stored in BDS
*———————————————————————-*