Skip to Content

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

CRM Order Status

Hello Friends,

I am using the following code for updating the status of order but it is not working .Please suggest me where i am wrong

LV_GUID16 = '48E8B1011F9F0114E10080000ADC1080'.

APPEND LV_GUID16 TO LT_GUID16.

CALL FUNCTION 'CRM_ORDER_READ'

EXPORTING

IT_HEADER_GUID = LT_GUID16

IMPORTING

ET_ORDERADM_H = LT_ORDERADM_H

ET_ORDERADM_I = LT_ORDERADM_I

ET_STATUS = LT_STATUS_WRKT

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.

READ TABLE LT_ORDERADM_H INTO WA_ORDERADM_H INDEX 1.

IF SY-SUBRC = 0.

  • Change into Loop

READ TABLE LT_STATUS_WRKT INTO LS_STATUS_WRK2

WITH KEY STATUS = 'E0005'

USER_STAT_PROC = 'ZOBAORD1'

ACTIVE = 'X'.

IF SY-SUBRC = 0.

LWA_STAT-REF_GUID = LS_STATUS_WRK2-GUID.

LWA_STAT-REF_KIND = 'A'.

LWA_STAT-STATUS = 'E0003'.

LWA_STAT-USER_STAT_PROC = 'ZOBAORD1'.

LWA_STAT-ACTIVATE = 'X'.

APPEND LWA_STAT TO LT_STAT.

CLEAR LT_INPUT_FIELD_NAMESM.

LS_INPUT_FIELDS-REF_GUID = LS_STATUS_WRK2-GUID.

LS_INPUT_FIELDS-REF_KIND = 'A'.

LS_INPUT_FIELDS-OBJECTNAME = 'STATUS'.

LS_LOGICAL_KEY-USER_STAT_PROC = 'ZOBAORD1'.

LS_LOGICAL_KEY-STATUS = 'E0003'.

LS_INPUT_FIELDS-LOGICAL_KEY = LS_LOGICAL_KEY.

LS_INPUT_FIELD_NAMESM-FIELDNAME = 'ACTIVATE'.

LS_INPUT_FIELD_NAMESM-CHANGEABLE = ''.

APPEND LS_INPUT_FIELD_NAMESM TO LT_INPUT_FIELD_NAMESM.

LS_INPUT_FIELDS-FIELD_NAMES[] = LT_INPUT_FIELD_NAMESM[].

INSERT LS_INPUT_FIELDS INTO TABLE LT_CTINPUT_FIELDSM.

CALL FUNCTION 'CRM_ORDER_MAINTAIN'

EXPORTING

IT_STATUS = LT_STAT "mod by Richa

CHANGING

CT_INPUT_FIELDS = LT_CTINPUT_FIELDSM

EXCEPTIONS

ERROR_OCCURRED = 1

DOCUMENT_LOCKED = 2

NO_CHANGE_ALLOWED = 3

NO_AUTHORITY = 4

OTHERS = 5.

IF SY-SUBRC = 0.

DATA : LIT_RET TYPE TABLE OF BAPIRET2,

LIT_OBJ_TO_SAVE TYPE TABLE OF BAPIBUS20001_GUID_DIS,

LIT_SAVED_OBJ TYPE TABLE OF BAPIBUS20001_OBJECT_ID.

APPEND LV_GUID16 TO LIT_OBJ_TO_SAVE.

CALL FUNCTION 'BAPI_BUSPROCESSND_SAVE'

TABLES

OBJECTS_TO_SAVE = LIT_OBJ_TO_SAVE

SAVED_OBJECTS = LIT_SAVED_OBJ

RETURN = LIT_RET.

Tags:
Not what you were looking for? View more on this topic or Ask a question