Skip to Content
author's profile photo Former Member
Former Member

CRM_COPY_BADI - Copying dates

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,

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Dec 12, 2011 at 05:43 PM

    Hello,

    In SAP standard the dates in sales processes are not copied to follow-up documents. Usually all dates are determined according to the date rules. If you want to copy the date fields you have to use the BAdI

    CRM_COPY_BADI. In function module CRM_DATES_COPY_EC the system loops over every single date field of the predecessing document and this BAdI is called everytime.

    Please check if you have used Transaction CRMV_EVENT to register callback module CRM_DATES_COPY

    [SAP Note 561538|: https://service.sap.com/sap/support/notes/561538

    I hope this information is helpful.

    Best Regards

    Reshma Rao

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.