<?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 New Syntax Read/ASSERT in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/new-syntax-read-assert/m-p/12133329#M1975296</link>
    <description>&lt;P&gt;Hello together,&lt;/P&gt;
  &lt;P&gt;I used a READ TABLE statement in combination with ASSIGNING and now replaced it by the following coding:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;TRY.           

ASSIGN mt_fu_root_data[ key = &amp;lt;ls_dlv_kl_fu&amp;gt;-target_key ]  TO &amp;lt;ls_fu_root&amp;gt;.         

CATCH cx_sy_itab_line_not_found.           

" TBD: Error Handling       

ENDTRY.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Directly after this read statement, there was an ASSERT sy-subrc = 0 in the old version.&lt;/P&gt;
  &lt;P&gt;How to enable this by using the new syntax? Can that be replaced if we now do something like ASSERT cx_sy_itab_line_not_found is bound in the CATCH statement?&lt;/P&gt;
  &lt;P&gt;Any Ideas?&lt;/P&gt;
  &lt;P&gt;Kind regards&lt;/P&gt;</description>
    <pubDate>Wed, 08 Apr 2020 06:45:27 GMT</pubDate>
    <dc:creator>former_member647100</dc:creator>
    <dc:date>2020-04-08T06:45:27Z</dc:date>
    <item>
      <title>New Syntax Read/ASSERT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/new-syntax-read-assert/m-p/12133329#M1975296</link>
      <description>&lt;P&gt;Hello together,&lt;/P&gt;
  &lt;P&gt;I used a READ TABLE statement in combination with ASSIGNING and now replaced it by the following coding:&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;TRY.           

ASSIGN mt_fu_root_data[ key = &amp;lt;ls_dlv_kl_fu&amp;gt;-target_key ]  TO &amp;lt;ls_fu_root&amp;gt;.         

CATCH cx_sy_itab_line_not_found.           

" TBD: Error Handling       

ENDTRY.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Directly after this read statement, there was an ASSERT sy-subrc = 0 in the old version.&lt;/P&gt;
  &lt;P&gt;How to enable this by using the new syntax? Can that be replaced if we now do something like ASSERT cx_sy_itab_line_not_found is bound in the CATCH statement?&lt;/P&gt;
  &lt;P&gt;Any Ideas?&lt;/P&gt;
  &lt;P&gt;Kind regards&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 06:45:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/new-syntax-read-assert/m-p/12133329#M1975296</guid>
      <dc:creator>former_member647100</dc:creator>
      <dc:date>2020-04-08T06:45:27Z</dc:date>
    </item>
    <item>
      <title>Re: New Syntax Read/ASSERT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/new-syntax-read-assert/m-p/12133330#M1975297</link>
      <description>&lt;P&gt;As of 7.53, ASSERT has no replacement, hopefully.&lt;/P&gt;&lt;P&gt;If you understand what ASSERT means, don't replace it with TRY CATCH.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 08:23:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/new-syntax-read-assert/m-p/12133330#M1975297</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2020-04-08T08:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: New Syntax Read/ASSERT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/new-syntax-read-assert/m-p/12133331#M1975298</link>
      <description>&lt;P&gt;That means, it is not possible to replace the read statement when an assert follows, correct?&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 08:52:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/new-syntax-read-assert/m-p/12133331#M1975298</guid>
      <dc:creator>former_member647100</dc:creator>
      <dc:date>2020-04-08T08:52:21Z</dc:date>
    </item>
    <item>
      <title>Re: New Syntax Read/ASSERT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/new-syntax-read-assert/m-p/12133332#M1975299</link>
      <description>&lt;UL&gt;
&lt;LI&gt;Why are you trying to 'replace' everything? &lt;/LI&gt;&lt;LI&gt;The READ TABLE statement and the ASSERT statement are not directly LINKED to each other.&lt;/LI&gt;&lt;LI&gt;After a failed ASSIGN statement, the sy-subrc is still set to "4 Assignment not completed.", if the assignment couldnt be performed in various instances, so the ASSERT sy-subrc = 0. statement still works for your coding (unless you add more coding in between the ASSIGN and the ASSERT that could potentially change the sy-subrc):&lt;/LI&gt;&lt;/UL&gt;&lt;PRE&gt;&lt;CODE&gt;TRY.           
  ASSIGN mt_fu_root_data[ key = &amp;lt;ls_dlv_kl_fu&amp;gt;-target_key ]  TO &amp;lt;ls_fu_root&amp;gt;.         
CATCH cx_sy_itab_line_not_found.                 
ENDTRY.
ASSERT sy-subrc = 0.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;In other instances, you might want to rewrite it to something like this, to make sure that the assignment was successfull. This way you dont rely on sy-subrc, which would also make it more robust and more straight forward:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;UNASSIGN &amp;lt;ls_fu_root&amp;gt;.
TRY.           
  ASSIGN mt_fu_root_data[ key = &amp;lt;ls_dlv_kl_fu&amp;gt;-target_key ]  TO &amp;lt;ls_fu_root&amp;gt;.         
CATCH cx_sy_itab_line_not_found.           
  " TBD: Error Handling       
ENDTRY.
ASSERT &amp;lt;ls_fu_root&amp;gt; IS ASSIGNED.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Apr 2020 10:30:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/new-syntax-read-assert/m-p/12133332#M1975299</guid>
      <dc:creator>michael_piesche</dc:creator>
      <dc:date>2020-04-08T10:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: New Syntax Read/ASSERT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/new-syntax-read-assert/m-p/12133333#M1975300</link>
      <description>&lt;P&gt;If you are using ASSIGN mt_fu_root_data[ key = &amp;lt;ls_dlv_kl_fu&amp;gt;-target_key ]  TO &amp;lt;ls_fu_root&amp;gt;.&lt;/P&gt;&lt;P&gt;then why not check sy-subrc = 0 or if you want to raise some exception then sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;ASSIGN mt_fu_root_data[ key = &amp;lt;ls_dlv_kl_fu&amp;gt;-target_key ] TO &amp;lt;ls_fu_root&amp;gt;.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;" do something&lt;/P&gt;&lt;P&gt;endif,&lt;/P&gt;&lt;P&gt;OR&lt;/P&gt;&lt;P&gt;ASSIGN mt_fu_root_data[ key = &amp;lt;ls_dlv_kl_fu&amp;gt;-target_key ] TO &amp;lt;ls_fu_root&amp;gt;.&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;" raise exception.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;Refer to: &lt;A href="https://blogs.sap.com/2015/10/25/abap-740-quick-reference/"&gt;https://blogs.sap.com/2015/10/25/abap-740-quick-reference/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Teshan&lt;/P&gt;</description>
      <pubDate>Wed, 08 Apr 2020 12:54:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/new-syntax-read-assert/m-p/12133333#M1975300</guid>
      <dc:creator>teshanappadoo</dc:creator>
      <dc:date>2020-04-08T12:54:12Z</dc:date>
    </item>
  </channel>
</rss>

