Release 7.2 of the SAP Solution Manager contains many significant improvements. One of them is the growing portfolio of SAP Fiori applications, including several easy to use apps for IT Service Management. In this blog, I will describe how you can use the Create Incident Fiori app, together with QR Codes (Quick Response codes), to make reporting and processing incidents even easier for your users.
QR Codes contain encoded information, similar to a 2-d bar code, which users can scan and decode – typically with a smartphone app. The most common use case is to encode a URL which users can scan from a printed physical object, such as a poster, handout, ticket, etc.; the user’s QR Code scanning app then automatically opens the decoded URL. This saves the user the error prone and sometimes tedious task of manually entering the URL in a Web browser.
For example the QR Code below encodes the permalink to my profile:
You can do the same with the SAP Solution Manager Create Incident Fiori app. If you post QR Codes in office spaces, your users will be able to quickly access the app without having to look up the URL. In addition, you can add parameters to the encoded URL to pre-fill fields, such as the component, configuration item, etc. This will save users from manually filling out fields, and make sure that users do not enter incorrect data.
To take advantage of this, perform the following steps:
- Determine the URL for your Create Incident app.
- Add parameters to the URL in order to pre-fill fields and attributes in the app.
- Optionally shorten the URL (this reduces the size of the QR Code).
- Encode the resulting URL as a QR Code.
- Distribute the QR Code to your users.
I describe each of the steps in more detail below.
1. Determine the URL for Your Create Incident App
This step is easy. Simply open the SAP Solution Manager’s Fiori Launchpad (or your central Fiori Launchpad if you use one) and select the Create Incident tile. Make note of the resulting URL, which should look like the following:
2. Add Parameters to the URL
The Create Incident app allows you to pre-fill most fields with URL parameters. The following is a list of the app’s parameters which were current as of the writing of this blog entry:
|Parameter Name||Description||Example / Encoded Example|
|title||Set the Short Text / Title of the Incident||title=Hello%20World|
|priority||Set the Priority of the Incident|
Priority ID (1-4) is considered and only valid keys are accepted.
|category||Set the MLC (Multi-Level Category) of the Incident|
Category ID is used. Only valid category IDs for the current Process Type.
|component||Set the SAP Component|
Only existing component keys are accepted
|configitem||Set the Configuration Item|
ConfigItem ID is accepted.
|contactperson||Set the additional contact person.|
BP (Business Partner) ID is accepted.
|description||Set the Long Text / Description of the Incident||description=Hello%20colleagues|
|PROCESS_TYPE||Preselect the Process Type. (Selection Screen will be skipped)|
Only valid process types can be used
Use URL encodings (title=Hello%20World instead of title=Hello World) for the parameter values.
A URL with parameters should look like the example below:
3. Optionally Shorten the URL
If you shorten the URL (in other words, reduce the number of characters in the URL), the QR Code which you generate will also be smaller. This could be convenient if you wish to affix QR Codes to smaller devices, such as laptops or printers.
There are a number of online services which offer convenient URL shortening functions. Be sure that your organization’s security policy allows you to use such services.
There is also a blog article which describes how you could implement such a service in ABAP, on one of your own NetWeaver servers:
Here is what my user profile looks like when shortened using a common (third party) service:
4. Encode the URL as a QR Code
You can use several methods to generate QR Codes from the URLs which you have generated:
- Use an online tool (perform an Internet search to find a reliable QR Code generator).
- Use your ABAP infrastructure to generate the codes. (See this blog and the sample report below)
- Use SAPUI5 and the Google Charts API (See this blog)
- Use a third party tool to generate the code. There are various commercial and open source software products which support this. You may already have access to such tools in your organization.
By far, the easiest options to get started are to use online services or a third party tool. However, if you want to generate lots of QR Codes (for example, to affix codes to every server or printer of your organization), you can use the ABAP infrastructure’s Smart Forms facilities to mass-produce the codes.
Here is an example of how the above generic URL looks when converted to a QR Code:
5. Distribute the QR Code to Your Users
This is also an easy step but could be time consuming. You simply need to print out the codes and affix them anywhere they might be needed: to printers or other devices, so users can report problems without having to find the device’s configuration ID, to user workplaces so users do not have to go hunting for the correct URL to report incidents. There are many options which would make reporting incidents much easier through QR Codes.
- Scan the QR code using their mobile device (smartphone or tablet).
- Launch the URL encoded in the QR code. This will start the Fiori Create Incident app and automatically fill in the given fields.
- Add any additional information, such as a specific description of the incident.
- Submit the incident.
The only requirement for end users is that they must have access to QR code scanners on their mobile devices. Such apps are readily available in the platform specific (iOS, Android, Windows) app stores.
- QR Codes in Wikipedia
- Online QR Code Generator
- ZXing Project: Open Source APIs and Android application for QR Code reading
- ZXing Online QR Code Generator
- Generate QR Code in Web Dynpro (Part I)
- Create QRCode via ABAP code (Part II)
Sample Report: Generate QR Codes in ABAP
The following sample report generates a QR code based on the URL which you input and sends the resulting PDF document to your e-mail address. You could adapt the code to automatically generate a series of QR codes based on a list of configuration item IDs, for example.
The code assumes you have created a form, ZPF_QRCODE, as described in the Blog Step by step to create QRCode in ABAP Webdynpro
PARAMETERS: content TYPE string OBLIGATORY, mailto TYPE ad_smtpadr OBLIGATORY. 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, lo_send_request TYPE REF TO cl_bcs, lo_document TYPE REF TO cl_document_bcs, lo_recipient TYPE REF TO if_recipient_bcs, lo_bcs_exception TYPE REF TO cx_bcs, lv_sent_to_all TYPE os_boolean, lv_pdf_size TYPE so_obj_len, lt_pdf_content TYPE solix_tab, lv_pdf_xstring TYPE xstring. ls_outputparams-noprint = 'X'. ls_outputparams-nopributt = 'X'. ls_outputparams-noarchive = 'X'. ls_outputparams-nodialog = 'X'. ls_outputparams-preview = 'X'. ls_outputparams-getpdf = 'X'. * 1. create pdf containing qr-code CALL FUNCTION 'FP_JOB_OPEN' CHANGING ie_outputparams = ls_outputparams EXCEPTIONS cancel = 1 usage_error = 2 system_error = 3 internal_error = 4 OTHERS = 5. CHECK sy-subrc = 0. TRY. CALL FUNCTION 'FP_FUNCTION_MODULE_NAME' EXPORTING i_name = 'ZPF_QRCODE' " put your own form template name here IMPORTING e_funcname = lv_fm_name. CATCH cx_fp_api_repository cx_fp_api_usage cx_fp_api_internal. RETURN. ENDTRY. ls_docparams-langu = 'E'. ls_docparams-country = 'US'. CALL FUNCTION lv_fm_name EXPORTING /1bcdwb/docparams = ls_docparams qrcode_input = content IMPORTING /1bcdwb/formoutput = ls_pdf_file EXCEPTIONS usage_error = 1 system_error = 2 internal_error = 3 OTHERS = 4. CHECK sy-subrc = 0. CALL FUNCTION 'FP_JOB_CLOSE' EXCEPTIONS usage_error = 1 system_error = 2 internal_error = 3 OTHERS = 4. * 2. send pdf via e-mail TRY. * -------- create persistent send request ------------------------ lo_send_request = cl_bcs=>create_persistent( ). * -------- create and set document ------------------------------- lt_pdf_content = cl_document_bcs=>xstring_to_solix( ls_pdf_file-pdf ). lo_document = cl_document_bcs=>create_document( i_type = 'PDF' i_hex = lt_pdf_content * i_length = lv_pdf_size i_subject = 'Your created QR Code' ). "#EC NOTEXT * add document object to send request lo_send_request->set_document( lo_document ). * --------- add recipient (e-mail address) ----------------------- * create recipient object lo_recipient = cl_cam_address_bcs=>create_internet_address( mailto ). * add recipient object to send request lo_send_request->add_recipient( lo_recipient ). * ---------- send document --------------------------------------- lv_sent_to_all = lo_send_request->send( i_with_error_screen = 'X' ). COMMIT WORK. IF lv_sent_to_all IS INITIAL. MESSAGE i500(sbcoms) WITH mailto. ELSE. MESSAGE s022(so). ENDIF. * ------------ exception handling ---------------------------------- * replace this rudimentary exception handling with your own one !!! CATCH cx_bcs INTO lo_bcs_exception. MESSAGE i865(so) WITH lo_bcs_exception->error_type. ENDTRY.