<?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 RAP: Error message in the definition method in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/rap-error-message-in-the-definition-method/m-p/13631213#M2027013</link>
    <description>&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;Does anybody know if it is possible to stop behavior execution and return the error back to API caller from the FOR DETERMINE method? I am using this method to call a BAPI and change my currently processed entity with a transaction ID returned from the BAPI. However, if the BAPI fails for any reason - I would like to return the error message back to API caller. I have tried populating REPORTED itab, but that doesn't stop the execution and save is eventually executed.&lt;/P&gt;&lt;P&gt;I know that this is possible via FOR VALIDATE methods and with FAILED itab, however I need to use the MODIFY ENTITIES statement (to update currently processed entity) which I cannot use in FOR VALIDATE method (hard error).&lt;/P&gt;&lt;P&gt;Any suggestions&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2024 12:31:08 GMT</pubDate>
    <dc:creator>imihailovs</dc:creator>
    <dc:date>2024-03-07T12:31:08Z</dc:date>
    <item>
      <title>RAP: Error message in the definition method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rap-error-message-in-the-definition-method/m-p/13631213#M2027013</link>
      <description>&lt;P&gt;Hello experts,&lt;/P&gt;&lt;P&gt;Does anybody know if it is possible to stop behavior execution and return the error back to API caller from the FOR DETERMINE method? I am using this method to call a BAPI and change my currently processed entity with a transaction ID returned from the BAPI. However, if the BAPI fails for any reason - I would like to return the error message back to API caller. I have tried populating REPORTED itab, but that doesn't stop the execution and save is eventually executed.&lt;/P&gt;&lt;P&gt;I know that this is possible via FOR VALIDATE methods and with FAILED itab, however I need to use the MODIFY ENTITIES statement (to update currently processed entity) which I cannot use in FOR VALIDATE method (hard error).&lt;/P&gt;&lt;P&gt;Any suggestions&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 12:31:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rap-error-message-in-the-definition-method/m-p/13631213#M2027013</guid>
      <dc:creator>imihailovs</dc:creator>
      <dc:date>2024-03-07T12:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: RAP: Error message in the definition method</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/rap-error-message-in-the-definition-method/m-p/13631256#M2027014</link>
      <description>&lt;P&gt;I think I somewhat figured it out.&lt;/P&gt;&lt;P&gt;First, in FOR DETERMINE method I store the message in %msg object of the reported structure, like so:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;INSERT VALUE #( orderuuid   = &amp;lt;fs_repair_order&amp;gt;-orderuuid
                %create     = if_abap_behv=&amp;gt;mk-on
                %state_area = 'XYZ'
                %msg        = me-&amp;gt;new_message_with_text( severity = CONV #( &amp;lt;fs_response&amp;gt;-type )
                                                         text     = &amp;lt;fs_response&amp;gt;-message ) ) INTO TABLE reported-repairorder.&lt;/LI-CODE&gt;&lt;P&gt;Then in FOR VALIDATE ON SAVE, I read the entity in question like so:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;READ ENTITIES OF zoem_i_repairorder IN LOCAL MODE
    ENTITY repairorder
    ALL FIELDS WITH CORRESPONDING #( keys )
    RESULT DATA(lt_data)
    REPORTED DATA(lt_reported_data).&lt;/LI-CODE&gt;&lt;P&gt;In this case, lt_reported_data will contain the entity with %msg content that I can analyze and, if any errors are present, populate the "failed" structure.&lt;/P&gt;&lt;P&gt;If anyone knows different (more correct way) of doing it - please let me know.&lt;/P&gt;</description>
      <pubDate>Thu, 07 Mar 2024 12:55:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/rap-error-message-in-the-definition-method/m-p/13631256#M2027014</guid>
      <dc:creator>imihailovs</dc:creator>
      <dc:date>2024-03-07T12:55:37Z</dc:date>
    </item>
  </channel>
</rss>

