cancel
Showing results for 
Search instead for 
Did you mean: 

CRM_COPY_BADI

Former Member
0 Kudos

I am trying to copy data from a Quote to Order in CRM by using the Badi CRM_COPY_BADI. I am trying to use the methods COPY, ORDERADM_H, CUSTOMER_H to copy the Data. Can anybody give me any Sample Codes for this or with the corresponding Function Modules to use in the Methods that I am using since i am fairly new to CRM.

Accepted Solutions (0)

Answers (2)

Answers (2)

gaurab_banerji
Active Participant
0 Kudos

This is how I copied dates.

METHOD if_ex_crm_copy_badi~dates.

* DATA: lw_input_field_names TYPE crmt_input_field_names.

CONSTANTS: lc_appt_type TYPE crmt_apptype VALUE 'Z_INC_DATE'.

* IF cs_date-appt_type EQ lc_appt_type.
* GET TIME STAMP FIELD DATA(lv_ts).
* cs_date-timestamp_from = lv_ts.
* cs_date-timestamp_to = lv_ts.
* ENDIF.

DATA: lt_fnames TYPE crmt_input_field_names_tab,
ls_fnames TYPE crmt_input_field_names.
FIELD-SYMBOLS: <ls_input_fields> LIKE LINE OF ct_input_fields.

CHECK cs_date-appt_type EQ lc_appt_type.

READ TABLE ct_input_fields ASSIGNING <ls_input_fields> WITH KEY logical_key = cs_date-appt_type.

IF <ls_input_fields> IS ASSIGNED.

CLEAR ls_fnames.
ls_fnames-fieldname = 'APPT_TYPE'.
INSERT ls_fnames INTO TABLE lt_fnames.
ls_fnames-fieldname = 'TIMESTAMP_FROM'.
INSERT ls_fnames INTO TABLE lt_fnames.
ls_fnames-fieldname = 'TIMEZONE_FROM'.
INSERT ls_fnames INTO TABLE lt_fnames.

<ls_input_fields>-field_names = lt_fnames.

ENDIF.

ENDMETHOD.

former_member927251
Active Contributor
0 Kudos

Hi Krish,

1. Pass the Quote GUID to CRM_ORDER_READ to get the required data for the order.

2. Use the data from the step1 to populate the BAPI_BUSPROCESSND_CREATEMULTI function module to create the order.

3. Call BAPI_BUSPROCESSND_SAVE to save the contract.

4. Call BAPI_TRANSACTION_COMMIT to commit the transaction.

<b>Reward points if it helps and feel free to ask further queries.</b>

Regards,

Amit Mishra

Former Member
0 Kudos

I think in CRM_COPY_BADI you only need to write code for copying customer fields. Rest can be taken care by copy control customizing. Customize a copy control from your quotation transaction to the Sales order transaction at transaction level AND item category level. For custom fields in quotation do as mentioned in earlier reply to this thread i.e. pass header guid --> CRM_ORDER_READ to read quotation and then call BAPI_BUSPROCESSSND_CHANGMULTI to just change for custom fields (if any).

Hope this gives you more idea.