<?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: ABAP Help with REPLACE REGEX in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-help-with-replace-regex/m-p/12056025#M1969045</link>
    <description>&lt;P&gt;Not sure how one would accomplish the same logic in a BPC Transformation File.  &lt;BR /&gt;So you are saying that the Transformation could change the Package Selection for Fiscal Period?&lt;BR /&gt;I'm open to any suggestions that would help the cause...  Thanks&lt;/P&gt;</description>
    <pubDate>Wed, 20 Nov 2019 18:14:27 GMT</pubDate>
    <dc:creator>sap_cohort</dc:creator>
    <dc:date>2019-11-20T18:14:27Z</dc:date>
    <item>
      <title>ABAP Help with REPLACE REGEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-help-with-replace-regex/m-p/12056021#M1969041</link>
      <description>&lt;P&gt;Hi, I need to replace a Fiscal Period value YYYYPPP found in a very long string 2000+ in length. I have a routine that determines the correct Fiscal Period to replace the current value in the string.&lt;/P&gt;
  &lt;P&gt;Below is an example of the string with the Fiscal Period entry in it. Its currently "2019001" but could be any value and needs to be replaced. &lt;/P&gt;
  &lt;P&gt;So if I sum it up I need to replace the 7 digit value that is found IMMEDIATELY after the following string token &lt;BR /&gt;&amp;lt;ID&amp;gt;0FISCPER&amp;lt;/ID&amp;gt;&amp;lt;Operator&amp;gt;1&amp;lt;/Operator&amp;gt;&amp;lt;LowValue&amp;gt;&lt;/P&gt;
  &lt;P&gt;Does anyone know how to create an ABAP Regex to accomplish this? &lt;BR /&gt;I am trying to accomplish this with REGEX_TOY to no avail. &lt;/P&gt;
  &lt;P&gt;Thanks for any thoughts. &lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;...&amp;lt;Attribute&amp;gt;&amp;lt;ID&amp;gt;0GL_ACCOUNT&amp;lt;/ID&amp;gt;&amp;lt;Operator&amp;gt;3&amp;lt;/Operator&amp;gt;&amp;lt;LowValue&amp;gt;0090000000&amp;lt;/LowValue&amp;gt;&amp;lt;HighValue&amp;gt;0099999999&amp;lt;/HighValue&amp;gt;&amp;lt;/Attribute&amp;gt;###&amp;lt;Attribute&amp;gt;&amp;lt;ID&amp;gt;0FISCPER&amp;lt;/ID&amp;gt;&amp;lt;Operator&amp;gt;1&amp;lt;/Operator&amp;gt;&amp;lt;LowValue&amp;gt;2019001&amp;lt;/LowValue&amp;gt;&amp;lt;HighValue /&amp;gt;&amp;lt;/Attribute&amp;gt;...&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Nov 2019 22:41:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-help-with-replace-regex/m-p/12056021#M1969041</guid>
      <dc:creator>sap_cohort</dc:creator>
      <dc:date>2019-11-19T22:41:50Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Help with REPLACE REGEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-help-with-replace-regex/m-p/12056022#M1969042</link>
      <description>&lt;P&gt;That string in xml format so you should use sXML Library to read and write instead of replace.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 00:42:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-help-with-replace-regex/m-p/12056022#M1969042</guid>
      <dc:creator>DoanManhQuynh</dc:creator>
      <dc:date>2019-11-20T00:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Help with REPLACE REGEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-help-with-replace-regex/m-p/12056023#M1969043</link>
      <description>&lt;P&gt;Hi, Thanks for the input all! &lt;BR /&gt;This is the solution I came up with.  Probably not the most elegant or proper, but I thought I would share in case it helps anyone down the line. &lt;BR /&gt;This basically reads(imports) an ABAP Variant in table VARI for program UJD_TEST_PACKAGE_LINK or UJD_TEST_PACKAGE and updates the PROMPT Parameter with a new FISCPER Value.  The value was located and updated using REPLACE REGEX.  &lt;/P&gt;&lt;P&gt;I was not able to use any of the standard FM to read the ABAP Variant Parameter value because the value length was greater than 255 and is stored in a scrambled format so I had to use IMPORT/EXPORT for table VARI.&lt;BR /&gt;Hope that helps.&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: BEGIN OF varid_key,
        report  TYPE raldb_repo,
        variant TYPE raldb_vari,
      END OF varid_key.
DATA: lv_prompt      TYPE string,
      lv_src_token   TYPE string,
      lv_tgt_token   TYPE string,
      lv_date        TYPE datum,
      lv_fiscper     TYPE /bi0/oifiscper,
      lv_offset_char TYPE rvari_val_255,
      lv_offset_int  TYPE i,
      lo_fm          TYPE REF TO zcl_fm_wrapper.

PARAMETERS: p_report TYPE raldb_repo DEFAULT 'UJD_TEST_PACKAGE_LINK'.
PARAMETERS: p_varnt  TYPE raldb_vari.

START-OF-SELECTION.
  lo_fm = NEW #( ).

  SELECT SINGLE low FROM tvarvc INTO lv_offset_char WHERE name = 'ZPKG_LINK_DAY_OFFSET'.
  IF sy-subrc = 0.
    lv_offset_int = CONV int4( lv_offset_char ).
    lv_date = sy-datum - lv_offset_int.
  ENDIF.

  lv_fiscper   = lo_fm-&amp;gt;convert_date_to_fiscper( i_date = lv_date i_periv = 'V3').
  lv_src_token = '(&amp;lt;ID&amp;gt;0FISCPER&amp;lt;/ID&amp;gt;&amp;lt;Operator&amp;gt;1&amp;lt;/Operator&amp;gt;&amp;lt;LowValue&amp;gt;)(\d{7})'.
  lv_tgt_token = |&amp;lt;ID&amp;gt;0FISCPER&amp;lt;/ID&amp;gt;&amp;lt;Operator&amp;gt;1&amp;lt;/Operator&amp;gt;&amp;lt;LowValue&amp;gt;{ lv_fiscper }|.

  varid_key-report  = p_report.
  varid_key-variant = p_varnt.
  IMPORT prompt TO lv_prompt FROM DATABASE vari(va) ID varid_key.
  REPLACE REGEX lv_src_token IN lv_prompt WITH lv_tgt_token.
  EXPORT prompt FROM lv_prompt TO DATABASE vari(va) ID varid_key.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Nov 2019 16:47:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-help-with-replace-regex/m-p/12056023#M1969043</guid>
      <dc:creator>sap_cohort</dc:creator>
      <dc:date>2019-11-20T16:47:48Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Help with REPLACE REGEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-help-with-replace-regex/m-p/12056024#M1969044</link>
      <description>&lt;P&gt;Sorry,  but is not better create a transformation of this?&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 16:58:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-help-with-replace-regex/m-p/12056024#M1969044</guid>
      <dc:creator>raphael_almeida</dc:creator>
      <dc:date>2019-11-20T16:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Help with REPLACE REGEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-help-with-replace-regex/m-p/12056025#M1969045</link>
      <description>&lt;P&gt;Not sure how one would accomplish the same logic in a BPC Transformation File.  &lt;BR /&gt;So you are saying that the Transformation could change the Package Selection for Fiscal Period?&lt;BR /&gt;I'm open to any suggestions that would help the cause...  Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 20 Nov 2019 18:14:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-help-with-replace-regex/m-p/12056025#M1969045</guid>
      <dc:creator>sap_cohort</dc:creator>
      <dc:date>2019-11-20T18:14:27Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Help with REPLACE REGEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-help-with-replace-regex/m-p/12056026#M1969046</link>
      <description>&lt;P&gt;it better to use xml library to read/write the prompt value, you can see in that program itself the subroutine PARSE_PROMPT_XML, how SAP parse the prompt parameter.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;U&gt;&lt;/U&gt;&lt;SUB&gt;&lt;/SUB&gt;&lt;SUP&gt;&lt;/SUP&gt;&lt;DEL&gt;&lt;/DEL&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 01:17:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-help-with-replace-regex/m-p/12056026#M1969046</guid>
      <dc:creator>DoanManhQuynh</dc:creator>
      <dc:date>2019-11-21T01:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: ABAP Help with REPLACE REGEX</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-help-with-replace-regex/m-p/12056027#M1969047</link>
      <description>&lt;P&gt;It is an XML string. Advise you to use XML class library and then update the value . You can then convert it back using Parse.&lt;/P&gt;</description>
      <pubDate>Thu, 21 Nov 2019 11:20:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-help-with-replace-regex/m-p/12056027#M1969047</guid>
      <dc:creator>former_member564522</dc:creator>
      <dc:date>2019-11-21T11:20:38Z</dc:date>
    </item>
  </channel>
</rss>

