首页 > 应用开发 > IT综合 > 使用ABAP创建QR Code(二维码)

使用ABAP创建QR Code(二维码)

原创 IT综合 作者:i042416 时间:2020-09-06 10:04:47 0 删除 编辑

In the previous  blog we discuss how to generate QRCode to enable it be scanned via mobile phone.

In that solution, the QRCode is generated and stored in a PDF file via ABAP webdynpro framework, we only provide the form template. In fact it is quite easy to adapt the solution to generate the PDF by ourselves, so that the QRCode could be used more flexibly in many other scenario for example as an attachment of email.

Note: it is still necessary to create a form interface and form template as described in the blog.

The report source code is below:

PARAMETERS: content TYPE string.DATA:
  ls_outputparams TYPE sfpoutputparams,
  ls_docparams    TYPE sfpdocparams,
  ls_pdf_file        TYPE fpformoutput,
  ls_post            TYPE crmd_soc_post,
  lv_fm_name      TYPE rs38l_fnam.ls_outputparams-noprint   = 'X'.ls_outputparams-nopributt = 'X'.ls_outputparams-noarchive = 'X'.ls_outputparams-nodialog  = 'X'.ls_outputparams-preview   = 'X'.ls_outputparams-getpdf    = 'X'.CALL FUNCTION 'FP_JOB_OPEN'
    ie_outputparams = ls_outputparams
    cancel                = 1
    usage_error        = 2
    system_error       = 3
    internal_error      = 4
    OTHERS              = 5.CHECK sy-subrc = 0.TRY.
        i_name        = 'ZPF_QRCODE' " put your own form template name here      IMPORTING
        e_funcname = lv_fm_name.
  CATCH cx_fp_api_repository
    RETURN.ENDTRY.ls_docparams-langu     = 'E'.ls_docparams-country   = 'US'.CALL FUNCTION lv_fm_name
    /1bcdwb/docparams  = ls_docparams
    qrcode_input            = content
    /1bcdwb/formoutput = ls_pdf_file
    usage_error         = 1
    system_error       = 2
    internal_error      = 3
    usage_error    = 1
    system_error   = 2
    internal_error  = 3OTHERS         = 4.

execute the report, the PDF binary is stored in ls_pdf_file-pdf.

It could be scanned by the QRCode scanner installed in my mobile phone:


来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录


  • 博文量
  • 访问量