cancel
Showing results for 
Search instead for 
Did you mean: 

CRM_ORDER_MAINTAIN

Former Member
0 Kudos

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.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

You forgot to call FM BAPI_TRANSACTION_COMMIT after CRM_ORDER_SAVE.

This should do the trick.

Reward points if useful!

Regards,

Joost

Former Member
0 Kudos

Joost,

I have used BAPI_TRANSACTION_COMMIT.But it still not working.

Please help me.

Thanks

Former Member
0 Kudos

try calling

CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.

before making a call to CRM_ORDER_MAINTAIN.

Hopefully this would resolve the issue.

Regards,

Piyush

Former Member
0 Kudos

Rushi,

waht is ur error u are getting?

what is the sy-subrc ?

Robin

Former Member
0 Kudos

Rushi,

We dont need for each individual object to for Maintain FM,

try this code:. for user status : use EXTERN, for systems statys: use INTERN

DATA:

st_status_exc TYPE jstat,

it_status_exc LIKE STANDARD TABLE OF st_status_exc.

CLEAR st_status_exc.

REFRESH it_status_exc.

st_status_exc-stat = 'I1003'.

st_status_exc-inact = c_x.

APPEND st_status_exc TO it_status_exc.

st_status_exc-stat = 'I1004'.

st_status_exc-inact = space.

APPEND st_status_exc TO it_status_exc.

CALL FUNCTION 'CRM_STATUS_CHANGE_INTERN'

EXPORTING

objnr = v_objnr

TABLES

status = it_status_exc

EXCEPTIONS

object_not_found = 1

status_inconsistent = 2

status_not_allowed = 3

OTHERS = 4.

DATA a TYPE balloghndl.

  • Save the Sub-Contract

CALL FUNCTION 'CRM_ORDER_SAVE'

EXPORTING

it_objects_to_save = i_objects_to_save

iv_save_frame_log = 'X'

IMPORTING

et_saved_objects = i_saved_objects

et_exception = i_exception1

et_objects_not_saved = i_objects_not_saved

CHANGING

cv_log_handle = a

EXCEPTIONS

document_not_saved = 1

OTHERS = 2.

commit.

it will work.

Reward points if helpful.

Robin.

Former Member
0 Kudos

Hi robin,

I am trying to change the User Status hence as you suggested i have used the Extern function module.

But still the status is not changed to 'Shipped'.

Also the sy-subrc is 0 also its retrurning the changed handle and the object id, with no exception raised.

I have checked the Authorisation object in SU53 but its blank.Also i can change the status manually thru the transaction CRMD_ORDER.

Please comment.

Thanks

Rushikesh

Former Member
0 Kudos

Hi Rushin,

Just looking at your code it is very difficult to say what went wrong. I will suggest you on way to resolve your problem .Go to the particular transaction in which you are trying to change the status. Go to the debugging mode before saving. Put a break point on the FM CRM_ORDER_MAINTAIN. See what all parameters are being populated at runtime in the IMPORT and TABLES parameters. Compare them with those of yours. You will get a fair idea of what is missing.

Hope this helps.

Regards

Sourabh

Former Member
0 Kudos

Rushi,

Did u put a bapi commit work?

it shoud lwork

otherwise do this. go to CRM_ORDER_MAINTAIN, and put a breakpoint.

then do try to change the status manually, and check the import and export parameters in the debuggin mode. make a note of it. pass the same way in ur code with order save and commit after crm-order-maintain.

it shoudl work this way then.

reward points if helpful.

Robin

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I am not sure about the current approach but I think you may use other approach >

Call FM 'CRM_STATUS_READ' to read the current status. And then call FM 'CRM_STATUS_UPDATE' to modify the current status.

Before you proceed for CRM_STATUS_UPDATE > go and in table CRM_JCDS check how the status is changed by system when we change it in order.

The same logical flow you need to implement so that the status is changed properly.

Cheers,

Ashish

Former Member
0 Kudos

Hi ,

see if this helps.

640498 Return from CRM_ORDER_MAINTAIN with message

regards,

Muralidhar Prasad Chatna