on 01-08-2007 7:56 PM
Hi CRM friends,
When I am saving the Order after changing the quantity (say from <b>5 to 10</b>); Now base on some conditions, quantity must be reverted back to the original quantity (i.e to 5). This has to be done while saving the order in a Call back function module. I have the following parameters:
1. Item Guid
2. Old Value (i.e 5)
3. Header Guid
I have tried using FM CRM_SCHEDLIN_I_MAINTAIN_OW using the following code:
DATA: LS_FIELDS TYPE CRMT_INPUT_FIELD,
LT_FIELDS TYPE CRMT_INPUT_FIELD_TAB,
LS_QTY TYPE CRMT_SCHEDLIN_EXTD,
LS_SCHEDLIN TYPE CRMT_SCHEDLIN_I_COM,
LT_SCHEDLIN TYPE CRMT_SCHEDLIN_I_COMT.
LS_FIELD_NAMES-FIELDNAME = 'QUANTITY'.
LS_FIELD_NAMES-CHANGEABLE = 'X'.
INSERT LS_FIELD_NAMES INTO TABLE LS_FIELDS-FIELD_NAMES.
LS_FIELDS-REF_HANDLE = 1.
LS_FIELDS-REF_GUID = IV_OBJECT_GUID. A88DE289D91D464C81052646DB6856BB
LS_FIELDS-REF_KIND = 'B'.
LS_FIELDS-OBJECTNAME = 'SCHEDLIN_I'.
INSERT LS_FIELDS INTO TABLE LT_FIELDS.
LS_QTY-GUID = ls_schedlin_i_new-GUID. A88DE289D91D464C81052646DB6856BB / 1D72D133BF86FC4F81BC8F0F88438136(From table CRMD_SCHEDLIN passing the item guid )
LS_QTY-ITEM_GUID = IV_OBJECT_GUID. A88DE289D91D464C81052646DB6856BB
LS_QTY-QUANTITY = lV_OLD_ORDER_QTY.
LS_QTY-MODE = 'B'.
LS_QTY-EVENT_TYPE_APPL = 'CRMS'.
LS_QTY-EVENT_TYPE = 'ORDER'.
LS_QTY-SCHED_NO_EXT = '0001'.
LS_SCHEDLIN-REF_GUID = IV_OBJECT_GUID.
LS_SCHEDLIN-REF_HANDLE = 1.
LS_SCHEDLIN-MODE = 'B'.
INSERT LS_QTY INTO TABLE LS_SCHEDLIN-SCHEDLINES.
CALL FUNCTION 'CRM_SCHEDLIN_I_MAINTAIN_OW'
CHANGING
CS_SCHEDLIN_I_COM = LS_SCHEDLIN
CT_INPUT_FIELDS = LT_FIELDS.
The code is executing fine, but the quantity changes to new one (i.e. <b>10</b>) Please tell me whether there is a mistake in passing the parameters. For LS_QTY-guid I have tried passing with item guid as well as schedule line guid from the table CRMD_SCHEDLIN.
Also tell me there is any other way.
Regards
Naveen.
hi use this code in
order_save-prepare method
The refrence code is from FM 'CRM_COMP_PROD_INS_AS_SUBITEMS' and include LCRM_COMP_PROD_UIF13
It does work. I am copying the main line item in sub line item and changing the quantity.
regards
M
cs_schedlin_i-ref_handle = iv_handle.
fill input_field
ls_input_field-ref_handle = iv_handle.
ls_input_field-ref_kind = gc_object_ref_kind-orderadm_i.
ls_input_field-objectname = gc_object_name-schedlin.
get handle
CALL FUNCTION 'CRM_INTLAY_GET_HANDLE'
IMPORTING
ev_handle = ls_schedlines-handle.
ls_schedlines-mode = gc_mode-create.
ls_schedlines-parent_sdln_guid = iv_own_item_guid.
ls_schedlines-logical_key = ls_schedlines-handle.
ls_schedlines-quantity = 1.
INSERT ls_schedlines INTO TABLE cs_schedlin_i-schedlines.
ls_input_field_names-fieldname = gc_fld_schedlin-handle.
INSERT ls_input_field_names INTO
TABLE ls_input_field-field_names.
ls_input_field_names-fieldname = gc_fld_schedlin-parent_sdln_guid.
INSERT ls_input_field_names INTO
TABLE ls_input_field-field_names.
ls_input_field_names-fieldname = gc_fld_schedlin-logical_key.
INSERT ls_input_field_names INTO
TABLE ls_input_field-field_names.
ls_input_field_names-fieldname = gc_fld_schedlin-quantity.
INSERT ls_input_field_names INTO
TABLE ls_input_field-field_names.
ls_input_field-logical_key = ls_schedlines-handle.
INSERT ls_input_field INTO TABLE ct_input_field.
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.