二维码

[Smart] ABAP调用外部网站生成彩色二维码打印在smartform中

Twilight发表于 2016-09-28 08:56zhongguomao 最后回复于 2017-08-09 11:54 [复制链接] 6997 1

SAP也提供了标准的二维码功能,只是比较简单,下面的方式是调用在线二维码网站生成的一些酷炫的二维码。

场景:调用外部系统创建一个 QR code ,分别在屏幕和smartform中打印显示。

1、创建smartform
qr1.jpg

2、在Form Interface中创建一个参数[W_NAME type char20],用来接收存储在SAP中二维码图片的名称
qr2.jpg

3、在smartform中创建一个graphics 元素,并命名 &W_NAME&
qr3.jpg

4、SE38创建执行程序
  1. *&---------------------------------------------------------------------*
  2. *& Report  Z03_QRCODE_IMAGE
  3. *&
  4. *&---------------------------------------------------------------------*
  5. *&
  6. *&
  7. *&---------------------------------------------------------------------*


  8. *types:  ty_boolean(1) type c.
  9. *
  10. *constants:
  11. *  c_true  type ty_boolean value 'X',
  12. *  c_false type ty_boolean value space.

  13. DATA : bds_description  LIKE bapisignat-prop_value.


  14. * BDS handling
  15. CONSTANTS:
  16.   c_bds_classname TYPE sbdst_classname VALUE 'DEVC_STXD_BITMAP',
  17.   c_bds_classtype TYPE sbdst_classtype VALUE 'OT',          " others
  18.   c_bds_mimetype  TYPE bds_mimetp      VALUE 'application/octet-stream',
  19.   c_bds_original  TYPE sbdst_doc_var_tg VALUE 'OR'.

  20. * Graphic handling
  21. CONSTANTS:
  22.       c_stdtext  LIKE thead-tdobject VALUE 'TEXT',
  23.       c_graphics LIKE thead-tdobject VALUE 'GRAPHICS',
  24.       c_bmon     LIKE thead-tdid     VALUE 'BMON',
  25.       c_bcol     LIKE thead-tdid     VALUE 'BCOL'.


  26. DATA: gi_filename    TYPE rlgrap-filename,
  27.       gi_name        TYPE stxbitmaps-tdname,
  28.       gi_object      TYPE stxbitmaps-tdobject,
  29.       gi_id          TYPE stxbitmaps-tdid,
  30.       gi_btype       TYPE stxbitmaps-tdbtype,
  31.       gi_resident    TYPE stxbitmaps-resident,
  32.       gi_autoheight  TYPE stxbitmaps-autoheight,
  33.       gi_bmcomp      TYPE stxbitmaps-bmcomp,
  34.       gi_resolution  TYPE stxbitmaps-resolution,
  35.       l_extension TYPE rlgrap-filename,
  36.       l_docid     TYPE stxbitmaps-docid.

  37. "Picture Control
  38. DATA: picture_container TYPE REF TO cl_gui_custom_container,
  39.       picture_control   TYPE REF TO cl_gui_picture.


  40. DATA: l_img_url     TYPE w3url.
  41. DATA :l_img_subtype TYPE w3param-cont_type.
  42. DATA : l_str_length TYPE i.
  43. DATA : url TYPE string.
  44. DATA :  l_content_length TYPE  i.

  45. DATA :  mime TYPE  w3mimetabtype.
  46. DATA: blob TYPE w3mimetabtype,
  47.             blob_size TYPE w3param-cont_len,
  48.             blob_type TYPE w3param-cont_type.

  49. DATA : i_igs_image_converter TYPE REF TO cl_igs_image_converter.
  50. DATA: content TYPE xstring.
  51. DATA : http_client TYPE REF TO if_http_client.


  52. TYPES : BEGIN OF ty_binary,
  53.                     binary_field(1000) TYPE c,
  54.                END OF ty_binary.

  55. DATA : hex_tab1 TYPE TABLE OF ty_binary WITH HEADER LINE.


  56. SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
  57. PARAMETERS : qr_text TYPE char100 OBLIGATORY.
  58. SELECTION-SCREEN END OF BLOCK b1.



  59. SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
  60. PARAMETERS : width TYPE int3,
  61.              height TYPE int3.
  62. SELECTION-SCREEN END OF BLOCK b2.



  63. PARAMETERS : p_rad1 RADIOBUTTON GROUP rd1 DEFAULT 'X',
  64.              p_rad2 RADIOBUTTON GROUP rd1.


  65. START-OF-SELECTION.

  66.   PERFORM download_qrcode.
  67.   PERFORM convert_image.

  68. *&---------------------------------------------------------------------*
  69. *&      Form  DOWNLOAD_QRCODE
  70. *&---------------------------------------------------------------------*
  71. *       text
  72. *----------------------------------------------------------------------*
  73. *  -->  p1        text
  74. *  <--  p2        text
  75. *----------------------------------------------------------------------*

  76. FORM download_qrcode .

  77. *  CONCATENATE 'http://chart.apis.google.com/chart?chs=200x200&cht=qr&chld=|1&chl=' qr_text '/chart.png' INTO url.
  78.   CONCATENATE 'http://qr.topscan.com/api.php?&bg=ffffff&fg=cc0000&pt=00ff00&inpt=000000&text=' qr_text INTO url.

  79.   CALL METHOD cl_http_client=>create_by_url
  80.     EXPORTING
  81.       url                = url
  82.     IMPORTING
  83.       client             = http_client
  84.     EXCEPTIONS
  85.       argument_not_found = 1
  86.       plugin_not_active  = 2
  87.       internal_error     = 3
  88.       OTHERS             = 4.


  89.   IF sy-subrc = 0.
  90.     CALL METHOD http_client->send
  91. *  EXPORTING
  92. *    timeout                    = CO_TIMEOUT_DEFAULT
  93.       EXCEPTIONS
  94.         http_communication_failure = 1
  95.         http_invalid_state         = 2
  96.         http_processing_failed     = 3
  97.         http_invalid_timeout       = 4
  98.         OTHERS                     = 5.

  99.     CALL METHOD http_client->receive
  100.       EXCEPTIONS
  101.         http_communication_failure = 1
  102.         http_invalid_state         = 2
  103.         http_processing_failed     = 3
  104.         OTHERS                     = 4.


  105.     content = http_client->response->get_data( ).

  106.     http_client->close( ).

  107.     l_str_length = xstrlen( content ).

  108.     CALL FUNCTION 'RSFO_XSTRING_TO_MIME'
  109.       EXPORTING
  110.         c_xstring = content
  111.         i_length  = l_str_length
  112.       TABLES
  113.         c_t_mime  = mime.

  114.   ENDIF.

  115. ENDFORM.                    " DOWNLOAD_QRCODE

  116. *&---------------------------------------------------------------------*
  117. *&      Form  CONVERT_IMAGE
  118. *&---------------------------------------------------------------------*
  119. *       text
  120. *----------------------------------------------------------------------*
  121. *  -->  p1        text
  122. *  <--  p2        text
  123. *----------------------------------------------------------------------*

  124. FORM convert_image .

  125.   CREATE OBJECT i_igs_image_converter .

  126.   i_igs_image_converter->input = 'image/png'.
  127.   i_igs_image_converter->output = 'image/bmp'.
  128.   i_igs_image_converter->width = width.
  129.   i_igs_image_converter->height = height.

  130.   CALL METHOD i_igs_image_converter->set_image
  131.     EXPORTING
  132.       blob      = mime
  133.       blob_size = l_content_length.


  134.   CALL METHOD i_igs_image_converter->execute
  135.     EXCEPTIONS
  136.       communication_error = 1
  137.       internal_error      = 2
  138.       external_error      = 3
  139.       OTHERS              = 4.

  140.   IF sy-subrc = 0.

  141.     CALL METHOD i_igs_image_converter->get_image
  142.       IMPORTING
  143.         blob      = blob
  144.         blob_size = blob_size
  145.         blob_type = blob_type.

  146.   ENDIF.

  147.   IF sy-subrc = 0.

  148.     IF  p_rad1 = 'X'.

  149.       CALL SCREEN '9000'.  "Calling the screen for qrcode display

  150.     ELSE.

  151.       PERFORM show_smart_form. "calling the smartform for qrcode display

  152.     ENDIF.

  153.   ENDIF.

  154. ENDFORM.                    " CONVERT_IMAGE


  155. *&---------------------------------------------------------------------*
  156. *&      Module  STATUS_9000  OUTPUT
  157. *&---------------------------------------------------------------------*
  158. *       text
  159. *----------------------------------------------------------------------*

  160. MODULE status_9000 OUTPUT.

  161.   SET PF-STATUS 'PF'.

  162.   "Creating the object for the container

  163.   CREATE OBJECT picture_container
  164.     EXPORTING
  165.       container_name = 'PICTURECONTROL'.
  166.   CREATE OBJECT picture_control
  167.     EXPORTING
  168.       parent = picture_container.

  169.   "Calling the screen

  170.   PERFORM call_screen.

  171. ENDMODULE.                 " STATUS_9000  OUTPUT

  172. *&---------------------------------------------------------------------*
  173. *&      Form  CALL_SCREEN
  174. *&---------------------------------------------------------------------*
  175. *       text
  176. *----------------------------------------------------------------------*
  177. *  -->  p1        text
  178. *  <--  p2        text
  179. *----------------------------------------------------------------------*

  180. FORM call_screen .

  181.   "Creating the url of the image for the display in the container in the screen
  182.   SPLIT blob_type AT '/' INTO blob_type l_img_subtype.

  183.   CALL FUNCTION 'DP_CREATE_URL'
  184.     EXPORTING
  185.       type     = blob_type
  186.       subtype  = l_img_subtype
  187.       size     = blob_size
  188.       lifetime = cndp_lifetime_transaction
  189.     TABLES
  190.       data     = blob
  191.     CHANGING
  192.       url      = l_img_url
  193.     EXCEPTIONS
  194.       OTHERS   = 1.


  195.   IF sy-subrc IS INITIAL.
  196.     CALL METHOD picture_control->load_picture_from_url
  197.       EXPORTING
  198.         url = l_img_url.
  199.   ENDIF.

  200. ENDFORM.                    " CALL_SCREEN

  201. *&---------------------------------------------------------------------*
  202. *&      Module  USER_COMMAND_9000  INPUT
  203. *&---------------------------------------------------------------------*
  204. *       text
  205. *----------------------------------------------------------------------*
  206. MODULE user_command_9000 INPUT.

  207.   IF sy-ucomm = 'BACK'.

  208.     LEAVE TO SCREEN 0.

  209.   ENDIF.

  210. ENDMODULE.                 " USER_COMMAND_9000  INPUT

  211. *&---------------------------------------------------------------------*
  212. *&      Form  SHOW_SMART_FORM
  213. *&---------------------------------------------------------------------*
  214. *       text
  215. *----------------------------------------------------------------------*
  216. *  -->  p1        text
  217. *  <--  p2        text
  218. *----------------------------------------------------------------------*

  219. FORM show_smart_form .

  220.   gi_name = 'QRCODE10'.         "name of the qrcode will be in se78 after one time running this program
  221.   gi_object = 'GRAPHICS'.
  222.   gi_id = 'BMAP'.
  223.   gi_btype = 'BCOL'. "If u want black and white pass BMON
  224.   gi_resident = ' '.
  225.   gi_autoheight =  'X'.
  226.   gi_bmcomp = 'X'.
  227.   l_extension = 'BMP'.

  228.   "importing the image into se78 before displaying it in the smartform.

  229.   PERFORM import_bitmap_bds    USING blob
  230.                                    gi_name
  231.                                    gi_object
  232.                                    gi_id
  233.                                    gi_btype
  234.                                    l_extension
  235.                                    ' '
  236.                                    gi_resident
  237.                                    gi_autoheight
  238.                                    gi_bmcomp
  239.                           CHANGING l_docid
  240.                                    gi_resolution.


  241.   IF sy-subrc = 0.

  242.     DATA:fname TYPE rs38l_fnam.

  243.     "gettingt the name FM of the smartform
  244.     CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
  245.       EXPORTING
  246.         formname           = 'ZQR_TEST'
  247. *       VARIANT            = ' '
  248. *       DIRECT_CALL        = ' '
  249.       IMPORTING
  250.         fm_name            = fname
  251.       EXCEPTIONS
  252.         no_form            = 1
  253.         no_function_module = 2
  254.         OTHERS             = 3.
  255.     "Calling the FM of the smartform for display
  256.     CALL FUNCTION fname
  257.       EXPORTING
  258. *       ARCHIVE_INDEX    =
  259. *       ARCHIVE_INDEX_TAB          =
  260. *       ARCHIVE_PARAMETERS         =
  261. *       CONTROL_PARAMETERS         =
  262. *       MAIL_APPL_OBJ    =
  263. *       MAIL_RECIPIENT   =
  264. *       MAIL_SENDER      =
  265. *       OUTPUT_OPTIONS   =
  266. *       USER_SETTINGS    = 'X'
  267.         w_name           = 'QRCODE10'
  268. *  IMPORTING
  269. *       DOCUMENT_OUTPUT_INFO       =
  270. *       JOB_OUTPUT_INFO  =
  271. *       JOB_OUTPUT_OPTIONS         =
  272.       EXCEPTIONS
  273.         formatting_error = 1
  274.         internal_error   = 2
  275.         send_error       = 3
  276.         user_canceled    = 4
  277.         OTHERS           = 5.
  278.     IF sy-subrc <> 0.
  279. * Implement suitable error handling here
  280.     ENDIF.

  281.   ENDIF.

  282. ENDFORM.                    " SHOW_SMART_FORM

  283. *&---------------------------------------------------------------------*
  284. *&      Form  IMPORT_BITMAP_BDS (Copied from standard program and modified it as per the requirement)
  285. *&---------------------------------------------------------------------*
  286. FORM import_bitmap_bds
  287.         USING    p_blob       TYPE w3mimetabtype
  288.                  p_name           TYPE stxbitmaps-tdname
  289.                  p_object         TYPE stxbitmaps-tdobject
  290.                  p_id             TYPE stxbitmaps-tdid
  291.                  p_btype          TYPE stxbitmaps-tdbtype
  292.                  p_format         TYPE c
  293.                  p_title          LIKE bds_description
  294.                  p_resident       TYPE stxbitmaps-resident
  295.                  p_autoheight     TYPE stxbitmaps-autoheight
  296.                  p_bmcomp         TYPE stxbitmaps-bmcomp
  297.         CHANGING p_docid          TYPE stxbitmaps-docid
  298.                  p_resolution     TYPE stxbitmaps-resolution.


  299.   DATA: l_object_key TYPE sbdst_object_key.
  300.   DATA: l_tab        TYPE ddobjname.

  301.   DATA: BEGIN OF l_bitmap OCCURS 0,
  302.           l(64) TYPE x,
  303.         END OF l_bitmap.

  304.   DATA: l_filename        TYPE string,
  305.         l_bytecount       TYPE i,
  306.         l_bds_bytecount   TYPE i.
  307.   DATA: l_color(1)        TYPE c,

  308.         l_width_tw        TYPE stxbitmaps-widthtw,
  309.         l_height_tw       TYPE stxbitmaps-heighttw,
  310.         l_width_pix       TYPE stxbitmaps-widthpix,
  311.         l_height_pix      TYPE stxbitmaps-heightpix.
  312.   DATA: l_bds_object      TYPE REF TO cl_bds_document_set,
  313.         l_bds_content     TYPE sbdst_content,
  314.         l_bds_components  TYPE sbdst_components,
  315.         wa_bds_components TYPE LINE OF sbdst_components,
  316.         l_bds_signature   TYPE sbdst_signature,
  317.         wa_bds_signature  TYPE LINE OF sbdst_signature,
  318.         l_bds_properties  TYPE sbdst_properties,
  319.         wa_bds_properties TYPE LINE OF sbdst_properties.

  320.   DATA  wa_stxbitmaps TYPE stxbitmaps.



  321. * Enqueue
  322.   PERFORM enqueue_graphic USING p_object
  323.                                 p_name
  324.                                 p_id
  325.                                 p_btype.


  326. * Bitmap conversion
  327.   CALL FUNCTION 'SAPSCRIPT_CONVERT_BITMAP_BDS'
  328.     EXPORTING
  329.       color                    = 'X'
  330.       format                   = p_format
  331.       resident                 = p_resident
  332.       bitmap_bytecount         = l_bytecount
  333.       compress_bitmap          = p_bmcomp
  334.     IMPORTING
  335.       width_tw                 = l_width_tw
  336.       height_tw                = l_height_tw
  337.       width_pix                = l_width_pix
  338.       height_pix               = l_height_pix
  339.       dpi                      = p_resolution
  340.       bds_bytecount            = l_bds_bytecount
  341.     TABLES
  342.       bitmap_file              = p_blob
  343.       bitmap_file_bds          = l_bds_content
  344.     EXCEPTIONS
  345.       format_not_supported     = 1
  346.       no_bmp_file              = 2
  347.       bmperr_invalid_format    = 3
  348.       bmperr_no_colortable     = 4
  349.       bmperr_unsup_compression = 5
  350.       bmperr_corrupt_rle_data  = 6
  351.       OTHERS                   = 7.

  352.   IF sy-subrc <> 0.

  353.     PERFORM dequeue_graphic USING p_object
  354.                                   p_name
  355.                                   p_id
  356.                                   p_btype.
  357.     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  358.             WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
  359.     RAISING conversion_failed.

  360.   ENDIF.



  361. * Save bitmap in BDS
  362.   CREATE OBJECT l_bds_object.

  363.   wa_bds_components-doc_count  = '1'.
  364.   wa_bds_components-comp_count = '1'.
  365.   wa_bds_components-mimetype   = c_bds_mimetype.
  366.   wa_bds_components-comp_size  = l_bds_bytecount.
  367.   APPEND wa_bds_components TO l_bds_components.

  368.   IF p_docid IS INITIAL.          " graphic is new

  369.     wa_bds_signature-doc_count = '1'.
  370.     APPEND wa_bds_signature TO l_bds_signature.


  371.     CALL METHOD l_bds_object->create_with_table
  372.       EXPORTING
  373.         classname  = c_bds_classname
  374.         classtype  = c_bds_classtype
  375.         components = l_bds_components
  376.         content    = l_bds_content
  377.       CHANGING
  378.         signature  = l_bds_signature
  379.         object_key = l_object_key
  380.       EXCEPTIONS
  381.         OTHERS     = 1.

  382.     IF sy-subrc <> 0.

  383.       PERFORM dequeue_graphic USING p_object
  384.                                     p_name
  385.                                     p_id
  386.                                     p_btype.
  387. *      message e285 with p_name  'BDS'.

  388.     ENDIF.

  389.     READ TABLE l_bds_signature INDEX 1 INTO wa_bds_signature
  390.     TRANSPORTING doc_id.

  391.     IF sy-subrc = 0.

  392.       p_docid = wa_bds_signature-doc_id.

  393.     ELSE.

  394.       PERFORM dequeue_graphic USING p_object
  395.                                     p_name
  396.                                     p_id
  397.                                     p_btype.
  398. *      message e285 with p_name 'BDS'.

  399.     ENDIF.

  400.   ELSE.                " graphic already exists

  401. ********* read object_key for faster access *****
  402.     CLEAR l_object_key.
  403.     SELECT SINGLE * FROM stxbitmaps INTO wa_stxbitmaps
  404.         WHERE tdobject = p_object
  405.           AND tdid     = p_id
  406.           AND tdname   = p_name
  407.           AND tdbtype  = p_btype.

  408.     SELECT SINGLE tabname FROM bds_locl INTO l_tab
  409.        WHERE classname = c_bds_classname
  410.           AND classtype = c_bds_classtype.

  411.     IF sy-subrc = 0.

  412.       SELECT SINGLE object_key FROM (l_tab) INTO l_object_key
  413.         WHERE loio_id = wa_stxbitmaps-docid+10(32)
  414.           AND classname = c_bds_classname
  415.             AND classtype = c_bds_classtype.

  416.     ENDIF.

  417. ******** read object_key end ********************

  418.     CALL METHOD l_bds_object->update_with_table
  419.       EXPORTING
  420.         classname     = c_bds_classname
  421.         classtype     = c_bds_classtype
  422.         object_key    = l_object_key
  423.         doc_id        = p_docid
  424.         doc_ver_no    = '1'
  425.         doc_var_id    = '1'
  426.       CHANGING
  427.         components    = l_bds_components
  428.         content       = l_bds_content
  429.       EXCEPTIONS
  430.         nothing_found = 1
  431.         OTHERS        = 2.

  432.     IF sy-subrc = 1.   " inconsistency STXBITMAPS - BDS; repeat check in

  433.       wa_bds_signature-doc_count = '1'.
  434.       APPEND wa_bds_signature TO l_bds_signature.

  435.       CALL METHOD l_bds_object->create_with_table
  436.         EXPORTING
  437.           classname  = c_bds_classname
  438.           classtype  = c_bds_classtype
  439.           components = l_bds_components
  440.           content    = l_bds_content
  441.         CHANGING
  442.           signature  = l_bds_signature
  443.           object_key = l_object_key
  444.         EXCEPTIONS
  445.           OTHERS     = 1.

  446.       IF sy-subrc <> 0.
  447.         PERFORM dequeue_graphic USING p_object
  448.                                       p_name
  449.                                       p_id
  450.                                       p_btype.
  451. *        message e285 with p_name 'BDS'.

  452.       ENDIF.

  453.       READ TABLE l_bds_signature INDEX 1 INTO wa_bds_signature
  454.       TRANSPORTING doc_id.
  455.       IF sy-subrc = 0.
  456.         p_docid = wa_bds_signature-doc_id.
  457.       ELSE.

  458.         PERFORM dequeue_graphic USING p_object
  459.                                       p_name
  460.                                       p_id
  461.                                       p_btype.

  462. *        message e285 with p_name 'BDS'.

  463.       ENDIF.

  464.     ELSEIF sy-subrc = 2.

  465.       PERFORM dequeue_graphic USING p_object
  466.                                     p_name
  467.                                     p_id
  468.                                     p_btype.

  469. *      message e285 with p_name 'BDS'.

  470.     ENDIF.

  471.   ENDIF.

  472. * Save bitmap header in STXBITPMAPS
  473.   wa_stxbitmaps-tdname     = p_name.
  474.   wa_stxbitmaps-tdobject   = p_object.
  475.   wa_stxbitmaps-tdid       = p_id.
  476.   wa_stxbitmaps-tdbtype    = p_btype.
  477.   wa_stxbitmaps-docid      = p_docid.
  478.   wa_stxbitmaps-widthpix   = l_width_pix.
  479.   wa_stxbitmaps-heightpix  = l_height_pix.
  480.   wa_stxbitmaps-widthtw    = l_width_tw.
  481.   wa_stxbitmaps-heighttw   = l_height_tw.
  482.   wa_stxbitmaps-resolution = p_resolution.
  483.   wa_stxbitmaps-resident   = p_resident.
  484.   wa_stxbitmaps-autoheight = p_autoheight.
  485.   wa_stxbitmaps-bmcomp     = p_bmcomp.
  486.   INSERT INTO stxbitmaps VALUES wa_stxbitmaps.

  487.   IF sy-subrc <> 0.

  488.     UPDATE stxbitmaps FROM wa_stxbitmaps.

  489.     IF sy-subrc <> 0.

  490. *       message e285 with p_name 'STXBITMAPS'.

  491.     ENDIF.

  492.   ENDIF.



  493. * Set description in BDS attributes

  494.   wa_bds_properties-prop_name  = 'DESCRIPTION'.
  495.   wa_bds_properties-prop_value = p_title.
  496.   APPEND wa_bds_properties TO l_bds_properties.


  497.   CALL METHOD l_bds_object->change_properties
  498.     EXPORTING
  499.       classname  = c_bds_classname
  500.       classtype  = c_bds_classtype
  501.       object_key = l_object_key
  502.       doc_id     = p_docid
  503.       doc_ver_no = '1'
  504.       doc_var_id = '1'
  505.     CHANGING
  506.       properties = l_bds_properties
  507.     EXCEPTIONS
  508.       OTHERS     = 1.

  509.   PERFORM dequeue_graphic USING p_object
  510.                                 p_name
  511.                                 p_id
  512.                                 p_btype.



  513. ENDFORM.

  514. *&---------------------------------------------------------------------*
  515. *&      Form  ENQUEUE_GRAPHIC
  516. *&---------------------------------------------------------------------*
  517. * Enqueue of graphics stored in BDS
  518. *----------------------------------------------------------------------*

  519. FORM enqueue_graphic USING p_object
  520.                            p_name
  521.                            p_id
  522.                            p_btype.


  523.   CALL FUNCTION 'ENQUEUE_ESSGRABDS'
  524.     EXPORTING
  525. *     MODE_STXBITMAPS = 'E'
  526.       tdobject     = p_object
  527.       tdname       = p_name
  528.       tdid         = p_id
  529.       tdbtype      = p_btype
  530. *     X_TDOBJECT   = ' '
  531. *     X_TDNAME     = ' '
  532. *     X_TDID       = ' '
  533. *     X_TDBTYPE    = ' '
  534. *     _SCOPE       = '2'
  535. *     _WAIT        = ' '
  536. *     _COLLECT     = ' '
  537.     EXCEPTIONS
  538.       foreign_lock = 1
  539.       OTHERS       = 2.

  540.   IF sy-subrc <> 0.
  541.     MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  542.           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
  543.     RAISING enqueue_failed.
  544.   ENDIF.

  545. ENDFORM.                    " ENQUEUE_GRAPHIC



  546. *&---------------------------------------------------------------------*
  547. *&      Form  DEQUEUE_GRAPHIC
  548. *&---------------------------------------------------------------------*
  549. * Dequeue of graphics stored in BDS
  550. *----------------------------------------------------------------------*

  551. FORM dequeue_graphic USING p_object
  552.                            p_name
  553.                            p_id
  554.                            p_btype.

  555.   CALL FUNCTION 'DEQUEUE_ESSGRABDS'
  556.     EXPORTING
  557. *     MODE_STXBITMAPS = 'E'
  558. *     X_TDOBJECT      = ' '
  559. *     X_TDNAME = ' '
  560. *     X_TDID   = ' '
  561. *     X_TDBTYPE       = ' '
  562. *     _SCOPE   = '3'
  563. *     _SYNCHRON       = ' '
  564. *     _COLLECT = ' '
  565.       tdobject = p_object
  566.       tdname   = p_name
  567.       tdid     = p_id
  568.       tdbtype  = p_btype.

  569. ENDFORM.                    " DEQUEUE_GRAPHIC
复制代码

创建一个screen 9000,并创建逻辑流;在屏幕上创建一个 acustom control,命名‘PICTURECONTROL’。

5、执行程序调试
qr4.jpg
Show Qrcode in the screen
qr5.jpg
Show Qrcode in the smartform
qr6.jpg

6、在线提供二维码接口的网站
二维码 API接口参数
还有很多参数,实现各种酷炫效果,拿去!
回复

使用道具 举报

zhongguomao
这个需要下载工具么,二维码的。
回复 支持 反对

使用道具 举报

快速回帖

本版积分规则
您需要登录后才可以回帖 登录 | 注册有礼

快速回复 返回顶部 返回列表