Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Issue with RAP singleton instance handle validation and message propagation in RAP OData V4

MKM
Active Participant
5,610

Hi Experts,

We are working with a RAP Singleton OData V4 service that includes validations to restrict the SAVE operation using the FAILED structure under FOR VALIDATE ON SAVE.

 

 

APPEND VALUE #( %tky = ls_transactional_data-%tky ) TO  failed-ProjectSBUAlloc.
        APPEND VALUE #( %tky = ls_transactional_data-%tky
              %state_area = 'VALIDATE_PERCENT'
              %path-ProjectSBUAllocAll = CORRESPONDING #( ls_transactional_data )
              %element-distkey = if_abap_behv=>mk-on
              %msg     = new_message(

                  id       =  'ZTEST'
                  number   =  000
                  severity = if_abap_behv_message=>severity-error "CONV #( 'E')
                  v1       = 'Percentage value cannot be greater than 100'
                  )
        ) TO  reported-ProjectSBUAlloc.

 

 

This works as expected in the Eclipse ADT preview, but we are facing an issue when accessing it via the Fiori app.

MKM_0-1739898785173.png

 

The custom validation message does not appear on the UI; instead, only the framework error (RAP_DSP_REQUEST/023) is returned. Despite properly updating the FAILED AND REPORTED structures, the validation failures are not being correctly tied to the singleton instance, unlike regular entities.

The RAP framework is overriding the message, preventing it from being properly surfaced in the response.

What would be the best approach to ensure that our custom validation messages are correctly displayed in the UI when using RAP?

Any suggestions would be greatly appreciated!

2 REPLIES 2
Read only

AZIZURRAHMAN
Discoverer
5,368
Dear,
was this issue solved..? we are on S4HANA ON PREMISE SAP S/4HANA 2022 (SP/FP 02 (05/2023) )..
I am facing similar situation. my custom validation message is not displayed and only we get to see the message ("Resolve data inconsistencies to save changes.").. I have exactly same code when mapping to failed and reported.. I have issue in both FLP and Eclipse ADT preview.. I am using SAP RAP based OData v4 service in FE template ..any guidance would be helpful.. best regards,
 
Read only

0 Likes
3,464

Hi,

I wanted to ask if there has been any further progress or solution discovered for this issue? If you have any new insights, fixes, or workarounds, I would really appreciate if you could share them.

Thanks in advance for your help!

Best Retards