cancel
Showing results for 
Search instead for 
Did you mean: 

Changing Appointments in CRM

Former Member
0 Kudos
225

Has anyone successfully updated dates on a CRM transaction using function BAPI_BUSPROCESSND_CHANGEMULTI?

If so, would you mind posting some code, please?

Accepted Solutions (1)

Accepted Solutions (1)

P000636
Active Contributor
0 Kudos

Hi Martin,

Look at maybe it helps you.

Regards.

Manuel

Former Member
0 Kudos

Hi Manuel,

Thanks for the reply. I have tried the solution in the thread, thinking perhaps my problem was the fields in the list of INPUT_FIELDS, but it is still not working.

Regards,

Martin

Former Member
0 Kudos

I get two messages back in RETURN:

S |CRM_MESSAGES <006 |Start of processing 'Individual receipt' <

E |CRM_ORDER <037 |The document could not be saved <

The first message comes up from calling BAPI_BUSPROCESSND_CHANGEMULTI and the second one from BAPI_BUSPROCESSND_SAVE. Is there a way to get more information than that?

Former Member
0 Kudos

I am posting the code of my program, so maybe you can see what I am doing wrong:

tables: crmd_orderadm_h.

DATA: RETURN TYPE TABLE OF BAPIRET2 WITH HEADER LINE.

DATA: GUID TYPE TABLE OF BAPIBUS20001_GUID_DIS WITH HEADER LINE.

DATA: APPOINTMENT TYPE TABLE OF BAPIBUS20001_APPOINTMENT_INS WITH HEADER LINE.

DATA: INPUT_FIELDS TYPE TABLE OF BAPIBUS20001_INPUT_FIELDS WITH HEADER LINE.

data: saved type TABLE OF BAPIBUS20001_OBJECT_ID with header line.

  • Select header using doc number to get guid

select single * from crmd_orderadm_h

where object_id = '0050000172'.

  • Guid from selected record

guid-guid = crmd_orderadm_h-GUID.

APPEND GUID.

  • Update input fields

INPUT_FIELDS-ref_guid = crmd_orderadm_h-guid.

INPUT_FIELDS-ref_kind = 'A'.

INPUT_FIELDS-objectname = 'APPOINTMENT'.

  • Add individual fields

INPUT_FIELDS-fieldname = 'REF_GUID'.

APPEND INPUT_FIELDS .

INPUT_FIELDS-fieldname = 'REF_KIND'.

APPEND INPUT_FIELDS .

INPUT_FIELDS-fieldname = 'REF_HANDLE'.

append INPUT_FIELDS .

INPUT_FIELDS-fieldname = 'APPT_TYPE'.

APPEND INPUT_FIELDS .

INPUT_FIELDS-fieldname = 'DATE_FROM'.

APPEND INPUT_FIELDS .

INPUT_FIELDS-fieldname = 'DATE_TO'.

APPEND INPUT_FIELDS .

INPUT_FIELDS-fieldname = 'MODE'.

APPEND INPUT_FIELDS .

INPUT_FIELDS-fieldname = 'TIMEZONE_FROM'.

APPEND INPUT_FIELDS .

INPUT_FIELDS-fieldname = 'TIMEZONE_TO'.

APPEND INPUT_FIELDS .

  • Update appointment - change to an exising record

APPOINTMENT-ref_guid = crmd_orderadm_h-guid.

APPOINTMENT-appt_type = 'CONTSIGNON'.

APPOINTMENT-timezone_from = 'CET'.

APPOINTMENT-timezone_to = 'CET'.

APPOINTMENT-date_from = sy-datum.

APPOINTMENT-time_from = sy-uzeit.

APPOINTMENT-date_to = sy-datum.

APPOINTMENT-time_to = sy-uzeit.

APPOINTMENT-mode = 'B'. "<-- Appointment type already exists, so change

APPEND APPOINTMENT.

  • Update Document

CALL FUNCTION 'BAPI_BUSPROCESSND_CHANGEMULTI'

TABLES

APPOINTMENT = APPOINTMENT

INPUT_FIELDS = INPUT_FIELDS

RETURN = return.

  • Persist Changes

CALL FUNCTION 'BAPI_BUSPROCESSND_SAVE'

EXPORTING

UPDATE_TASK_LOCAL = 'X'

TABLES

OBJECTS_TO_SAVE = GUID

SAVED_OBJECTS = saved

RETURN = RETURN.

Former Member
0 Kudos

I thought I had found the problem when I changed this section:

  • Update appointment - change to an exising record

APPOINTMENT-ref_guid = crmd_orderadm_h-guid.

APPOINTMENT-ref_kind = 'A'. "<-- Added this line

APPOINTMENT-appt_type = 'CONTSIGNON'.

as it was looking for the ref_kind indicator.

However, I still get the error message, and now I am out of ideas.

Former Member
0 Kudos

Hi Martin,

I think if you add the following entries it should work

INPUT_FIELDS-logical_key = 'CONTSIGNON'.

INPUT_FIELDS-fieldname = 'TIMESTAMP_FROM'.

APPOINTMENT-timestamp_from = sy-uzeit.

Regards,

Chamu

Former Member
0 Kudos

Hi Chamu,

I don't know how putting the appointment type in INPUT_FIELDS-logical_key is supposed to help, but now it works, so I'm happy!

Also, I had to call BAPI_TRANSACTION_COMMIT after reading the documentation on BAPI_BUSPROCESSND_SAVE.

Thank you very much!

Answers (0)