CRM_ORDER_MAINTAIN - Appointments
Hi all
A client is using the CRM interaction centre (trxn. CIC0). When a date is set in a transaction within CIC0, they want that date copied to all the follow up activities as well when the user saves.
We've already used BADI ORDER_SAVE and FM's CRM_ORDER_READ, CRM_ORDER_MAINTAIN, and CRM_ORDER_SAVE to achieve this for some customer fields that were added in on a customer screen within CIC0 but cannot seem to achieve the same thing for the standard dates (appointments). When testing, the dates don't get copied through and don't appear on the Bdoc's (getting them onto the Bdoc's is the main priority).
Any guidance from ABAP developer's experienced with this area of CRM would be greatly appreciated.
The relevant coding from within the BADI is below:- (for ease of reading I've removed the coding going through the document flow and building up the internal table of GUID's that need to have the date maintained)
METHOD if_ex_order_save~prepare .
TYPES: BEGIN OF t_guids,
guid TYPE crmt_doc_flow_wrk-objkey_a,
END OF t_guids.
* Header GUID's.
DATA: lt_header_guid TYPE crmt_object_guid_tab,
ls_header_guid TYPE crmt_object_guid,
* Read appointments.
lt_appointment_wrk TYPE crmt_appointment_wrkt,
ls_appointment_wrk TYPE crmt_appointment_wrk,
* Update appointments.
lt_appointment_com TYPE crmt_appointment_comt,
ls_appointment_com TYPE crmt_appointment_com,
* GUID's
lt_guids TYPE TABLE OF t_guids,
ls_guids TYPE t_guids,
* Update fields.
ls_input_fields TYPE crmt_input_field,
lt_input_fields TYPE crmt_input_field_tab,
ls_input_field_names TYPE crmt_input_field_names,
lt_input_field_names TYPE crmt_input_field_names_tab,
* Order header data.
lt_orderadm_h TYPE crmt_orderadm_h_comt,
* Objects to be updated.
lt_objects_to_save TYPE crmt_object_guid_tab,
* Exceptions.
lt_exception TYPE crmt_exception_t,
* Updated documents.
lt_saved_objects TYPE crmt_return_objects,
lt_objects_not_saved TYPE crmt_object_guid_tab,
* Local update task.
lv_update_task_local TYPE boolean.
* Use a global variable to ensure this method is only called once per user save.
IF gv_first IS INITIAL.
gv_first = 'X'.
* Get the dates for the current activity.
ls_header_guid = iv_guid.
INSERT ls_header_guid INTO TABLE lt_header_guid.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_header_guid
IMPORTING
et_appointment = lt_appointment_wrk
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 sy-subrc <> 0.
EXIT.
ENDIF.
DELETE lt_appointment_wrk WHERE appt_type <> 'ZLSC00003'
OR timestamp_from IS INITIAL.
* Check if the conclusion date has been set (appointment type ZLSC00003).
READ TABLE lt_appointment_wrk
INTO ls_appointment_wrk
WITH KEY appt_type = 'ZLSC00003'.
IF sy-subrc = 0.
* Coding removed here, build up the follow up GUID's from the document flow.
* lt_header_guid now contains the parent GUID and the follow up activty GUID's
* Get all of the date details for all of the documents.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_header_guid
IMPORTING
et_appointment = lt_appointment_wrk
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 sy-subrc <> 0.
EXIT.
ENDIF.
* Get rid of date entries which aren't conclusion dates or aren't the same conclusion date.
DELETE lt_appointment_wrk WHERE appt_type <> 'ZLSC00003'
OR timestamp_from <> ls_appointment_wrk-timestamp_from.
* Process each of the documents and, if they don't have a conclusion date with the same value,
* set up the internal tables to update the document.
LOOP AT lt_header_guid INTO ls_header_guid.
* Check if it has a conclusion date with the correct value already.
READ TABLE lt_appointment_wrk
WITH KEY ref_guid = ls_header_guid
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
DELETE lt_header_guid.
CONTINUE.
ENDIF.
* Set up the fields to be updated.
CLEAR lt_input_field_names.
ls_input_field_names-fieldname = 'REF_KIND'.
INSERT ls_input_field_names INTO TABLE lt_input_field_names.
ls_input_field_names-fieldname = 'APPT_TYPE'.
INSERT ls_input_field_names INTO TABLE lt_input_field_names.
ls_input_field_names-fieldname = 'TIMESTAMP_FROM'.
INSERT ls_input_field_names INTO TABLE lt_input_field_names.
ls_input_field_names-fieldname = 'TIMEZONE_FROM'.
INSERT ls_input_field_names INTO TABLE lt_input_field_names.
ls_input_field_names-fieldname = 'TIMESTAMP_TO'.
INSERT ls_input_field_names INTO TABLE lt_input_field_names.
ls_input_field_names-fieldname = 'TIMEZONE_TO'.
INSERT ls_input_field_names INTO TABLE lt_input_field_names.
ls_input_field_names-fieldname = 'TIME_UNIT'.
INSERT ls_input_field_names INTO TABLE lt_input_field_names.
ls_input_fields-ref_handle = '0000000000'.
ls_input_fields-ref_guid = ls_header_guid.
ls_input_fields-objectname = 'APPOINTMENT'.
ls_input_fields-field_names = lt_input_field_names.
INSERT ls_input_fields INTO TABLE lt_input_fields.
* Set up the values for the fields to be updated.
ls_appointment_com-ref_handle = '0000000000'.
ls_appointment_com-ref_guid = ls_header_guid.
ls_appointment_com-ref_kind = 'A'.
ls_appointment_com-appt_type = 'ZLSC00003'.
ls_appointment_com-timestamp_from = ls_appointment_wrk-timestamp_from.
ls_appointment_com-timezone_from = ls_appointment_wrk-timezone_from.
ls_appointment_com-timestamp_to = ls_appointment_wrk-timestamp_to.
ls_appointment_com-timezone_to = ls_appointment_wrk-timezone_to.
ls_appointment_com-time_unit = ls_appointment_wrk-time_unit.
INSERT ls_appointment_com INTO TABLE lt_appointment_com.
* Create an entry in the internal table used to determine which documents will be updated.
INSERT ls_header_guid INTO TABLE lt_objects_to_save.
ENDLOOP.
* Change the values in the documents
IF NOT lt_appointment_com IS INITIAL.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_appointment = lt_appointment_com
IMPORTING
et_exception = lt_exception
CHANGING
ct_orderadm_h = lt_orderadm_h
ct_input_fields = lt_input_fields
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 5.
IF sy-subrc <> 0.
EXIT.
ENDIF.
ENDIF.
* Save the changed date values.
IF NOT lt_objects_to_save IS INITIAL.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = lt_objects_to_save
iv_update_task_local = lv_update_task_local
IMPORTING
et_saved_objects = lt_saved_objects
et_exception = lt_exception
et_objects_not_saved = lt_objects_not_saved
EXCEPTIONS
document_not_saved = 1
OTHERS = 2.
IF sy-subrc <> 0.
EXIT.
ENDIF.
ENDIF.
ENDIF.
CLEAR gv_first.
ENDIF.
ENDMETHOD.
Hi All,
I am currently trying to insert a date into DATE TYPE(APPT_TYPE) in Item Level. There are no errors in the code but the transaction is not updated. Can somebody help me out ? Thanx a lot...
MOVE: gw_service_item_guid_ubb TO gw_appointment-
ref_guid,
'B' TO gw_appointment ref_kind,
'CONTDISMAN' TO gw_appointment-appt_type,
'20060901220000' TO gw_appointment-timestamp_from,
'20060901220000' TO gw_appointment-timestamp_to,
'CET' TO gw_appointment-timezone_from,
'CET' TO gw_appointment-timezone_to,
'B' TO gw_appointment-mode.
APPEND gw_appointment TO gt_appointment_ubb.
gw_fname-fieldname = 'APPT_TYPE'.
gw_fname-changeable = 'X'.
insert gw_fname into table gt_fname.
gw_fname-fieldname = 'TIMESTAMP_FROM'.
gw_fname-changeable = 'X'.
INSERT gw_fname INTO TABLE gt_fname.
gw_fname-fieldname = 'TIMESTAMP_TO'.
gw_fname-changeable = 'X'.
INSERT gw_fname INTO TABLE gt_fname.
gw_fname-fieldname = 'TIMEZONE_FROM'.
gw_fname-changeable = 'X'.
INSERT gw_fname INTO TABLE gt_fname.
gw_fname-fieldname = 'TIMEZONE_TO'.
gw_fname-changeable = 'X'.
INSERT gw_fname INTO TABLE gt_fname.
gw_input-ref_guid = gw_service_item_guid_ubb.
gw_input-ref_kind = 'B'.
gw_input-objectname = 'APPOINTMENT'.
gw_input-logical_key = '0000'.
gw_input-ref_handle = '0000000000'.
gw_input-field_names = gt_fname.
APPEND gw_input TO gt_input_fields.
gw_item-guid = gw_service_item_guid_ubb.
gw_item-header = '39CF8B702B8B334F90AF4B23CA991925'.
gw_item-ITM_TYPE = gw_orderadm_i_ubb-itm_type.
gw_item-mode = 'B'.
APPEND gw_item TO gt_item.
CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
CALL FUNCTION 'CRM_ORDER_INITIALIZE'
EXPORTING
iv_initialize_whole_buffer = true
EXCEPTIONS
OTHERS = 2.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_appointment = gt_appointment_ubb
it_status = gt_status_maint
CHANGING
CT_ORDERADM_I = gt_item
ct_input_fields = gt_input_fields
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 5.
CALL FUNCTION 'DIALOG_SET_WITH_DIALOG'.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = gt_obj_guids
IMPORTING
et_saved_objects = gt_saved_objects
et_objects_not_saved = gt_objects_not_saved
EXCEPTIONS
document_not_saved = 1
OTHERS = 2.
IF sy-subrc EQ 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.
COMMIT WORK.
Useful help will be awarded. : )
Similar Messages
-
CRM - CRM_ORDER_MAINTAIN - Appointments
Hi all
A client is using the CRM interaction centre (trxn. CIC0). When a date is set in a transaction within CIC0, they want that date copied to all the follow up activities as well when the user saves.
We've already used BADI ORDER_SAVE and FM's CRM_ORDER_READ, CRM_ORDER_MAINTAIN, and CRM_ORDER_SAVE to achieve this for some customer fields that were added in on a customer screen within CIC0 but cannot seem to achieve the same thing for the standard dates (appointments). When testing, the dates don't get copied through and don't appear on the Bdoc's (getting them onto the Bdoc's is the main priority).
Any guidance from ABAP developer's experienced with this area of CRM would be greatly appreciated.
The relevant coding from within the BADI is below:- (for ease of reading I've removed the coding going through the document flow and building up the internal table of GUID's that need to have the date maintained)
METHOD if_ex_order_save~prepare .
TYPES: BEGIN OF t_guids,
guid TYPE crmt_doc_flow_wrk-objkey_a,
END OF t_guids.
Header GUID's.
DATA: lt_header_guid TYPE crmt_object_guid_tab,
ls_header_guid TYPE crmt_object_guid,
Read appointments.
lt_appointment_wrk TYPE crmt_appointment_wrkt,
ls_appointment_wrk TYPE crmt_appointment_wrk,
Update appointments.
lt_appointment_com TYPE crmt_appointment_comt,
ls_appointment_com TYPE crmt_appointment_com,
GUID's
lt_guids TYPE TABLE OF t_guids,
ls_guids TYPE t_guids,
Update fields.
ls_input_fields TYPE crmt_input_field,
lt_input_fields TYPE crmt_input_field_tab,
ls_input_field_names TYPE crmt_input_field_names,
lt_input_field_names TYPE crmt_input_field_names_tab,
Order header data.
lt_orderadm_h TYPE crmt_orderadm_h_comt,
Objects to be updated.
lt_objects_to_save TYPE crmt_object_guid_tab,
Exceptions.
lt_exception TYPE crmt_exception_t,
Updated documents.
lt_saved_objects TYPE crmt_return_objects,
lt_objects_not_saved TYPE crmt_object_guid_tab,
Local update task.
lv_update_task_local TYPE boolean.
Use a global variable to ensure this method is only called once per user save.
IF gv_first IS INITIAL.
gv_first = 'X'.
Get the dates for the current activity.
ls_header_guid = iv_guid.
INSERT ls_header_guid INTO TABLE lt_header_guid.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_header_guid
IMPORTING
et_appointment = lt_appointment_wrk
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 sy-subrc <> 0.
EXIT.
ENDIF.
DELETE lt_appointment_wrk WHERE appt_type <> 'ZLSC00003'
OR timestamp_from IS INITIAL.
Check if the conclusion date has been set (appointment type ZLSC00003).
READ TABLE lt_appointment_wrk
INTO ls_appointment_wrk
WITH KEY appt_type = 'ZLSC00003'.
IF sy-subrc = 0.
Coding removed here, build up the follow up GUID's from the document flow.
lt_header_guid now contains the parent GUID and the follow up activty GUID's
Get all of the date details for all of the documents.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_header_guid
IMPORTING
et_appointment = lt_appointment_wrk
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 sy-subrc <> 0.
EXIT.
ENDIF.
Get rid of date entries which aren't conclusion dates or aren't the same conclusion date.
DELETE lt_appointment_wrk WHERE appt_type <> 'ZLSC00003'
OR timestamp_from <> ls_appointment_wrk-timestamp_from.
Process each of the documents and, if they don't have a conclusion date with the same value,
set up the internal tables to update the document.
LOOP AT lt_header_guid INTO ls_header_guid.
Check if it has a conclusion date with the correct value already.
READ TABLE lt_appointment_wrk
WITH KEY ref_guid = ls_header_guid
TRANSPORTING NO FIELDS.
IF sy-subrc = 0.
DELETE lt_header_guid.
CONTINUE.
ENDIF.
Set up the fields to be updated.
CLEAR lt_input_field_names.
ls_input_field_names-fieldname = 'REF_KIND'.
INSERT ls_input_field_names INTO TABLE lt_input_field_names.
ls_input_field_names-fieldname = 'APPT_TYPE'.
INSERT ls_input_field_names INTO TABLE lt_input_field_names.
ls_input_field_names-fieldname = 'TIMESTAMP_FROM'.
INSERT ls_input_field_names INTO TABLE lt_input_field_names.
ls_input_field_names-fieldname = 'TIMEZONE_FROM'.
INSERT ls_input_field_names INTO TABLE lt_input_field_names.
ls_input_field_names-fieldname = 'TIMESTAMP_TO'.
INSERT ls_input_field_names INTO TABLE lt_input_field_names.
ls_input_field_names-fieldname = 'TIMEZONE_TO'.
INSERT ls_input_field_names INTO TABLE lt_input_field_names.
ls_input_field_names-fieldname = 'TIME_UNIT'.
INSERT ls_input_field_names INTO TABLE lt_input_field_names.
ls_input_fields-ref_handle = '0000000000'.
ls_input_fields-ref_guid = ls_header_guid.
ls_input_fields-objectname = 'APPOINTMENT'.
ls_input_fields-field_names = lt_input_field_names.
INSERT ls_input_fields INTO TABLE lt_input_fields.
Set up the values for the fields to be updated.
ls_appointment_com-ref_handle = '0000000000'.
ls_appointment_com-ref_guid = ls_header_guid.
ls_appointment_com-ref_kind = 'A'.
ls_appointment_com-appt_type = 'ZLSC00003'.
ls_appointment_com-timestamp_from = ls_appointment_wrk-timestamp_from.
ls_appointment_com-timezone_from = ls_appointment_wrk-timezone_from.
ls_appointment_com-timestamp_to = ls_appointment_wrk-timestamp_to.
ls_appointment_com-timezone_to = ls_appointment_wrk-timezone_to.
ls_appointment_com-time_unit = ls_appointment_wrk-time_unit.
INSERT ls_appointment_com INTO TABLE lt_appointment_com.
Create an entry in the internal table used to determine which documents will be updated.
INSERT ls_header_guid INTO TABLE lt_objects_to_save.
ENDLOOP.
Change the values in the documents
IF NOT lt_appointment_com IS INITIAL.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_appointment = lt_appointment_com
IMPORTING
et_exception = lt_exception
CHANGING
ct_orderadm_h = lt_orderadm_h
ct_input_fields = lt_input_fields
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 5.
IF sy-subrc <> 0.
EXIT.
ENDIF.
ENDIF.
Save the changed date values.
IF NOT lt_objects_to_save IS INITIAL.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = lt_objects_to_save
iv_update_task_local = lv_update_task_local
IMPORTING
et_saved_objects = lt_saved_objects
et_exception = lt_exception
et_objects_not_saved = lt_objects_not_saved
EXCEPTIONS
document_not_saved = 1
OTHERS = 2.
IF sy-subrc <> 0.
EXIT.
ENDIF.
ENDIF.
ENDIF.
CLEAR gv_first.
ENDIF.
ENDMETHOD.Hello Mark,
did you know that there is also a Forum for SAP CRM: Webclient UI - Framework?
Regards
Gregor -
Activity status , and partner changed by FM CRM_ORDER_MAINTAIN
Hi any one used FM CRM_ORDER_MAINTAIN to change the Activity status and the BP assign to the activity. If yes please help me.
Import parameters:
it_partner
it_status
CHANGING
ct_orderadm_i
ct_input_fieldsHello Sachin,
Search for the thread "CRM_ORDER_MAINTAIN - Appointments" on SDN. This talks of your problem and should give u the exact solution.
https://forums.sdn.sap.com/post!reply.jspa?threadID=47889
Reward points if it helps !!
Rgds
Priyanka Bansal -
To create an APPOINTMENT using report in webui
Hello Experts,
Please send the steps how to create appointment or quotation or any example report program(with sample code) in web ui.I guess code in below post would help you -
CRM_ORDER_MAINTAIN - Appointments
Regards,
BJ -
ive added my work coleague to my iCloud account so we can share the calendar on our I-phones for work appointments. when he makes a purchase on iTunes i now get charged though so how do I stop this from happening? also can I just share only work appointments or do i have to share the whole calendar with him? Can I select what he sees?
Hi Frantic503,
Welcome to the Apple Support Communities!
When you are the Family Sharing organizer, purchases are billed to your account unless the family member making purchases has an iTunes Gift Card or iTunes credit on their account. The attached article has more information on how this process works.
Family Sharing - Apple Support
What I may suggest in your situation would be to discontinue the Family Sharing and use iCloud calendar sharing. Using this method keeps your accounts separate but allows you to still share your calendar.
iCloud: Share a calendar with others
Have a great day,
Joe -
They changed the way we see our appointments. That's awful! Is there a way to chnage back to the "old" way when you could see all your appointments at a glance????
Maybe I'm fool, but how I get the "day view"? I have three options on the top line, an icon that seems a computer (a square and two lines), a magnifying glass to search a especific item and a "plus" to add appointments. The "day view" isn't any more there - that's the point!!! Using the first icon a get the full month-that uses 2/3 of the screen- and two lines of appointments...To see the rest I have to slide up and down the two lines taking care to not touch the month...
-
IPhone calendar does not sync new events and appointments from Outlook
iTunes 9.2.0.61/iPhone 4.0.1 - does not sync newly added events and appointments! Previously added stuff is all there, new stuff added in Outlook 2007 just doesn't show up. I've gone back to my old Palm T|X which syncs all this stuff with no problem, so it's not an Outlook bug.
It looks like Apple has put a team of junior programmers on the Calendar app - I've seen leap-year bugs (still there), events showing up on the wrong day (still there), and I'm still waiting for the "week at a glance" view. Calendar is SO important for business use that top level "gray beard" engineers need to be on this. (Question for Apple's calendar developers: what's Zeller's Congruence? It they haven't heard of it they have no business doing calendar programming.)Spontaneously started syncing again - no idea why now, nor why it failed for so long. Related to the alarm bug? Who knows...
-
Looking for a calendar for confidential appointments
Hi,
I am getting ready to start a new job and the appointments that I will have will need to be kept very confidential. I was wondering if anyone has see an app that is some kind of calendar that has a password on it. I have iCal on my ipad however, that isn't password protected. If there is a way to password protect it that would be great, but otherwise something that to keep out everyone but me on that specifc calendar. I would prefer free but I know for something this specific it maybe hard to find, so I would be willing to pay for it. Any suggestions? Thanks!You are going to need to take a careful look at options in the App Store (search on Calendar). There are some that appear to support a passcode, but it typically isn't a feature that is front and center. Read the descriptions carefully.
Have you considered simpy setting the passcode on the iPad? -
To whom do I complain about the OS 7 calendar on the iPad 2? I used to be able to read my appointments. The new small font is horrible. Text size doesn't seem to change it. Can I change it?
Try this - Reset the iPad by holding down on the Sleep and Home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons. (This is equivalent to rebooting your computer.) No data/files will be erased. http://support.apple.com/kb/ht1430http://support.apple.com/kb/ht1430
Cheers, Tom -
When I ask Siri "How does my day look tomorrow?" she tells me every appointment (busy) and task (free) I have scheduled. I'm trying to find a way to let her know that I'm only interested in seeing what appointments (busy) I have that day.
Has anyone found a way to do this? I'm using iCloud calendars on all my devices.
I've already used iCloud calendars to designate each individual event as either "free" or "busy," but she continues to display all calendar events when I ask for an overview of my day. I've tried to do this from my iPhone, Macbook, and iCloud website.
Moving my tasks to my "Reminders" app won't help, because I need to be able to schedule time to work on specific tasks and also put important deadlines into my calendar. At the same time, when I ask Siri, "How does my day look," I am only interested in knowing what appointments I have that day.
I've also tried asking specifically "What meetings do I have in my [work/personal/family etc. calendar]" but that doesn't work either.
I've also tried asking "Can you show me when I'm busy today" and "Can you show me todays's appointments."
It may be that Siri doesn't have this capability yet, but it would be nice to know if its in the works or if it exists.When I ask Siri "How does my day look tomorrow?" she tells me every appointment (busy) and task (free) I have scheduled. I'm trying to find a way to let her know that I'm only interested in seeing what appointments (busy) I have that day.
Has anyone found a way to do this? I'm using iCloud calendars on all my devices.
I've already used iCloud calendars to designate each individual event as either "free" or "busy," but she continues to display all calendar events when I ask for an overview of my day. I've tried to do this from my iPhone, Macbook, and iCloud website.
Moving my tasks to my "Reminders" app won't help, because I need to be able to schedule time to work on specific tasks and also put important deadlines into my calendar. At the same time, when I ask Siri, "How does my day look," I am only interested in knowing what appointments I have that day.
I've also tried asking specifically "What meetings do I have in my [work/personal/family etc. calendar]" but that doesn't work either.
I've also tried asking "Can you show me when I'm busy today" and "Can you show me todays's appointments."
It may be that Siri doesn't have this capability yet, but it would be nice to know if its in the works or if it exists. -
Snow Leopard: iCal doesn't show private appointments of as booked !
Hi Apple-Dev-Team,
one HUGE issue with the new Exchange iCal implementation: I cannot see if a collegue has an appointment at a given time because it won't display private entrys!! that's an absolute no-go for any workgroup/team or enterprise using macs with iCal !!
Please tell me if i've missed some option... If not it would be absolutely necessery for us and all of our customers to see private appointments in iCal because everybody uses its calendar to manage private appointments as well...
I love iCal/Mail much more than Entourage, so it would be really nice if one could fix this issue...
Thanks a lot!
DanielHi,
Welcome to Apple Discussions.
This forum is not monitored by Apple for feedback. To pass this feature request to Apple I suggest you use their iCal feedback form:
http://www.apple.com/feedback/ical.html
Best wishes
John M -
Change Pricing Condition for an item with CRM_ORDER_MAINTAIN
Hi community,
I try to change an existing condition with the function module crm_order_maintain.
Everything looks fine, no error no dump, but no success
The condition stays the same!
Can anybody find a solution for this?
Heres my report so far:
*& Report ZTEST_PRICING2
REPORT ztest_pricing2.
DATA: lt_guid TYPE crmt_object_guid_tab,
lt_item TYPE crmt_object_guid_tab,
lt_saved TYPE crmt_return_objects,
lt_pridoc TYPE crmt_pric_cond_t,
ls_pridoc TYPE crmt_pric_cond,
lt_pricom TYPE crmt_pridoc_comt,
ls_pricom TYPE crmt_pridoc_com,
lt_header TYPE crmt_orderadm_h_comt,
lt_input TYPE crmt_input_field_tab,
ls_input TYPE crmt_input_field,
ls_input_fn TYPE CRMT_INPUT_FIELD_NAMES,
ls_cond_chg TYPE prct_cond_external_change,
ls_cond TYPE PRCT_COND_DU,
lt_pricing_i TYPE CRMT_PRICING_I_WRKT.
PARAMETERS: lv_head TYPE crmt_object_guid DEFAULT 'C4C61C4E35DDF306E10000000A024089'.
PARAMETERS: lv_item TYPE crmt_object_guid DEFAULT '09C71C4E35DDF306E10000000A024089'.
PARAMETERS: lv_kbetr TYPE prct_cond_rate DEFAULT '100'.
INSERT lv_head INTO TABLE lt_guid.
INSERT lv_item INTO TABLE lt_item.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_guid
it_item_guid = lt_item
* IV_MODE =
* IV_ONLY_SPEC_ITEMS =
* IT_REQUESTED_OBJECTS =
* IV_NO_AUTH_CHECK =
* IT_ITEM_USAGE_RANGE =
* IV_SUBITEM_DEPTH = -1
* IT_OBJECT_FILTER =
* IV_ONLY_CHANGED_OBJ = FALSE
* IV_STATUS_H_CHECK_RELEVANCE = FALSE
IMPORTING
et_pridoc = lt_pridoc
et_pricing_i = lt_pricing_i
* CHANGING
* CV_LOG_HANDLE =
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 sy-subrc <> 0 AND lt_pridoc IS NOT INITIAL.
WRITE: / 'ERROR'.
EXIT.
ENDIF.
READ TABLE lt_pridoc INDEX 1 INTO ls_pridoc.
IF sy-subrc <> 0.
WRITE: / 'ERROR'.
EXIT.
ENDIF.
READ TABLE ls_pridoc-pric_cond INTO ls_cond WITH KEY kschl = 'PB00'.
IF sy-subrc <> 0.
WRITE: / 'ERROR'.
EXIT.
ENDIF.
ls_input-ref_guid = lv_head.
ls_input-ref_kind = 'A'.
ls_input-objectname = 'PRIDOC'.
ls_input_fn-fieldname = 'WAERS'.
INSERT ls_input_fn INTO TABLE ls_input-field_names.
ls_input_fn-fieldname = 'KBETR'.
INSERT ls_input_fn INTO TABLE ls_input-field_names.
INSERT ls_input INTO TABLE lt_input.
ls_pricom-ref_guid = lv_head.
ls_pricom-ref_kind = 'A'.
*ls_pricom-PRICING_TYPE = 'B'.
*ls_pricom-pricing_procedure = 'ZZMTA'.
ls_pricom-pric_cond[] = ls_pridoc-pric_cond[].
MOVE-CORRESPONDING ls_cond TO ls_cond_chg.
ls_cond_chg-waers = 'EUR'.
ls_cond_chg-kbetr = lv_kbetr.
INSERT ls_cond_chg INTO TABLE ls_pricom-cond_change.
APPEND ls_pricom TO lt_pricom.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
it_pridoc = lt_pricom
CHANGING
* ct_orderadm_h = lt_header
ct_input_fields = lt_input
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 5.
IF sy-subrc <> 0.
EXIT.
ENDIF.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = lt_guid
IMPORTING
et_saved_objects = lt_saved
* ET_EXCEPTION =
* ET_OBJECTS_NOT_SAVED =
EXCEPTIONS
document_not_saved = 1
OTHERS = 2.
IF sy-subrc EQ 0.
COMMIT WORK AND WAIT.
ELSE.
ROLLBACK WORK.
ENDIF.
regards
MarkusHello Jordi,
The example below is whereby i was trying to copy all the pricing condition on one document to another and deleting what's not present on the source document.
You can used this piece of code to adapt your requirement.
CALL FUNCTION 'ZCRC_FM_COPY_PRICE_COND_ALL'
EXPORTING
id_object_guid_src = <fs_el_con_guid>
id_object_guid_dest = <fs_el_so_guid>
id_commit = abap_false
EXCEPTIONS
not_allowed = 1
error_occured = 2
OTHERS = 3.
PERFORM f_recup_donnees USING id_object_guid_src
id_object_guid_dest.
PERFORM f_modif_condition_prix USING id_object_guid_src
id_object_guid_dest.
PERFORM f_header_copy_pricing using id_object_guid_src
id_object_guid_dest.
FORM f_recup_donnees USING pd_object_guid_src TYPE crmt_object_guid
pd_object_guid_dest TYPE crmt_object_guid.
DATA:
lt_header_guid TYPE crmt_object_guid_tab.
INSERT pd_object_guid_src INTO TABLE lt_header_guid.
INSERT pd_object_guid_dest INTO TABLE lt_header_guid.
CLEAR: gt_orderadm_i, gt_doc_flow.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_header_guid
IMPORTING
et_doc_flow = gt_doc_flow
et_orderadm_i = gt_orderadm_i
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 sy-subrc NE 0.
RAISE error_occured.
ENDIF.
" F_RECUP_DONNEES
FORM f_modif_condition_prix USING pd_guid_src TYPE crmt_object_guid
pd_guid_dest TYPE crmt_object_guid.
DATA : ld_pd_handle_src TYPE prct_handle,
ld_pd_handle_dest TYPE prct_handle,
lt_komv_print_src TYPE prct_cond_print_t,
lt_komv_print_dest TYPE prct_cond_print_t,
ls_komv_print_dest LIKE LINE OF lt_komv_print_dest,
ls_komv_print_src LIKE LINE OF lt_komv_print_src,
lt_cond_chg TYPE prct_cond_print_t,
lt_cond_chg_insert TYPE prct_cond_print_t,
ls_cond_chg TYPE prct_cond_print,
ls_cond_chg_tmp TYPE prct_cond_print,
ls_input_fields TYPE crmt_input_field,
lt_input_fields TYPE crmt_input_field_tab.
DATA : bal_log TYPE balloghndl,
lt_item_ret TYPE prct_item_ret_t,
lt_cond_ret TYPE prct_cond_print_t,
ld_data_changed TYPE xfeld,
gv_decimal TYPE usdefaults-dcpfm,
ld_lines TYPE i,
ld_ajout_cond TYPE abap_bool.
FIELD-SYMBOLS : <fs_orderadm_i_dest> TYPE crmt_orderadm_i_wrk,
<fs_orderadm_i_src> TYPE crmt_orderadm_i_wrk,
<fs_cond_chg> TYPE prct_cond_print,
<fs_cond_chg_insert> TYPE prct_cond_print.
* Début Ajout CD1K904313-001.
DATA: ld_guid_src TYPE crmt_object_guid.
FIELD-SYMBOLS: <fs_doc_flow> TYPE crmt_doc_flow_wrk.
* Début Ajout CD1K904313-001.
* Verrouillage des documents source et destinataire
PERFORM f_lock_document USING pd_guid_src.
PERFORM f_lock_document USING pd_guid_dest.
*Récupérer le pricing handle des documents
* Document source
CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
EXPORTING
iv_header_guid = pd_guid_src
IMPORTING
ev_pd_handle = ld_pd_handle_src
EXCEPTIONS
error_occurred = 1
handle_determination_error = 2
orgdata_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
RETURN.
ENDIF.
* Document destinataire
CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
EXPORTING
iv_header_guid = pd_guid_dest
IMPORTING
ev_pd_handle = ld_pd_handle_dest
EXCEPTIONS
error_occurred = 1
handle_determination_error = 2
orgdata_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
RETURN.
ENDIF.
* A ne pas traiter les postes de type ZPDF
DELETE gt_orderadm_i WHERE itm_type = 'ZPDF'.
LOOP AT gt_orderadm_i ASSIGNING <fs_orderadm_i_dest> WHERE header = pd_guid_dest.
REFRESH : lt_komv_print_src,
lt_komv_print_dest,
lt_cond_chg,
lt_cond_chg_insert.
* Début Modif CD1K904313-001.
* Récupérer le guid de l'item liée au item destinataire.
READ TABLE gt_doc_flow ASSIGNING <fs_doc_flow> WITH KEY objkey_b = <fs_orderadm_i_dest>-guid.
CHECK sy-subrc EQ 0.
ld_guid_src = <fs_doc_flow>-objkey_a.
* READ TABLE gt_orderadm_i ASSIGNING <fs_orderadm_i_src> WITH KEY header = pd_guid_src
* number_int = <fs_orderadm_i_dest>-number_int.
* Fin Modif CD1K904313-001.
* Récupérer les pricing document
IF sy-subrc EQ 0.
* Document source
CALL FUNCTION 'PRC_PD_ITEM_SHOW'
EXPORTING
iv_pd_handle = ld_pd_handle_src
* iv_item_no = <fs_orderadm_i_src>-guid "Supression CD1K904313-001
iv_item_no = ld_guid_src "Addition CD1K904313-001
IMPORTING
et_komv_print = lt_komv_print_src
EXCEPTIONS
non_existing_handle = 1
non_existing_item = 2
ipc_error = 3
OTHERS = 4.
ENDIF.
* Document destinataire
CALL FUNCTION 'PRC_PD_ITEM_SHOW'
EXPORTING
iv_pd_handle = ld_pd_handle_dest
iv_item_no = <fs_orderadm_i_dest>-guid
IMPORTING
et_komv_print = lt_komv_print_dest
EXCEPTIONS
non_existing_handle = 1
non_existing_item = 2
ipc_error = 3
OTHERS = 4.
* Modification et Suppression des conditions de prix
LOOP AT lt_komv_print_dest INTO ls_komv_print_dest .
CLEAR: ls_cond_chg,
ls_komv_print_src.
MOVE-CORRESPONDING ls_komv_print_dest TO ls_cond_chg.
* Rechercher la condition sur le document source
READ TABLE lt_komv_print_src INTO ls_komv_print_src WITH KEY kschl = ls_komv_print_dest-kschl
zaehk = ls_komv_print_dest-zaehk. "CD1K904313
IF sy-subrc EQ 0.
ls_cond_chg-kbetr_prt = ls_komv_print_src-kbetr_prt.
ls_cond_chg-kwert = ls_komv_print_src-kwert.
ls_cond_chg-kinak = ls_komv_print_src-kinak.
ELSEIF ls_cond_chg-kschl IS NOT INITIAL.
CLEAR ls_cond_chg.
CONTINUE.
ENDIF.
* Format décimal
CASE gv_decimal.
WHEN space. "format N.NNN,NN
REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
WHEN 'Y'. "format N NNN NNN,NN
REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
ENDCASE.
INSERT ls_cond_chg INTO TABLE lt_cond_chg.
CLEAR ls_cond_chg.
ENDLOOP.
* Ajout des conditions de prix
LOOP AT lt_komv_print_src INTO ls_komv_print_src WHERE kschl IS NOT INITIAL.
CLEAR: ls_cond_chg, ld_lines, ls_komv_print_dest, ls_cond_chg_tmp, ld_ajout_cond.
* Vérifier la présence de la condition sur le document destinataire
READ TABLE lt_komv_print_dest INTO ls_komv_print_dest WITH KEY kschl = ls_komv_print_src-kschl
zaehk = ls_komv_print_src-zaehk. "CD1K904313.
IF sy-subrc EQ 0.
CLEAR: ls_cond_chg, ls_komv_print_dest.
CONTINUE.
ELSE.
DESCRIBE TABLE lt_cond_chg LINES ld_lines.
READ TABLE lt_cond_chg INTO ls_cond_chg_tmp INDEX ld_lines.
IF sy-subrc EQ 0.
ld_ajout_cond = abap_true.
MOVE-CORRESPONDING ls_komv_print_src TO ls_cond_chg.
ls_cond_chg-knumv = ls_cond_chg_tmp-knumv.
ls_cond_chg-kposn = ls_cond_chg_tmp-kposn.
ls_cond_chg-stunr = ls_cond_chg_tmp-stunr + 10.
ELSE.
CLEAR: ls_cond_chg, ld_lines, ls_komv_print_dest, ls_cond_chg_tmp.
CONTINUE.
ENDIF.
ENDIF.
* Format décimal
CASE gv_decimal.
WHEN space. "format N.NNN,NN
REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
WHEN 'Y'. "format N NNN NNN,NN
REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
ENDCASE.
* Récupérer les nouvelles conditions qui seront ajouté au document destinataire
IF ld_ajout_cond EQ abap_true.
INSERT ls_cond_chg INTO TABLE lt_cond_chg_insert.
ENDIF.
INSERT ls_cond_chg INTO TABLE lt_cond_chg.
CLEAR ls_cond_chg.
ENDLOOP.
CALL FUNCTION 'PRC_INT_ITEM_INPUT'
EXPORTING
iv_pd_handle = ld_pd_handle_dest
iv_item_no = <fs_orderadm_i_dest>-guid
it_cond_prt = lt_cond_chg
iv_bal_log = bal_log
iv_req_ret = abap_true
iv_req_cond_prt = abap_true
IMPORTING
et_item_ret = lt_item_ret
et_cond_prt = lt_cond_ret
ev_data_changed = ld_data_changed
EXCEPTIONS
non_existing_handle = 1
non_existing_item = 2
ipc_error = 3.
IF sy-subrc = 0.
* En cas d'ajout de nouvelles conditions de prix, appeler le MF PRC_INT_ITEM_INPUT
* avec les montants
IF lt_cond_chg_insert IS NOT INITIAL.
REFRESH lt_cond_chg[].
lt_cond_chg[] = lt_cond_ret[].
LOOP AT lt_cond_chg_insert ASSIGNING <fs_cond_chg_insert>.
READ TABLE lt_cond_chg ASSIGNING <fs_cond_chg> WITH KEY kschl = <fs_cond_chg_insert>-kschl.
IF sy-subrc EQ 0.
<fs_cond_chg>-kwert = <fs_cond_chg_insert>-kwert.
<fs_cond_chg>-kbetr_prt = <fs_cond_chg_insert>-kbetr_prt.
ENDIF.
ENDLOOP.
REFRESH lt_cond_ret[].
CALL FUNCTION 'PRC_INT_ITEM_INPUT'
EXPORTING
iv_pd_handle = ld_pd_handle_dest
iv_item_no = <fs_orderadm_i_dest>-guid
it_cond_prt = lt_cond_chg
iv_bal_log = bal_log
iv_req_ret = abap_true
iv_req_cond_prt = abap_true
IMPORTING
et_item_ret = lt_item_ret
et_cond_prt = lt_cond_ret
ev_data_changed = ld_data_changed
EXCEPTIONS
non_existing_handle = 1
non_existing_item = 2
ipc_error = 3.
ENDIF.
* Publish event afin de sauvegarder les conditions de prix
CALL FUNCTION 'CRM_EVENT_PUBLISH_OW'
EXPORTING
iv_obj_name = 'PRIDOC'
iv_guid_hi = pd_guid_dest
iv_kind_hi = 'A'
iv_event = 'SAVE'
EXCEPTIONS
OTHERS = 1.
* As no order_maintain will follow implicitly and therefore no
* exec times for the events will be set, call CRM_ORDER_MAINTAIN
* without any parameters
* Then the exec time 'end of document' will be set and with the
* group logic also all exec times before
* But at least one object is needed in input_fields
* --> use PRIDOC
ls_input_fields-ref_guid = <fs_orderadm_i_dest>-guid.
ls_input_fields-ref_kind = 'B'.
ls_input_fields-objectname = 'PRIDOC'.
INSERT ls_input_fields INTO TABLE lt_input_fields.
CLEAR ls_input_fields.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
CHANGING
ct_input_fields = lt_input_fields
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 5.
ENDIF.
ENDLOOP.
" F_MODIF_CONDITION_PRIX
*& Form F_LOCK_DOCUMENT
* Verrouillage d'un document
FORM f_lock_document USING pd_guid TYPE crmt_object_guid.
CONSTANTS : lc_orderadm_h TYPE crmt_object_name VALUE 'ORDERADM_H',
lc_orderadm_i TYPE crmt_object_name VALUE 'ORDERADM_I'.
DATA: lv_process_mode TYPE crmt_mode,
lv_order_initialized TYPE crmt_boolean,
lv_process_type TYPE crmt_process_type,
lv_already_locked TYPE abap_bool.
DATA: ls_admin_ui_status TYPE crmt_admin_ui_status,
ls_item_usage_range TYPE crmt_item_usage_range.
DATA: lt_objects_to_read TYPE crmt_object_guid_tab,
lt_requested_objects TYPE crmt_object_name_tab,
lt_item_usage_range TYPE crmt_item_usage_range_tab,
lt_locked_contract TYPE crmt_object_guid_tab.
INSERT pd_guid INTO TABLE lt_objects_to_read.
INSERT lc_orderadm_h INTO TABLE lt_requested_objects.
INSERT lc_orderadm_i INTO TABLE lt_requested_objects.
ls_item_usage_range-sign = 'E'.
ls_item_usage_range-value = '02'.
INSERT ls_item_usage_range INTO TABLE lt_item_usage_range.
* LAM: Financing Options should be viewed in a separate screen:
ls_item_usage_range-sign = 'E'.
ls_item_usage_range-value = '05'. "Financing options
INSERT ls_item_usage_range INTO TABLE lt_item_usage_range.
*-> read document in change mode
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_objects_to_read
iv_mode = 'B'
it_requested_objects = lt_requested_objects
it_item_usage_range = lt_item_usage_range
EXCEPTIONS
document_not_found = 1
error_occurred = 2
document_locked = 3
no_change_authority = 4
no_display_authority = 5
OTHERS = 6.
PERFORM enqueue_order IN PROGRAM saplcrm_order_ow IF FOUND
USING pd_guid
abap_false
abap_false
abap_false
CHANGING sy-subrc
lv_already_locked
lt_locked_contract.
" F_LOCK_DOCUMENT
* Fin Ajout CD1K904074-001
FORM f_header_copy_pricing USING pd_guid_src
pd_guid_dest.
DATA : ld_pd_handle_src TYPE prct_handle,
ld_pd_handle_dest TYPE prct_handle,
lt_komv_print_src TYPE prct_cond_print_t,
lt_komv_print_dest TYPE prct_cond_print_t,
ls_komv_print_dest LIKE LINE OF lt_komv_print_dest,
ls_komv_print_src LIKE LINE OF lt_komv_print_src,
lt_cond_chg TYPE prct_cond_print_t,
ls_cond_chg TYPE prct_cond_print,
ls_input_fields TYPE crmt_input_field,
lt_input_fields TYPE crmt_input_field_tab.
DATA : bal_log TYPE balloghndl,
lt_cond_ret TYPE prct_cond_print_t,
ld_data_changed TYPE xfeld,
gv_decimal TYPE usdefaults-dcpfm.
* Verrouillage des documents source et destinataire
PERFORM f_lock_document USING pd_guid_src.
PERFORM f_lock_document USING pd_guid_dest.
* Récupérer le pricing handle des documents
* Document source
CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
EXPORTING
iv_header_guid = pd_guid_src
IMPORTING
ev_pd_handle = ld_pd_handle_src
EXCEPTIONS
error_occurred = 1
handle_determination_error = 2
orgdata_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
RETURN.
ENDIF.
* Document destinataire
CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
EXPORTING
iv_header_guid = pd_guid_dest
IMPORTING
ev_pd_handle = ld_pd_handle_dest
EXCEPTIONS
error_occurred = 1
handle_determination_error = 2
orgdata_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
RETURN.
ENDIF.
* * Récupérer les pricing document
* Document Source
CALL FUNCTION 'PRC_PD_HEAD_SHOW'
EXPORTING
iv_pd_handle = ld_pd_handle_src
IMPORTING
et_komv_print = lt_komv_print_src
EXCEPTIONS
non_existing_handle = 1
ipc_error = 2
OTHERS = 3.
CHECK sy-subrc EQ 0.
* Document Destinataire
CALL FUNCTION 'PRC_PD_HEAD_SHOW'
EXPORTING
iv_pd_handle = ld_pd_handle_dest
IMPORTING
et_komv_print = lt_komv_print_dest
EXCEPTIONS
non_existing_handle = 1
ipc_error = 2
OTHERS = 3.
CHECK sy-subrc EQ 0.
* * Modification et Suppression des conditions de prix
LOOP AT lt_komv_print_src INTO ls_komv_print_src .
CLEAR: ls_cond_chg,
ls_komv_print_dest.
MOVE-CORRESPONDING ls_komv_print_src TO ls_cond_chg.
* Rechercher la condition sur le document source
READ TABLE lt_komv_print_dest INTO ls_komv_print_dest WITH KEY kschl = ls_komv_print_src-kschl
zaehk = ls_komv_print_src-zaehk.
IF sy-subrc EQ 0.
IF ls_komv_print_src-kbetr NE ls_komv_print_dest-kbetr.
ls_cond_chg-kbetr_prt = ls_komv_print_src-kbetr_prt.
ls_cond_chg-kwert = ls_komv_print_src-kwert.
ls_cond_chg-kinak = ls_komv_print_src-kinak.
CASE gv_decimal.
WHEN space. "format N.NNN,NN
REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
WHEN 'Y'. "format N NNN NNN,NN
REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
ENDCASE.
ENDIF.
ENDIF.
CLEAR ls_cond_chg-krech.
INSERT ls_cond_chg INTO TABLE lt_cond_chg.
CLEAR ls_cond_chg.
ENDLOOP.
CALL FUNCTION 'PRC_INT_HEAD_INPUT'
EXPORTING
iv_pd_handle = ld_pd_handle_dest
iv_bal_log = bal_log
it_cond_prt = lt_cond_chg
iv_req_ret = abap_true
iv_req_cond_prt = abap_true
IMPORTING
et_cond_prt = lt_cond_ret
ev_data_changed = ld_data_changed
EXCEPTIONS
non_existing_handle = 1
ipc_error = 2
not_allowed = 3
OTHERS = 4.
CHECK sy-subrc EQ 0.
* * Publish event afin de sauvegarder les conditions de prix
CALL FUNCTION 'CRM_EVENT_PUBLISH_OW'
EXPORTING
iv_obj_name = 'PRIDOC'
iv_guid_hi = pd_guid_dest
iv_kind_hi = 'A'
iv_event = 'SAVE'
EXCEPTIONS
OTHERS = 1.
* As no order_maintain will follow implicitly and therefore no
* exec times for the events will be set, call CRM_ORDER_MAINTAIN
* without any parameters
* Then the exec time 'end of document' will be set and with the
* group logic also all exec times before
* But at least one object is needed in input_fields
* --> use PRIDOC
ls_input_fields-ref_guid = pd_guid_dest.
ls_input_fields-ref_kind = 'A'.
ls_input_fields-objectname = 'PRIDOC'.
INSERT ls_input_fields INTO TABLE lt_input_fields.
CLEAR ls_input_fields.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
CHANGING
ct_input_fields = lt_input_fields
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 5.
ENDFORM.
FORM f_header_copy_pricing USING pd_guid_src
pd_guid_dest.
DATA : ld_pd_handle_src TYPE prct_handle,
ld_pd_handle_dest TYPE prct_handle,
lt_komv_print_src TYPE prct_cond_print_t,
lt_komv_print_dest TYPE prct_cond_print_t,
ls_komv_print_dest LIKE LINE OF lt_komv_print_dest,
ls_komv_print_src LIKE LINE OF lt_komv_print_src,
lt_cond_chg TYPE prct_cond_print_t,
ls_cond_chg TYPE prct_cond_print,
ls_input_fields TYPE crmt_input_field,
lt_input_fields TYPE crmt_input_field_tab.
DATA : bal_log TYPE balloghndl,
lt_cond_ret TYPE prct_cond_print_t,
ld_data_changed TYPE xfeld,
gv_decimal TYPE usdefaults-dcpfm.
PERFORM f_lock_document USING pd_guid_src.
PERFORM f_lock_document USING pd_guid_dest.
* Récupérer le pricing handle des documents
* Document source
CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
EXPORTING
iv_header_guid = pd_guid_src
IMPORTING
ev_pd_handle = ld_pd_handle_src
EXCEPTIONS
error_occurred = 1
handle_determination_error = 2
orgdata_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
RETURN.
ENDIF.
* Document destinataire
CALL FUNCTION 'CRM_PRIDOC_GET_HANDLE_OW'
EXPORTING
iv_header_guid = pd_guid_dest
IMPORTING
ev_pd_handle = ld_pd_handle_dest
EXCEPTIONS
error_occurred = 1
handle_determination_error = 2
orgdata_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
RETURN.
ENDIF.
* * Récupérer les pricing document
* Document Source
CALL FUNCTION 'PRC_PD_HEAD_SHOW'
EXPORTING
iv_pd_handle = ld_pd_handle_src
IMPORTING
et_komv_print = lt_komv_print_src
EXCEPTIONS
non_existing_handle = 1
ipc_error = 2
OTHERS = 3.
CHECK sy-subrc EQ 0.
* Document Destinataire
CALL FUNCTION 'PRC_PD_HEAD_SHOW'
EXPORTING
iv_pd_handle = ld_pd_handle_dest
IMPORTING
et_komv_print = lt_komv_print_dest
EXCEPTIONS
non_existing_handle = 1
ipc_error = 2
OTHERS = 3.
CHECK sy-subrc EQ 0.
* * Modification et Suppression des conditions de prix
LOOP AT lt_komv_print_src INTO ls_komv_print_src .
CLEAR: ls_cond_chg,
ls_komv_print_dest.
MOVE-CORRESPONDING ls_komv_print_src TO ls_cond_chg.
* Rechercher la condition sur le document source
READ TABLE lt_komv_print_dest INTO ls_komv_print_dest WITH KEY kschl = ls_komv_print_src-kschl
zaehk = ls_komv_print_src-zaehk.
IF sy-subrc EQ 0.
IF ls_komv_print_src-kbetr NE ls_komv_print_dest-kbetr.
ls_cond_chg-kbetr_prt = ls_komv_print_src-kbetr_prt.
ls_cond_chg-kwert = ls_komv_print_src-kwert.
ls_cond_chg-kinak = ls_komv_print_src-kinak.
CASE gv_decimal.
WHEN space. "format N.NNN,NN
REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
WHEN 'Y'. "format N NNN NNN,NN
REPLACE ALL OCCURRENCES OF '.' IN ls_cond_chg-kbetr_prt WITH ','.
ENDCASE.
ENDIF.
ENDIF.
CLEAR ls_cond_chg-krech.
INSERT ls_cond_chg INTO TABLE lt_cond_chg.
CLEAR ls_cond_chg.
ENDLOOP.
CALL FUNCTION 'PRC_INT_HEAD_INPUT'
EXPORTING
iv_pd_handle = ld_pd_handle_dest
iv_bal_log = bal_log
it_cond_prt = lt_cond_chg
iv_req_ret = abap_true
iv_req_cond_prt = abap_true
IMPORTING
et_cond_prt = lt_cond_ret
ev_data_changed = ld_data_changed
EXCEPTIONS
non_existing_handle = 1
ipc_error = 2
not_allowed = 3
OTHERS = 4.
CHECK sy-subrc EQ 0.
CALL FUNCTION 'CRM_EVENT_PUBLISH_OW'
EXPORTING
iv_obj_name = 'PRIDOC'
iv_guid_hi = pd_guid_dest
iv_kind_hi = 'A'
iv_event = 'SAVE'
EXCEPTIONS
OTHERS = 1.
ls_input_fields-ref_guid = pd_guid_dest.
ls_input_fields-ref_kind = 'A'.
ls_input_fields-objectname = 'PRIDOC'.
INSERT ls_input_fields INTO TABLE lt_input_fields.
CLEAR ls_input_fields.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
CHANGING
ct_input_fields = lt_input_fields
EXCEPTIONS
error_occurred = 1
document_locked = 2
no_change_allowed = 3
no_authority = 4
OTHERS = 5. -
How to update multiple Price conditions in FM CRM_ORDER_MAINTAIN
Hi All,
need to update multiple price conditions in a contract Thru FM CRM_ORDER_MAINTAIN.
please see the piece of code that am using...
am able to update single price condition...but not able to populate 2 or more .......i,e..ADD A Condition
i,e...DATA : ls_cond TYPE prct_cond_external_input,
lt_cond TYPE prct_cond_external_input_t.
DATA : ls_con TYPE PRCT_COND_DU,
lt_con TYPE PRCT_COND_DU_TAB.
Create Condition Type
*ls_con-KNUMV = lv_header_guid.
*ls_con-KPOSN = lv_item_guid.
ls_con-stunr = '134'.
IF Y EQ 1.
ls_con-ZAEHK = '001'.
ELSE.
ls_con-ZAEHK = '002'.
*ENDIF.
*ls_con-kschl = 'ZFP1'.
**ls_cond-waers = 'CNY'.
*ls_con-kbetr = '0.00'.
*ls_con-kpein = '1'.
ls_cond-kschl = 'ZFP1'.
ls_cond-waers = 'CNY'.
ls_cond-kbetr = '0'.
ls_cond-kpein = '1'.
ls_cond-knumh = lv_item_guid .
CLEAR ls_Price_doc.
ls_Price_doc-ref_guid = lv_item_guid.
ls_Price_doc-ref_kind = 'A'.
IF Y EQ 1.
ls_Price_doc-ref_handle = '000000001'.
ELSE.
ls_Price_doc-ref_handle = '000000002'.
ENDIF.
*ls_price_doc-PRIC_COND[] = lt_cond[].
*INSERT ls_con into table ls_price_doc-PRIC_COND.
INSERT ls_cond into table ls_price_doc-COND_ADD.
INSERT ls_price_doc INTO TABLE lt_price_doc.
ls_input_fields-ref_guid = lv_item_guid.
ls_input_field_names-fieldname = 'KNUMH'.
INSERT ls_input_fields INTO TABLE lt_input_fields.
ls_input_field_names-fieldname = 'KPOSN'.
INSERT ls_input_fields INTO TABLE lt_input_fields.
ls_input_field_names-fieldname = 'KSCHL'.
INSERT ls_input_fields INTO TABLE lt_input_fields.
ls_input_field_names-fieldname = 'KPEIN'.
INSERT ls_input_fields INTO TABLE lt_input_fields.
ls_input_field_names-fieldname = 'STUNR'.
INSERT ls_input_fields INTO TABLE lt_input_fields.
ls_input_field_names-fieldname = 'ZAEHK'.
INSERT ls_input_fields INTO TABLE lt_input_fields.
ls_input_field_names-fieldname = 'WAERS'.
INSERT ls_input_fields INTO TABLE lt_input_fields.
ls_input_field_names-fieldname = 'KBETR'.
INSERT ls_input_fields INTO TABLE lt_input_fields.
CLEAR ls_input_fields.
Ls_input_fields-ref_guid = lv_item_guid.
ls_input_fields-ref_kind = 'B'.
ls_input_fields-objectname = 'PRIDOC'.
*ls_input_fields-logical_key = '0001'.
ls_input_fields-field_names = lt_input_field_names.
INSERT ls_input_fields INTO TABLE lt_input_fields.
CLEAR ls_input_fields.
CLEAR ls_Price_agreement.
Clear ls_cond.
I kept this under code. loop, for item records.....
Though the internal table lt_price_doc. is holding all the records, it is updating only one record. can you any one pls guide me ,This example works fine for me. Modify it according to your needs...
Price
IF it_item-value IS NOT INITIAL.
ls_cond-kschl = 'PR00'. " add price
ls_cond-kbetr = it_item-value.
ls_cond-waers = st_head-currency.
INSERT ls_cond INTO TABLE ls_pridoc_com-cond_add.
index_2 = 1.
CLEAR: ls_cond.
ENDIF.
Discount
IF it_item-discount IS NOT INITIAL.
ls_cond-kschl = 'ZPPP'. " add discount
wa_procent_calc = it_item-discount * 10.
ls_cond-kbetr = wa_procent_calc."it_item-discount.
ls_cond-waers = '%'."st_head-currency.
INSERT ls_cond INTO TABLE ls_pridoc_com-cond_add.
index_2 = 1.
CLEAR: ls_cond, wa_procent_calc.
ENDIF.
IF index_2 = 1.
ls_pridoc_com-ref_handle = counter.
ls_pridoc_com-ref_kind = 'B'.
INSERT ls_pridoc_com INTO TABLE gt_pridoc_com.
CLEAR: index_2,ls_pridoc_com.
ENDIF. -
Error Occured in CRM_ORDER_MAINTAIN . Kindly help asap.
I have written folowing code but exception occurs in changing parameter lt_exception of FM maintain.What can be the possible error.
msg no - 0004
REPORT ZTEST_PROGRAM.
*Internal tables
Data : lt_partner TYPE crmt_partner_comt,
lt_sales TYPE crmt_sales_comt,
lt_orgman TYPE crmt_orgman_comt,
lt_status TYPE crmt_status_comt,
lt_customer_h TYPE CRMT_SERVICE_H_COMT,
lt_input_field TYPE crmt_input_field_names_tab,
lt_exception TYPE crmt_exception_t,
lt_crm_save TYPE crmt_object_guid_tab,
lt_orderadm_h TYPE crmt_orderadm_h_comt,
lt_saved_objects TYPE crmt_return_objects,
lt_objects_not_saved TYPE CRMT_OBJECT_GUID_TAB,
lt_input TYPE crmt_input_field_tab.
*Structures
Data : ls_partner TYPE crmt_partner_com,
ls_sales TYPE crmt_sales_com,
ls_orgman TYPE crmt_orgman_com,
ls_status TYPE crmt_status_com,
ls_input TYPE crmt_input_field,
ls_input_field TYPE crmt_input_field_names,
ls_crm_save TYPE crmt_object_guid,
ls_saved_objects LIKE LINE OF lt_saved_objects,
ls_orderadm_h TYPE crmt_orderadm_h_com,
ls_customer_h TYPE CRMT_SERVICE_H_COM.
*Variables
Data : lv_guid TYPE guid_16,
lv_timezone TYPE timezone,
lv_timestamp TYPE timestamp,
lv_log_handle TYPE balloghndl.
GET GUID
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_16 = lv_guid.
Filling status data
CLEAR ls_status.
ls_status-ref_guid = lv_guid.
ls_status-ref_kind = 'A'.
ls_status-status = 'E0003'.
ls_status-user_stat_proc = 'CRMORDER'.
ls_status-activate = 'X'.
APPEND ls_status TO lt_status.
Filling the partner data
CLEAR ls_partner.
ls_partner-ref_guid = lv_guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = '0001'.
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = '00000001'. " Sold to Party
ls_partner-partner_no = '190'.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
INSERT ls_partner INTO TABLE lt_partner.
Input Fields for Partner Data that are to be changed
CLEAR ls_input.
ls_input-ref_guid = lv_guid.
ls_input-ref_kind = 'A'.
ls_input-logical_key = '0001'.
ls_input-objectname = 'PARTNER'.
ls_input_field-fieldname = 'DISPLAY_TYPE'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'KIND_OF_ENTRY'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'NO_TYPE'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'PARTNER_FCT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'PARTNER_NO'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input-field_names[] = lt_input_field[].
INSERT ls_input INTO TABLE lt_input.
Prepare Organisation Data
Clear ls_orgman.
ls_orgman-ref_guid = lv_guid.
ls_orgman-ref_kind = 'A'.
ls_orgman-sales_group_ori = 'A'.
ls_orgman-sales_orgr_ori = 'A'.
ls_orgman-division_ori = 'A'.
ls_orgman-dis_channel_ori = 'A'.
APPEND ls_orgman TO lt_orgman.
Input Fields for Organization Data that are to be changed
ls_input-ref_guid = lv_guid.
ls_input-ref_kind = 'A'.
ls_input-objectname = 'ORGMAN'.
ls_input_field-fieldname = 'SALES_GROUP_ORI'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'SALES_ORGR_ORI'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'DIVISION_ORI'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input-field_names[] = lt_input_field[]. " Contains all fields to updatd
INSERT ls_input INTO TABLE lt_input.
CLEAR: ls_input, ls_input_field.
REFRESH lt_input_field.
EXTERNAL REFERENCE DATA And Requested Delivery Date Data
ls_sales-ref_guid = lv_guid.
ls_sales-po_number_sold = 'A'. " PO Reference
ls_sales-ref_kind = 'A'.
Get the user Time Zone
CALL FUNCTION 'TZON_GET_USER_TIMEZONE'
EXPORTING
if_username = sy-uname
IMPORTING
ef_timezone = lv_timezone
EXCEPTIONS
no_timezone_customizing = 1
no_valid_user = 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.
Convert Requested delivery date into Timestamp
CALL FUNCTION 'BBP_PD_CONVERT_DATETIME_TO_TS'
EXPORTING
iv_date = sy-datum
iv_time = sy-uzeit
iv_time_zone = lv_timezone
IMPORTING
ev_timestamp = lv_timestamp
EV_TIMESTAMPL =
EXCEPTIONS
convert_error = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ls_sales-req_dlv_date = lv_timestamp. " Requested delivery date time stamp
ls_sales-req_timezone = lv_timezone. " User timezone
ls_sales-po_date_sold = sy-datum.
APPEND ls_sales TO lt_sales.
Input fields for Sales Data that are to be changed
CLEAR: ls_input, ls_input_field.
REFRESH lt_input_field.
ls_input-ref_guid = lv_guid.
ls_input-ref_kind = 'A'.
ls_input-objectname = 'SALES'.
ls_input_field-fieldname = 'PO_NUMBER_SOLD'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'REQ_DLV_DATE'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input-field_names[] = lt_input_field[]. "Contains all fields to updatd
INSERT ls_input INTO TABLE lt_input.
Prepare Data for Orderadm_h
CLEAR ls_orderadm_h.
CLEAR: ls_input, ls_input_field.
REFRESH lt_input_field.
ls_orderadm_h-guid = lv_guid.
ls_orderadm_h-process_type = 'ZEDL'.
ls_orderadm_h-description = 'ACB'. " Order Description
ls_orderadm_h-posting_date = sy-datum.
ls_orderadm_h-descr_language = 'EN'.
ls_orderadm_h-template_type = 'D'.
ls_orderadm_h-mode = 'A'.
APPEND ls_orderadm_h TO lt_orderadm_h.
CLEAR ls_input.
ls_input-ref_guid = lv_guid.
ls_input-ref_kind = 'A'.
ls_input-objectname = 'ORDERADM_H'.
ls_input_field-fieldname = 'MODE'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'DESCRIPTION'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'PROCESS_TYPE'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input-field_names[] = lt_input_field[]. "Contains all fields to updatd
INSERT ls_input INTO TABLE lt_input.
CLEAR: ls_input, ls_input_field.
REFRESH lt_input_field.
Prepare Data for customer_h
ls_customer_h-ref_guid = lv_guid.
Ls_customer_h-mode = 'A'.
*Ls_customer_h-customer_ext = 'b'.
APPEND ls_customer_h to lt_customer_h.
Call bapi to create and update order
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
IT_OPPORT_H =
IT_LEAD_H =
IT_ACTIVITY_H =
IT_LAWREF_H =
IT_SALES = lt_sales
IT_PRICING =
IT_PRICING_I =
IT_PRIDOC =
IT_ORGMAN = lt_orgman
IT_SHIPPING =
IT_ACTIVITY_I =
IT_PRODUCT_I =
IT_BATCH =
IT_FINPROD_I =
IT_STRUCT_I =
IT_CONFIG =
IT_PAYPLAN =
IT_PAYPLAN_D =
IT_CUSTOMER_H =
IT_CUSTOMER_I =
IT_SERVICE_H =
IT_SERVICE_I =
IT_SERVICE_ASSIGN =
IT_QUALIF =
IT_APPOINTMENT =
IT_TEXT =
IT_SCHEDLIN_I =
IT_PARTNER = lt_partner
IT_SERVICE_OS =
IT_REFOBJ =
IT_SUBJECT =
IT_CANCEL =
IT_CANCEL_IR =
IT_CANCEL_DATES =
IT_STATUS = lt_status
IT_BILLPLAN =
IT_BILLING =
IT_ORDPRP_I =
IT_ORDPRP_I_D =
IT_ORDPRP_OBJL_I_D =
IT_CUMULATED_I =
IT_SERVICEPLAN_I =
IT_SERVICEPLAN_IE =
IT_PRICE_AGREEMENTS_BBP =
IT_PRICE_AGREEMENTS_CRM =
IT_CONFIG_FILTER =
IT_AC_ASSIGN =
IT_SURVEY =
IT_EXTENSION =
IT_ACTIVE_SWITCH =
IT_UBB_CTR_I =
IT_UBB_CR_I =
IT_UBB_VOL_I =
IT_APO_I =
IT_CHNGPROC_I =
IT_EXT_REF =
IT_DOC_FLOW_PNT =
IT_CHNGPROC_H =
IT_FUND_H =
IT_CLA_H =
IT_SRV_REQ_H =
IT_APPROVAL =
IMPORTING
ET_EXCEPTION = lt_exception
CHANGING
CT_ORDERADM_H = lt_orderadm_h
CT_ORDERADM_I =
CT_INPUT_FIELDS = lt_input
CV_LOG_HANDLE = lv_log_handle
CT_PARTNER_ATTRIBUTES =
CT_DOC_FLOW =
EXCEPTIONS
ERROR_OCCURRED = 1
DOCUMENT_LOCKED = 2
NO_CHANGE_ALLOWED = 3
NO_AUTHORITY = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ls_crm_save = lv_guid.
INSERT ls_crm_save INTO TABLE lt_crm_save.
Saving the Order which is created by above function module
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = lt_crm_save
IMPORTING
et_saved_objects = lt_saved_objects
et_exception = lt_exception " Receiving objects that can be saved
et_objects_not_saved = lt_objects_not_saved
EXCEPTIONS
document_not_saved = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
write 'hello1'.
ENDIF.
Commit the save
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
write 'hello2'.
ENDIF.
Check Created order
READ TABLE lt_saved_objects INTO ls_saved_objects INDEX 1.
READ TABLE lt_objects_not_saved INTO ls_saved_objects INDEX 1.
write : lv_guid,ls_saved_objects-GUID,ls_saved_objects-OBJECT_ID.I have written folowing code but exception occurs in changing parameter lt_exception of FM maintain.What can be the possible error.
msg no - 0004
REPORT ZTEST_PROGRAM.
*Internal tables
Data : lt_partner TYPE crmt_partner_comt,
lt_sales TYPE crmt_sales_comt,
lt_orgman TYPE crmt_orgman_comt,
lt_status TYPE crmt_status_comt,
lt_customer_h TYPE CRMT_SERVICE_H_COMT,
lt_input_field TYPE crmt_input_field_names_tab,
lt_exception TYPE crmt_exception_t,
lt_crm_save TYPE crmt_object_guid_tab,
lt_orderadm_h TYPE crmt_orderadm_h_comt,
lt_saved_objects TYPE crmt_return_objects,
lt_objects_not_saved TYPE CRMT_OBJECT_GUID_TAB,
lt_input TYPE crmt_input_field_tab.
*Structures
Data : ls_partner TYPE crmt_partner_com,
ls_sales TYPE crmt_sales_com,
ls_orgman TYPE crmt_orgman_com,
ls_status TYPE crmt_status_com,
ls_input TYPE crmt_input_field,
ls_input_field TYPE crmt_input_field_names,
ls_crm_save TYPE crmt_object_guid,
ls_saved_objects LIKE LINE OF lt_saved_objects,
ls_orderadm_h TYPE crmt_orderadm_h_com,
ls_customer_h TYPE CRMT_SERVICE_H_COM.
*Variables
Data : lv_guid TYPE guid_16,
lv_timezone TYPE timezone,
lv_timestamp TYPE timestamp,
lv_log_handle TYPE balloghndl.
GET GUID
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_16 = lv_guid.
Filling status data
CLEAR ls_status.
ls_status-ref_guid = lv_guid.
ls_status-ref_kind = 'A'.
ls_status-status = 'E0003'.
ls_status-user_stat_proc = 'CRMORDER'.
ls_status-activate = 'X'.
APPEND ls_status TO lt_status.
Filling the partner data
CLEAR ls_partner.
ls_partner-ref_guid = lv_guid.
ls_partner-ref_kind = 'A'.
ls_partner-ref_partner_handle = '0001'.
ls_partner-kind_of_entry = 'C'.
ls_partner-partner_fct = '00000001'. " Sold to Party
ls_partner-partner_no = '190'.
ls_partner-display_type = 'BP'.
ls_partner-no_type = 'BP'.
INSERT ls_partner INTO TABLE lt_partner.
Input Fields for Partner Data that are to be changed
CLEAR ls_input.
ls_input-ref_guid = lv_guid.
ls_input-ref_kind = 'A'.
ls_input-logical_key = '0001'.
ls_input-objectname = 'PARTNER'.
ls_input_field-fieldname = 'DISPLAY_TYPE'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'KIND_OF_ENTRY'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'NO_TYPE'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'PARTNER_FCT'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'PARTNER_NO'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input-field_names[] = lt_input_field[].
INSERT ls_input INTO TABLE lt_input.
Prepare Organisation Data
Clear ls_orgman.
ls_orgman-ref_guid = lv_guid.
ls_orgman-ref_kind = 'A'.
ls_orgman-sales_group_ori = 'A'.
ls_orgman-sales_orgr_ori = 'A'.
ls_orgman-division_ori = 'A'.
ls_orgman-dis_channel_ori = 'A'.
APPEND ls_orgman TO lt_orgman.
Input Fields for Organization Data that are to be changed
ls_input-ref_guid = lv_guid.
ls_input-ref_kind = 'A'.
ls_input-objectname = 'ORGMAN'.
ls_input_field-fieldname = 'SALES_GROUP_ORI'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'SALES_ORGR_ORI'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'DIVISION_ORI'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input-field_names[] = lt_input_field[]. " Contains all fields to updatd
INSERT ls_input INTO TABLE lt_input.
CLEAR: ls_input, ls_input_field.
REFRESH lt_input_field.
EXTERNAL REFERENCE DATA And Requested Delivery Date Data
ls_sales-ref_guid = lv_guid.
ls_sales-po_number_sold = 'A'. " PO Reference
ls_sales-ref_kind = 'A'.
Get the user Time Zone
CALL FUNCTION 'TZON_GET_USER_TIMEZONE'
EXPORTING
if_username = sy-uname
IMPORTING
ef_timezone = lv_timezone
EXCEPTIONS
no_timezone_customizing = 1
no_valid_user = 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.
Convert Requested delivery date into Timestamp
CALL FUNCTION 'BBP_PD_CONVERT_DATETIME_TO_TS'
EXPORTING
iv_date = sy-datum
iv_time = sy-uzeit
iv_time_zone = lv_timezone
IMPORTING
ev_timestamp = lv_timestamp
EV_TIMESTAMPL =
EXCEPTIONS
convert_error = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ls_sales-req_dlv_date = lv_timestamp. " Requested delivery date time stamp
ls_sales-req_timezone = lv_timezone. " User timezone
ls_sales-po_date_sold = sy-datum.
APPEND ls_sales TO lt_sales.
Input fields for Sales Data that are to be changed
CLEAR: ls_input, ls_input_field.
REFRESH lt_input_field.
ls_input-ref_guid = lv_guid.
ls_input-ref_kind = 'A'.
ls_input-objectname = 'SALES'.
ls_input_field-fieldname = 'PO_NUMBER_SOLD'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'REQ_DLV_DATE'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input-field_names[] = lt_input_field[]. "Contains all fields to updatd
INSERT ls_input INTO TABLE lt_input.
Prepare Data for Orderadm_h
CLEAR ls_orderadm_h.
CLEAR: ls_input, ls_input_field.
REFRESH lt_input_field.
ls_orderadm_h-guid = lv_guid.
ls_orderadm_h-process_type = 'ZEDL'.
ls_orderadm_h-description = 'ACB'. " Order Description
ls_orderadm_h-posting_date = sy-datum.
ls_orderadm_h-descr_language = 'EN'.
ls_orderadm_h-template_type = 'D'.
ls_orderadm_h-mode = 'A'.
APPEND ls_orderadm_h TO lt_orderadm_h.
CLEAR ls_input.
ls_input-ref_guid = lv_guid.
ls_input-ref_kind = 'A'.
ls_input-objectname = 'ORDERADM_H'.
ls_input_field-fieldname = 'MODE'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'DESCRIPTION'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input_field-fieldname = 'PROCESS_TYPE'.
INSERT ls_input_field INTO TABLE lt_input_field.
ls_input-field_names[] = lt_input_field[]. "Contains all fields to updatd
INSERT ls_input INTO TABLE lt_input.
CLEAR: ls_input, ls_input_field.
REFRESH lt_input_field.
Prepare Data for customer_h
ls_customer_h-ref_guid = lv_guid.
Ls_customer_h-mode = 'A'.
*Ls_customer_h-customer_ext = 'b'.
APPEND ls_customer_h to lt_customer_h.
Call bapi to create and update order
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
IT_OPPORT_H =
IT_LEAD_H =
IT_ACTIVITY_H =
IT_LAWREF_H =
IT_SALES = lt_sales
IT_PRICING =
IT_PRICING_I =
IT_PRIDOC =
IT_ORGMAN = lt_orgman
IT_SHIPPING =
IT_ACTIVITY_I =
IT_PRODUCT_I =
IT_BATCH =
IT_FINPROD_I =
IT_STRUCT_I =
IT_CONFIG =
IT_PAYPLAN =
IT_PAYPLAN_D =
IT_CUSTOMER_H =
IT_CUSTOMER_I =
IT_SERVICE_H =
IT_SERVICE_I =
IT_SERVICE_ASSIGN =
IT_QUALIF =
IT_APPOINTMENT =
IT_TEXT =
IT_SCHEDLIN_I =
IT_PARTNER = lt_partner
IT_SERVICE_OS =
IT_REFOBJ =
IT_SUBJECT =
IT_CANCEL =
IT_CANCEL_IR =
IT_CANCEL_DATES =
IT_STATUS = lt_status
IT_BILLPLAN =
IT_BILLING =
IT_ORDPRP_I =
IT_ORDPRP_I_D =
IT_ORDPRP_OBJL_I_D =
IT_CUMULATED_I =
IT_SERVICEPLAN_I =
IT_SERVICEPLAN_IE =
IT_PRICE_AGREEMENTS_BBP =
IT_PRICE_AGREEMENTS_CRM =
IT_CONFIG_FILTER =
IT_AC_ASSIGN =
IT_SURVEY =
IT_EXTENSION =
IT_ACTIVE_SWITCH =
IT_UBB_CTR_I =
IT_UBB_CR_I =
IT_UBB_VOL_I =
IT_APO_I =
IT_CHNGPROC_I =
IT_EXT_REF =
IT_DOC_FLOW_PNT =
IT_CHNGPROC_H =
IT_FUND_H =
IT_CLA_H =
IT_SRV_REQ_H =
IT_APPROVAL =
IMPORTING
ET_EXCEPTION = lt_exception
CHANGING
CT_ORDERADM_H = lt_orderadm_h
CT_ORDERADM_I =
CT_INPUT_FIELDS = lt_input
CV_LOG_HANDLE = lv_log_handle
CT_PARTNER_ATTRIBUTES =
CT_DOC_FLOW =
EXCEPTIONS
ERROR_OCCURRED = 1
DOCUMENT_LOCKED = 2
NO_CHANGE_ALLOWED = 3
NO_AUTHORITY = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ls_crm_save = lv_guid.
INSERT ls_crm_save INTO TABLE lt_crm_save.
Saving the Order which is created by above function module
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
it_objects_to_save = lt_crm_save
IMPORTING
et_saved_objects = lt_saved_objects
et_exception = lt_exception " Receiving objects that can be saved
et_objects_not_saved = lt_objects_not_saved
EXCEPTIONS
document_not_saved = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
write 'hello1'.
ENDIF.
Commit the save
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
write 'hello2'.
ENDIF.
Check Created order
READ TABLE lt_saved_objects INTO ls_saved_objects INDEX 1.
READ TABLE lt_objects_not_saved INTO ls_saved_objects INDEX 1.
write : lv_guid,ls_saved_objects-GUID,ls_saved_objects-OBJECT_ID. -
I recently updated to 10.8.2 and now my notes from my iphone no longer appear in my mail nor do my calender appointments. Is there any way to change it so they will appear?
If it has the same (bad) behavior on two different systems then there is a very good chance that the drive is toast.
BTW you'll get better response to your questions if the question actually reflects the problem you are having. In this case it would have been better to say you couldn't access the drive rather then that it doesn't show on the desktop.
regards
Maybe you are looking for
-
How to add an image to an IMAGE control in Java WebDynpro
hi How to add an image to an IMAGE control in Java WebDynpro. Please give me the steps to assign an image to an IMAGE control. Advanced Thanks brahma
-
Lost Bridge CS3 keywords after upgrade to Leopard
So I have have spent many, many man hours assigning keywords to images in Bridge CS3. I then recently upgraded the computer from OSX Tiger to Leopard (not Snow Leopard). I use Filters to get at the exact images that I am interested in previewing. The
-
Mac won't restart to install Leopard
In short, I need to do an erase and install for Leopard. The problem is that my computer will not shut down unless I do it via a hard shut down. This prevents the Leopard process from starting. How do you boot up from the DVD drive so I can install L
-
I need to be able to navigate between tabs on a canvas using just keyboard access keys, similar to access keys on buttons. Can anyone advise on if this is possible and if so how?? Many Thanks, Jayesh Kavia
-
Can somebody from Verzion answer this?
I and many other customers have been waiting for a response from Verizon as to when they will offer more WP7 handsets. I spoke with one of your marketing people who was at my place of employement trying to drum up customers the other day and she had