cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Replicate the QR Code to custom Smartform, decoding from Table EDOPLINV

Abh_2
Participant
0 Likes
501

Hi All,

How to replicate the QR Code, for an Invoice that was accepted by the KSeF, e-invoicing System and sent back the PDF with QR Code?  The QR Code (not the pdf)  is stored in the Table Field EDOPLINV-QRCODE_ACCEPTED.

Expected Result: 
The QR Code should be re-generated in a custom Smart form, from the value stored in the Table field EDOPLINV-QRCODE_ACCEPTED. when scanned, it should re-direct to KSef PL Gov website.

Procedure:
I have the following test code written in the Smart form, very similar to this blog post QR Code in Base64 encoding for KSA E-Invoicing - Directly from data in Table EDOSAINV  
Note: In the- above Blog, QR Code is  encoded to Base 64, But I don't want this.

  1. Configured System Bar Code in SE73 for QR Code with "QR Code 2005".
  2. Created a smart form style, For a  Character font, assigned the QR Code system bar code to it.
  3. Assigned the custom style to my custom Smart form.
  4. Below is the code written in the Initialization of Smart form (Please note this is a prototype)
*Global Data
 Data:
 EV_QRCODE type string. "or xstring
SELECT SINGLE
  FROM edoplinv
FIELDS *
 WHERE edoc_guid = '699D630206330553E1000000A467BBA9'
  INTO ls_edoplinv.

  DATA lv_image_base64 TYPE string.
  DATA lo_xstr_to_str_conv TYPE REF TO cl_abap_conv_in_ce.
  cl_abap_conv_in_ce=>create(
    EXPORTING
      encoding = 'UTF-8'
      input    = ls_edoplinv-qr_code_accepted
    RECEIVING
      conv     = lo_xstr_to_str_conv
  ).
  lo_xstr_to_str_conv->read( IMPORTING data = lv_image_base64 ).

  DATA: lv_image_xstring TYPE xstring.
  lv_image_xstring = cl_http_utility=>decode_x_base64( 
                         encoded = lv_image_base64 ).

*--Assign to the QRCode variable used in the UI
   EV_QRCODE = lv_image_xstring

In the smart form, created a text with the following snippet

<QR>&EV_QRCODE&</>​

The QR Code is generated, but does not point to the KSeF, instead shows a 4 digit gibberish value.

Expected URL starts with below URL
https://qr-demo.ksef.mf.gov/client-app/invoice/

 Can you please suggest how to fix it ?

Accepted Solutions (0)

Answers (1)

Answers (1)

abo
Active Contributor
0 Likes

In a smartform you have two options for a QR code:

  1. system font: you pass the string value to the text node, set the appropriate paragraph / character type and done. Main problem: sizing and positioning can be extremely finicky
  2. embedded image: you can generate an image dynamically, you can even come up with a dynamic name and pass it to the graphic node but you cannot pass the image content itself to the graphic node! This works in Adobe Forms, not in SF.

What I did for a customer is: generate the image in the print program, save it to a dynamically-named image (so that concurrent printing of different invoices is possible), in the smartform read the appropriate name of the picture, when form is done remove the picture from DB.

 

Bettina07
Discoverer
0 Likes
I have a similar problem to print the QR-Code on the SAPScript form for invoice. The code from Note 3714529 returns me the content from EDOPLINV-QR_CODE_ACCEPTED in the variable lv_image_xstring. I use a system font for printing the QR-code. That’s fine for me, but the QR code contains instead of the URL the content from EDOPLINV-QR_CODE_ACCEPTED. How can I receive the URL from EDOPLINV-QR_CODE_ACCEPTED ? Maybe you have a tip for me ?