cancel
Showing results for 
Search instead for 
Did you mean: 

time capture in date rule depending on priority change in Order_save BADI

Former Member
0 Kudos

Hi,

Is there a possibility to link the priority to a dateprofile

Is there a how to guide / documentation available for CRMV_EVENT -transaction and Date rules (XML format). We need to add/update dates and time based on priority changes.

will the badi order_save helpful?If so which methods will help to do the required code .

Any help?

Friends any help?

I found that this can be achieved through order_save BADI .Is that the way?

Any programming samples

Thanking u for the reply,

sree

Edited by: Sree on Sep 17, 2008 5:08 AM

Edited by: Sree on Sep 17, 2008 10:02 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

i have made sth similar. but used CRM_ORDER_STATUS badi, and filter was status and status profile eg. E0001ZSTAT1.

in AFTER_CHANGE method of badi implementation i called "CALL FUNCTION 'CRM_APPT_MAINTAIN_MULTI_OW'"

to change dates on activity.

i defined data:

data lt_appointment type CRMT_APPOINTMENT_COMT.

data ls_appoinment type CRMT_APPOINTMENT_COM.

data lt_input_fields type CRMT_INPUT_FIELD_TAB.

data ls_input_fields type CRMT_INPUT_FIELD.

and fill it with appointment type (appt_type), rule_name, timestamp_from, timezone_from, also ref_guid with documents guid and ref_kind = A, and so on.

input fields are also important because with them function module knows which fields to update.

eg

CALL FUNCTION 'CRM_APPT_MAINTAIN_MULTI_OW'

EXPORTING

iv_ref_guid = is_status_wrk-guid

iv_ref_kind = 'A'

it_appointment_com = lt_appointment

CHANGING

ct_input_fields = lt_input_fields

EXCEPTIONS

PRECONDITION_VIOLATION = 1

INVARIANT_VIOLATION = 2

OTHERS = 3.

I would advice you to set breakpoint in CRM_ORDER_MAINTAIN function module, and change in you document that dates, then i debug mode you will see which input fields and which fields with dates you will need to fill in badi.

in order_save badi we also used some FMs to change values on documet so i think it could be useful for you.

we used here CHECK_BEFORE_SAVE method.

Regards

Radek

Former Member
0 Kudos

Hi Radek,

Thank u very much for the reply,by ur reply understood u too had worked on this.

May I have sample code which u have done.

here I have to capture the time in the dates rule when the status is changed .

May i have the code written by u for this.

thanking u for the reply,

Sree.

Former Member
0 Kudos

Hi,

i cannot give you exact code, but here you have it almost similar, i didnt compile it but believe it works:

method IF_EX_CRM_ORDER_STATUS~AFTER_CHANGE.

"if status of doc is e0002

IF ( is_status_wrk-status = 'E0002').

"data creation

DATA lt_header_guid TYPE crmt_object_guid_tab.

DATA ls_header_guid TYPE crmt_object_guid.

data lt_lead_h type CRMT_LEAD_H_COMT.

data ls_lead_h type CRMT_LEAD_H_COM.

data lt_appointment type CRMT_APPOINTMENT_COMT.

data ls_appoinment type CRMT_APPOINTMENT_COM.

data ls_tmp_timestamp type CRMT_DATE_TIMESTAMP_FROM.

data lt_input_fields type CRMT_INPUT_FIELD_TAB.

data ls_input_fields type CRMT_INPUT_FIELD.

data lt_field_name type CRMT_INPUT_FIELD_NAMES_TAB.

data ls_field_name type CRMT_INPUT_FIELD_NAMES.

data ls_logical_date_key type CRMT_DATE_LOGICAL_DATE_KEY.

data ls_app_tmp type CRMT_INTLAY_PROC_APPT_COM.

ls_app_tmp-appt_type = 'ZDATE_END'.

DATA:

l_datum LIKE sy-datlo, " Date

l_ctime LIKE sy-timlo. " Current time

l_datum = sy-datlo.

l_ctime = sy-timlo.

"conversion because sap displayed in my gui time about 1 or 2 hours back - sth with time zones.

"with this conversion everything went ok in my implementation

CONVERT DATE l_datum

TIME l_ctime

INTO TIME STAMP ls_tmp_timestamp TIME ZONE sy-zonlo.

ls_app_tmp-timestamp_from = ls_tmp_timestamp.

ls_appoinment-ref_guid = is_status_wrk-guid.

ls_appoinment-ref_kind = 'A'.

ls_appoinment-appt_type = 'ZDATE_END'.

ls_appoinment-rule_name = '000000000003'.

ls_appoinment-timestamp_from = ls_tmp_timestamp.

ls_appoinment-TIMEZONE_FROM = 'CET'.

INSERT ls_appoinment into table lt_appointment.

**input fields filling, like i told you this is very important in update fms in crm

ls_field_name-fieldname = 'DOMINANT'.

insert ls_field_name into table lt_field_name.

ls_field_name-fieldname = 'DURATION'.

insert ls_field_name into table lt_field_name.

ls_field_name-fieldname = 'RULE_NAME'.

insert ls_field_name into table lt_field_name.

ls_field_name-fieldname = 'SHOW_LOCAL'.

insert ls_field_name into table lt_field_name.

ls_field_name-fieldname = 'TIMESTAMP_FROM'.

insert ls_field_name into table lt_field_name.

ls_field_name-fieldname = 'TIMEZONE_FROM'.

insert ls_field_name into table lt_field_name.

ls_field_name-fieldname = 'TIME_UNIT'.

insert ls_field_name into table lt_field_name.

ls_input_fields-ref_guid = is_status_wrk-guid.

ls_input_fields-ref_kind = 'A'.

ls_input_fields-objectname = 'APPOINTMENT'.

ls_input_fields-logical_key = 'ZDATE_END'.

ls_input_fields-field_names = lt_field_name.

insert ls_input_fields into table lt_input_fields.

*and FM for change executing

CALL FUNCTION 'CRM_APPT_MAINTAIN_MULTI_OW'

EXPORTING

iv_ref_guid = is_status_wrk-guid

iv_ref_kind = 'A'

it_appointment_com = lt_appointment

CHANGING

ct_input_fields = lt_input_fields

EXCEPTIONS

PRECONDITION_VIOLATION = 1

INVARIANT_VIOLATION = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endif.

endmethod.