<?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: Format incoming string... in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/format-incoming-string/m-p/1379672#M185608</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fred!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you should more think in 'I take what I need' instead of shifting...&lt;/P&gt;&lt;P&gt;Space you can get, when you clear your target structure (or don't fill at all), an H you can assign hardcoded. Because of the structure definition, you will have the data in the right place (there is no shrinking, if you move values to fields of a structure - concatenate is only leaving one space (in earlier releases)).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So yes, you just can fill spaces and H by yourself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Jun 2006 15:55:38 GMT</pubDate>
    <dc:creator>christian_wohlfahrt</dc:creator>
    <dc:date>2006-06-26T15:55:38Z</dc:date>
    <item>
      <title>Format incoming string...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/format-incoming-string/m-p/1379669#M185605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i have the following string that i'm reading into my program:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;122400724      XXXXXXXXXXXXXXXXXXXXXXXX20060623150029 000000000000001200000012000000000187140110&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the header record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i need to put it in the following format:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1234567890          20060623          H&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;'H' is the record indicator for header&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The structure that i need to put it in is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;  BEGIN OF t_HEADER,                 &lt;/P&gt;&lt;P&gt;    BANK_NUM(10)    type n,&lt;/P&gt;&lt;P&gt;    FILLER_1(10) type c,&lt;/P&gt;&lt;P&gt;    DATE         type sy-datum,&lt;/P&gt;&lt;P&gt;    FILLER_2(10) type c,&lt;/P&gt;&lt;P&gt;    REC_IND1(1)   type c,&lt;/P&gt;&lt;P&gt;  END OF t_HEADER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I have the detail and trailer records for which i have the following structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;  BEGIN OF t_DETAILS OCCURS 100,       &lt;/P&gt;&lt;P&gt;    BANKN(10)  type n,&lt;/P&gt;&lt;P&gt;    CHECT(10)  type n,&lt;/P&gt;&lt;P&gt;    ZALDT      type sy-datum,&lt;/P&gt;&lt;P&gt;    AMNT(10)   type c,&lt;/P&gt;&lt;P&gt;    REC_IND2(1) type c,&lt;/P&gt;&lt;P&gt;    ZNME1(20)  type c,&lt;/P&gt;&lt;P&gt;  END OF t_DETAILS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA:&lt;/P&gt;&lt;P&gt;  BEGIN OF t_TRAILER,                    &lt;/P&gt;&lt;P&gt;FILLER_3(10)   type c,&lt;/P&gt;&lt;P&gt;    ITEM_COUNT(9)  type c,&lt;/P&gt;&lt;P&gt;    FILLER_4(1)    type c,&lt;/P&gt;&lt;P&gt;    ZALDT1          type sy-datum,&lt;/P&gt;&lt;P&gt;    PPT_AMOUNT(10) type c,&lt;/P&gt;&lt;P&gt;    PPT_REC_IND(1) type c,&lt;/P&gt;&lt;P&gt; END OF t_TRAILER.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For details I have the following data coming that i accordingly need to put in my format.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Details:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;000990127847      000007440288 000007440288 xxx xxxxxxxx xxxxx xx              0000000000000120002006050100&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is no trailer record, I have to put in the data according to the structure defined above.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also need to replace the bank_num in the header with bankn in details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your help will be highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Fred.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2006 04:44:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/format-incoming-string/m-p/1379669#M185605</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-26T04:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: Format incoming string...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/format-incoming-string/m-p/1379670#M185606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fred!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just define some more structures for header and position, which match your incoming string. E.g. first filler in header has about 20 chars, then comes date+time field and so one. Then you can assign matching parts to your output structure, also some other replacements are possible. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;header-date = string_header-datetime(8).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you got the idea,&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2006 11:32:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/format-incoming-string/m-p/1379670#M185606</guid>
      <dc:creator>christian_wohlfahrt</dc:creator>
      <dc:date>2006-06-26T11:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: Format incoming string...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/format-incoming-string/m-p/1379671#M185607</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;In the header, the date is available immediately after the X's. So based on my structure, after the first string, i need to put 10 blank spaces, then shift the date replacing the X's and delete the trailing numbers after the date. After the date, i need to put 10 blank spaces again and put the record indicator 'H'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would i still be able to achieve this if my i make 2 diff. structures, one for original string and the other how i want it to be and then explicitly assigning the values i want. how would i deal with the blank spaces i need to put?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Fred.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2006 15:12:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/format-incoming-string/m-p/1379671#M185607</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-26T15:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: Format incoming string...</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/format-incoming-string/m-p/1379672#M185608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fred!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Maybe you should more think in 'I take what I need' instead of shifting...&lt;/P&gt;&lt;P&gt;Space you can get, when you clear your target structure (or don't fill at all), an H you can assign hardcoded. Because of the structure definition, you will have the data in the right place (there is no shrinking, if you move values to fields of a structure - concatenate is only leaving one space (in earlier releases)).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So yes, you just can fill spaces and H by yourself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Christian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Jun 2006 15:55:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/format-incoming-string/m-p/1379672#M185608</guid>
      <dc:creator>christian_wohlfahrt</dc:creator>
      <dc:date>2006-06-26T15:55:38Z</dc:date>
    </item>
  </channel>
</rss>

