Skip to Content
0
Former Member
Dec 12, 2011 at 03:18 PM

CRM_COPY_BADI - Copying dates

170 Views

Hi Experts,

I am using CRM_COPY_BADI to pass few custom date types from one custom activity type to other custom activity type. During debug I can see the values are coming from source activity type but they are not copied to target activity type. I am using DATES method of BADI. Can someone provide sample code how to pass the data?

I am using following code

  DATA:
        ls_input_field_names   TYPE crmt_input_field_names,
        ls_input_field         TYPE crmt_input_field,
        ls_ct_input_field      TYPE crmt_input_field,
        it_input_field         TYPE crmt_input_field_tab
        .

  FIELD-SYMBOLS:
                <fs_ref_dates> TYPE crmt_date_wrk.

	IF cs_date-appt_type EQ lc_orderplanned.
          READ TABLE it_ref_dates ASSIGNING <fs_ref_dates> WITH KEY appt_type = cs_date-appt_type.
          IF sy-subrc EQ 0.
            cs_date-duration       = <fs_ref_dates>-duration.
            cs_date-time_unit      = <fs_ref_dates>-time_unit.
            cs_date-is_duration    = <fs_ref_dates>-is_duration.

            ls_input_field-ref_guid    = ls_ct_input_field-ref_guid.
            ls_input_field-ref_kind    = ls_ct_input_field-ref_kind.
            ls_input_field-objectname  = ls_ct_input_field-objectname.
            ls_input_field-logical_key = cs_date-appt_type.

            ls_input_field_names-fieldname = 'DURATION'.
            APPEND ls_input_field_names TO ls_input_field-field_names.
            ls_input_field_names-fieldname = 'IS_DURATION'.
            APPEND ls_input_field_names TO ls_input_field-field_names.
            ls_input_field_names-fieldname = 'TIME_UNIT'.
            APPEND ls_input_field_names TO ls_input_field-field_names.


            APPEND ls_input_field TO it_input_field.
            ct_input_fields = it_input_field.
          ENDIF.  
        ENDIF.  

Any help?

Thank you,