<?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>Question Re: RAP: Using state message causes error in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/rap-using-state-message-causes-error/qaa-p/13713446#M4830853</link>
    <description>&lt;P&gt;Hi, were you able to resolve this problem? I'm facing a similar issue where I'm unable to highlight the child entity fields even after providing all the necessary values(tky, msg, element, path) in the reported structure. Any suggestion?&lt;/P&gt;&lt;P&gt;Edit: S4H 2022 FPS02&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 27 May 2024 13:50:09 GMT</pubDate>
    <dc:creator>saurabh__khare38</dc:creator>
    <dc:date>2024-05-27T13:50:09Z</dc:date>
    <item>
      <title>RAP: Using state message causes error</title>
      <link>https://community.sap.com/t5/technology-q-a/rap-using-state-message-causes-error/qaq-p/12528079</link>
      <description>&lt;P&gt;I am developing a simple RAP service using BTP ABAP trial environment.&lt;/P&gt;
  &lt;P&gt;I have implemented a validation with the following code.&lt;/P&gt;
  &lt;P&gt;This BO is managed, draft-enabled, and the validation is triggered at the point of save.&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;  validation mandatory_check on save {create; update; field FirstName, LastName; }&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;  METHOD mandatory_check.
    "Get Mandatory Fields
    READ ENTITIES OF zi_person_m IN LOCAL MODE
    ENTITY Person
      FIELDS ( FirstName LastName )
      WITH CORRESPONDING #( keys )
      RESULT DATA(persons).

    "Do check
    LOOP AT persons INTO DATA(person).
        APPEND VALUE #( %tky = person-%tky
                        %state_area = 'mandatory_check')
               TO reported-person.

      IF person-FirstName IS INITIAL.

        "Set failed keys
        APPEND VALUE #( %tky = person-%tky )
               TO failed-person.

        "Set message
        APPEND VALUE #( %tky = person-%tky
                        %element-FirstName = if_abap_behv=&amp;gt;mk-on
                        %state_area = 'mandatory_check'
                        %msg = new_message(
                                 id       = 'ZRAP_MSG_YASU2122_2'
                                 number   = 001
                                 severity = if_abap_behv_message=&amp;gt;severity-error
                                 v1       = 'First Name'
                               ) )
               TO reported-person.
      ENDIF.
    ENDLOOP.
  ENDMETHOD.&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;However, specifying %state_area = 'mandatory_check' causes the app to throw error. The following screen appears after the validation gets triggered.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2006515-error-3.png" /&gt;&lt;/P&gt;
  &lt;P&gt;Below code (without %state_area)works fine.&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;    "Do check
    LOOP AT persons INTO DATA(person).
      IF person-FirstName IS INITIAL.

        "Set failed keys
        APPEND VALUE #( %tky = person-%tky )
               TO failed-person.

        "Set message
        APPEND VALUE #( %tky = person-%tky
                        %element-FirstName = if_abap_behv=&amp;gt;mk-on
                        %msg = new_message(
                                 id       = 'ZRAP_MSG_YASU2122_2'
                                 number   = 001
                                 severity = if_abap_behv_message=&amp;gt;severity-error
                                 v1       = 'First Name'
                               ) )
               TO reported-person.
      ENDIF.
    ENDLOOP.&amp;lt;br&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;According to the &lt;A href="https://help.sap.com/viewer/923180ddb98240829d935862025004d6/Cloud/en-US/c69301e17aab41e2b24b4ef957432568.html"&gt;doc&lt;/A&gt;, state message can be used for validation on save in Managed Scenario.&lt;/P&gt;
  &lt;UL&gt; 
   &lt;LI&gt; &lt;P&gt;Business Object with Draft Capabilities: Determinations and Validation that are allocated to the PREPARE or a determine action&lt;/P&gt;&lt;/LI&gt; 
   &lt;LI&gt; &lt;P&gt;Unmanaged Business Object: Finalize/Check Before Save Code Exit&lt;/P&gt;&lt;/LI&gt; 
   &lt;LI&gt; &lt;P&gt;Managed Scenario: Determinations/Validation on Save&lt;/P&gt;&lt;/LI&gt; 
  &lt;/UL&gt;
  &lt;P&gt;Do you have any idea what is causing this error? Should I use state message for my scenario or not?&lt;/P&gt;
  &lt;P&gt;Best regards,&lt;/P&gt;
  &lt;P&gt;Mio&lt;/P&gt;</description>
      <pubDate>Fri, 17 Dec 2021 22:02:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rap-using-state-message-causes-error/qaq-p/12528079</guid>
      <dc:creator>MioYasutake</dc:creator>
      <dc:date>2021-12-17T22:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: RAP: Using state message causes error</title>
      <link>https://community.sap.com/t5/technology-q-a/rap-using-state-message-causes-error/qaa-p/12528080#M4696162</link>
      <description>&lt;P&gt;Hi Mio,&lt;/P&gt;&lt;P&gt;Perhaps this &lt;A href="https://github.com/SAP-samples/teched2020-DEV260/tree/main/exercises/ex9"&gt;link&lt;/A&gt; will explane the problem to you. (&lt;EM&gt;This is a known backend problem that will be fixed with the upcoming release.&lt;/EM&gt;)&lt;/P&gt;</description>
      <pubDate>Tue, 25 Jan 2022 20:43:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rap-using-state-message-causes-error/qaa-p/12528080#M4696162</guid>
      <dc:creator>juryrychko</dc:creator>
      <dc:date>2022-01-25T20:43:57Z</dc:date>
    </item>
    <item>
      <title>Re: RAP: Using state message causes error</title>
      <link>https://community.sap.com/t5/technology-q-a/rap-using-state-message-causes-error/qaa-p/12528081#M4696163</link>
      <description>&lt;P&gt;Hi &lt;SPAN class="mention-scrubbed"&gt;juryrychko&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;Thanks for letting me know about this! &lt;/P&gt;</description>
      <pubDate>Wed, 26 Jan 2022 09:00:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rap-using-state-message-causes-error/qaa-p/12528081#M4696163</guid>
      <dc:creator>MioYasutake</dc:creator>
      <dc:date>2022-01-26T09:00:36Z</dc:date>
    </item>
    <item>
      <title>Re: RAP: Using state message causes error</title>
      <link>https://community.sap.com/t5/technology-q-a/rap-using-state-message-causes-error/qaa-p/12528082#M4696164</link>
      <description>&lt;P&gt;Hello, &lt;BR /&gt;&lt;BR /&gt;I'm on a 2021 SP2 system and couldn't find on the link mentioned above which release had or solved the issue. Please, are you aware if by any chance this error also affects messages on child entities in any way? &lt;/P&gt;&lt;P&gt;I have a validation running on save for Child entity, which is a list item within my object page, and I'm unable to properly highlight a field as you can see on the following print - the row is marked as unknown.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/2145673-image.png" /&gt;&lt;/P&gt;&lt;P&gt;I checked this over and over but couldn't figure out what is missing. Shouldn't the following set of parameters be enough to provide a message with a highlight? I'm also feeding %tky to failed-child.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;reported-child=
  VALUE #(
    BASE reported-child(
      %tky = ls_child-%tky
      %path = VALUE #(
        root-%is_draft = ls_child-%is_draft
        root-%key-RootUUID = ls_child-RootUUID
      )
      %msg = new_message(
        id       = 'ZTEST_MSG'
        number   = '018'
        severity = if_abap_behv_message=&amp;gt;severity-error
      )
      %element-%field-allocatedquantity = if_abap_behv=&amp;gt;mk-on
      "%state_area = 'qty_not_null'
      "%element-%assoc-_root = if_abap_behv=&amp;gt;mk-on
    )
).&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;"OData response 

{
    "error": {
        "code": "ZTEST_MSG/018",
        "message": "Allocated Quantity must be informed.",
        "target": "$Parameter/_it/_Child(ChildUUID=000d3a17-2339-1eed-ae8d-a23793571f23,IsActiveEntity=true)/AllocatedQuantity",
        "@SAP__common.ExceptionCategory": "Provider_Application_Error",
        "innererror": {
            "ErrorDetails": {
                "@SAP__common.Application": {
                    "ComponentId": "BC-ESI-ESF-GW",
                    "ServiceRepository": "SRVD",
                    "ServiceId": "ZTEST_SRV",
                    "ServiceVersion": "0001"
                },
                "@SAP__common.TransactionId": "039B658AE04600D0E0063F06F0085867",
                "@SAP__common.Timestamp": "20230301220915.319091",
                "@SAP__common.ErrorResolution": {
                    "Analysis": "Use ADT feed reader \"SAP Gateway Error Log\" or run transaction /IWFND/ERROR_LOG on SAP Gateway hub system and search for entries with the timestamp above for more details",
                    "Note": "See SAP Note 1797736 for error analysis (https://service.sap.com/sap/support/notes/1797736)"
                }
            }
        }
    }
}&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 01 Mar 2023 22:30:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rap-using-state-message-causes-error/qaa-p/12528082#M4696164</guid>
      <dc:creator>rodrigo_oliveira5</dc:creator>
      <dc:date>2023-03-01T22:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: RAP: Using state message causes error</title>
      <link>https://community.sap.com/t5/technology-q-a/rap-using-state-message-causes-error/qaa-p/13713446#M4830853</link>
      <description>&lt;P&gt;Hi, were you able to resolve this problem? I'm facing a similar issue where I'm unable to highlight the child entity fields even after providing all the necessary values(tky, msg, element, path) in the reported structure. Any suggestion?&lt;/P&gt;&lt;P&gt;Edit: S4H 2022 FPS02&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 May 2024 13:50:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rap-using-state-message-causes-error/qaa-p/13713446#M4830853</guid>
      <dc:creator>saurabh__khare38</dc:creator>
      <dc:date>2024-05-27T13:50:09Z</dc:date>
    </item>
    <item>
      <title>Re: RAP: Using state message causes error</title>
      <link>https://community.sap.com/t5/technology-q-a/rap-using-state-message-causes-error/qaa-p/13853971#M4881846</link>
      <description>&lt;P&gt;Hello juryrychko,&lt;BR /&gt;Is this backend problem solved? As I am also getting the error. So just wanted to know if it still exists or is there a way to fix the issue?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 04 Sep 2024 09:21:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rap-using-state-message-causes-error/qaa-p/13853971#M4881846</guid>
      <dc:creator>argupta199315</dc:creator>
      <dc:date>2024-09-04T09:21:22Z</dc:date>
    </item>
    <item>
      <title>Re: RAP: Using state message causes error</title>
      <link>https://community.sap.com/t5/technology-q-a/rap-using-state-message-causes-error/qaa-p/14332315#M4937361</link>
      <description>Were you able to solve this?</description>
      <pubDate>Fri, 20 Feb 2026 01:07:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/rap-using-state-message-causes-error/qaa-p/14332315#M4937361</guid>
      <dc:creator>Preeti_Kohli</dc:creator>
      <dc:date>2026-02-20T01:07:44Z</dc:date>
    </item>
  </channel>
</rss>

