2024 Nov 18 8:16 AM - edited 2024 Nov 19 3:30 PM
Hello,
I'm working on adding a custom action to the application Manage Sales Order V2. The behavior is for the SalesOrderItem entity. I've extended the behavior C_SALESORDERMANAGE, added my action for the entity SalesOrderItem and implemented it. I've added a Metadata extension to show the button above the Items table in a Sales Order object page. The action is now working as expected, I'm having an issue with showing the standard warning message "Reorder point for item <Item_number> has been exceeded: <X> PC" which shows up the requested amount is too high (it's part of the "normal" application).
I have done the update operation like this:
LOOP AT read_entity ASSIGNING FIELD-SYMBOL(<ls_read>).
MODIFY ENTITIES OF c_salesordermanage IN LOCAL MODE
ENTITY SalesOrderItem
UPDATE
FIELDS ( RequestedQuantity RequestedQuantityUnit )
WITH VALUE #( ( %key = <ls_key>-%key
RequestedQuantity = <ls_key>-%param-NewQuantity
RequestedQuantityUnit = <ls_key>-%param-NewQuantityUnit ) )
FAILED DATA(modify_failed)
REPORTED DATA(modify_reported)
MAPPED DATA(modify_mapped).
ENDLOOP.
The Failed, Reported and Mapped tables are coming back empty even though the entry I've made should bring up the message (which is related to the parent SalesOrder). If I do a read like this after the modify:
READ ENTITIES OF c_salesordermanage IN LOCAL MODE
ENTITY SalesOrder
ALL FIELDS WITH VALUE #( ( %tky = <ls_key>-%tky ) )
RESULT DATA(read_after_update)
FAILED DATA(failed_read_after_update)
REPORTED data(reported_after_update).
I get one row in the SALESORDER table of the reported_after_update table. Shouldn't this message also appear in the reported table of the MODIFY operation? The row in read_after_update has the expected SALESORDER, the expected message object (%MSG) the %STATE_AREA is SALESORDER. I've copied the content of reported_after_update to the derived Reported table of the method.
If I empty the %state field of the Reported table, the message comes up as a pop up in the middle of the screen instead of the expected area and log.
If I leave the state as it comes back from the table I get a short dump with Exception CX_ABAP_BEHV_RUNTIME_ERROR and the message "Invalid STATE message (%STATE_AREA filled) for entity C_SALESORDRITEMMANAGE".
Does anyone have any idea how to show the warning message in the correct place?
A bit about what I tried:
I did some debugging and I found that in CL_ABAP_BEHV_CTRL the following condition is done:
if <reported> is not initial.
if handler_kind = 'M' and handler->meth <> 0 and line_exists( <callparams>[ op = 'A' ] ).
" was this an implementation for a projection action?
job->load_root_infos( ).
if job->root_infos[ root = stdpar-root ]-itype = cl_abap_behv_load=>c_impltype_PROJECTION.
handler_kind = '%'. " ... then reject STATE messages (dump)
endif.
endif.
When I fill the %state message in my reported table I get handler kind 'M' and The job->root_infos table has one entry which (correctly) shows that the root is C_SALESORDERMANAGE and the type of the caller is a projection (also correct). If I understand it correctly this condition forbids raising a message with a state value if it comes form a projection, is there a reason for that?
Just to try it out I also implemented the method (under a different name) in an extension to r_salesordertp and a "use action..." in the extension for C_SALESORDERMANAGE. In that case the message is not shown but there's no dump.
All the best,
Ben
Request clarification before answering.
| User | Count |
|---|---|
| 18 | |
| 7 | |
| 6 | |
| 6 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.