<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Flat File Processing using Batch Job in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039600#M1171922</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to tell the other system which write file....to first write in the other folder and then move or FTP to the SAP application server. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this is not possible....have them write some End of File Character in the last line.&lt;/P&gt;&lt;P&gt;Then in the reading program when it completes reading the file.......if the last line matches with the End of File character....means file is complete....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Jan 2009 18:05:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-01-07T18:05:51Z</dc:date>
    <item>
      <title>Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039592#M1171914</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need some ABAP advice...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The scenario: There's a batch job that runs every hour and picks up all the files from APP server and processes them to creates idocs. Sometimes, while a batch job is running, a file is being created on the app server. But although the file is being written to and is not yet complete, the batch job picks up this file to create an idoc and hence leads to errors. Is there a way I can check if a file is already complete and then only the batch job should process the file. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using SAP 4.6c and it doesnt allow me to use GET DATASET attributes...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions on how to check.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 17:14:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039592#M1171914</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T17:14:15Z</dc:date>
    </item>
    <item>
      <title>Re: Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039593#M1171915</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Not sure about FM's to get dataset attributes. However you might try a workaround. For example create a little Z table with the filename and status, and make the batch job process to check if the status for the file is completed, if so, then process it. Otherwise, leave it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gilberto Li&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 17:21:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039593#M1171915</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T17:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039594#M1171916</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Flat files come from Power Vision to SAP randomly at any time, so if we create a Z table how do we keep a track of updating it ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 17:36:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039594#M1171916</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T17:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039595#M1171917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;At the moment there is only one workaround that is coming to my mind.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After you do READ dataset and transfer to the internal table.&lt;/P&gt;&lt;P&gt;WAIT FOR 5 seconds.&lt;/P&gt;&lt;P&gt;Again read the file with the same procedure.&lt;/P&gt;&lt;P&gt;Compare the two internal table using DESCRIBE TABLE 1 LINES and similarly LINES of table 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now if there is no difference proceed. If there is a difference you could either ignore this run of batch job so that when the program runs next time definitely file would be complete OR i dont think writing the file from whatever source could be taking more than 10 seconds, so after another WAIT of 5 seconds read the file and process without checking anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Revert if u think this is not feasible.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 17:42:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039595#M1171917</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T17:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039596#M1171918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That sounds like a good idea but is there also a way I can check the timestamp of the file ? I mean instead of reading the whole file and then taking a count of lines twice in the program, if I could check for the timestamp of the file and then wait for 5 seconds and again check for timestamp of file. If the file timestamp remains the same that means the file is not being edited anymore, right?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you suggest something.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shipra.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 17:47:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039596#M1171918</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T17:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039597#M1171919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shipra,&lt;/P&gt;&lt;P&gt;There could be one more way.&lt;/P&gt;&lt;P&gt;Whatever dataset name you get, before doing OPEN DATASET FOR input do an OPEN DATASET FOR APPENDING.... &lt;/P&gt;&lt;P&gt;Now if the file cannot be opened for appending then sy-subrc = 4 else 0.&lt;/P&gt;&lt;P&gt;also i am pretty sure that while one source is writing to the file it wont allow second to open for appending... Hence the check u need...&lt;/P&gt;&lt;P&gt;Explore this possibility.... For testing you may OPEN DATASET FOR INPUT and then APPENDING in the same program...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also if this thing works you could have this in DO loop to wait till the file is completely written to and proceed only afterwards..&lt;/P&gt;&lt;P&gt;Revert if you feel like.&lt;/P&gt;&lt;P&gt;Cheers !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 17:51:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039597#M1171919</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T17:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039598#M1171920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sure I will try this out. Sounds like it should work &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shipra.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 17:53:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039598#M1171920</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T17:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039599#M1171921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shipra,&lt;/P&gt;&lt;P&gt;All the best to you..I gotta be leaving..&lt;/P&gt;&lt;P&gt;If things do work then do update accordingly..&lt;/P&gt;&lt;P&gt;Also if you get time then you could explore RSPO_READ_DATASET  to read the dataset directly.. Its just for your info.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 18:00:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039599#M1171921</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T18:00:39Z</dc:date>
    </item>
    <item>
      <title>Re: Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039600#M1171922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try to tell the other system which write file....to first write in the other folder and then move or FTP to the SAP application server. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If this is not possible....have them write some End of File Character in the last line.&lt;/P&gt;&lt;P&gt;Then in the reading program when it completes reading the file.......if the last line matches with the End of File character....means file is complete....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 18:05:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039600#M1171922</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T18:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039601#M1171923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shipra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I assumed that the file was generated by a program that you got control. &lt;/P&gt;&lt;P&gt;You can try using the FM EPS_GET_FILE_ATTRIBUTES. As Ankesh said, use the FM and check the File size. Wait for few seconds, and check again. If file size differ, don't process it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This way you won't have to open the file and read the lines and compare them, just use the size attributes of the FM.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gilberto Li&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Gilberto Li on Jan 7, 2009 7:08 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 18:07:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039601#M1171923</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T18:07:32Z</dc:date>
    </item>
    <item>
      <title>Re: Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039602#M1171924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;From the help on OPEN Dataset:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Unicode programs, the file must not yet be open in the current program; otherwise a treatable exception occurs. In non-Unicode programs, the file may already be open. The statement OPEN DATASET then does not reopen the file but moves the read or write position depending on the access mode. In this case, you should not change the access or storage mode.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 18:12:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039602#M1171924</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T18:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039603#M1171925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you mean if I try to reopen an already open file in Append mode, it would give an error? What do you mean by a unicode / non unicode program...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please explain.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shipra&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 18:37:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039603#M1171925</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T18:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039604#M1171926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It was taken directly from the help - you probably should have a look at it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 18:56:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039604#M1171926</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T18:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039605#M1171927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Shipra,&lt;/P&gt;&lt;P&gt;Can you make use of this FM, RZL_READ_DIR_LOCAL, this will give you list of the files and then you can do some more coding to resolve your probelm?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 19:07:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039605#M1171927</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T19:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039606#M1171928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shipra,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this code taken from another post to get the creation time of the file:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Report  ZFILE_CREATE_DATE
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;
*&amp;amp;
*&amp;amp;---------------------------------------------------------------------*

REPORT  zfile_create_date.

TABLES epsf.

PARAMETERS dir
  LIKE epsf-epsdirnam DEFAULT 'directory here'.

PARAMETERS file LIKE epsf-epsfilnam DEFAULT 'file here'.

DATA : mtime TYPE p DECIMALS 0,
            time(10),
           date LIKE sy-datum.

CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
     EXPORTING
          file_name              = file
          dir_name               = dir
     IMPORTING
          file_size              = epsf-epsfilsiz
          file_owner             = epsf-epsfilown
          file_mode              = epsf-epsfilmod
          file_type              = epsf-epsfiltyp
          file_mtime             = mtime
     EXCEPTIONS
          read_directory_failed  = 1
          read_attributes_failed = 2
          OTHERS                 = 3.

IF sy-subrc NE 0.

  WRITE: / 'error:', sy-subrc.

ELSE.

*The subroutine p6_to_date_time_tz is sap std present in rstr0400.

  PERFORM p6_to_date_time_tz(rstr0400) USING mtime
                                             time
                                             date.
  WRITE: / 'mtime:',mtime.
  WRITE: / 'date: ', date.
  WRITE: /  'time:',time.
ENDIF.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gilberto Li&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Jan 2009 20:21:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039606#M1171928</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-07T20:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: Flat File Processing using Batch Job</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039607#M1171929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Ankesh &amp;amp; Gilberto, your replies helped alot. Thanks all for your help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2009 16:13:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/flat-file-processing-using-batch-job/m-p/5039607#M1171929</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-01-08T16:13:31Z</dc:date>
    </item>
  </channel>
</rss>

