on 2025 Feb 12 10:08 AM
While using RAP EML to update the startdatetime of a service order, I encountered the following ABAP runtime error:
Help me understand why am I getting this error.
Short Text:
Statement "MODIFY ENTITIES" is not allowed with this status.
Runtime Error:
BEHAVIOR_STATEMENT_ILLEGAL
Program:
CL_IRES_RESERVATION===========CP
Application Component:
MM-IM-RS
I have developed a managed RAP application for stock transfer. Within this application, I have implemented an Action to handle stock transfer, and inside the action method of the behavior implementation class, I am invoking the API API_MATERIAL_DOCUMENT_SRV.
Everything works fine up to this point. However, after successfully creating the material document, there is a requirement to update the start date of the service order. To achieve this, I attempted to use EML (Entity Manipulation Language) to update the requestedservicestartdatetime field.
Unfortunately, this results in a BEHAVIOR_STATEMENT_ILLEGAL error.
Inside the action method, the public API is called to create a material document:
** Call public API for warehouse-managed scenario
public_api_post( EXPORTING is_param = ls_param
it_items = lt_items
it_srnobin = lt_srnobin
it_issueqty = lt_issueqty
it_srnoprofile = lt_srnoprofile
IMPORTING ev_get_resp_stat = DATA(lv_get_resp_stat)
ev_get_resp_text = DATA(lv_get_resp_text)
ev_post_resp_stat = DATA(lv_post_resp_stat)
ev_post_resp_text = DATA(lv_post_resp_text)
ev_exception_msg = DATA(lv_exception_msg) ).
IF lv_post_resp_stat-code = '201' OR lv_post_resp_stat-code = '200'.
** Fetch the requested service start date based on service order
SELECT SINGLE requestedservicestartdatetime FROM i_serviceordertp
WHERE serviceorder = @iv_serviceorder INTO @DATA(lv_startdate).
** Add 60 seconds (1 minute) to the start time
CALL METHOD cl_abap_tstmp=>add
EXPORTING
tstmp = lv_startdate
secs = 60
RECEIVING
r_tstmp = lv_startdate.
** Attempt to update the service order with the new start date
MODIFY ENTITIES OF i_serviceordertp FORWARDING PRIVILEGED
ENTITY serviceorder
UPDATE FIELDS ( requestedservicestartdatetime )
WITH VALUE #( ( serviceorder = iv_serviceorder
requestedservicestartdatetime = lv_startdate
* %control = VALUE #( requestedservicestartdatetime = cl_abap_behv=>flag_changed )
) )
FAILED DATA(lt_failed_modify)
MAPPED DATA(lt_mapped_modify)
REPORTED DATA(lt_reported_modify).
ENDIF.
The ABAP program "CL_IRES_RESERVATION===========CP" terminated due to an invalid statement execution.
Error Analysis:
Termination Point:
Request clarification before answering.
User | Count |
---|---|
98 | |
11 | |
10 | |
9 | |
6 | |
5 | |
4 | |
4 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.