这篇文章主要讲解了“怎么用ABAP生成二维码”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“怎么用ABAP生成二维码”吧!
在网页上输入要生成的二维码数据源,校验级别和图片大小,点生成即可看到生成的二维码图片:
下面是用ABAP code 利用上述service生成二维码的代码:
DATA:ls_form type zcl_http_tool=>ty_name_pair,lt_header type zcl_http_tool=>tt_name_pair,lt_form type zcl_http_tool=>tt_name_pair,lv_code type xstring.ls_form = value #( name = 'data' value = 'testforQRCode' ). APPEND ls_form TO lt_form.ls_form = value #( name = 'level' value = 'M' ). APPEND ls_form TO lt_form.ls_form = value #( name = 'size' value = '6' ). APPEND ls_form TO lt_form.zcl_http_tool=>send_request( iv_url = 'http://www.makepic.com/qrcode.php' iv_req_type = if_http_request=>co_request_method_postit_form = lt_form ).ls_form = value #( name = 'Referer' value = 'http://www.makepic.com/qrcode.php' ). APPEND ls_form TO lt_header.zcl_http_tool=>send_request( EXPORTING iv_url = 'http://www.makepic.com/mkqr.php?data=testforQRCode&level=M&size=6' iv_req_type = if_http_request=>co_request_method_getit_header = lt_headerIMPORTING ev_response = lv_code ).
testforQRCode对应生成的二维码:
用手机上的二维码扫描应用能够成功扫描出来:
感谢各位的阅读,以上就是“怎么用ABAP生成二维码”的内容了,经过本文的学习后,相信大家对怎么用ABAP生成二维码这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是编程网,小编将为大家推送更多相关知识点的文章,欢迎关注!