<?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: regarding string operations in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142070#M114892</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;      As you know that if you split this string with delimiter as ,then you will get 11 strings. right. &lt;/P&gt;&lt;P&gt;In that these strings you donot need , between 4 and 5 &lt;/P&gt;&lt;P&gt;&amp;amp; 10 and 11. Right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the bellow code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data str1(20),
     str2(20),
     str3(20),
     str4(20),
     str5(20),
     str6(20),
     str7(20),
     str8(20),
     str9(20),
     str10(20),
     str11(20).

SPLIT source_string AT ',' INTO
str1,str2,str3,str4,str5,str6,str7,str8,str9,str10,str11.

concatenate str1, ',',
            str2, ',',
            str3, ',',
            str4,
            str5, ',',
            str6, ',',
            str7, ',',
            str8, ',',
            str9, ',',
            str10,
            str11.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Maheswaran.B&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Maheswaran B&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Jan 2006 09:02:51 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-01-20T09:02:51Z</dc:date>
    <item>
      <title>regarding string operations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142062#M114884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;i've a string holding the value as given below.&lt;/P&gt;&lt;P&gt;AA,17,2/19/2003,"9,999.00",USD,00,10,318,"193,275.31"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by performing some string operations i want the result string in the format as given below:&lt;/P&gt;&lt;P&gt;AA,17,2/19/2003,"9999.00",USD,00,10,318,"193,275.31"&lt;/P&gt;&lt;P&gt;  i.e., i want to remove all the commas(,)that are included in between a pair of " " only.&lt;/P&gt;&lt;P&gt; can anyone provide me a sample code for the same&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2006 16:05:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142062#M114884</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-19T16:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: regarding string operations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142063#M114885</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;Maybe you have to do it the hard way:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Move the input-line to a char field (l_text type char255)&lt;/P&gt;&lt;P&gt;- start a do-loop.&lt;/P&gt;&lt;P&gt;- assign one char after each other to a field symbol&lt;/P&gt;&lt;P&gt;- check, if content is equal ": if yes, switch a flag (on or off)&lt;/P&gt;&lt;P&gt;- check, if content is equal ',' and flag is on: replace content with space (because of assign, you change l_text)&lt;/P&gt;&lt;P&gt;- enddo.&lt;/P&gt;&lt;P&gt;- condense l_text -&amp;gt; all space are gone &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here the help for assign:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA text(10) TYPE c VALUE '0123456789'. 

FIELD-SYMBOLS &amp;lt;char&amp;gt; TYPE c. 

DATA off TYPE i. 

DO.
  off = sy-index - 1. 
  ASSIGN text+off(1) TO &amp;lt;char&amp;gt;. 
  IF sy-subrc ne 0.
    EXIT.
  ENDIF.
  WRITE / &amp;lt;char&amp;gt;. 
ENDDO. 
&lt;/CODE&gt;&lt;/PRE&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>Thu, 19 Jan 2006 16:25:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142063#M114885</guid>
      <dc:creator>christian_wohlfahrt</dc:creator>
      <dc:date>2006-01-19T16:25:17Z</dc:date>
    </item>
    <item>
      <title>Re: regarding string operations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142064#M114886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Vijay,  this may not look pretty but it does work.  Check it out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;


report zrich_0003 .

data: pos1 type i,
      pos2 type i,
      diff type i.
data: string type string.
data: c(1000) type c.


string = 'AA,17,2/19/2003,"9,999.00",USD,00,10,318,"193,275.31"'.


c = string.

while sy-subrc = 0.
  search c for '"'.
  if sy-subrc = 0.
    pos1 = sy-fdpos + 2.
    search c for '"' starting at pos1.
    if sy-subrc = 0.
      pos2 = sy-fdpos + 2.
      pos1 = pos1 - 2.
      while sy-subrc = 0.
        replace ',' with space into c+pos1(pos2).
      endwhile.
      sy-subrc = 0.
      while sy-subrc = 0.
        replace '"' with space into c+pos1(pos2).
      endwhile.
      condense c+pos1(pos2) no-gaps.
      sy-subrc = 0.
    endif.
  endif.
endwhile.
condense c no-gaps.

write:/ c.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Rich Heilman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2006 16:34:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142064#M114886</guid>
      <dc:creator>RichHeilman</dc:creator>
      <dc:date>2006-01-19T16:34:07Z</dc:date>
    </item>
    <item>
      <title>Re: regarding string operations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142065#M114887</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; Try this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: text(255).&lt;/P&gt;&lt;P&gt;data: v_x.&lt;/P&gt;&lt;P&gt;text =    'AA,17,2/19/2003,"9,999.00",USD,00,10,318,"193,275.31"'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;do.&lt;/P&gt;&lt;P&gt;v_x = ' '.&lt;/P&gt;&lt;P&gt;search text for '"' and mark.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;replace first OCCURRENCE OF '"' in section offset sy-fdpos of text with&lt;/P&gt;&lt;P&gt;''.&lt;/P&gt;&lt;P&gt;replace first OCCURRENCE OF ',' in section offset sy-fdpos of text with&lt;/P&gt;&lt;P&gt;''.&lt;/P&gt;&lt;P&gt;replace first OCCURRENCE OF '",' in section offset sy-fdpos of text with&lt;/P&gt;&lt;P&gt;','.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;v_x = 'X'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;if v_x = ' '.&lt;/P&gt;&lt;P&gt;exit.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;enddo.&lt;/P&gt;&lt;P&gt;      write:/ text.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2006 16:39:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142065#M114887</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-19T16:39:54Z</dc:date>
    </item>
    <item>
      <title>Re: regarding string operations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142066#M114888</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;A bit complex but works for sure, check the following logic,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT zsritest.

DATA: gs_string TYPE string.


gs_string = 'AA,17,2/19/2003,"9,999.00",USD,00,10,318,"193,275.31"'.

WRITE: / gs_string.

PERFORM string_trim CHANGING gs_string.

*---------------------------------------------------------------------*
*       FORM string_trim                                              *
*---------------------------------------------------------------------*
*       ........                                                      *
*---------------------------------------------------------------------*
*  --&amp;gt;  LS_STRING                                                     *
*---------------------------------------------------------------------*
FORM string_trim CHANGING ls_string.

  DATA: lt_string TYPE string OCCURS 0 WITH HEADER LINE,
        lv_tabix TYPE i,
        lv_start.

  SPLIT gs_string AT '"' INTO TABLE lt_string.
  CHECK sy-subrc EQ 0.
  CLEAR gs_string.
  LOOP AT lt_string.
    lv_tabix = sy-tabix MOD 2.
    IF lv_tabix EQ 0.
      TRANSLATE lt_string USING ', '.
      CONDENSE lt_string NO-GAPS.
    ENDIF.

    IF lv_tabix EQ 0 OR lv_start EQ 'X'.
      CONCATENATE gs_string lt_string INTO gs_string SEPARATED BY '"'.
      IF lv_start EQ 'X'.
        CLEAR lv_start.
      ELSE.
        lv_start = 'X'.
      ENDIF.
    ELSE.
      CONCATENATE gs_string lt_string INTO gs_string.
    ENDIF.
  ENDLOOP.

  IF lv_start EQ 'X'.
    CONCATENATE gs_string '"' INTO gs_string.
  ENDIF.

  WRITE: / gs_string.

ENDFORM.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jan 2006 16:48:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142066#M114888</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-19T16:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: regarding string operations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142067#M114889</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Phani,&lt;/P&gt;&lt;P&gt;  ur logic worked great, but if i've have more than one comma in between a pair of " " it replaces only the first one. how can i handle this scenario ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2006 06:42:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142067#M114889</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-20T06:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: regarding string operations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142068#M114890</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can use replace all occurences of ','.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2006 06:56:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142068#M114890</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-20T06:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: regarding string operations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142069#M114891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Vijay , &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try this code. Hope this would give the required result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Report rpt .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data: strtest type c length 100.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: i type i.&lt;/P&gt;&lt;P&gt;data: j type i.&lt;/P&gt;&lt;P&gt;data: k type c. " Indicator flag for "&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;strtest = 'AA,17,2/19/2003,"9,999.00",USD,00,10,318,"193,275.31"'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;message strtest type 'I'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i = 0.&lt;/P&gt;&lt;P&gt;j = strlen( strtest ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;while i &amp;lt; j.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if strtest+i(1) = '"' and k = ''.&lt;/P&gt;&lt;P&gt;  k = 'X'.&lt;/P&gt;&lt;P&gt;elseif strtest+i(1) = '"' and k = 'X'.&lt;/P&gt;&lt;P&gt;  k = space.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt; if strtest+i(1) = ',' and k = 'X'.&lt;/P&gt;&lt;P&gt;   strtest+i(1) = ''.&lt;/P&gt;&lt;P&gt; endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i = i + 1.&lt;/P&gt;&lt;P&gt;endwhile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;message strtest type 'I'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Shankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2006 07:20:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142069#M114891</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-20T07:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: regarding string operations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142070#M114892</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;      As you know that if you split this string with delimiter as ,then you will get 11 strings. right. &lt;/P&gt;&lt;P&gt;In that these strings you donot need , between 4 and 5 &lt;/P&gt;&lt;P&gt;&amp;amp; 10 and 11. Right.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use the bellow code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data str1(20),
     str2(20),
     str3(20),
     str4(20),
     str5(20),
     str6(20),
     str7(20),
     str8(20),
     str9(20),
     str10(20),
     str11(20).

SPLIT source_string AT ',' INTO
str1,str2,str3,str4,str5,str6,str7,str8,str9,str10,str11.

concatenate str1, ',',
            str2, ',',
            str3, ',',
            str4,
            str5, ',',
            str6, ',',
            str7, ',',
            str8, ',',
            str9, ',',
            str10,
            str11.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope it helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Maheswaran.B&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Maheswaran B&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2006 09:02:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142070#M114892</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-20T09:02:51Z</dc:date>
    </item>
    <item>
      <title>Re: regarding string operations</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142071#M114893</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;u can do this using offset functionality.read each letter from the string when ever u encounter ".pass the letters after that inverted comma (") until another one is encountered in between this if u encounter a comma delete it.and finally concatenate that string&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Suresh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: suresh B&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jan 2006 10:18:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/regarding-string-operations/m-p/1142071#M114893</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-01-20T10:18:57Z</dc:date>
    </item>
  </channel>
</rss>

