cancel
Showing results for 
Search instead for 
Did you mean: 

Crm_order_maintain

Former Member
0 Kudos

Hi Experts,

This is my requirement I have to write a report for mass creation of claims using Crm_order_maintain, to create claims for initiative Element can any body share your knowledge and code for the same.Please find the code in attachment, I'm populating all those table but I don't know  why the changing table il_orderadm_h is not getting populated with guid after calling the Function module.

So that I can save and commit the task.

Thanks in advance

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member210661
Active Contributor
0 Kudos

Hi Kishore,

Have you used crm_order_save and bapi_trasaction_commit function module. just go through this code you may get some idea..

data:wa_input_fields TYPE CRMT_INPUT_FIELD_NAMES,
wa_input_fields_t
type CRMT_INPUT_FIELD,
it_input_fields
type CRMT_INPUT_FIELD_TAB,
wa_activity
TYPE CRMT_ACTIVITY_H_COM,
it_activity
TYPE CRMT_ACTIVITY_H_COMT,
wa_sales
TYPE CRMT_SALES_COM,
it_sales
TYPE CRMT_SALES_COMT,
wa_service_h
TYPE CRMT_SERVICE_H_COM,
it_service_h
TYPE CRMT_SERVICE_H_COMT,
wa_orderadm_h
TYPE CRMT_ORDERADM_H_COM,
it_orderadm_h
TYPE CRMT_ORDERADM_H_COMT,
et_exception
TYPE CRMT_EXCEPTION_T,
wa_objects_to_save
TYPE CRMT_OBJECT_GUID,
it_objects_to_save
TYPE CRMT_OBJECT_GUID_TAB,
wa_saved_objects
TYPE CRMT_RETURN_OBJECTS_STRUC,
it_saved_objects
TYPE CRMT_RETURN_OBJECTS,
it_objects_not_saved
TYPE CRMT_OBJECT_GUID_TAB,
guid
TYPE GUID_16.

CALL FUNCTION 'GUID_CREATE'
IMPORTING
EV_GUID_16 = guid.


wa_activity-ref_guid = guid.
wa_activity-category =
'URL'.
insert wa_activity INTO TABLE it_activity.

wa_sales-ref_guid = guid.
wa_sales-ref_kind =
'A'.
insert wa_sales INTO TABLE it_sales.
clear wa_sales.

wa_service_h-ref_guid = guid.
insert wa_service_h INTO TABLE it_service_h.
clear wa_service_h.

wa_orderadm_h-guid = guid.
wa_orderadm_h-PROCESS_TYPE =
'ZRVQ'.
wa_orderadm_h-DESCRIPTION =
'service order'.
wa_orderadm_h-
mode = 'A'.
INSERT wa_orderadm_h INTO TABLE it_orderadm_h.
clear wa_orderadm_h.

wa_input_fields-fieldname =
'DESCRIPTION'.
insert wa_input_fields INTO TABLE wa_input_fields_t-field_names.
wa_input_fields_t-ref_guid = guid.
wa_input_fields_t-objectname =
'ORDERADM_H'.
insert wa_input_fields_t INTO TABLE it_input_fields.
clear wa_input_fields_t.


CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
IT_ACTIVITY_H     = it_activity
IT_SALES          = it_sales
IT_SERVICE_H      = it_service_h
IMPORTING
ET_EXCEPTION      = et_exception
CHANGING
CT_ORDERADM_H     = it_orderadm_h
CT_INPUT_FIELDS   = it_input_fields
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.

READ TABLE it_orderadm_h into wa_orderadm_h INDEX 1.

wa_objects_to_save = wa_orderadm_h-guid.
insert wa_objects_to_save INTO TABLE it_objects_to_save.

CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
IT_OBJECTS_TO_SAVE   = it_objects_to_save
IMPORTING
ET_SAVED_OBJECTS     = it_saved_objects
ET_EXCEPTION         = et_exception
ET_OBJECTS_NOT_SAVED = it_objects_not_saved
EXCEPTIONS
DOCUMENT_NOT_SAVED   =
1
OTHERS               = 2.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT          = 'X'.


Thanks & Regards,

Srinivask