on 06-12-2011 1:17 AM
Hi all,
I have one requirement.where I have to display the service confirmation's line item's start date. The APPT_TYPE is
'SRVC_ACTUAL' . I actually get this data in ET_APPOINTEMENT in export parameter of CRM_ORDER_READ but my requirement is not to use CRM_ORDER_READ, which is taking long time. . So could any one suggest any table name to retrieve confirmation's start date?
Thanks,
hi,
Use the FM- crm_appointment_read_ow
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can use same FM, CRM_ORDER_READ by passing 'APPOINTMENT' in it_requested_objects paramter . So that it will fetch only the required information (it_appointments) in your case.
Or you can search CRMORDERAPPOINTMENT*GET in se37 to get the FM only to read appointments.
Regards,
Nithish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nithish,
Thanks for your reply. Currently I am doing that only using CRM_ORDER_READ by passing 'APPOINTMENT' in it_requested_objects paramter . what my problem is , I have enhanced Service Contract component with one button. When this button is clicked one pop-up window has to be displayed with all the service orders or service confirmations, whose start dates are between the Service Contract start and end dates.
For pop-up , I developed one component( ZCOMPONENT)and in that Inbound plug of Window, first I am catching the Header GUID(Service Contract GUID) and based on that I am retreiving all the items, components and appointements by passing
the below parameters to CRM_ORDER_READ like below
INSERT ls_reqobj INTO TABLE lt_reqobj.
ls_reqobj = 'APPOINTMENT'.
INSERT ls_reqobj INTO TABLE lt_reqobj.
ls_reqobj = 'ORDPRP_I'.
INSERT ls_reqobj INTO TABLE lt_reqobj.
Based on the above retreived parameters, I will get associated IBases and then I will get all the associated components to each IBase by using the below Function Modules. Then I have to retreive all the service orders(service confirmations) associated to each IBase and component. After getting all the service process for all the IBases and component combination. Again I have to filter them based on the required process types and collect all the valid service confirmation GUID's after filtering them. Now after getting all the required service confirmations again I have to read CRM_ORDER by passing 'APPOINTMENT' in it_requested_objects paramter and passing those GUID's .Now i have to compare the required dates by reading ET_APPOINTMENT Table by using APPT_TYPE = 'SERV_ACTUAL' for one type of service confirmation and 'srv_cust_beg'.
My problem is I am getting empty pop-up. I checked this it is taking 2+mins for one Service Contract. My question is in the above
after filtering the service orders based on the process types, I got 931 GUID's. Again I am passing these GUID's to CRM_ORDER_READ and filtering service orders based on the dates in ET_APPOINTMENT table. After filtering out based on the dates I got only 16 valid service confirmations out of total 931, which is waste of time. So my question is before passing the 931 GUID's to CRM_ORDER_READ, is there any table or FM to read the dates of each service order to filter out and then I could read CRM_ORDER_READ with only valid service confirmations ( 16 in this case ) instead of 931.
Please check the below code for your understanding purpose. Finally I have to know exact tables or FM's to read requested start date ( APPT_TYPE = 'SRV_CUST_BEG in ET_APPOITMENT table)and Service start date ( APPT_TYPE = 'SERV_ACTUAL) . As you said, I checked all the FM's but most of them are giving VISIT Dates . For example pls check CRM_GET_APPOINTEMENT.
Getting the Header GUID of the Service Contract.
lr_core = cl_crm_bol_core=>get_instance( ).
lr_current = iv_collection->get_first( ).
lv_cont_guid = lr_current->get_property_as_string( 'GUID' ).
ls_guid = lr_current->get_property_as_string( 'GUID' ).
INSERT lv_cont_guid INTO TABLE lt_cont_guid.
Retrieving the Items and IBase Components.
ls_reqobj = 'ORDERADM_I'.
INSERT ls_reqobj INTO TABLE lt_reqobj.
ls_reqobj = 'APPOINTMENT'.
INSERT ls_reqobj INTO TABLE lt_reqobj.
ls_reqobj = 'ORDPRP_I'.
INSERT ls_reqobj INTO TABLE lt_reqobj.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_cont_guid
it_requested_objects = lt_reqobj
IMPORTING
et_orderadm_i = lt_items
et_ordprp_objl_i_d = lt_comp
et_appointment = lt_appt.
CLEAR lv_cont_guid.
REFRESH: lt_cont_guid[],lt_popup[],lt_reqobj[].
*Retrieving the Service Contract Start and End Dates.
LOOP AT lt_appt INTO ls_appt WHERE ref_kind = c_a
AND ( appt_type = c_contstart
OR appt_type = c_contend ).
IF ls_appt-appt_type = c_contstart.
Service Contract Start Date.
lv_start = ls_appt-date_from.
ENDIF.
IF ls_appt-appt_type = c_contend.
Service Contract End Date.
lv_end = ls_appt-date_from.
ENDIF.
ENDLOOP.
"Ignore the billing items in the items list.
DELETE lt_items WHERE object_type = c_bus2000163.
LOOP AT lt_items INTO ls_items WHERE number_parent = ' '.
ls_item_comp-knumber = ls_items-ZZ_K_NUMBER.
if not ls_item_comp-knumber is initial.
APPEND ls_item_comp TO lt_item_comp.
endif.
ENDLOOP.
SORT LT_ITEM_COMP BY KNUMBER.
DELETE ADJACENT DUPLICATES FROM LT_ITEM_COMP COMPARING KNUMBER.
IF NOT lt_item_comp[] IS INITIAL.
SELECT ibase extid INTO TABLE lt_ibase FROM ibib FOR ALL ENTRIES IN
lt_item_comp WHERE
extid = lt_item_comp-knumber.
sort lt_ibase by ibase extid.
if not lt_ibase[] is initial.
LOOP AT lt_ibase INTO ls_ibase.
REFRESH LT_IBASECOMP[].
ls_ibapcomp-IBASE = ls_ibase-ibase.
*Retrieving all the components attached to the IBase.
*The below FM retrieves all the components associated with Ibase.
CALL FUNCTION 'CRM_IBASE_COMP_FIND_MULTI'
EXPORTING
I_COMP_DET = ls_ibapcomp
I_DATE =
I_TIME =
IV_INCLUDE_VOID =
IMPORTING
E_COMP_TAB = lt_ibasecomp
EXCEPTIONS
NOT_FOUND = 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.
append lines of lt_ibasecomp to lt_ibasecomp1.
ENDLOOP.
Retrieving all the service process attached to IBase and
Component
LOOP AT LT_IBASECOMP1 into ls_ibasecomp.
clear ls_inst_identifier.
refresh: lt_serv_item[],lt_inst_identifier[].
ls_inst_identifier-ibase = ls_ibasecomp-ibase.
ls_inst_identifier-instance = ls_ibasecomp-instance.
append ls_inst_identifier to lt_inst_identifier.
Retrieving all the service process( service orders or service confirmations)
CALL FUNCTION 'IB_SRV_ORDER_TO_COMPONENT_REP'
EXPORTING
it_inst_identifier = lt_inst_identifier
iv_on_header_level = C_X
IMPORTING
et_srv_ord_items_to_comp = lt_serv_item.
et_srv_ord_headers_to_comp = lt_serv_item.
append lines of lt_serv_item to lt_serv_item1.
endloop.
refresh lt_serv_item[].
SORT lt_serv_item1 BY crm_object_id.
DELETE ADJACENT DUPLICATES FROM lt_serv_item1 COMPARING
crm_object_id.
IF NOT lt_serv_item1[] IS INITIAL.
*Retrieving the required process types for all the Service Processes.
LOOP AT lt_serv_item1 INTO ls_serv_item WHERE
process_type = c_zcon OR
process_type = c_zcts OR
process_type = c_zicn OR
process_type = c_zcso OR
process_type = c_zcrt.
Retreiving the Service Process GUID to compare with Service Contract
Start and End Dates.
lv_cont_guid = ls_serv_item-header_guid.
INSERT lv_cont_guid INTO TABLE lt_cont_guid.
append ls_serv_item to lt_serv_item.
ENDLOOP.
ls_reqobj = 'APPOINTMENT'.
INSERT ls_reqobj INTO TABLE lt_reqobj.
ls_reqobj = 'TEXTS'.
INSERT ls_reqobj INTO TABLE lt_reqobj.
ls_reqobj = 'STATUS'.
INSERT ls_reqobj INTO TABLE lt_reqobj.
ls_reqobj = 'CUMULAT_H'. "'CUMULATED_I'.
INSERT ls_reqobj INTO TABLE lt_reqobj.
ls_reqobj = 'DOC_FLOW'.
INSERT ls_reqobj INTO TABLE lt_reqobj.
DELETE ADJACENT DUPLICATES FROM lt_cont_guid.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_cont_guid
it_requested_objects = lt_reqobj
IMPORTING
et_appointment = lt_appt_serv
et_text = lt_text
et_status = lt_status
et_cumulat_h = lt_cum
et_doc_flow = lt_doc_flow.
REFRESH lt_reqobj[].
LOOP AT lt_serv_item INTO ls_serv_item.
CLEAR lv_startserv.
if ls_serv_item-process_type = c_zcso.
READ TABLE lt_appt_serv INTO ls_appt_serv WITH KEY
ref_kind = c_a
ref_guid = ls_serv_item-header_guid
appt_type = c_srv_cust_beg.
Checking whether this BSO contains any confirmations ****
IF sy-subrc = 0.
READ TABLE lt_doc_flow INTO wa_docflow WITH KEY
ref_guid = ls_serv_item-header_guid
objtype_b = 'BUS2000116'
objtype_a = 'BUS2000117'
brel_kind = c_a.
objtype_b = c_vbrk
reltype = c_vona.
IF sy-subrc = 0.
REFRESH: lt_cont_guid, lt_appt_serv1.
lv_cont_guid = wa_docflow-ref_guid.
lv_cont_guid = wa_docflow-objkey_a.
INSERT lv_cont_guid INTO TABLE lt_cont_guid.
ls_reqobj = 'APPOINTMENT'.
INSERT ls_reqobj INTO TABLE lt_reqobj.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_cont_guid
IMPORTING
et_appointment = lt_appt_serv1.
IF sy-subrc = 0.
READ TABLE lt_appt_serv1 INTO ls_appt_serv1 WITH KEY
ref_kind = C_B
appt_type = C_SRVC_ACTUAL.
***If there is confirmation then bring the confirmation service date.
if sy-subrc = 0.
lv_startserv = ls_appt_serv1-date_to.
endif.
ENDIF.
else.
If it is stand-alone BSO then get the requested start date*****
lv_startserv = ls_appt_serv-date_to.
ENDIF.
ENDIF." if sy-subrc = 0 lt_appt_serv.
else.
READ TABLE lt_appt_serv INTO ls_appt_serv WITH KEY
ref_kind = c_a
ref_guid = ls_serv_item-header_guid.
appt_type = c_srvc_actual.
if sy-subrc = 0.
REFRESH: lt_cont_guid, lt_appt_serv1.
lv_cont_guid = wa_docflow-ref_guid.
lv_cont_guid = ls_serv_item-header_guid.
INSERT lv_cont_guid INTO TABLE lt_cont_guid.
ls_reqobj = 'APPOINTMENT'.
INSERT ls_reqobj INTO TABLE lt_reqobj.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_cont_guid
IMPORTING
et_appointment = lt_appt_serv1.
IF sy-subrc = 0.
READ TABLE lt_appt_serv1 INTO ls_appt_serv1 WITH KEY
ref_kind = C_B
appt_type = C_SRVC_ACTUAL.
***If there is confirmation then bring the confirmation service date.
if sy-subrc = 0.
lv_startserv = ls_appt_serv1-date_to.
endif.
endif.
endif.
endif.
if the Service Process Date is in between Service Contract Start and
end dates.
IF lv_startserv BETWEEN lv_start AND lv_end.
Hi Nithish,
You might get mess up with my code. So please check my below requirement without code.
Thanks for your reply. Currently I am doing that only using CRM_ORDER_READ by passing 'APPOINTMENT' in it_requested_objects paramter . what my problem is , I have enhanced Service Contract component with one button. When this button is clicked one pop-up window has to be displayed with all the service orders or service confirmations, whose start dates are between the Service Contract start and end dates.
For pop-up , I developed one component( ZCOMPONENT)and in that Inbound plug of Window, first I am catching the Header GUID(Service Contract GUID) and based on that I am retreiving all the items, components and appointements by passing
the below parameters to CRM_ORDER_READ like below
INSERT ls_reqobj INTO TABLE lt_reqobj.
ls_reqobj = 'APPOINTMENT'.
INSERT ls_reqobj INTO TABLE lt_reqobj.
ls_reqobj = 'ORDPRP_I'.
INSERT ls_reqobj INTO TABLE lt_reqobj.
Based on the above retreived parameters, I will get associated IBases and then I will get all the associated components to each IBase by using the below Function Modules. Then I have to retreive all the service orders(service confirmations) associated to each IBase and component. After getting all the service process for all the IBases and component combination. Again I have to filter them based on the required process types and collect all the valid service confirmation GUID's after filtering them. Now after getting all the required service confirmations again I have to read CRM_ORDER by passing 'APPOINTMENT' in it_requested_objects paramter and passing those GUID's .Now i have to compare the required dates by reading ET_APPOINTMENT Table by using APPT_TYPE = 'SERV_ACTUAL' for one type of service confirmation and 'srv_cust_beg'.
My problem is I am getting empty pop-up. I checked this it is taking 2+mins for one Service Contract. My question is in the above
after filtering the service orders based on the process types, I got 931 GUID's. Again I am passing these GUID's to CRM_ORDER_READ and filtering service orders based on the dates in ET_APPOINTMENT table. After filtering out based on the dates I got only 16 valid service confirmations out of total 931, which is waste of time. So my question is before passing the 931 GUID's to CRM_ORDER_READ, is there any table or FM to read the dates of each service order to filter out and then I could read CRM_ORDER_READ with only valid service confirmations ( 16 in this case ) instead of 931.
Please check the below code for your understanding purpose. Finally I have to know exact tables or FM's to read requested start date ( APPT_TYPE = 'SRV_CUST_BEG in ET_APPOITMENT table)and Service start date ( APPT_TYPE = 'SERV_ACTUAL)
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.