<?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 Required Logic in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/required-logic/m-p/6625850#M1441197</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My flate file structure is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;020116-FEB-201003:00:00&lt;/P&gt;&lt;P&gt;0679771000600   name  tests 1NarenSTD2010011520100515201001152010010679771000600&lt;/P&gt;&lt;P&gt;000000000013&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this i need to distinguish as first line as header, from Second line onwords Detaild, this detailed can have any number of lines and the last one is Trailer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for this i have declared three internal tables for header detailed and trailer,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;header internal table consists of '0201' this is constant for all the files and Date and time.&lt;/P&gt;&lt;P&gt;detailed with some fields&lt;/P&gt;&lt;P&gt;trailer will have only one field as count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As header is having the constant value i can distinguish as header file based on that value '0201' but for the detailed and trailer how to distinguish.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for this Please Suggest the Solution and Logic how about to do this scenario.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Feb 2010 07:39:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-02-18T07:39:37Z</dc:date>
    <item>
      <title>Required Logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/required-logic/m-p/6625850#M1441197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My flate file structure is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;020116-FEB-201003:00:00&lt;/P&gt;&lt;P&gt;0679771000600   name  tests 1NarenSTD2010011520100515201001152010010679771000600&lt;/P&gt;&lt;P&gt;000000000013&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this i need to distinguish as first line as header, from Second line onwords Detaild, this detailed can have any number of lines and the last one is Trailer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for this i have declared three internal tables for header detailed and trailer,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;header internal table consists of '0201' this is constant for all the files and Date and time.&lt;/P&gt;&lt;P&gt;detailed with some fields&lt;/P&gt;&lt;P&gt;trailer will have only one field as count.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As header is having the constant value i can distinguish as header file based on that value '0201' but for the detailed and trailer how to distinguish.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for this Please Suggest the Solution and Logic how about to do this scenario.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pavan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Feb 2010 07:39:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/required-logic/m-p/6625850#M1441197</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-18T07:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: Required Logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/required-logic/m-p/6625851#M1441198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kumar,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using a standard FM to load the file into an internal table, you can use the DESCRIBE statement to count the total number of lines. Then, read the last line and pass it to your trailer table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All remaining lines, between line 1 and the last line, will go in your detailed table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make sure you delete any null lines at the end of the table before the DESCRIBE statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps! Do revert if you need anything else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Shailesh.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Always provide feedback for helpful answers&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Feb 2010 07:52:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/required-logic/m-p/6625851#M1441198</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-18T07:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: Required Logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/required-logic/m-p/6625852#M1441199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can try this, if the file is of fixed length format i.e. the length of the data will never change.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For Header:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;  You are saying the the header will start with "020", so you are able to distinguish.&lt;/P&gt;&lt;P&gt;It may fail, if the detial record starts with "020".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, What you can do is Since the Header Has 0201 (4) + Date of length(11) + Time(8) Total length is 23.&lt;/P&gt;&lt;P&gt;While reading the file if the Length of record is 23, then that record can be considered as header.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For Footer:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;you can do it in  2 ways&lt;/P&gt;&lt;P&gt;1.Compare the length = 12, if yes then it is Trailer.&lt;/P&gt;&lt;P&gt;2.if you think that the trailer will have number always, then you can very well compare if the record has any characters, if no then obviously that will be Trailer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;For Details.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If the above 2 doesnt satisfy, then that record will be detailed record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Overall Logic will be&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Loop through the File.&lt;/P&gt;&lt;P&gt;  if record length = 23.&lt;/P&gt;&lt;P&gt;      Append it to the Header Table.&lt;/P&gt;&lt;P&gt;  elseif not record CA sy-abcde.&lt;/P&gt;&lt;P&gt;     Append it to the Trailer Table&lt;/P&gt;&lt;P&gt; else.&lt;/P&gt;&lt;P&gt;     Append it to the Detail table.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Vamsi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Feb 2010 09:08:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/required-logic/m-p/6625852#M1441199</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-02-18T09:08:27Z</dc:date>
    </item>
  </channel>
</rss>

