cancel
Showing results for 
Search instead for 
Did you mean: 

Message handling in DRAFT and Strict Mode

shavneet1
Participant
0 Kudos

Hello andre.fischer ,

I have created two applications , one is draft enabled other one is Strict (Non-draft), both from your RAP generator.

I have some validations for mandatory fields , and i log message which i want to show in the UI.

Everything is working fine , but with one big difference , on how the messages are displayed.

In Non- draft behavior , i get the messages at the footer with hyperlinks, and in draft based app , i get the message in the form of pop up.

My requirement is get the error messages at the footer in draft Scenario.

Is this some kind of product error in RAP , or i am missing something in my code , which i have to add.

Raising messages and calling validation from Behavior is 100% same in both cases. But message handling is different

koradaramjee789

volker.drees : would you please look at this bheaviour and provide some solution or answer

Waiting for your response.

Thanks and Regards ,

Shavneet Singh

Accepted Solutions (0)

Answers (2)

Answers (2)

AbhishekSharma
Active Contributor
0 Kudos

Hi shavs

Per my experience, Managed scenario with Draft will show all error messages collectively, which is already happening in your case. But in unmanaged scenario we need to have Draft Enabled (must).

To collect all error messages and show then on bottom left you need to add

%state_area property in your REPORTED-<ENTITYNAME> structure like below...

reported-<entity name> = VALUE #((
%tky = <record>-%tky

%state_area = 'VALIDATE_FIELD' "this can be any text just to identify state of field
%element-<fieldname to validate> = if_abap_behv=>mk-on

%msg = new_message ("update your error message").
)).

for more step by step details please visit below video:

https://www.youtube.com/watch?v=MXQLFrNNusM

Hope this helps...

Thanks-

Abhishek

shavneet1
Participant
0 Kudos

Hello abhishek-166 ,

I was able to get the custom message at the footer level for the header, but still in my case the validation is the header level, and messages don't add up for items. in the example you shared above, it is again at the ROOT level, and not at the child level.

Do we have any solution for this ? or it is an error in RAP framework still?

please also check this post, where i have share more details in the comment section.

ABAP RAP extensibility: Behavior extension messages not reported in UI | SAP Community

we are still in S/4 hana 2021 on premise release.

Regards,

shavneet

p619793
Active Participant
0 Kudos

Hi shavs ,

Can you share the code you have used to implement the behavior for draft case?

'Error in footer' indicates that it is the final state of the BO entity.

I think it is by design that for a draft entity (i.e. still not saved to active table) the messages will appear in a popup.

Ideally, If you don't add entry into 'failed' workarea explicitly RAP framework assumes that the BO has not failed yet (final state), hence http=412 precondition failed which results in confirmation popup.

Best regards,

shavneet1
Participant
0 Kudos

Hi sumit.kundu2 ,

Below Screenshot shows, the code of behaviour defnition.

AS you can see its a draft table , and validation NettpriceDeliveryTime on save is called.

and the implementation code is as below.

READ ENTITIES OF zscp_rfx_r_header01tp IN LOCAL MODE ENTITY items BY \_Header

FIELDS ( Ebeln revno )

WITH CORRESPONDING #( keys ) RESULT DATA(dATASETS).

LOOP AT datasets INTO DATA(dataset).

READ ENTITIES OF zscp_rfx_r_header01tp IN LOCAL MODE

ENTITY header BY \_items FIELDS ( Netpr EliveryTimeWe ) WITH

VALUE #( ( %tky = dataset-%tky ) ) RESULT DATA(ItemDataset).

SORT ItemDataset BY Ebelp DESCENDING.

LOOP AT ItemDataset INTO DATA(ItemData).

lv_item_no = ItemData-ebelp.

IF ItemData-netpr > 0 AND ItemData-eliverytimewe IS INITIAL .

APPEND VALUE #( %tky = ItemData-%tky ) TO failed-items.

APPEND VALUE #( %tky = ItemData-%tky

%msg = NEW zscp_rfx_msg_defn(

textid = zscp_rfx_msg_defn=>delivery_time

mv_value = lv_item_no

severity = if_abap_behv_message=>severity-error )

%element-EliveryTimeWe = if_abap_behv=>mk-on

) TO reported-items.

ENDIF.

ENDLOOP.

ENDLOOP.


Thanks for your time.. if you can help.. what is missed here..



Regards ,

Shavneet