<?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: Dynamically Replace substring in an Element ABAP CDS Masking in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamically-replace-substring-in-an-element-abap-cds-masking/m-p/12606235#M2011410</link>
    <description>&lt;P&gt;Hi Quynh Bui Cong,&lt;/P&gt;&lt;P&gt;Decent code i would say. But I am looking for ABAP CDS/SQL Script not ABAP. How i wish we could do this in CDS.&lt;/P&gt;&lt;P&gt;Thanks anyway.&lt;/P&gt;</description>
    <pubDate>Fri, 05 Aug 2022 04:43:57 GMT</pubDate>
    <dc:creator>rowieforms</dc:creator>
    <dc:date>2022-08-05T04:43:57Z</dc:date>
    <item>
      <title>Dynamically Replace substring in an Element ABAP CDS Masking</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamically-replace-substring-in-an-element-abap-cds-masking/m-p/12606233#M2011408</link>
      <description>&lt;P&gt;Hi Experts!&lt;/P&gt;
  &lt;P&gt;Good day!&lt;/P&gt;
  &lt;P&gt;I am trying to mask a sensitive element in a view.&lt;/P&gt;
  &lt;P&gt;So for example, in the following data, the expected output is beside it.&lt;/P&gt;
  &lt;P&gt;Elon Musk -&amp;gt; E*** M***&lt;/P&gt;
  &lt;P&gt;Meta World Peace -&amp;gt; M*** W**** P****&lt;/P&gt;
  &lt;P&gt;Arnold Schwarzenegger -&amp;gt; A***** S*************&lt;/P&gt;
  &lt;P&gt;I was thinking of using a table function which uses substring and other string functions but the one thing i don't think will work is the fact that we dont know how many words will be in the field itself. This calls for a dynamic approach, some sort of loop which I know isnt possible in SQL (please correct me if Im wrong). Any thoughts?&lt;/P&gt;
  &lt;P&gt;Thanks and regards,&lt;/P&gt;
  &lt;P&gt;Erwin Formaran&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 03:21:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamically-replace-substring-in-an-element-abap-cds-masking/m-p/12606233#M2011408</guid>
      <dc:creator>rowieforms</dc:creator>
      <dc:date>2022-08-04T03:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Replace substring in an Element ABAP CDS Masking</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamically-replace-substring-in-an-element-abap-cds-masking/m-p/12606234#M2011409</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;** This is bad code but it use helpful.
REPORT ZTEST.

DATA: TEXT      TYPE STRING VALUE 'Arnold Schwarzenegger',
      LV_LENGTH TYPE I,
      LV_ITEM   TYPE STRING,
      LV_RESULT TYPE STRING.

SPLIT TEXT AT SPACE INTO: DATA(STR1) DATA(STR2) DATA(STR3),
                          TABLE DATA(ITAB).

LOOP AT ITAB ASSIGNING FIELD-SYMBOL(&amp;lt;FS_ITAB&amp;gt;).
  LV_LENGTH = STRLEN( &amp;lt;FS_ITAB&amp;gt; ) - 1.
  DO LV_LENGTH TIMES.
    CONCATENATE LV_ITEM '*' INTO LV_ITEM.
  ENDDO.
  &amp;lt;FS_ITAB&amp;gt; = &amp;lt;FS_ITAB&amp;gt;+0(1) &amp;amp;&amp;amp; LV_ITEM.

  IF LV_RESULT IS INITIAL.
    CONCATENATE LV_RESULT &amp;lt;FS_ITAB&amp;gt; INTO LV_RESULT.
  ELSE.
    CONCATENATE LV_RESULT &amp;lt;FS_ITAB&amp;gt; INTO LV_RESULT SEPARATED BY SPACE.
  ENDIF.
  CLEAR: LV_ITEM.
ENDLOOP.
BREAK QUYNHBC.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Aug 2022 10:45:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamically-replace-substring-in-an-element-abap-cds-masking/m-p/12606234#M2011409</guid>
      <dc:creator>former_member808116</dc:creator>
      <dc:date>2022-08-04T10:45:32Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Replace substring in an Element ABAP CDS Masking</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamically-replace-substring-in-an-element-abap-cds-masking/m-p/12606235#M2011410</link>
      <description>&lt;P&gt;Hi Quynh Bui Cong,&lt;/P&gt;&lt;P&gt;Decent code i would say. But I am looking for ABAP CDS/SQL Script not ABAP. How i wish we could do this in CDS.&lt;/P&gt;&lt;P&gt;Thanks anyway.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 04:43:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamically-replace-substring-in-an-element-abap-cds-masking/m-p/12606235#M2011410</guid>
      <dc:creator>rowieforms</dc:creator>
      <dc:date>2022-08-05T04:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamically Replace substring in an Element ABAP CDS Masking</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamically-replace-substring-in-an-element-abap-cds-masking/m-p/12606236#M2011411</link>
      <description>&lt;P&gt;Hello everybody, just an update. This was resolved by using function replace_regex in table function.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 12:35:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamically-replace-substring-in-an-element-abap-cds-masking/m-p/12606236#M2011411</guid>
      <dc:creator>rowieforms</dc:creator>
      <dc:date>2022-08-08T12:35:43Z</dc:date>
    </item>
  </channel>
</rss>

