Ansicht
Dokumentation

CRM_ORDER_CHANGE_STATUS - System- oder Anwenderstatus setzen

CRM_ORDER_CHANGE_STATUS - System- oder Anwenderstatus setzen

CPI1466 during Backup   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

Functionality

The CRM_ORDER_CHANGE_STATUS function module is used for setting system statuses that can be changed manually in a CRM business transaction or in all items of a CRM business transaction.

The main use of this function module is in Actions (PPF).

The module has the following functions:

  • Set a system status for all items in a transaction, at the header level if required.
  • For setting or re-setting the system status, a specific transaction is provided in the CRMC_STATUS_PROC table. If a user status is intended by the transaction control for the status profile, this user status is also set. If the transaction is not intended there, but if a user status with status number has been assigned to the CRM transaction, then this user status is also set.
  • It is possible to also run a log with messages from status management. For this, the import parameter IV_TRACE_LOG has to contain the handle for the application log.

Note

Only use this module to change a system status that can also be changed by the user manually.

For system statuses that can only be set by the program, and that cannot be set or cancelled manually, you can use the following modules:

Example

You have created the "Release Transaction" using the Generic Action Tool (PPR). When you press this button, all transaction items, excluding the header, are released. For this, implement the EXECUTE method in a CL_IM_RELEASE_ALL_ITEMS implementation class of the EXEC_METHODCALL_PPF Business Add-In. Coding could be as follows:


METHOD if_ex_exec_methodcall_ppf~execute .

DATA: lv_guid_ref TYPE crmt_object_guid,
lv_kind_ref TYPE crmt_object_kind,
lc_action_execute TYPE REF TO cl_action_execute.
DATA: lv_message TYPE char80.
DATA: lv_preview TYPE char1.

INCLUDE crm_status_con.
INCLUDE crm_log_states_con.

********************************************************************

CREATE OBJECT lc_action_execute.

* get parameter from reference object
CALL METHOD lc_action_execute->get_ref_object
EXPORTING
io_appl_object = io_appl_object
ip_action = ip_action
ii_container = ii_container
IMPORTING
ev_guid_ref = lv_guid_ref
ev_kind_ref = lv_kind_ref
ev_preview = lv_preview.

********************************************************************

* not relevant iv preview is active
IF NOT lv_preview IS INITIAL.
MESSAGE s007(crm_action).
EXIT.
ENDIF.

********************************************************************

CALL FUNCTION 'CRM_ORDER_CHANGE_STATUS'
EXPORTING
iv_ref_guid = lv_guid_ref
iv_ref_kind = lv_kind_ref
iv_status = gc_status-released
iv_all_items = true
iv_only_items = true
iv_trace_log = ip_application_log
EXCEPTIONS
parameter_error = 1
not_allowed = 2
error_occurred = 3
OTHERS = 4.

IF sy-subrc NE 0.
* write message into ppf-log
CALL METHOD cl_log_ppf=>add_message
EXPORTING
ip_problemclass = '2'
ip_handle = ip_application_log.
* set return status
rp_status = '2'.
EXIT.
ENDIF.



********************************************************************
* register new document for saving
CALL METHOD lc_action_execute->register_for_save
EXPORTING
iv_source_header_guid = lv_guid_ref
ip_application_log = ip_application_log
IMPORTING
rp_status = rp_status.

ENDMETHOD. "

Notes

Further information





Parameters

IV_ACTIVATE
IV_ALL_ITEMS
IV_ONLY_ITEMS
IV_REF_GUID
IV_REF_KIND
IV_STATUS
IV_TRACE_LOG

Exceptions

ERROR_OCCURRED
NOT_ALLOWED
PARAMETER_ERROR

Function Group

CRM_STATUS_TOOLS

CPI1466 during Backup   Vendor Master (General Section)  
This documentation is copyright by SAP AG.

Length: 5702 Date: 20240523 Time: 104854     sap01-206 ( 63 ms )