Compliant status not updating
I am trying to update complaint status in ORDER_SAVE BADI in CHECK_BEFORE_SAVE method. I am facing below Issue with this.
I am reading the complaint status using CRM_STATUS_READ_OW. If the status of complaint is closed I am doing some validation on custom field if the validation fails..I need to set the status of complaint back to previous one instead of complaint closed.
I am changing the status using CRM_STATUS_MAINTAIN_OW function module.
But issue is if the previous status is approved it's changing the status back from Complaint closed to approved. If it has any other previous status Like 'Complaint assessment' or 'Open' it's not setting the status back to those values from complaint closed and getting the error message saying 'Not Allowed'.
I am not sure How can I achieve this.
Is there any configuration I have to do to allow the status back to open or Compliant Assessments to change it from Complaint closed..?
Is there any dependency with system status...?
Currently I am not passing any user_stat_proc in the FM do i have to pass this always..?
ls_status-ref_guid = iv_guid.
ls_status-ref_kind = lc_a.
ls_status-status = ls_status_wrk-status.
* ls_status-user_stat_proc = iv_user_stat_proc.
ls_status-activate = abap_true.
APPEND ls_status TO lt_status.
ls_field_name-fieldname = 'ACTIVATE'. "#EC NOTEXT
APPEND ls_field_name TO lt_field_names.
CALL FUNCTION 'CRM_STATUS_MAINTAIN_OW'
it_status_com = lt_status
ct_input_field_names = lt_field_names
not_allowed = 1
error_occurred = 2
warning_occurred = 3
OTHERS = 4.
IF sy-subrc EQ 0.
I appreciate your help on this.
Arden Stricke replied
Most likely the Status Profile is configured such that the status cannot be lowered beyond "Approved" once "Closed" is reached.
I do not believe you can code around this. Instead adjust the configuration such that the values can be lowered to those that you require.
Then as per your other comment, you will need to adjust (via code) the visibility (filter) of those Status's which you do not want the users to have access to.
Hope this helps