14 мая 2021

Преобразование PDF-запроса в спул в PDF-файл

Пример метода:

METHOD spool_pdf_to_bin.

  " iv_spoolid TYPE rspoid
  " rt_bin_tab TYPE solix_tab
  
  DATA:
    ls_tsp01 TYPE tsp01,
    ls_rq TYPE tsp01sys,
    lt_partlist TYPE TABLE OF adspartdesc,
    lv_pdf TYPE fpcontent,
    lt_bin_tab1 TYPE solix_tab.

  FIELD-SYMBOLS:
    <fs_partlist> LIKE LINE OF lt_partlist.

  REFRESH rt_bin_tab.

  CHECK iv_spoolid IS NOT INITIAL.

  SELECT SINGLE *
    FROM tsp01
    INTO ls_tsp01
    WHERE rqident = iv_spoolid.

  CHECK sy-subrc = 0.

  MOVE-CORRESPONDING ls_tsp01 TO ls_rq.

  CALL FUNCTION 'RSPO_ADSP_FILL_PARTLIST'
    EXPORTING
      rq                    = ls_rq
*   IMPORTING
*     all_docs              =
*     number_of_parts       =
*     old_document          =
    TABLES
      partlist              = lt_partlist.

  LOOP AT lt_partlist ASSIGNING <fs_partlist>.

    CALL FUNCTION 'FPCOMP_CREATE_PDF_FROM_SPOOL'
      EXPORTING
        i_spoolid         = iv_spoolid
        i_partnum         = <fs_partlist>-adsnum
      IMPORTING
        e_pdf             = lv_pdf
*       e_renderpagecount =
*       e_pdf_file        =
      EXCEPTIONS
        ads_error         = 1
        usage_error       = 2
        system_error      = 3
        internal_error    = 4
        OTHERS            = 5.

    REFRESH lt_bin_tab1.

    CALL METHOD cl_bcs_convert=>xstring_to_solix
      EXPORTING
        iv_xstring = lv_pdf
      RECEIVING
        et_solix   = lt_bin_tab1.

    INSERT LINES OF lt_bin_tab1 INTO TABLE rt_bin_tab.

  ENDLOOP.

ENDMETHOD.

Комментариев нет:

Отправить комментарий