on 2021 Sep 16 9:46 AM
Hi all,
I am trying to realize th pront-out of the PT QR-code in a custom print-program according to the note 2981450 Cookbook for Customers 2.0.
The chapter "Calling the QR Code Class" gives an example for the coding. But that is not enough.
How can I "realize" this comments? To get this famous qrcode.
DATA ls_qrc_get_param TYPE cl_rdsv_qrcode=>qrcode_get_param.
DATA ls_qrc_object_pt TYPE cl_sipt_qrcode_pt=>source_object_pt.
DATA ls_get_status_param TYPE cl_sipt_pr_util=>doc_status_get_param.
DATA ls_qrc_result TYPE cl_rdsv_qrcode=>qrcode_output.
DATA lx_qrc_exc TYPE REF TO cx_rdsv_qrcode. DATA ls_qrcode TYPE sipt_s_invqrcode.
* Fill ls_qrc_object_pt in case the call uses source_object
* (and source type implements method GET_CONTENT_BY_OBJECT)
* The source type must implement one or both GET_CONTENT_BY_* methods
* Only the implemented methods can be called
TRY.
cl_rdsv_qrcode=>get_qrcode(
EXPORTING
get_param = ls_qrc_get_param
source_object = ls_qrc_object_pt
IMPORTING qrcode = ls_qrc_result ).
As I am not the great OO-programmer, I tried to look up for examples how to use the methods above.
It's clear: without content I won't get any QR code.
I can't call the method GET_CONTENT_BY_OBJECT_PT because it is protected.
Does anyone have an example or an advice?
We have SAP_BASIS 740/25 and SAP_APPL/SAP_FIN617/022
Thanks and best regards
Jörg
I use this code in Smartforms. I think it could work in a SapScript also.
In case invoice is not digitally signed a short-dump will occur.
DATA: source_object_pt TYPE cl_sipt_qrcode_pt=>source_object_pt,
qrc_get_param TYPE cl_rdsv_qrcode=>qrcode_get_param,
source_object TYPE cl_rdsv_map_util_sd=>source_object_sd,
key TYPE cl_rdsv_map_util_sd=>keys_sd.
qrc_get_param-intca = 'PT'.
qrc_get_param-source_type = 'BILLING_DOCUMENT'.
key-vbeln = vbeln_vf.
SELECT SINGLE print_char
FROM sipt_vbrk
INTO @DATA(print_char)
WHERE vbeln = @key-vbeln.
IF print_char IS INITIAL.
RETURN.
ENDIF.
DATA(map) = NEW cl_sipt_map_qrc_pt_sd( ).
TRY.
map->if_rdsv_map_get~read_source_object( EXPORTING key = key
IMPORTING source_object = source_object ).
map->if_rdsv_map_get~map( EXPORTING source_object = source_object
IMPORTING target_object = source_object_pt ).
CATCH cx_rdsv_map INTO DATA(exc_map).
MESSAGE ID exc_map->if_t100_message~t100key-msgid
TYPE 'E'
NUMBER exc_map->if_t100_message~t100key-msgno
WITH exc_map->if_t100_message~t100key-attr1.
ENDTRY.
TRY.
cl_rdsv_qrcode=>get_qrcode( EXPORTING get_param = qrc_get_param
source_object = source_object_pt
IMPORTING qrcode = DATA(qrc_result) ).
CATCH cx_rdsv_qrcode INTO DATA(exc_qrc).
MESSAGE ID exc_qrc->if_t100_message~t100key-msgid
TYPE 'E'
NUMBER exc_qrc->if_t100_message~t100key-msgno
WITH exc_qrc->if_t100_message~t100key-attr1.
ENDTRY.
qrstring = condense( qrc_result-qrstring ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
100 | |
8 | |
6 | |
6 | |
5 | |
5 | |
5 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.