cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

very slow execution of function module CRM_ORDER_READ.How to improve performance?

0 Likes
1,661

If data is less then function module execute easily but data is arounds more than 80,000 then it take more time.Please provide the solution.

Accepted Solutions (1)

Accepted Solutions (1)

michael_piesche
Active Contributor
0 Likes

You are seriously trying to use CRM_ORDER_READ for 80'000 one-order objects at once? I am not surprised that this will take a long time. What 'performance' are you hoping to realistically achieve (seconds, minutes, hours)?

Are you already making use of most import parameters to limit the scope of the FM? What do you actually need to read from those orders?

I simple limitation would be this one, to restrict to read-mode as well as the objects you actually only need from the one-orders.

INCLUDE CRM_DIRECT. " includes e.g. CRM_OBJECT_NAMES_CON as well CRM_MODE_CON

DATA lt_requested_objects TYPE crmt_object_name_tab.

" ....

" only request necessary objects from one-order objects, e.g. ORDERADM_H, CUSTOMER_H
" but there are also others, see Include CRM_OBJECT_NAMES_CON
INSERT gc_object_name-orderadm_h INTO TABLE lt_requested_objects.
INSERT gc_object_name-customer_h INTO TABLE lt_requested_objects.

CALL FUNCTION 'CRM_ORDER_READ'
      EXPORTING
        it_header_guid       = lt_header_guid
        it_requested_objects = lt_requested_objects
        iv_mode              = gc_mode-display
      IMPORTING
        et_orderadm_h         = lt_orderadm_h
        et_customer_h         = lt_customer_h
      EXCEPTIONS
        OTHERS               = 1.

Otherwise, you might have to read from database tables directly and join accordingly, to truely get the best performance possible.

And you will have to be a lot more specific on what you are currently doing and actually trying to achieve, in order for the community to help you out.

0 Likes

Hi Michael,

But how to find all tables which used in this function module?

michael_piesche
Active Contributor
0 Likes

gaurav120z

Post your coding of calling CRM_ORDER_READ and I can help you out. But basically, the importing tables are the objects that you need (or also need to question whether you need all of those), and therefore only for those you do the request.

0 Likes

Please find this..

IF IT_GUID_H[] IS NOT INITIAL.

IS_REQ = 'ACTIVITY_H'.
INSERT IS_REQ INTO TABLE IT_REQ.
IS_REQ = 'ORDERADM_H'.
INSERT IS_REQ INTO TABLE IT_REQ.
IS_REQ = 'PARTNER'.
INSERT IS_REQ INTO TABLE IT_REQ.
IS_REQ = 'STATUS'.
INSERT IS_REQ INTO TABLE IT_REQ.
IS_REQ = 'SERVICE_OS'.
INSERT IS_REQ INTO TABLE IT_REQ.
IS_REQ = 'DOC_FLOW'.
INSERT IS_REQ INTO TABLE IT_REQ.

CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
IT_HEADER_GUID = IT_GUID_H
IT_REQUESTED_OBJECTS = IT_REQ
IMPORTING
ET_ORDERADM_H = ET_ORDERADM_H
ET_PARTNER = ET_PARTNER
ET_SERVICE_OS = ET_SERVICE_OS
ET_STATUS = ET_STATUS
ET_ACTIVITY_H = ET_ACTIVITY
ET_DOC_FLOW = ET_DOC_FLOW.

michael_piesche
Active Contributor
0 Likes

gaurav120z

Your above coding looks ok, in that case I am not sure what you mean by 'But how to find all tables which used in this function module?'

What is the current performance time with this coding with 80'000+ entries and what performance would you accept?

0 Likes

Actually, Debugging time,If i execute the function module , then it's take more than 30 min .

michael_piesche
Active Contributor
Gaurav SharmaAnd you inserted 80'000+ guids into IT_GUID_H? I wouldnt be surprised that it takes that long.If you want to read the data from database tables directly, currently you would need these, and in most cases they are joined from CRMD_ORDERADM_H/I-GUID in CRMD_LINK with GUID in related tables:
  • CRMD_ORDERADM_H
  • CRMD_PARTNER
  • CRM_JEST (Status)
  • CRMD_ACTIVITY_H
  • For SERVICE_OS I would recommend checking/debugging FM CRM_SERVICE_OS_GET_DATA to find out what database tables are used, most likely CRMD_SRV_*
  • For DOC_FLOW it depends what you all need, mainly CRMD_BINREL, CRMD_BRELVONAE, also check dbs in package CRM_DOC_FLOW, CRMD_BREVONAE has ORDERADM_H-GUID for instance in field objguid_a_sel

Answers (1)

Answers (1)

S_Sriram
Active Contributor
0 Likes

Hi Sharma Ji.

Enable the ST12 trace, refer the SAP note 2436955 with help of ABAPer check the expensive sql statement and take the necessary action.

Regards

SS