Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with saving data in text file in Application server

Former Member
0 Kudos

Hello Experts,

I am trying to save a text file in application server.When I text file have less that 60000 (i.e 59999) records, it saves the file successfully, but if records in text file (saved in application server) is more than 60000 (i.e 60002), it creates a new file at the 60000th record with the continued records.

Can anyone please advise, why it is creating a new file if records are more that 60000. I tested it with 59000 records in my internal table and it is working fine. I have not given any restriction in my program to create a new file if records are more than 60000.

The logic I implemented is the following:

*Open file
  open dataset g_accnt_file for output in text mode encoding utf-8.
  if sy-subrc = 0.
    clear g_header_record.
*Building header record for Accounting Validation file
    concatenate gc_hdr_desc
                gc_filetype
                gc_sequence
                gc_idntf_refresh
                gc_cmpny_idntf
                gc_accnt_id
                sy-datum
                sy-uzeit
                gc_linde_group
                sy-sysid
                gc_not_used into g_header_record separated by
                                           gc_deliminator.
    transfer g_header_record to g_accnt_file.

*Move Cost center data to file to create a detail record for Accounting
*Validation file
    loop at gt_csks into gs_csks.
*Remove leading Zeros
      call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
        exporting
          input  = gs_csks-kostl
        importing
          output = gs_csks-kostl.
*      Overlay gs_csks-kostl with space.
*      SHIFT gs_csks-kostl RIGHT DELETING TRAILING gc_space.
*Prepare Cost Centre String
      perform prepare_costcentre_string.
*Prepare detail record with Company Code & Cost Centre
      perform prepare_detail_record.
      clear:g_detail_record,gs_csks,g_coa.
    endloop.

*Move Order data to file to create a detail record for Accounting
*Validation file
    loop at gt_aufk into gs_aufk.
*Remove leading Zeros
      call function 'CONVERSION_EXIT_ALPHA_OUTPUT'
        exporting
          input  = gs_aufk-aufnr
        importing
          output = gs_aufk-aufnr.
*      SHIFT gs_aufk-aufnr RIGHT DELETING TRAILING gc_space.
*Prepare Order String
      perform prepare_order_string.
*Prepare detail record with Company Code & Order
      perform prepare_detail_record.
      clear:g_detail_record,gs_aufk,g_coa.
    endloop.

*Move WBS data to file to create a detail record for Accounting
*Validation file
    loop at gt_prps into gs_prps.
      call function 'CONVERSION_EXIT_ABPSP_OUTPUT'
        exporting
          input  = gs_prps-pspnr
        importing
          output = g_wbs_element.
*      SHIFT g_wbs_element RIGHT DELETING TRAILING gc_space.
*Prepare WBS Element String
      perform prepare_wbs_string.
*Prepare detail record with Company Code & WBS Element
      perform prepare_detail_record.
      clear:g_detail_record,gs_prps,g_coa.
    endloop.

*Building trailer record for Accounting Validation file which will
*contain the total number of detail records in file
    concatenate gc_trail_desc
                g_total_count
                into g_trailer_record
                separated by gc_deliminator.

    transfer g_trailer_record to g_accnt_file.
*Close file
    close dataset g_accnt_file.
    if sy-subrc = 0.
      message s036(/lig/fi).
    endif.
  endif.
endform.                    " SELECT_DATA

Edited by: Matt on Sep 30, 2010 11:02 AM - added tags

1 ACCEPTED SOLUTION

matt
Active Contributor
0 Kudos

I presume you're doing the TRANSFER for the output data in one of the forms you call? You need to give just the pertinent detail of that form.

By the way - updating global data directly within forms is very bad programming practice. Get into the habit of passing parameters instead. Much safer.

Edited by: Matt on Sep 30, 2010 11:06 AM

2 REPLIES 2

matt
Active Contributor
0 Kudos

I presume you're doing the TRANSFER for the output data in one of the forms you call? You need to give just the pertinent detail of that form.

By the way - updating global data directly within forms is very bad programming practice. Get into the habit of passing parameters instead. Much safer.

Edited by: Matt on Sep 30, 2010 11:06 AM

Former Member
0 Kudos

Hi Pankaj,

Can u check the concatenate statement with one more data. Check the no of lines for a single file.


    concatenate gc_hdr_desc
                gc_filetype
                gc_sequence
                gc_idntf_refresh
                gc_cmpny_idntf
                gc_accnt_id
                sy-datum
                sy-uzeit
                gc_linde_group
                sy-sysid
                sy-subrc
                gc_not_used into g_header_record separated by
                                           gc_deliminator.

Regards,

Amitava