Skip to Content

crm_order_maintain

Dear all

i need to update the system status of header and line item of the order , i have tried crm_order_maintain , it gives subrc 0 but when i check crm_jest table there is not entry.

current status is 'completed' , i want to put status 'IN PROCESS'

here is my coding block

LOOP AT GT_CRMD_ORDERADM_H INTO GS_CRMD_ORDERADM_H.

gs_header_guid = GS_CRMD_ORDERADM_H-guid.
APPEND gs_header_guid TO gt_header_guid.

REFRESH: gT_ORDERADM_H_READ , gT_ORDERADM_I_READ.


CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
IT_HEADER_GUID = gt_header_guid
IMPORTING
ET_ORDERADM_H = gT_ORDERADM_H_READ
ET_ORDERADM_I = gT_ORDERADM_i_READ
* CHANGING
* CV_LOG_HANDLE =
EXCEPTIONS
DOCUMENT_NOT_FOUND = 1
ERROR_OCCURRED = 2
DOCUMENT_LOCKED = 3
NO_CHANGE_AUTHORITY = 4
NO_DISPLAY_AUTHORITY = 5
NO_CHANGE_ALLOWED = 6
OTHERS = 7
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.


REFRESH : gt_ORDERADM_H, gt_ORDERADM_I.
LOOP at gT_ORDERADM_H_READ INTO gs_ORDERADM_H_READ.
MOVE-CORRESPONDING gs_ORDERADM_H_READ TO gs_ORDERADM_H.
APPEND gs_ORDERADM_H to gt_ORDERADM_H.
endloop.


LOOP at gT_ORDERADM_i_READ INTO gs_ORDERADM_i_READ.
MOVE-CORRESPONDING gs_ORDERADM_i_READ TO gs_ORDERADM_i.
APPEND gs_ORDERADM_i to gt_ORDERADM_i.
endloop.


LOOP AT GT_CRMD_ORDERADM_I INTO GS_CRMD_ORDERADM_I
WHERE HEADER = GS_CRMD_ORDERADM_H-GUID ."AND PARENT IS NOT INITIAL.

REFRESH GT_STATUS.
gs_Status-REF_GUID = GS_CRMD_ORDERADM_I-GUID.
gs_Status-REF_KIND = 'B'.
gs_Status-STATUS = 'I1003'. "in process
gs_Status-ACTIVATE = 'X' ."C_CHECK.
APPEND gs_Status TO gt_Status.


REFRESH Gt_INPUT_FIELDS.
Gs_INPUT_FIELDS-REF_GUID = GS_CRMD_ORDERADM_I-GUID.
Gs_INPUT_FIELDS-REF_KIND = 'B'.
Gs_INPUT_FIELDS-OBJECTNAME = 'STATUS'.
Gs_INPUT_FIELDS-LOGICAL_KEY = 'I1003'.
REFRESH gt_fieldname.
gs_fieldname-FIELDNAME = 'ACTIVATE'.
APPEND gs_fieldname TO gt_fieldname.
Gs_INPUT_FIELDS-FIELD_NAMES = gt_fieldname.
APPEND Gs_INPUT_FIELDS TO Gt_INPUT_FIELDS.


CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
IT_STATUS = gt_Status
* IMPORTING
* ET_EXCEPTION =
CHANGING
CT_ORDERADM_H = gt_ORDERADM_H
CT_ORDERADM_I = gt_ORDERADM_i
CT_INPUT_FIELDS = GT_INPUT_FIELDS
* CV_LOG_HANDLE =
* CT_PARTNER_ATTRIBUTES =
* CT_DOC_FLOW =
EXCEPTIONS
ERROR_OCCURRED = 1
DOCUMENT_LOCKED = 2
NO_CHANGE_ALLOWED = 3
NO_AUTHORITY = 4
OTHERS = 5
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIf .


ENDLOOP.


REFRESH GT_OBJECTS_TO_SAVE.
APPEND GS_CRMD_ORDERADM_H-guid TO GT_OBJECTS_TO_SAVE.
REFRESH : GT_OBJECTS_NOT_SAVED, GT_SAVED_OBJECTS.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
IT_OBJECTS_TO_SAVE = GT_OBJECTS_TO_SAVE
* IV_UPDATE_TASK_LOCAL = FALSE
* IV_SAVE_FRAME_LOG = FALSE
* IV_NO_BDOC_SEND = FALSE
* IT_ACTIVE_SWITCH =
IMPORTING
ET_SAVED_OBJECTS = GT_SAVED_OBJECTS
* ET_EXCEPTION =
ET_OBJECTS_NOT_SAVED = GT_OBJECTS_NOT_SAVED
* CHANGING
* CV_LOG_HANDLE =
* CT_NOCHECK_BEFORE_SAVE =
EXCEPTIONS
DOCUMENT_NOT_SAVED = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
* IMPORTING
* RETURN =
.
ENDLOOP.

help me in this..

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers