Skip to Content
0

Populate Non-Selling Activity Dates based on Activity Header Data

Feb 11 at 12:06 PM

22

avatar image
Former Member

Hi All,

i have requirement to populate Dates tab in Non-Selling Activity based on selected values from Activity Header. i implement the BADI "crm_appointment_badi" and in "CRM_APPOINTMENT_MERGE" method i write the code to update the value based on activity header data value, requirement is to update Recurring End Date, Duration and Duration type in Dates tab. (its calling only when i do any update or add operation in Dates section and not all appt_types are comming in CS_APPointment_BADI_APPT_TYPE. ) requirement is update the fields upon save (Creation/ updation ) any advice?

 IF cs_appointment_badi-appt_type = 'RECUEND' OR cs_appointment_badi-appt_type = 'FREQUENCY'.

      CLEAR lv_timestamp.

      INSERT cs_appointment_badi-ref_guid INTO TABLE lt_header_guid.

      CALL FUNCTION 'CRM_ORDER_READ'

        EXPORTING

          it_header_guid       = lt_header_guid

        IMPORTING

          et_orderadm_h        = lt_orderadm_h

          et_activity_h        = lt_activity_h

        EXCEPTIONS

          document_not_found   = 1

          error_occurred       = 2

          document_locked      = 3

          no_change_authority  = 4

          no_display_authority = 5

          no_change_allowed    = 6

          OTHERS               = 7.



      IF line_exists( lt_activity_h[ 1 ] )

        AND lt_activity_h[ 1 ]-zzafld00004v IS NOT INITIAL

        AND lt_activity_h[ 1 ]-zzafld00004w IS NOT INITIAL

        AND cs_appointment_badi-appt_type = 'FREQUENCY'.



        cs_appointment_badi-duration = lt_activity_h[ 1 ]-zzafld00004v.

        cs_appointment_badi-time_unit = lt_activity_h[ 1 ]-zzafld00004w.



      ENDIF.



      IF line_exists( lt_activity_h[ 1 ] )

        AND lt_activity_h[ 1 ]-zzafld00004u IS NOT INITIAL

        AND cs_appointment_badi-appt_type = 'RECUEND'.



        lv_tz = 'UTC'.

        lv_date = lt_activity_h[ 1 ]-zzafld00004u.



        CONVERT DATE lv_date  TIME lv_tim

          DAYLIGHT SAVING TIME ' ' INTO

           TIME STAMP lv_timestamp TIME ZONE lv_tz.



        cs_appointment_badi-timestamp_from = lv_timestamp.

        cs_appointment_badi-timestamp_to = lv_timestamp.

        cs_appointment_badi-mode = 'B'.

      ENDIF.

    ENDIF.
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers