Symptom
When using the create action of I_SupplierInvoiceTP , the following error is raised:
"Statement "MODIFY ENTITY <save action>" is only permitted in certain phases of BEHAVIOR
At present, the execution is in "MODIFY". The statement is forbidden here."
Environment
S/4Hana Cloud Public Edition
Cause
The create action of I_SupplierInvoiceTP is a "static factory save action" and as a result you can only call this action in the save phase.
Resolution
Please check out the following documentations:
ABAP for RAP: Entity Manipulation Language (ABAP EML)
"//Non-standard operations (check the specification options in the documentation, e.g. feature //control and others are possible) such as actions (modify RAP BO instance) and functions (return //information). There are different flavors of actions such as non-factory and factory actions, //which themselves have different variations. Other flavors of actions are save actions (only to //be executed during save sequence), determine actions (allow RAP BO consumers to execute //determinations and validations on request), and draft actions."
The part about "Other flavors of actions are save actions" is important for I_SupplierInvoiceTP. The action "Create" in I_SupplierInvoiceTP is such a save action.
As a result it is needed to add a local class that handles the save phase.
Please see this documentation for general information about all RAP saver methods:
Keywords
ABAP RAP, RAP saver methods, ABAP EML, Entity Manipulation Language, I_SupplierInvoiceTP, modify entity , KBA , MM-FIO-IV , Fiori UI for Invoice Verification , Problem
SAP Knowledge Base Article - Public