Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Spool Appending on multiple runs

$
0
0

Hi All, I have a FM that spools the output of a smart form.

Some background, I am spooling reminder notices to a payee by company code and not by each check number.

When the FM is run it will spool all notices by company codes as expected. However I have to delete the previous spool file to run print for another company code. If I don’t delete the previous spool tile then 2nd run will spool the new data along with the 1st spool file.

 

e.g.  1) Run Print for co code 2010 , works fine

        2) Run pint for co code 2020. If don’t delete spool for 2010 then spool is created with 2010 + 2020 data

            If run after deleting spool from step 1)  i.e. deleting 2010 spool then works fine.

 

We don’t want to delete Spool file and want to retain those spool files for future reference.

 

Here is the Relevant Code

 

FUNCTION zfkk_sample_0808.

 

Prior code deleted for length, basically just getting the required data to send for the spool

 

    gw_fscd-name1 = gw_adrc-name1.

    gw_fscd-name2 = gw_adrc-name2.

    gw_fscd-nickname = lv_nickname.

    gw_fscd-po_box = gw_adrc-po_box.

    gw_fscd-street = gw_adrc-street.

    gw_fscd-street2 = gw_adrc-str_suppl1.

    gw_fscd-city1 = gw_adrc-city1.

    gw_fscd-region = gw_adrc-region.

    gw_fscd-post_code1 = gw_adrc-post_code1.

    gw_fscd-house_num1 = gw_adrc-house_num1.

 

 

    gw_fscd-opupk = gw_zdescr_check-opupk.

    gw_fscd-zz_payee_name_1 = gw_zdescr_check-zz_payee_name_1.

    gw_fscd-zz_payee_name_2 = gw_zdescr_check-zz_payee_name_2.

    gw_fscd-zz_payee_name_3 = gw_zdescr_check-zz_payee_name_3.

    gw_fscd-zz_payee_name_4 = gw_zdescr_check-zz_payee_name_4.

    gw_fscd-zz_cl_txt_1     = gw_zdescr_check-zz_cl_txt_1.

    gw_fscd-zz_cl_txt_2     = gw_zdescr_check-zz_cl_txt_2.

    gw_fscd-zz_cl_txt_3     = gw_zdescr_check-zz_cl_txt_3.

 

    gw_fscd-vtref = i_dfkkcoh-vtref.

    gw_fscd-insobjectext = gw_dimaiob-insobjectext.

 

*   Retrieve FM name of form

    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

      EXPORTING

        formname           = gc_formname_fscd "'ZFBL_CHECK_ESCHEATMENT'

      IMPORTING

        fm_name            = gv_fm_name

      EXCEPTIONS

        no_form            = 1

        no_function_module = 2

        OTHERS             = 3.

    IF sy-subrc = 0.

*   Print form

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

*>> Begining of  Change to spool                    ED1K903100

 

 

* old code.

*     gw_output_op-tdnewid   = 'X'.                 "New Spool Request

* new code

      CLEAR:  gw_output_op-tdnewid,

              gw_output_op-tdimmed,

              gw_output_op-tddelete.

 

      gw_output_op-tdlifetime = 9. " retain period up to 9 days.

      gw_output_op-tddest    = 'LOCL'.             "Spool: Output device

      gw_control_par-no_dialog = 'X'.

      gw_control_par-langu       = sy-langu.

      gw_control_par-no_open     = lv_noopen_flg.

      gw_control_par-no_close    = lv_noclose_flg.

 

      CALL FUNCTION gv_fm_name

        EXPORTING

          control_parameters = gw_control_par

          output_options     = gw_output_op

          gw_contact_info    = gw_contact_info

          gv_company_name    = gw_t001-butxt

          gw_fscd            = gw_fscd

        EXCEPTIONS

          formatting_error   = 1

          internal_error     = 2

          send_error         = 3

          user_canceled      = 4

          OTHERS             = 5.

      IF sy-subrc <> 0.

*   Implement suitable error handling here

      ENDIF.

    ENDIF.

 

 

  ENDIF.  "Modified by E0C1767 ED1K902821

*ENDIF.

ENDFUNCTION.


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>