<?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: condense statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/condense-statement/m-p/2219368#M476343</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The CONDENSE statement deletes redundant spaces from a string: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONDENSE &amp;lt;c&amp;gt; [NO-GAPS].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement removes any leading blanks in the field &amp;lt;c&amp;gt; and replaces other sequences of blanks by exactly one blank. The result is a left-justified sequence of words, each separated by one blank. If the addition NO-GAPS is specified, all blanks are removed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA: STRING(25) VALUE ' one two three four',
LEN TYPE I.

LEN = STRLEN( STRING ).
WRITE: STRING, '!'.
WRITE: / 'Length: ', LEN.

CONDENSE STRING.
LEN = STRLEN( STRING ).
WRITE: STRING, '!'.
WRITE: / 'Length: ', LEN.

CONDENSE STRING NO-GAPS.
LEN = STRLEN( STRING ).
WRITE: STRING, '!'.
WRITE: / 'Length: ', LEN.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Output: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one two three four !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Length:           25&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one two three four !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Length:           18&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;onetwothreefour !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Length:           15&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that the total length of the field STRING remains unchanged, but that the deleted blanks appear again on the right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards Rk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 May 2007 15:24:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-09T15:24:15Z</dc:date>
    <item>
      <title>condense statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/condense-statement/m-p/2219366#M476341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;what is condense statement and its function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2007 15:21:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/condense-statement/m-p/2219366#M476341</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-09T15:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: condense statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/condense-statement/m-p/2219367#M476342</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;PRE&gt;&lt;CODE&gt;
Syntaxdiagramm 
CONDENSE 


Basic form 
CONDENSE c. 

Addition: 
... NO-GAPS 



Note 
Like all string processsing statements, you can only use character-type operands here. 
If the type of an operand is not STRING, the operand is treated like a type C field, regardless of its actual type, even though no actual conversion takes place. 



In an ABAP Objects context, a more severe syntax check is performed that in other ABAP areas. See Only character fields allowed in string processing. 

Effect 
Shifts the contents of c to the left, so that sequences of blanks are reduced to exactly one blank. Leading spaces (and, for type C fields, trailing spaces as well), are removed completely. 



Example
DATA NAME (30). 
        NAME(10)    = '   Dr.', 
        NAME+10(10) = 'Michael', 
        NAME+20(10) = 'Hofmann'. 
CONDENSE NAME. 
WRITE NAME. 



produces the output: 

Dr. Michael Hofmann 



Addition 
... NO-GAPS 


Effect 
Suppresses all blanks from the field c 



Example
DATA: BEGIN OF NAME, 
        TITLE(8)       VALUE '   Dr.', 
        FIRST_NAME(10) VALUE 'Michael', 
        SURNAME(10)    VALUE 'Hofmann', 
      END   OF NAME. 
CONDENSE NAME NO-GAPS. 



The contents of NAME is now "Dr.MichaelHofmann". 

Since the field string NAME is interpreted and handled like a type C field, the CONDENSE statement treats it as a whole and ignores any sub-fields. The contents of the sub-field would therefore now be as follows: 

NAME-TITLE       = 'Dr.Micha' 
NAME-FIRST_NAME  = 'elHofmann ' 
NAME-SURNAME     = '          ' 



Note 
Do not use CONDENSE to manipulate structures that include fields not of type C. This could result in the subfields containing characters of a different (i.e. incorrect) type. You cannot use the statement with structures containing components of type STRING. 






Note 
Performance: 



The runtime required to condense three fields is about 20 msn (standardized microseconds). The variant ... NO-GAPS needs about 12 msn. 

Related 
SHIFT, CONCATENATE, REPLACE, SPLIT 


Additional help 
Compressing Field Contents 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once ur problem is solved reward the points and close the thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vasanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2007 15:23:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/condense-statement/m-p/2219367#M476342</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-09T15:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: condense statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/condense-statement/m-p/2219368#M476343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Vijay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The CONDENSE statement deletes redundant spaces from a string: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CONDENSE &amp;lt;c&amp;gt; [NO-GAPS].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This statement removes any leading blanks in the field &amp;lt;c&amp;gt; and replaces other sequences of blanks by exactly one blank. The result is a left-justified sequence of words, each separated by one blank. If the addition NO-GAPS is specified, all blanks are removed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

DATA: STRING(25) VALUE ' one two three four',
LEN TYPE I.

LEN = STRLEN( STRING ).
WRITE: STRING, '!'.
WRITE: / 'Length: ', LEN.

CONDENSE STRING.
LEN = STRLEN( STRING ).
WRITE: STRING, '!'.
WRITE: / 'Length: ', LEN.

CONDENSE STRING NO-GAPS.
LEN = STRLEN( STRING ).
WRITE: STRING, '!'.
WRITE: / 'Length: ', LEN.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Output: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one two three four !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Length:           25&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one two three four !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Length:           18&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;onetwothreefour !&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Length:           15&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that the total length of the field STRING remains unchanged, but that the deleted blanks appear again on the right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards Rk&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 May 2007 15:24:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/condense-statement/m-p/2219368#M476343</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-09T15:24:15Z</dc:date>
    </item>
    <item>
      <title>Re: condense statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/condense-statement/m-p/2219369#M476344</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;its for Suppresses all blanks from the field of type CHAR,&lt;/P&gt;&lt;P&gt;reward points and close the thread.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Harish&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Harish AGINATI&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 May 2007 13:44:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/condense-statement/m-p/2219369#M476344</guid>
      <dc:creator>harishaginati</dc:creator>
      <dc:date>2007-05-10T13:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: condense statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/condense-statement/m-p/2219370#M476345</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;Removes spaces from a string. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Syntax&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;CONDENSE &amp;lt;c&amp;gt; [NO-GAPS].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Removes all leading spaces, and replaces other series of blanks with a single space in the character field &amp;lt;c&amp;gt;. If you use the NO-GAPS addition, all of the spaces are removed. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REWARD IF USEFUL...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2007 12:49:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/condense-statement/m-p/2219370#M476345</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-15T12:49:27Z</dc:date>
    </item>
  </channel>
</rss>

