on 04-08-2009 11:28 AM
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
Well, during debugging an implicit COMMIT WORK is executed on a regular basis. This might cause the ITEM GUID to be created during debugging.
However, normally, after CRM_ORDER_MAINTAIN, you should use the CRM_ORDER_SAVE as well. This will return a list of SAVED_OBJECTS. If all objects were saved correctly, do an explicit COMMIT WORK.
Works fine for us.....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.