Skip to Content
avatar image
Former Member

Problem with impression of justificant in BRF+ in form processing Tax Registration

Hi Experts,

I have a BRF Plus apllication for form processing Tax registration, and I want that a justificant (based on adobe form) appears when tha tax registration (based on adobe form too) be processed.


I have included my function ZIFTR_PRINT_001 as an action in the brf plus application, but the justificant doesn't appear, only a spool order is generated. It seems like my function, which print the justificant, is executed on back ground.

The weird is, when I execute my function ZIFTR_PRINT_001 since SE37 the justificant (adobe form) appears.


¿Could anyboody tell me if I would have to change the function ZIFTR_PRINT_001 (I am attaching the code) in order to be executed correctly in BRF Plus application?.


Please, for further information don't hesitate to ask me.


Best Regards,

Joham

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Nov 03, 2015 at 05:01 PM

    Sorry, I couldn't attach the code of ZIFTR_PRINT_001.

    I am copying here instead. Thanks!

    FUNCTION ziftr_print_001.

    *"----------------------------------------------------------------------

    *"*"Interfase local

    *"  IMPORTING

    *"     REFERENCE(IT_FORM) TYPE  FMCA_FORMS_T OPTIONAL

    *"----------------------------------------------------------------------

    *  Taules i dades per crida dinamica MF

      DATA: ptab      TYPE abap_func_parmbind_tab,

            ptab_line TYPE abap_func_parmbind,

            etab      TYPE abap_func_excpbind_tab,

            etab_line TYPE abap_func_excpbind.



      DATA: ls_form TYPE fmca_fobj_s.

      DATA: lt_forms_data     TYPE fmca_form_field_data_t,

            ls_form_data      TYPE fmca_form_field_data,

            lt_used_forms     TYPE fmca_form_data_t,

            ls_used_form      TYPE fmca_form_data,

            lv_case_guid      TYPE fmca_return_guid,

            fp_outputparams   TYPE sfpoutputparams,

            fp_docparams      TYPE sfpdocparams,

            fp_result         TYPE fpformoutput,

            l_conn            TYPE rfcdest,

            l_form_name       TYPE fpwbformname,

            fm_name           TYPE rs38l_fnam,

            lf_name           TYPE eu_lname,

            lt_pdf_table      TYPE tfpcontent,

            error_string      TYPE string.


      DATA: ls_function       TYPE rsfbintfv,

            ls_import_par     TYPE rsfbpara.


      DATA: lt_return             TYPE bapirettab,

            ls_taxsubdoc_filecont TYPE fmca_esoa_binary,

            lt_taxsubdoc_filecont TYPE fmca_esoa_binary_t,

            l_pdf_xstring         TYPE xstring,

            l_file                TYPE string,

            l_len                 TYPE i,

            lt_data               TYPE STANDARD TABLE OF soli-line,

            lv_sep                TYPE c,

            l_rc                  TYPE i.


    * Dades dinamiques

      DATA: l_field_data  TYPE REF TO data,

            wa_header     TYPE fkkinvdoc_h,

            wa_pdf_result TYPE efg_strn_pdf_result.


      DATA: l_funcname TYPE funcname.

      DATA: y_pdf_result-str_result_form TYPE fpformoutput,

            l_str_docparams              TYPE sfpdocparams,

            ls_fpformoutput              TYPE fpformoutput.

      DATA: e_fkkinvdoc_h TYPE fkkinvdoc_h,

            lv_print      TYPE rspopname.

      DATA: pwb_data         TYPE fica_inv_s_header,

            l_period_key     TYPE persl_kk,

            l_opbel          TYPE opbel_kk,

            wa_item          TYPE fica_inv_s_item,

            l_vkbez          TYPE vkbez_kk,

            l_faedn          TYPE faedn_kk,

            wa_fkkinvdoc_i   TYPE dfkkinvdoc_i,

            l_fbnum          TYPE fbnum_ps.


      FIELD-SYMBOLS: <fs> TYPE STANDARD TABLE.


      fp_outputparams-nodialog   = 'X'.

      fp_outputparams-preview    = 'X'.

      fp_outputparams-device     = 'PRINTER'.

      fp_outputparams-reqnew     = 'X'.

      fp_outputparams-reqimm     = 'X'.

      fp_outputparams-bumode     = 'M'.

      SELECT SINGLE dest INTO lv_print FROM  ztbc002

             WHERE  sysid  = sy-sysid.


      IF sy-subrc = 0.

        fp_outputparams-dest = lv_print.

      ENDIF.


      CALL FUNCTION 'FP_JOB_OPEN'

        CHANGING

          ie_outputparams = fp_outputparams

        EXCEPTIONS

          cancel          = 1

          usage_error     = 2

          system_error    = 3

          internal_error  = 4

          OTHERS          = 5.


      CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'

        EXPORTING

          i_name     = 'Z_TR_TR_JUSTIFICANT_IRPF_MERGE'

        IMPORTING

          e_funcname = l_funcname.


      CALL FUNCTION l_funcname

        EXPORTING

          pwb_data           = pwb_data

        IMPORTING

          /1bcdwb/formoutput = ls_fpformoutput.


      l_conn = cl_fp=>get_ads_connection( ).


      IF l_conn IS INITIAL.

        l_conn = 'ADS'.

      ENDIF.



    *  ---------------------------------------------

    *  Excepciones dinamicas de la funcion de formulario PDF

    *  ---------------------------------------------

      etab_line-name = 'USAGE_ERROR'.

      etab_line-value = 1.

      INSERT etab_line INTO TABLE etab.

      etab_line-name = 'SYSTEM_ERROR'.

      etab_line-value = 2.

      INSERT etab_line INTO TABLE etab.

      etab_line-name = 'INTERNAL_ERROR'.

      etab_line-value = 3.

      INSERT etab_line INTO TABLE etab.


      LOOP AT it_form INTO ls_form WHERE optxt IS NOT INITIAL.


    *   Limpiar parametros de funcion de formulario

        REFRESH ptab.

    *---------------------------------------------

    *   Obtenir nom del formulari PDF

    *---------------------------------------------

        l_form_name = ls_form-form.

    *    l_form_name = 'Z_ISR_FORM_3200'.


        TRY.

            CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'

              EXPORTING

                i_name     = l_form_name

              IMPORTING

                e_funcname = fm_name.

          CATCH cx_fp_api_repository cx_fp_api_usage cx_fp_api_internal.

            RAISE err_fp_form_name.


    *        MESSAGE ID 'FPAPIGENERIC' TYPE 'E' NUMBER '000' WITH ls_used_form-form.

        ENDTRY.

    *--------------------------------------------

    *   Omplir estructura FP parametres document

    *---------------------------------------------

    *      fp_docparams-fillable = 'F'.

    *      fp_docparams-update_interaction_code = 'X'.

        fp_docparams-country = 'ES'.

        fp_docparams-langu = 'c'.

        fp_docparams-replangu1 = 'c'.

        fp_docparams-replangu2 = 'c'.

        fp_docparams-replangu3 = 'c'.

    *---------------------------------------------

    *   Param. exporting de la crida dinamica a MF

    *---------------------------------------------

        ptab_line-name = '/1BCDWB/DOCPARAMS'.

        ptab_line-kind = abap_func_exporting.

        GET REFERENCE OF fp_docparams INTO ptab_line-value.

        INSERT ptab_line INTO TABLE ptab.

    *   Recuperar los parametros IMPORT de cada formulario

        lf_name = fm_name.

        CALL METHOD cl_fb_function_utility=>meth_get_interface

          EXPORTING

            im_name      = lf_name

          IMPORTING

            ex_interface = ls_function.

        IF sy-subrc <> 0.

          RAISE err_fp_form_call.

        ENDIF.


    *   Per a cada parametre, obtenir el valor obtingut de la declaracio

        LOOP AT ls_function-import INTO ls_import_par

          WHERE parameter NE '/1BCDWB/DOCPARAMS' AND


                optional = ''.

          CREATE DATA l_field_data TYPE (ls_import_par-structure).


    *     Buscar parametre en taula de dades del formulari

          LOOP AT ls_used_form-fields INTO ls_form_data

            WHERE fieldname = ls_import_par-parameter.


            IF ls_import_par-structure = 'QISR_TAB_TYPE' OR

                  ls_import_par-structure = 'QISR_TAB_TYPE_DATE'.


              ASSIGN l_field_data->* TO <fs>.


              APPEND ls_form_data-fieldvalue TO <fs>.

              ptab_line-name = ls_import_par-parameter.

              ptab_line-kind = abap_func_exporting.

              ptab_line-value = l_field_data.

              INSERT ptab_line INTO TABLE ptab.


            ELSE.

              RAISE err_fp_form_call.

            ENDIF.

          ENDLOOP.


    *     Si no hay valor para el param => afegir en blanc

          IF sy-subrc NE 0.

            ptab_line-name = ls_import_par-parameter.

            ptab_line-kind = abap_func_exporting.

            ptab_line-value = l_field_data .

            INSERT ptab_line INTO TABLE ptab.

          ENDIF.

        ENDLOOP.


    *--------------------------------------------

    *   Preparar parametres de retorn

    *---------------------------------------------

        ptab_line-name = '/1BCDWB/FORMOUTPUT'.

        ptab_line-kind = abap_func_importing.

        GET REFERENCE OF fp_result INTO ptab_line-value.

        INSERT ptab_line INTO TABLE ptab.


    *---------------------------------------------

    *   Crida al MF dinamic

    *---------------------------------------------

        CALL FUNCTION fm_name

          PARAMETER-TABLE

          ptab

          EXCEPTION-TABLE

          etab.


      ENDLOOP.


    * Close spool job.

      CALL FUNCTION 'FP_JOB_CLOSE'

        EXCEPTIONS

          usage_error    = 1

          system_error   = 2

          internal_error = 3

          OTHERS         = 4.

    ENDFUNCTION.

    Add comment
    10|10000 characters needed characters exceeded