cancel
Showing results for 
Search instead for 
Did you mean: 

SAP CRM :How to change the Date management Duration value at run time in BADI

Former Member
0 Kudos

Hi Frds,

How to update the date management duration value(number of month) in CRM_APPOINTMENT_BADI.

Example:

Duration = END date - Start Date.

When END Date manually change in Web UI--> BADI Trigger --> In Badi need to update Duration

Plese suggeste,

Thanks,

Rajan

Accepted Solutions (0)

Answers (1)

Answers (1)

spencer_liang
Active Contributor
0 Kudos

Dear Rajan,

Let me provide you some further input.

1st, you need to create a z implementation in crm_appointment_badi in tcode se18.

2nd, write your own code in IF_EX_CRM_APPOINTMENT_BADI~CRM_APPOINTMENT_MERGE

30IF_EX_CRM_APPOINTMENT_BADI~CRM_APPOINTMENT_MERGEZCL_SPENCER_DATE_BADI=========CP
29IF_EX_CRM_APPOINTMENT_BADI~CRM_APPOINTMENT_MERGECL_EX_CRM_APPOINTMENT_BADI====CP
28APPOINTMENT_BADI_MERGESAPLCRM_ACTIVITY_FOREIGN_OW
27CRM_APPOINTMENT_MERGE_OWSAPLCRM_ACTIVITY_FOREIGN_OW
26CRM_APPOINTMENT_FILL_OWSAPLCRM_ACTIVITY_FOREIGN_OW
25CRM_APPOINTMENT_CHANGE_OWSAPLCRM_ACTIVITY_FOREIGN_OW
24CRM_APPT_MAINTAIN_SINGLE_OWSAPLCRM_ACTIVITY_FOREIGN_OW
23CRM_APPT_MAINTAIN_MULTI_OWSAPLCRM_ACTIVITY_FOREIGN_OW
22CRM_DATES_DETERM_INITIAL_ECSAPLCRM_DATES_EC

This crm_appointment_merge is called every time after system determine or modify an existing date type and duration. and provide user a chance to change this date type or duration.

basically, you need to write something in this method like below.

* duration is DURATION. start time is CONTSTART and end time is CONTEND.

if CS_APPOINTMENT_BADI-appt_type = 'DURATION' .

* read teh contstart and contend

* you need to find the proper FM to calculate contstart - contend = ? months. I do not know it.

* assign ? months to CS_APPOINTMENT_BADI-DURATION.

ENDIF.

If you cannot find FM to calculate contstart - contend, you may read start and end time from buffer gt_date_wrkt directly and calculate it yourself.

Spencer