on 09-25-2008 2:34 PM
Dear all,
I want to copy document X (complaint) to document type Y (sales order) in CRM online but the requested delivery date should be cleared and not copied from document X.
I am trying this with BADI "CRM_COPY_BADI" but in this BADI I can't find the field for the requested delivery date.
Anybody know which field to use or a better solution?
Regards, Maarten
Hi Eswar,
thanks for your reply. I've used your code but the method seems not to be called. I've set breakpoints in the method but SAP runs over them. '(as test I also set a breakpoint in method COPY and here SAP stops.
Do you have more advise?
Regards, Maarten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Maarten,
CRM_COPY_BADI is the right spot. When you are implementing this BADI, you have to add code to the method DATES
Hint: Ddates are mostly available in the APPOINTMENT SET of the CRM 1O objects.
You may add some code like this:
method if_ex_crm_copy_badi~dates.
* constants
include crm_appointment_types_con.
include crm_object_kinds_con.
include crm_object_names_con.
* local data
data:
ls_sales_com type crmt_sales_com,
lv_allowed type crmt_boolean,
lv_ref_kind type crmt_object_kind,
ls_input_field_names type crmt_input_field_names,
lt_input_field_names type crmt_input_field_names_tab.
field-symbols:
<fs_ref_dates> type crmt_date_wrk.
* start processing
* special behaviour only for REQ_DLV_DATE
* --> copy REQ_DLV_DATE to the default delivery date on header level
if ( not ( is_orderadm_h is initial ) )
and ( not ( is_ref_orderadm_h is initial ) )
and ( is_orderadm_i is initial )
and ( is_ref_orderadm_i is initial )
and ( cs_date-appt_type = 'REQ_DLV_DATE' ).
lv_ref_kind = gc_object_ref_kind-orderadm_h.
* is the sales set allowed for this transaction type
call function 'CRM_ORDERADM_H_OBJ_ALLOWED_OW'
exporting
iv_ref_guid = is_orderadm_h-guid
iv_objectname = gc_object_name-sales
importing
ev_allowed = lv_allowed
exceptions
admin_header_not_found = 1
others = 2.
if sy-subrc <> 0 or lv_allowed <> 'X'.
* nothing to do
return.
endif.
clear ls_input_field_names.
clear lt_input_field_names[].
ls_input_field_names-fieldname = 'REQ_DLV_DATE'.
insert ls_input_field_names into table lt_input_field_names.
ls_sales_com-ref_guid = is_orderadm_h-guid.
ls_sales_com-ref_kind = lv_ref_kind.
read table it_ref_dates
with key appt_type = 'REQ_DLV_DATE'
assigning <fs_ref_dates>.
if sy-subrc = 0.
ls_sales_com-req_dlv_date = <fs_ref_dates>-timestamp_from.
call function 'CRM_SALES_MAINTAIN_OW'
exporting
is_sales_com = ls_sales_com
* IS_SALES_COM_INT =
* IV_FIELD_SELECTION_OFF = FALSE
changing
ct_input_field_names = lt_input_field_names
exceptions
error_occurred = 1
others = 2.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endif.
endif.
endmethod.
Easwar Ram
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.