Método GET_STREAM no Gateway:

method /iwbep/if_mgw_appl_srv_runtime~get_stream.

    data: lv_pdf      type xstring,
          lv_filename type char50,
          ls_stream   type ty_s_media_resource,
          lt_ee_tab   type pernr_us_tab.

    " Busca PERNR de acordo com o SY-UNAME logado
    call function 'HR_GET_EMPLOYEES_FROM_USER'
      exporting
        user              = sy-uname
        iv_with_authority = abap_false
      tables
        ee_tab            = lt_ee_tab.

    data(lv_pernr) = conv pernr-pernr( value #( lt_ee_tab[ user = sy-uname ]-pernr optional ) ).
    data(lv_date)  = value #( it_key_tab[ name = 'data' ]-value optional ).
    data(lv_begda) = conv pnpbegda( |{ lv_date }0101| ).
    data(lv_endda) = conv pnpendda( |{ lv_date }1231| ).

    data(s_spool_parameters) = me->get_print_parameters( ).
    s_spool_parameters-pdest = 'LP01'.

    "Exibe formulário do recibo de férias
    submit hbrcced0 with pnpbegda = lv_begda
                    with pnpendda = lv_endda
                    with pnppernr = lv_pernr
                    with pnpbukrs = '1000'
                    with p_form   = 'HR_BR_CEDULA_PDF'
                    with ano      = sy-datum(4)
                    with natur    = 'RENDIMENTOS DO TRABALHO ASSALARIADO'
                    with respcc   = sy-uname
                    with filename = '/tmp/'
                    with p_tech   = abap_true
                    to sap-spool without spool dynpro
                    spool parameters s_spool_parameters
                    and return.

    ls_stream-value     = me->convert_abapspooljob_2_pdf( iv_spoolid = me->get_spool_number( iv_repid = 'CL_HR99B_' ) ).
    ls_stream-mime_type = 'application/pdf'.
    lv_filename         = |{ lv_pernr } - Informe de Rendimentos { lv_date }|.

    set_header( value ihttpnvp( name  = 'Content-Disposition'
                                value = |inline; filename="{ lv_filename }.pdf"| ) ).

    copy_data_to_ref( exporting is_data = ls_stream changing cr_data = er_stream ).

  endmethod.

Métodos customizados necessários para tratamento do arquivo pdf no spool:

* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Static Public Method ZCL_ZGW_INFORME_RENDIM_DPC_EXT=>CONVERT_ABAPSPOOLJOB_2_PDF
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_SPOOLID                     TYPE        RSPOID
* | [<-()] RX_CONTENT                     TYPE        XSTRING
* +--------------------------------------------------------------------------------------</SIGNATURE>
  method convert_abapspooljob_2_pdf.

    call function 'FPCOMP_CREATE_PDF_FROM_SPOOL'
      exporting
        i_spoolid      = iv_spoolid
        i_partnum      = 1
      importing
        e_pdf          = rx_content
      exceptions
        ads_error      = 1
        usage_error    = 2
        system_error   = 3
        internal_error = 4
        others         = 5.

  endmethod.

* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Static Public Method ZCL_ZGW_INFORME_RENDIM_DPC_EXT=>GET_PRINT_PARAMETERS
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_USER                        TYPE        UNAME (default =SY-UNAME)
* | [<-()] RS_PRINT_PARAMETERS            TYPE        PRI_PARAMS
* +--------------------------------------------------------------------------------------</SIGNATURE>
  method get_print_parameters.

    call function 'GET_PRINT_PARAMETERS'
      exporting
        no_dialog            = 'X'
        user                 = iv_user
      importing
        out_parameters       = rs_print_parameters
      exceptions
        invalid_print_params = 2
        others               = 4.

  endmethod.

* <SIGNATURE>---------------------------------------------------------------------------------------+
* | Static Public Method ZCL_ZGW_INFORME_RENDIM_DPC_EXT=>GET_SPOOL_NUMBER
* +-------------------------------------------------------------------------------------------------+
* | [--->] IV_REPID                       TYPE        REPID (default =SY-REPID)
* | [--->] IV_UNAME                       TYPE        UNAME (default =SY-UNAME)
* | [<-()] RV_SPOOLID                     TYPE        RSPOID
* +--------------------------------------------------------------------------------------</SIGNATURE>
  method get_spool_number.

    data: v_rq2name type rspo2name.

    concatenate iv_repid+0(9) iv_uname+0(3) into v_rq2name.

    select rqident from tsp01 where rq2name = @v_rq2name order by rqcretime descending into @rv_spoolid up to 1 rows.
      exit.
    endselect.

  endmethod.

Talvez tenha que mexer no select da tabela de Spool adaptando pra necessidade. Por exemplo, talvez o concatenate com usuário não esteja da mesma forma acima em algum cliente.

Resultado:

Untitled