on 07-20-2009 4:29 PM
Hi,
I created one custom function module in which i am using CRM_ORDER_READ in the loop and reading the requested start date of the service order which is given by the user as a selection parameter.
LOOP AT t_itm_srvo INTO ds_itm_srvo. " this table contains the records of the crmd_orderadm_h
REFRESH lt_guid.
CLEAR: lt_guid ." ds_itm_srvo.
APPEND ds_itm_srvo-guid TO lt_guid.
REFRESH: lt_pricing_i, lt_partner, lt_appointment,lt_orgman,lt_status.
CLEAR: ds_pricing_i, ds_partner, ds_appointment,ds_orgman,ds_status.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_guid
it_item_guid = lt_guid
IMPORTING
et_pricing_i = lt_pricing_i
et_appointment = lt_appointment
et_partner = lt_partner
et_orgman = lt_orgman
et_status = lt_status.
LOOP AT lt_appointment INTO ds_appointment WHERE ref_guid = ds_itm_srvo-guid AND
appt_type = 'SRV_CUST_BEG'.
( appt_type = 'SRV_CUST_BEG' OR
appt_type = 'VALIDFROM').
EXIT.
ENDLOOP.
IF sy-subrc = 0.
date_from = ds_appointment-date_from.
IF NOT r_st_date[] IS INITIAL.
IF ds_appointment-date_from NOT IN r_st_date.
CONTINUE.
ENDIF.
ELSE.
gs_result-valid_from = date_from.
ENDIF.
ENDIF.
ENDLOOP.
I don't have to consider those records where requested start date is not in selection parameter. This function module runs for ever and at the end it gives short dump TSV_LIN_ALLOC_FAILED.
Could anyone please suggest me why this is taking long time or is their any better alternative so that i can avoid using this FM.
Regards,
Kamesh Bathla
Hi Kamesh,
How many guid/documents do you have in table t_itm_srvo?
If you have tons of them, maybe the system will not have the memory/capacity needed to perform your calculations.
Also, you can accelerate the CRM_ORDER_READ processing time. Just declare the objects that you want to read in importing parameter it_requested_objects. Here's an example that I had here:
INCLUDE crm_direct.
INSERT gc_object_name-appointment INTO TABLE lt_req_objects.
INSERT gc_object_name-orderadm_h INTO TABLE lt_req_objects.
INSERT gc_object_name-doc_flow INTO TABLE lt_req_objects.
INSERT gc_object_name-activity_h INTO TABLE lt_req_objects.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_header_guid
it_requested_objects = lt_req_objects
...
You can check also how the system will behave if you call only once this function. Put all guids into lt_guid table, and call it. This also may improve your performance issue. Something like this:
LOOP AT t_itm_srvo INTO ds_itm_srvo. " this table contains the records of the crmd_orderadm_h
APPEND ds_itm_srvo-guid TO lt_guid.
ENDLOOP.
REFRESH: lt_pricing_i, lt_partner, lt_appointment,lt_orgman,lt_status.
CLEAR: ds_pricing_i, ds_partner, ds_appointment,ds_orgman,ds_status.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_guid
IMPORTING
et_pricing_i = lt_pricing_i
et_appointment = lt_appointment
et_partner = lt_partner
et_orgman = lt_orgman
et_status = lt_status.
**** YOU SHOULD TREAT THE EXCEPTIONS, OR A SHORTDUMP MAY OCCUR.
LOOP AT t_itm_srvo INTO ds_itm_srvo.
LOOP AT lt_appointment INTO ds_appointment WHERE ref_guid = ds_itm_srvo-guid AND
appt_type = 'SRV_CUST_BEG'.
* ( appt_type = 'SRV_CUST_BEG' OR
* appt_type = 'VALIDFROM').
EXIT.
ENDLOOP.
IF sy-subrc = 0.
date_from = ds_appointment-date_from.
IF NOT r_st_date[] IS INITIAL.
IF ds_appointment-date_from NOT IN r_st_date.
CONTINUE.
ENDIF.
ELSE.
gs_result-valid_from = date_from.
ENDIF.
ENDIF.
ENDLOOP.
Hope that this may help you a little further.
Kind regards,
Garcia
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I tried by passing lt_req_objects
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_guid
it_requested_objects = lt_req_objects
it_item_guid = lt_guid
IMPORTING
et_pricing_i = lt_pricing_i
et_appointment = lt_appointment
et_partner = lt_partner
et_orgman = lt_orgman
et_status = lt_status
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
.
i am also using initialize after the read
CALL FUNCTION 'CRM_ORDER_INITIALIZE'
EXPORTING
IT_GUIDS_TO_INIT = lt_guid
IV_INITIALIZE_WHOLE_BUFFER =
IV_INIT_FRAME_LOG =
IV_LOG_HANDLE =
IV_KEEP_LOCK = FALSE
IMPORTING
ET_INITIALIZED_OBJECTS = lt_guid1
EXCEPTIONS
ERROR_OCCURRED = 1
OTHERS = 2
.
still its giving the same dump.
does it related to table space or shall i ask basis people to look over the dump?
Regards,
Kamesh Bathla
Hi,
I am using CRM_ORDER_READ just to filter out my result table on the basis of appointment date i.e et_appointment appt_type = 'SRV_CUST_BEG'. is there any way i can filter the record in my select query itself on the basis of appointment date, in that case i don't have to go to CRM_ORDER_READ.
Regards,
Kamesh Bathla
Hi Kamesh,
Just to share one more idea:
You can build a table vision based on the conditions that you've learned in this thread:
Then, to search with timestamps, you have to transform your dates into timestamps.
Example:
Date from = 01.01.2009
Date to = 31.01.2009
DATA lv_timestamp_from TYPE timestamp.
DATA lv_timestamp_to TYPE timestamp.
DATA lv_date_from TYPE udate VALUE '20090101'.
DATA lv_date_to TYPE udate VALUE '20090131'.
*- Conversions
CONVERT DATE lv_date_from TIME '000000' INTO TIME STAMP lv_timestamp_from TIME ZONE sy-zonlo.
CONVERT DATE lv_date_to TIME '235959' INTO TIME STAMP lv_timestamp_to TIME ZONE sy-zonlo.
Then use the timestamp variables and the table vision, to filter the documents guids that you want to use.
Kind regards,
Garcia
User | Count |
---|---|
8 | |
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.