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

#COE KKS01 Issue creating queue item for print

mtunc
Explorer
0 Likes
2,099

Hi everyone,

I have an issue when creating a queue item for printer in a public cloud system. It appeared after major update last weekend. I don't know what is the problem. What else can be used istead of this method or can we use this method in an other way? Any suggestions are welcome.

Accepted Solutions (1)

Accepted Solutions (1)

mtunc
Explorer
0 Likes

Hello Hüseyin,

https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/abensaver_method_save.htm solved my issue,

thanks for your help.

SumitKundu
Active Participant
0 Likes

Hi @mtunc The link doesn't work anymore. Can you please elaborate how exactly did you resolve this issue?

Hi @hdemirkale can you please share the updated link to the documentation? I am using an instance  factory action in an unmanaged behavior implementation

SumitKundu_1-1760339361183.pngand facing similar issue (Statement "INSERT " is not allowed with this status.).

SumitKundu_0-1760339276149.png

I understand that one alternative is to use bgPF method which will create the print queue item in a separate background session (LUW) but curious to know if any other way as mentioned in this thread.

Best regards,

Sumit

Answers (2)

Answers (2)

hdemirkale
Product and Topic Expert
Product and Topic Expert
0 Likes

Hello Mehmet,

Could you test with the below implementation ?

https://help.sap.com/doc/abapdocu_cp_index_htm/CLOUD/en-US/abensaver_check_before_save.htm ?

Regards.

hdemirkale
Product and Topic Expert
Product and Topic Expert
0 Likes

Hello Mehmet,

how are you getting IV_ITEMID ? with cl_print_queue_utils=>create_queue_itemid( )?

Regards.

mtunc
Explorer
0 Likes

Yes, i am using create_queue_itemid( ) method like belove.

hdemirkale
Product and Topic Expert
Product and Topic Expert
0 Likes

Is there any commit work ?

mtunc
Explorer
0 Likes

No there isnt any commit work. Is it needed after cl_print_queue_utils=>create_queue_itemid( ) method?

hdemirkale
Product and Topic Expert
Product and Topic Expert
0 Likes

Hello Mehmet, Not needed. And also is there any FM/method that is used before or after cl_print_queue_utils ?

mtunc
Explorer
0 Likes

Hello Huseyin,

I forgot to add some details to my issue. Let me clarify the general situation;

We are using a CDS named ZDD_BARKOD with a unmanaged behaviour and v2 odata service.

We are using post method for sending necessary data to adobe service and using create method to send it.

We are parsing the returning binary data to iv_print_data,

name of queue to iv_qname,

and file name to iv_name_of_main_doc parameters.

But we are getting error as seen on the screenshot in the standard method named cl_print_queue_utils=>create_queue_itemid( )

in line 72 with "in update task" statement.

You can see the rest of the method ;

METHOD pdf_to_print.

    TYPES: BEGIN OF ty_pdf,
             fileName(120) ,
             fileContent   TYPE xstring,
             qname(32),
           END OF ty_pdf. 
    DATA ls_pdf TYPE ty_pdf.

    DATA:lv_buffer       TYPE xstring.

    DATA(lo_client) = NEW zcl_fp_client(
          iv_name = *********
        ).

    DATA(lv_x_xml) = xco_cp=>string( iv_xml_raw )->as_xstring( io_conversion = xco_cp_character=>code_page->utf_8  )->value.

    DATA(lv_xml_encode) = cl_web_http_utility=>encode_x_base64( lv_x_xml ).

    DATA(lv_rendered_pdf) = lo_client->reder_pdf( iv_xml = lv_xml_encode
                                                  iv_form_name      = iv_form_name
                                                  iv_template_name  = iv_template_name    ).
    /ui2/cl_json=>deserialize(
          EXPORTING
          json = lv_rendered_pdf
          CHANGING
          data = ls_pdf
          ).

    IF  ls_pdf IS NOT INITIAL.

      IF iv_pdf_name IS NOT INITIAL.
        ls_pdf-filename = iv_pdf_name.
      ENDIF.
      DATA(lv_qitem_id) = cl_print_queue_utils=>create_queue_itemid(   ).

      cl_print_queue_utils=>create_queue_item_by_data(
                            EXPORTING
                               iv_qname = iv_printer_name
                               iv_print_data = ls_pdf-filecontent"
                               iv_name_of_main_doc = ls_pdf-filename
                               iv_itemid = lv_qitem_id
                            IMPORTING
                              ev_err_msg          = rv_error
                            RECEIVING
                              rv_itemid           = lv_qitem_id  ).

    ELSE.

      rv_error = 'Adobe servisinin ' && iv_form_name && ' formunun ' && iv_template_name && ' templatinden PDF oluşturulamamıştır.' ##NO_TEXT .


    ENDIF.

  ENDMETHOD.