Skip to Content
Technical Articles
Author's profile photo Raghavendra B Nayak

Swiss QR Bill – Simplified way of printing a Compliant QR Bill SD Invoice


Update 1: 6th of May  – Latest updates  post release of solution for all customers


Update 2 : 16th of June – Update on overcoming the fixed size QR Code restriction with SAPscript/Smartform technology



Starting June 2020, it would be legally required in Switzerland to generate a QR Bill payment part for all outgoing invoices. The SAP solution for printing QR Bills of SD invoices has been released in the collective note 2910269. The solution will enable you to generate a legally compliant print out adhering to the style guide published in the Swiss payment standard website


This blog post would be helpful if you are not directly using the SAP standard solution and doing a custom implementation for QR Bill Invoice printing.


As a part of the standard solution SAP has delivered certain templates and routines and I will explain the end to end process for handling the QR Bill invoice printing.  Based on your requirement, you can decide to simplify the custom implementation activities based on the recommendations below.


Step 1 : Creation of the Form Template


Form Data Providers Interface/SEGW Service:

Pre-requisite for developing a  Output Form template is defining and developing a Data provider. SAP has delivered a reference XFA Form interface as well as  XFA2 OData  based Gateway Service as Form Data Providers (details in Note 2910269), which could be copied/reused/referred to when creating your own Form Data Provider. The SAP design was to split the data provider into 2 parts to give a direction for customers when developing custom forms to only adjust the deltas while transitioning  from ESR regime to QR Bill regime.

  • Invoice Information: This is the basic Billing Document header/Item information along with the associated Material and Customer Master Data information and certain pricing information. With QR Bill there wouldn’t be a change to this part compared to the prior ISR invoice and mechanism  to fetch the information from the Billing document could be reused from ISR invoice for  QR Invoice printing.


  • QR Bill Payment part: This consists of following components
    • Account / Payable to: In this section the account of the payee and its address is shown.
    • Reference: Here we can see either a 27 digit QR-Reference or a 25 digit ISO 11649 Creditor reference.
    •  Additional Information: Consists of unstructured information and structured information, the so-called SWICO tags.
    • Payable by: Contains the address of the payer
    • Swiss QR Code with  the embedded Swiss Cross at the center.
    • Control Data parameters from T049Q for dynamic layout adjustments
    • SAP has delivered routines to fetch the QR Bill payment information corresponding to the SD invoice. The ABAP structure defining the skeleton of the QR Bill payment part as well as coding logic routines to fetch the data could be directly reused in print programs/gateway service classes


The skeleton of XFA interface/ XFA2 gateway service is as shown in the images below

The XFA2 gateway based service can be delivered by release/support pack only. If you are not planning to upgrade to the latest support pack, via SAP notes only the interface based SAP standard form would be available.


QR Bill Style guide explains different ways/formats/languages in which the QR Bill could be printed.

  • Languages :SAP supports the printing of QR Bill Invoice in German/French/English/Italian, and mandatory headings in different languages are automatically adapted in the language you want to print the form. To achieve this, the headings in the layout should be made dynamic and SAP has delivered interface with legal headings in different languages “IF_CL_QRBILL_UTIL_XX” where XX is the language key and could be DE/FR/IT/EN


  • Formats :  In the SAP delivered configuration for QR Bill Control you can choose the following
    • PDF output form with scissors/separated lines: means that the payment part of the invoice is separated with the scissors icon or with a separation line from the actual invoice data in the PDF output.
    • Integrated QR-Bill A4: means that the QR-bill is part of the invoice.
    • Separated QR-Bill A5: means that the QR-bill is generated separately and is not part of the invoice.
    • Amount formatting is dynamically done based on the control data configuration


To achieve this, certain control parameters needs to be added in the Form Data Provider to dynamically adjust the layout. This logic for such dynamic layout adjustment based on configuration T049Q should be done at the layout script level. Reference can be taken from SAP delivered standard forms


Form Template


SAP form strategy is to deliver only Adobe forms as standard solutions. For QR Bill, SAP has delivered a reference QR Bill invoice adobe form template as described in note 2910269.

SAP’s approach for achieving the fixed size QR Code with the Swiss Cross, was using an Image Element in the form rather than a Barcode Element.

  • With the Bar Code element, there are 2 challenges we faced
    • Adobe  Forms does not support fixed size QR code element and the sizing of the QR code is dynamic based on the Data used for encoding. This means, in the form if a Swiss QR is an Barcode Element, then the style guide rules cannot be adhered to
    • Generating a QR code with a Cross in the middle (“Swiss QR Code Standard”) isn’t supported by Adobe yet


  •  To overcome this, in the reference Adobe Form template which SAP has designed, SAP used an image based approach
    • The SAP BASIS Class routine (CL_RSTX_BARCODE_RENDERER => QR_CODE), delivered via note 2790500, is used to fetch the QR Code Image in BITmap format.
    •  In the Form Data Provider( Interface/Gateway)  an Image Element variable is created  (Graphic/Image String)


    • In the Form Layout, there would be 2 elements of Image Type. One Mapped to the QR Code Image. Second one would be the static Swiss cross Image



    • There wouldn’t be any data loss, due to superimposition of the Swiss cross over the QR Code image.


There are limitation in SAPscripts and Smartform technology to achieve a the Swiss QR code, either by the image approach or the barcode element approach

  • Only static images which are uploaded in the application server can be used in the form. The design for Adobe forms explained above uses a dynamic QR Code generation as an image which is not feasible in SAPscript/Smartform technology. Additionally superimposition of Swiss cross over the bar code too isn’t possible with the dynamic image approach, as it needs to be uploaded to the application server
  • Even though QR Code Barcode element is supported in SAPscript/Smartform technology, the sizing is dynamic based on the text input.  Similar to adobe forms, achieving fixed size QR Code with Barcode element is not possible.


Update : To overcome these restrictions in SAPscript and Smartform, SAP has provided design/implementation recommendations in the consulting note 2937591.  The following steps would be helpful only if you are using Smart forms or SAPscript for the QR Bill invoice. The High level design block for achieving the style guide specifications are as follows

1. Creating the QR Code

Create the QR Code in BITMAP format passing the invoice data and certain fixed QR Code generation control data as shown in the code block below. This would be the same routine as explained for Adobe forms in the prior sections

            i_module_size      = l_module_size  "Module Size should 10
            i_mode             = co_mode        "Mode should be U
            i_error_correction = co_err_corr    "Error Correction should be M
            i_rotation         = 0           
            i_barcode_text     = i_qrcode_data  "String for QR code generation as per the Data Structure
            e_bitmap           = e_bitmap       "QR Code Output in BITMAP format

2. Re-Scaling the QR Code Image

The QR Code Output should be re-scaled based on the Print resolution. If the print resolution is 600 DPI, to achieve a 46*46 mm QR Code, it should be scaled to 1087*1087 pixel. This needs to performed every time as the data input to the QR code generator might vary in character size. Based on the character size, the bar code rendering utility would return an image of variable size.


Following is the sequence to adjust the dimension

  • Calculate the current Image size
    * create FXS-object and add bitmap
      data(lr_ip) = new cl_fxs_image_processor( ).
      data(lv_hndl) = lr_ip->add_image( lv_bitmap ). "Bitmap Output from Step1
    * Method to extract the Image size
      lr_ip->get_info( exporting
                         iv_handle   = lv_hndl
                         ev_mimetype = lv_mimetype
                         ev_xres     = lv_xres          "Contains the Width size
                         ev_yres     = lv_yres          "Contains the Height size
                         ev_xdpi     = lv_xdpi
                         ev_ydpi     = lv_ydpi
                         ev_bitdepth = lv_bitdepth ).
  • Recalculate the Module Size based on the extracted Image Height/Width Size
* we need a height of 1087 pixel to get the print-size of 46mm at 600dpi.
"c_module_size is 10 used in step 1 to generate the QR Code BITMAP
"lv_yres is width size extracted in the previous step
  l_new_module_size = c_module_size * 1087 / lv_yres.
  • Once the required dimension is nearly achieved after looping the action in the previous steps, generate the QR Code again with the recalculated Module size, as explain in step 1 using “cl_rstx_barcode_renderer=>qr_code”. Since module size can only be specified as an integer value, there could be rounding errors resulting in QR Code size difference of approx. +/-1mm.

3. Swiss Cross Logo

The Official logo downloaded using the link, available under, has a white background. Smart form interprets this as transparent and doesn’t completely cover the QR Code. In the note 2937591, you can find a .BMP image file attached, which overcomes the problem by performing the following

  • Convert Image of PNG to BMP
  • Increase Color Depth to 8Bit (256 Colors)
  • Replace white background color with a light gray background – for example, RGB: 240, 240, 240

This image needs to be uploaded in SE78 as explained in the note 2937591


4. Form Layout and Processing

With the restriction of using only Static images for form rendering, the QR Code image needs to be uploaded via program logic in the print program, each time the form is rendered. Separate SE78 image object space in the application layer for QR Code Image. Every time the QR Bill is printed, this space is used for uploaded, overwriting the QR Code image. Optimized coding example is explained in the note 2937591

"Further Processong of extracted BITMAP image in prior steps

  data(lt_bin_data) = cl_bcs_convert=>xstring_to_solix( iv_xstring = i_bitmap ).

"Static Space for QR Code generation which is overwritten when rendering a new QR Bill
  ls_stxbitmaps-tdname   = 'ZZ_TESTQRCODE_SWISSQR'. 

  ls_stxbitmaps-tdobject = 'GRAPHICS'.
  ls_stxbitmaps-tdid     = 'BMAP'.
  ls_stxbitmaps-tdbtype  = 'BMON'.

  l_bytecount = xstrlen( i_bitmap ). 

  ls_stxbitmaps-resident   = off.
  ls_stxbitmaps-autoheight = on.

* enqueue bds graphic
  call function 'ENQUEUE_ESSGRABDS'
      tdobject     = ls_stxbitmaps-tdobject
      tdname       = ls_stxbitmaps-tdname
      tdid         = ls_stxbitmaps-tdid
      tdbtype      = ls_stxbitmaps-tdbtype
      foreign_lock = 1
      others       = 2.

  if sy-subrc <> 0.

      color                     = off
      format                    = 'BMP'
      resident                  = off
      bitmap_bytecount          = l_bytecount
      compress_bitmap           = off
      width_tw                  = ls_stxbitmaps-widthtw
      height_tw                 = ls_stxbitmaps-heighttw
      width_pix                 = ls_stxbitmaps-widthpix
      height_pix                = ls_stxbitmaps-heightpix
      dpi                       = ls_stxbitmaps-resolution
      bds_bytecount             = l_bds_bytecount
      bitmap_file               = lt_bin_data
      bitmap_file_bds           = lt_bds_content
      format_not_supported      = 1
      no_bmp_file               = 2
      bmperr_invalid_format     = 3
      bmperr_no_colortable      = 4
      bmperr_unsup_compression  = 5
      bmperr_corrupt_rle_data   = 6
      tifferr_invalid_format    = 7
      tifferr_no_colortable     = 8
      tifferr_unsup_compression = 9
      bmperr_eof                = 10
      others                    = 11.

  if sy-subrc <> 0.
*   conversion error 
*   dequeue bds graphic
    call function 'DEQUEUE_ESSGRABDS'
        tdobject = ls_stxbitmaps-tdobject
        tdname   = ls_stxbitmaps-tdname
        tdid     = ls_stxbitmaps-tdid
        tdbtype  = ls_stxbitmaps-tdbtype.


And in the Smart form script,  at specific positions

"For QR Code Image which has a static SE78 space reserved


"In the same screen space the Swiss Cross static image is superimposed




Step 2 : Configuration Of Output Management

  • NAST Output Management


    • Prerequisite is have the form template as explained in the Step 1 ready. Additionally a print driver program would be required. Print program should perform the following
      1. Get the Invoice information to be mapped to in the interface. As explained in Step 1, the existing solution for ISR invoice print program can be reused for the QR Bill print program, as the changes are only related with the payment part.
      2. Get The QR Bill payment part to be mapped in the Form interface. QR Bill payment part should be structured in the same way as SAP standard form interface, then the routines explained in the note  can be reused for getting the QR Bill Payment part data.
      3. Perform the standard print processing technical flow, where you open the print jobs and finally call the Function module corresponding to your Form template sending the information extracted in point 1 and 2.
      4. To better understand the SAP print program, the invoice/ payment part information fetching have separate “GET” routines and print processing is done in separate routine.


    • A sample Output management config via transaction code NACE is shown below
      • Create a new output type for Billing Area (V3)

      • Assign the newly created Form Template and the print driver program in the Processing routine section of the output type

  • Maintain condition record for the newly created output type, for a Specific Business Partner/BillingType/Sales Org combination based on your requirement.


      • When creating a invoice, an output item is created as with the specified medium/language and Form template in the NACE configuration

  • New Output Management in S/4 HANA On-Prem


    • Unlike the legacy NAST based output management,  APOC based output management wouldn’t require a print program, if you have created a Gateway Service based form.
    • The Structure of your FDP (The skeleton) should be defined as Entity/Entity Sets in your gateway Service.
    • For the Invoice information, redefinition from the Core SD Service  “FDP_V3_BD_STANDARD” is recommended
    • For the QR Bill Payment part, you would need to create new Entity sets, as shown in the section above ( Highlighted part) and the logic to fetch the QR Bill payment part information should be written in the generated DPC extension class. Here you can reuse the SAP delivered routines explained in the note 2910269, to fetch the information
    • You would need to maintain the Output Control Configurations via IMG path “Cross-Application Components -> Output Control

    • You can create new Output Types under Application Object Type “Billing Document”

    • In the Business  Rule for Output Parameter determination (Tcode OPD) you can assign the newly created Form Template, to a Billing Type and also specify the language you want the form template to be printed.


    • In the configuration “Assign Form Templates”, you would need to assign the Form template to your newly created Billing Type. Please note, with the new output management, you can also use a interface based form explained in the “NAST output Management Section” for which you would need a Print driver program. If you want to use a interface based form, then all the steps in the earlier section needs to be followed.

    • When creating a invoice, an output item is created as with the specified medium/language and Form template in the Output Control configurations


When the Output is triggered,( i.e, the created output item is completely processed) can also be configured. Generally, this should be done when the SD Billing Document is release to FI. In the NAST based output management, this is handled via procedures and routines and in the APOC output management it is handled via Output relevance setting as shown below


This is an overview of the end to end process and development cycle to generate a compliant QR Bill Invoice.


Additionally to cater to requirements pertaining to selection of separate printer tray for printing the payment part, SAP has a design approach and recommendation

  • The QR Bill payment part is always printed in a separate page (The last page)
  • The page format of the page containing the QR Bill payment part is  different compared to the other pages containing the invoice information.

For example SAP has delivered a reference form in A4 format. The pages in the form template layout  for the invoice information part, are specified as A4 format. The last page in the layout with the QR Bill payment part, is specified as A4 Plain format

  • The printer description file (the .XDC file associated with the printer) is modified by assigning different printer trays for specific page format. Details for modifying the XDC file using Eclipse IDE is described in the SAP note 766410

Assigned tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Prabhjot Bhatia
      Prabhjot Bhatia

      Very nice and informative document. It's good to know a legal requirement which I believe, I also would need to implement soon in my company. I also like SAP approach to provide standard solutions only applicable for new output management which was committed at the beginning for new output management.

      I would be interested to know about gateway based Adobe forms if we can use it for a custom adobe form.

      Do we always need to refer a standard form if we want to use odata based forms?

      Author's profile photo Raghavendra B Nayak
      Raghavendra B Nayak
      Blog Post Author

      Hi Prabhjot,


      You could create custom adobe form (layout ) reusing the SAP delivered Gateway Service as form data provider. This is the approach, most customers use in S/4 HANA Cloud and On Premise.

      You could always refer to the standard form, just to reuse the same form layout elements, to avoid any issues when using the SAP delivered gateway Service.


      Kind Regards,


      Author's profile photo Dirk Sann
      Dirk Sann

      Dear Raghavendra,

      thanks for this detailed Information. I tried to open OSS-Note 2874819 and failed with message:

      You are not entitled to access SAP Note/KBA 2874819. The target audience for the SAP Note/KBA you were trying to reach does not match your profile.

      Is this OSS-Note not released yet? Do you have any Information when this OSS-Note will be released?


      Best Regards,

      Dirk Sann

      Author's profile photo Raghavendra B Nayak
      Raghavendra B Nayak
      Blog Post Author

      Hello Dirk Sann,


      SAP had now released the collective note 2910269, which contains the solution for QR Bill SD invoice printing.

      Kind Regards,


      Author's profile photo Shital Kade
      Shital Kade

      Hi Raghavendra ..thanks for posting this ..As Dirk said we are not able to check note  -2874819 as this is not released ..any idea of other sap notes which will be useful for ECC system

      Author's profile photo Raghavendra B Nayak
      Raghavendra B Nayak
      Blog Post Author

      Hello All,


      The note 2874819 is currently being tested a few select Pilot Customers. We would be releasing the note in the coming weeks to all customers.


      Kind Regards,


      Author's profile photo Lijo Raj
      Lijo Raj

      Hi Raghavendra,

      Could you please let us know about generating and printing of Swiss QR code for SAP Scripts also?

      Are there any pre-requisites and/or other SAP Notes to be implemented?

      Is there any specific Note for the Swiss-QR Symbology, for example?


      Author's profile photo Raghavendra B Nayak
      Raghavendra B Nayak
      Blog Post Author

      Hello Lijo,


      There are restrictions with SAP script technology and I have included a section in this blog for the same. We would recommend to go for Adobe forms for QR bill Invoice form due to the limitations.


      Kind Regards,


      Author's profile photo Shital Kade
      Shital Kade

      Hello Raghavendra,


      Thanks for the post but still its Note 2874819 is not available for customer ..

      we can see sap has released  collective note for Switzerland QR IBAN functionality

      2673953_E_20200410_2673953 - QR Bill Collective Note for implementation of new process for simplifying invoicing with QR IBAN

      We check above note but our system is lower level of support packed and this note has hundreds of per-requisite notes and either imp these note or support package upgrade is not possible ..

      so how to achieve this functionality  without above note in ECC system on which these note cannot be possible to implement it possible to achieve this by small customization of SAP FB60 screen ..please suggest .


      Author's profile photo Raghavendra B Nayak
      Raghavendra B Nayak
      Blog Post Author

      Hello Shital,


      SAP had now released the collective note 2910269, which contains the solution for QR Bill SD invoice printing.


      About the pre-requisites, we have removed the redundant dependencies and collated the information about the set of notes to be implemented with the sequence in this collective note.


      Kind Regards,


      Author's profile photo Apoorva Dethe
      Apoorva Dethe

      Hi Raghavendra,


      How do we incorporate Swiss QR code in Adobe form layout? It is not available in QR code templates in Object Library.


      Kindly, assist.

      Author's profile photo Raghavendra B Nayak
      Raghavendra B Nayak
      Blog Post Author

      Hello Apoorva,


      I have now updated this blog with information on SAP design for the QR Code generation in the form layout. As explained, we would need to characterize the QR Code as an image element with super imposition of Swiss Cross.


      Kind regards,


      Author's profile photo Daniel Nicula
      Daniel Nicula

      Hi Raghavendra,


      Do you know something about the MIRO functionality in regard to QR-Bill for Switzerland?

      How do we activate there and how to handle in MM the new functions?



      Daniel Nicula

      Author's profile photo Raghavendra B Nayak
      Raghavendra B Nayak
      Blog Post Author

      Hello Daniel,


      To enable the QR Bill for MIRO, your would need to  implement the SAP notes 2792267 and 2901229


      Kind Regards,


      Author's profile photo Daniel Nicula
      Daniel Nicula

      Hi Raghavendra,


      Maybe you have a hint for me regarding the QR Code functionality for MIRO?




      Author's profile photo Raghavendra B Nayak
      Raghavendra B Nayak
      Blog Post Author

      Hello Daniel,


      To enable the QR Bill for MIRO, your would need to  implement the SAP notes 2792267 and 2901229


      Kind Regards,


      Author's profile photo Christian Assig
      Christian Assig

      Hello Raghavendra,

      can you give us an update regarding the general availability of SAP note 2874819? Or is there any chance to become one of the pilot customers for this topic at this point?

      Best regards,

      Author's profile photo Raghavendra B Nayak
      Raghavendra B Nayak
      Blog Post Author

      Hello Christian,


      SAP had now released the collective note 2910269, which contains the solution for QR Bill SD invoice printing.


      Kind Regards,


      Author's profile photo Bladimir Montaño
      Bladimir Montaño

      Dear Raghavendra, thank for you information, let me ask you a question; Do you know if exist or SAP is planned to relase a standard specific solution for RE-FX (Lease-out) for QR-Bill?, because we’ve found for FI/SD/MM/RE lease-in but nothing specific for RE-FX (Lease-out).

      Thanks in advances


      Best Regards


      Author's profile photo Raghavendra B Nayak
      Raghavendra B Nayak
      Blog Post Author

      Hi Bladimir,


      To my knowledge, RE-FX template is still under development and you could track the changes in the "Legal Change Notification" app (link)




      Author's profile photo Bladimir Montaño
      Bladimir Montaño

      Dear Raghavendra, thank for you information, in Jam forum SAP answer the solution will be release on November 2020.


      Best Regards


      Author's profile photo Mayur Gondhalekar
      Mayur Gondhalekar

      Dear Raghavendra,


      Is there a specific solution for printing of a Dunning notice based on SAP script form and with QR code printed just like the invoice. Would the process be similar to what you have explained above for invoice printing? Only difference being the changes would be needed in the dunning print program. The logic for QR code itself and the superimposition of logo would remain the same?


      Thank you


      Author's profile photo G.V.S Praveen Kumar
      G.V.S Praveen Kumar

      Hi Raghavendra,


      Thanks for the post. As per Snote 2937591, I have tried implementing the attachment But the driver program given is not getting activated due to missing class "CL_SWISS_QR_REF".


      Could you please suggest the process of getting missing class in our system.