Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How 2 change the status of a CRM document? crm_order_change_status

I have a requirement to update the status of a CRM document (Oppertunity). After updation, eventhough the FM is returning sy-subrc = 0, Nothing is changed, when i see the doucment thru t-code CRMD_ORDER. My sample code is attached. Can any one help me in this ?.

DATA : iv_status TYPE crm_j_status,

iv_ref_guid TYPE crmt_object_guid,

iv_trace_log TYPE balloghndl.

INCLUDE crm_status_con.

INCLUDE crm_log_states_con.

BREAK-POINT.

iv_ref_guid = '443A15D3D8E3548AE1000000AF01022A'.

iv_status = 'E0001'.

CALL FUNCTION 'CRM_ORDER_CHANGE_STATUS'

EXPORTING

iv_ref_guid = iv_ref_guid

iv_status = iv_status

iv_activate = true

iv_ref_kind = 'A'

iv_all_items = true

iv_only_items = true

iv_trace_log = iv_trace_log

EXCEPTIONS

parameter_error = 1

not_allowed = 2

error_occurred = 3

OTHERS = 4.

BREAK-POINT.

Tags:
replied

Hi Jay,

In place of the function module what you are using, u try to use "CRM_STATUS_CHANGE_INTERN_VB" which actually changes the status for the header level and the line item level.

This is the function module which updates or inserts a record for the status changes in crmd_order. you can update a status or insert a new status.

It will defintly work out. since the status to be displayed should be active one. Try using this function module and let me know..

Steps: first read the current status for the guid from crm_jest table and use the function module 'CRM_STATUS_CHANGE_INTERN_VB' to make the current status inactive. You have to assign 'X' for the inact parameter.

code for new status

data: lv_stat type table of jstat,

str_stat-stat = 'E001'.

str_stat-inact = ' '.(this makes the status active)

append str_stat to lv_stat.

call function 'CRM_STATUS_CHANGE_INTERN_VB'

exporting

objnr = 'SHOULD BE THE GUID header or item guid'

tables

status = lv_stat.

this would definatly work out try and let me know.

Regards,

Sundar

Regards,

Sundar

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question