cancel
Showing results for 
Search instead for 
Did you mean: 

CRM_ORDER_MAINTAIN works only in debug mode!

Former Member
0 Kudos

Hi Experts,

I am currently facing a strange issue. I am trying to add a line item to a service ticket, but the code works only in debug mode. Sample code is given below:

lv_product_i-ref_handle = '0000000001'.

lv_product_i-ref_guid = lv_header_guid.

INSERT lv_product_i INTO TABLE lt_product_i.

ls_orderadm_i-header = lv_header_guid.

ls_orderadm_i-itm_type = 'ZSG5'.

ls_orderadm_i-number_int = '0000000010'.

ls_orderadm_i-ordered_prod = 'SERVICEITEM_SG5'.

ls_orderadm_i-handle = '0000000001'.

ls_orderadm_i-mode = 'A'.

ls_orderadm_i-itm_proc_ident = 'SRVC'.

INSERT ls_orderadm_i INTO TABLE lt_orderadm_i.

ls_input_fields-ref_handle = '0000000001'.

ls_input_fields-objectname = 'ORDERADM_I'.

CLEAR ls_field_names.

ls_field_names-fieldname = 'HANDLE'.

APPEND ls_field_names TO ls_input_fields-field_names.

ls_field_names-fieldname = 'HEADER'.

APPEND ls_field_names TO ls_input_fields-field_names.

ls_field_names-fieldname = 'ITM_PROC_IDENT'.

APPEND ls_field_names TO ls_input_fields-field_names.

ls_field_names-fieldname = 'ITM_TYPE'.

APPEND ls_field_names TO ls_input_fields-field_names.

ls_field_names-fieldname = 'MODE'.

APPEND ls_field_names TO ls_input_fields-field_names.

ls_field_names-fieldname = 'NUMBER_INT'.

APPEND ls_field_names TO ls_input_fields-field_names.

ls_field_names-fieldname = 'ORDERED_PROD'.

APPEND ls_field_names TO ls_input_fields-field_names.

INSERT ls_input_fields INTO TABLE lt_input_fields.

CALL FUNCTION 'CRM_ORDER_MAINTAIN'

EXPORTING

it_product_i = lt_product_i

CHANGING

ct_orderadm_i = lt_orderadm_i

ct_input_fields = lt_input_fields

EXCEPTIONS

error_occurred = 1

document_locked = 2

no_change_allowed = 3

no_authority = 4

OTHERS = 5.

LOOP AT lt_orderadm_i INTO lv_tempvar.

lv_item_guid = lv_tempvar-guid.

ENDLOOP.

The item guid is coming as initial and no item is being added.But if i put a breakpoint in CRM_ORDER_MAINTIAN, then the guid is being generated properly. Any pointers why the code is behaving like this or someone has faced a similar issue before?

Thanks and Regards,

Rohit

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Rohit,

please add the function module CRM_ORDER_SAVE after the order_maintain FM!

It's necessary to save the changes..

regards

marc

former_member189678
Active Contributor
0 Kudos

Hi Rohit,

After your CRM_ORDER_MAINTAIN check for sy-subrc = 0 and then commit.

IF sy-subrc = 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

ENDIF.

Then You can get the information from the FM CRM_ORDER_READ by passing in the header Guid.

See if this works out.

Regards,

Harshit

Former Member
0 Kudos

Hi,

Instead of using CRM_ORDER_MAINTAIN function, try to use

CRM_ORDER_I_MAINTAIN_MULTI_OW

CRM_ORDER_I_MAINTAIN_SINGLE_OW.

regards.