Skip to Content
author's profile photo Former Member
Former Member

CRM_ORDER_MAINTAIN / SAVE don't work?

Hello,

I want to change the priority of a CRM order(e.g. Object-id: 9999000241 , Header-GUID: F3330F14B8A20A43BEEDDD3B6791395F). According to some threads here, I used three FMs: CRM_ORDER_MAINTAIN, CRM_ORDER_SAVE and CRM_ORDER_INITIALIZE. I pasted the codes below. After running the report I got the result as follows, which is exactly what I expected:

-


05.10.2005

10:30:48

F3330F14B8A20A43BEEDDD3B6791395F

saved object: F3330F14B8A20A43BEEDDD3B6791395F

9999000241

-


It seems to be OK, but in the CRM order the priority remains unchanged.

Do I forget something?

Thanks.

Nuno

&----


REPORT Z_CRM_ORDER_TEST_03.

DATA: IGUID TYPE CRMT_OBJECT_GUID.

DATA: IT_ACTIVITY TYPE CRMT_ACTIVITY_H_COMT,

IS_ACTIVITY LIKE LINE OF IT_ACTIVITY.

DATA: LT_ORDERADM_H TYPE CRMT_ORDERADM_H_COMT,

LS_ORDERADM_H LIKE LINE OF LT_ORDERADM_H.

DATA: LT_EXCEPTION TYPE CRMT_EXCEPTION_T.

DATA: LT_OBJECTS_TO_SAVE TYPE CRMT_OBJECT_GUID_TAB.

DATA: LS_INPUT_FIELD_NAMES TYPE CRMT_INPUT_FIELD_NAMES,

LT_INPUT_FIELD_NAMES TYPE CRMT_INPUT_FIELD_NAMES_TAB,

LS_INPUT_FIELDS TYPE CRMT_INPUT_FIELD,

LT_INPUT_FIELDS TYPE CRMT_INPUT_FIELD_TAB.

  • Updated documents.

DATA: LT_SAVED_OBJECTS TYPE CRMT_RETURN_OBJECTS,

LS_SAVED_OBJECTS LIKE LINE OF LT_SAVED_OBJECTS,

LT_OBJECTS_NOT_SAVED TYPE CRMT_OBJECT_GUID_TAB.

  • Local update task.

DATA: LV_UPDATE_TASK_LOCAL TYPE BOOLEAN.

DATA: GV_FIRST TYPE STRING.

IGUID = 'F3330F14B8A20A43BEEDDD3B6791395F'.

INSERT IGUID INTO TABLE LT_OBJECTS_TO_SAVE.

LS_ORDERADM_H-GUID = IGUID.

LS_ORDERADM_H-OBJECT_ID = '9999000241'.

INSERT LS_ORDERADM_H INTO TABLE LT_ORDERADM_H.

LS_INPUT_FIELD_NAMES-FIELDNAME = 'PRIORITY'.

INSERT LS_INPUT_FIELD_NAMES INTO TABLE LT_INPUT_FIELD_NAMES.

LS_INPUT_FIELDS-REF_HANDLE = '0000000000'.

LS_INPUT_FIELDS-REF_KIND = 'A'.

LS_INPUT_FIELDS-REF_GUID = IGUID.

LS_INPUT_FIELDS-OBJECTNAME = 'ACTIVITY_H'.

LS_INPUT_FIELDS-FIELD_NAMES = LT_INPUT_FIELD_NAMES.

INSERT LS_INPUT_FIELDS INTO TABLE LT_INPUT_FIELDS.

IS_ACTIVITY-REF_HANDLE = '0000000000'.

IS_ACTIVITY-REF_GUID = IGUID.

IS_ACTIVITY-PRIORITY = '4'.

INSERT IS_ACTIVITY INTO TABLE IT_ACTIVITY.

IF NOT IS_ACTIVITY IS INITIAL.

CALL FUNCTION 'CRM_ORDER_MAINTAIN'

EXPORTING

IT_ACTIVITY_H = IT_ACTIVITY

IMPORTING

ET_EXCEPTION = LT_EXCEPTION

CHANGING

CT_ORDERADM_H = LT_ORDERADM_H

CT_INPUT_FIELDS = LT_INPUT_FIELDS

EXCEPTIONS

ERROR_OCCURRED = 1

DOCUMENT_LOCKED = 2

NO_CHANGE_ALLOWED = 3

NO_AUTHORITY = 4

OTHERS = 5.

ENDIF.

  • Save the changed date values.

IF NOT LT_OBJECTS_TO_SAVE IS INITIAL.

CALL FUNCTION 'CRM_ORDER_SAVE'

EXPORTING

IT_OBJECTS_TO_SAVE = LT_OBJECTS_TO_SAVE

IV_UPDATE_TASK_LOCAL = 'X'

IMPORTING

ET_SAVED_OBJECTS = LT_SAVED_OBJECTS

  • ET_EXCEPTION = LT_EXCEPTION

  • ET_OBJECTS_NOT_SAVED = LT_OBJECTS_NOT_SAVED

EXCEPTIONS

DOCUMENT_NOT_SAVED = 1

OTHERS = 2.

IF SY-SUBRC <> 0.

EXIT.

ENDIF.

ENDIF.

CALL FUNCTION 'CRM_ORDER_INITIALIZE'

EXPORTING

IT_GUIDS_TO_INIT = LT_OBJECTS_TO_SAVE

EXCEPTIONS

ERROR_OCCURRED = 1

OTHERS = 2

.

LOOP AT LT_OBJECTS_TO_SAVE INTO IGUID.

WRITE:/ IGUID.

ENDLOOP.

LOOP AT LT_SAVED_OBJECTS INTO LS_SAVED_OBJECTS.

WRITE:/ 'saved object: ', LS_SAVED_OBJECTS-GUID,

/ LS_SAVED_OBJECTS-OBJECT_ID.

ENDLOOP.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 05, 2005 at 10:44 AM

    Hi,

    Do you have to perform a commit work as well to ensure the updates occur?

    Thanks,

    Gareth.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.