on 01-09-2007 9:33 PM
Kia Ora!
Business requires the pricing date in Pricing for a sales order line with the requested delivery date, when the order is created or changed.
I attempted the following code in the BADI IF_EX_ORDER_SAVE~PREPARE,
Read the Order (with Items) based on the GUID (iv_guid)
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_header_guid
iv_no_auth_check = 'X'
IMPORTING
et_pricing = lt_pricing
et_sales = lt_sales "(Requested delivery date is BLANK)
EXCEPTIONS
document_not_found = 1
error_occurred = 2
document_locked = 3
no_change_authority = 4
no_display_authority = 5
no_change_allowed = 6.
FIELD-SYMBOLS: <pricing> TYPE LINE OF crmt_pricing_wrkt.
DATA: ls_pricing TYPE crmt_pricing_com,
lt_exception TYPE crmt_exception_t,
lt_pricing2 TYPE crmt_pricing_comt.
LOOP AT lt_pricing ASSIGNING <pricing> WHERE ref_kind = 'B'.
<pricing>-price_date = sy-datum + 2. "Hardcoding just to test
MOVE-CORRESPONDING <pricing> TO ls_pricing.
APPEND ls_pricing TO lt_pricing2.
data: ls_input_field TYPE crmt_input_field,
ls_input_field_names TYPE crmt_input_field_names,
lt_input_field_names TYPE crmt_input_field_names_tab.
ls_input_field-ref_guid = <pricing>-guid.
ls_input_field-objectname = 'PRICING'.
ls_input_field-ref_kind = 'B'.
ls_input_field_names-fieldname = 'PRICE_DATE'.
INSERT ls_input_field_names INTO TABLE lt_input_field_names.
ls_input_field-field_names = lt_input_field_names.
append ls_input_field to lt_input_fields.
ENDLOOP.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_pricing = lt_pricing2
IMPORTING
et_exception = lt_exception
CHANGING
ct_input_fields = lt_input_fields
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 5.
Does not update the pricing date at all.
Any help is much appreciated.
TIA
John Kuriakose
If am not mistaken doesnt it defaults from the Pricing configurator.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I achieved this by creating a callback function CRM_UPDATE_PRICING_DATE_EC and attaching it to the object SCHEDLIN event AFTER_CREATE and AFTER_CHANGE using transaction CRMV_EVENT.
Within the function module, I executed CRM_SCHEDLIN_READ_OW to read the schedule line date schedlin-from_time, then CRM_PRICING_READ_OW to get the pricing record, set the PRICE_DATE to the schedule line date, and updated the pricing record using CRM_PRICING_CHANGE_OW.
User | Count |
---|---|
6 | |
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.