Skip to Content
0
Former Member
Apr 16, 2008 at 10:41 AM

CRM_ORDER_MAINTAIN

20 Views

Hi,

I am facing problem with Func Mod CRM_ORDER_MAINTAIN.

I am trying to change the status of service order from New to Shipped in the transaction CRMD_ORDER.

Below is my code.Please look into it and let me the issue.

Thanks.Rushikesh

REPORT ZRD1.

data:IT_STATUS TYPE CRMT_STATUS_COMT,

wa like line of it_status.

DATA : ls_input_field TYPE crmt_input_field,

ls_input_field_names TYPE crmt_input_field_names,

lt_input_fields TYPE crmt_input_field_tab,

CT_PARTNER_ATTRIBUTES TYPE CRMT_PARTNER_ATTRIBUTE_COM_TAB,

l_i_orderadm_h TYPE CRMT_ORDERADM_H_COMT,

l_i_orderadm_i TYPE CRMT_ORDERADM_I_COMT,

l_i_obj_guids TYPE CRMT_OBJECT_GUID_TAB,

ls_i_obj_guids like line of l_i_obj_guids.

wa-REF_GUID = '47FDBF975F6100E1E10080000A0630A7'.

wa-ref_kind = 'B'.

wa-status = 'E0023'.

wa-USER_STAT_PROC = 'ZRV_ST01'.

wa-activate = 'X'.

APPEND wa TO it_status.

ls_input_field-ref_guid = '47FDBF975F6100E1E10080000A0630A7'.

ls_input_field-ref_kind = 'B'.

ls_input_field_names-fieldname = 'REF_GUID'.

INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.

ls_input_field_names-fieldname = 'REF_KIND'.

INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.

ls_input_field_names-fieldname = 'STATUS'.

INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.

ls_input_field_names-fieldname = 'USER_STAT_PROC'.

INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.

ls_input_field_names-fieldname = 'ACTIVATE'.

INSERT ls_input_field_names INTO TABLE ls_input_field-field_names.

INSERT ls_input_field INTO TABLE lt_input_fields.

*Start of solution1.

CALL FUNCTION 'CRM_ORDER_MAINTAIN'

EXPORTING

IT_STATUS = IT_STATUS

CHANGING

CT_INPUT_FIELDS = lt_INPUT_FIELDS

ct_orderadm_h = l_i_orderadm_h

ct_orderadm_i = l_i_orderadm_i

EXCEPTIONS

ERROR_OCCURRED = 1

DOCUMENT_LOCKED = 2

NO_CHANGE_ALLOWED = 3

NO_AUTHORITY = 4

OTHERS = 5.

IF SY-SUBRC 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ls_i_obj_guids = '47FDBF975F6100E1E10080000A0630A7'.

append ls_i_obj_guids to l_i_obj_guids.

CALL FUNCTION 'CRM_ORDER_SAVE'

EXPORTING

it_objects_to_save = l_i_obj_guids

EXCEPTIONS

document_not_saved = 1.