使用ABAP程式碼生成二維碼(QR Code)
Previously we have discussed how to generate QRcode with SAP standard functionality:
(1) Generate QRcode with ABAP Webdynpro (2) Generate QRcode with ABAP Code plus Adobe form template
Both solutions will generate QRCode within a PDF file.
If your requirement is to generate the QRCode in a picture file, you can use the solution described in this blog.
There are lots of websites which provide free QRCode generation service. Just google it:
I prefer to use this one http://www. qrstuff.com : just choose “Plain Text” and we can input some characters in Text field. There is a AJAX call which will generate QRCode immediately after some characters are typed.
te (二維碼自動識別)
Now question is how we automate the character input via ABAP.
I use Chrome to explore what has happened when we input some char in webpage. Click F12 to launch Chrome developer tool, input some char and observe the information displayed in the “Network” tab:
test (二維碼自動識別)
The request URL is found: http://www. qrstuff.com/generate.ge nerate The request method is GET. Also it is necessary to identify http form fields and they are also listed in Chrome:
We need to copy all of those form fields into our ABAP code except preview=1, since we don’t need the preview functionality, we just need the generated png file.
here below is the simple report to generate QRCode from hard coded string “testforQRCode”. ( The bold text are just copied from Chrome developer tool ) The source code of zcl_http_tool could be found from attachment.
DATA:ls_form type zcl_http_tool=>ty_name_pair,
lt_form type zcl_http_tool=>tt_name_pair,
lv_code type xstring.ls_form = value #( name = 'type' value = 'TEXT' ).APPEND ls_form TO lt_form.ls_form = value #( name = 'foreground_color' value = '000000' ).APPEND ls_form TO lt_form.ls_form = value #( name = 'ecc_level' value = 'L' ).APPEND ls_form TO lt_form.ls_form = value #( name = 'width_pixels' value = '200' ).APPEND ls_form TO lt_form.ls_form = value #( name = 'dpi' value = '72' ).APPEND ls_form TO lt_form.ls_form = value #( name = 'file_type' value = 'png' ).APPEND ls_form TO lt_form.ls_form = value #( name = 'text' value = 'testforQRCode' ).APPEND ls_form TO lt_form.zcl_http_tool=>send_request( EXPORTING iv_url = 'http://www.qrstuff.com/generate.generate'
iv_req_type = if_http_request=>co_request_method_get
it_form = lt_formIMPORTING ev_response = lv_code ).
And this is QRCode scanned from my mobile phone:
要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2717328/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用ABAP建立QR Code(二維碼)
- QR Code二維碼
- Python 生成條形碼、二維碼 (Code 128、EAN-13、QR code等)Python
- 【轉載】 SAP 列印二維碼 QR Code or 2D Bar Code in SAP
- Amazing QR!一款 Python 二維碼生成器!Python
- 使用 Python 生成二維碼Python
- Tp生成小程式二維碼
- 小巧實用的二維碼製作生成工具:QR Creator PRO Mac版Mac
- 如何使用 Python 生成二維碼?Python
- 二維碼生成
- 二維碼管理平臺 生成二維碼
- SAP ABAP關鍵字語法圖和ABAP程式碼自動生成工具Code Composer
- Flutter - 生成二維碼與識別二維碼Flutter
- 二維碼生成-PythonPython
- 趣味二維碼生成
- react使用qrcode.react生成二維碼React
- 直播系統搭建,java二維碼 生成二維碼Java
- 使用Visual Studio Code編寫和啟用ABAP程式碼 (上)
- 使用Java生成具有安全雜湊的QR碼 | Rustam MehmandarovJavaRust
- iOS 生成二維碼/條形碼iOS
- 簡單易用的二維碼掃描工具:QR Capture for MacAPTMac
- UI2Code智慧生成Flutter程式碼——機器生成程式碼UIFlutter
- qrcodejs js生成二維碼JS
- Tp框架 生成二維碼框架
- ios--二維碼生成iOS
- 二維碼線上生成
- 二維碼生成工具類
- 使用 ABAP 程式碼製作手機能夠掃描的二維碼(QRCode)試讀版
- 支付寶 二維碼/轉賬碼/生成方式,突破二維碼生成數量的限制
- 微信小程式:小程式碼、小程式二維碼、普通二維碼微信小程式
- .NET生成小程式碼,併合自定義背景圖生成推廣小程式二維碼
- .NET生成微信小程式推廣二維碼微信小程式
- 生成商品海報,附帶小程式二維碼
- php生成二維碼圖片PHP
- PHP生成簡單二維碼PHP
- url 生成二維碼圖片
- java實現二維碼生成Java
- 二維碼生成工具 Simple QrCode