Showing results for 
Search instead for 
Did you mean: 

Call Customer Exist Enhancement (EXIST_SAPLRSAP_001) CMOD with 11310 records

Former Member
0 Kudos

Hello Experts,

Extraction from 2lis_11_vaitm is taking longer time even there are only few records. Normally it takes 2-3 mins but sometimes it takes 2-3 hrs to complete. Even once it take 12 hrs. there is no idoc stuck in SM58. I've attached job log screenshot from ECC.. Please can any body siggess why this is happening.. if someone else face some issue.

Accepted Solutions (0)

Answers (1)

Answers (1)

Active Contributor
0 Kudos

You better to fine tune your CMOD code with help of abap expert.

Mean while you can share your abap code, so that scn experts will provider some suggestions on your code.

Former Member
0 Kudos


Please see codes below:


* 1.0      D11K967555         16/03/2011    Peter Phillips Original


* Begin D11K967555 Supply Chain Project

DATA: l_mvgr1     TYPE mvgr1,

      l_noise_cat TYPE zsd_pressage_noise.

FIELD-SYMBOLS: <fs_data> TYPE mc11va0itm.


* SORDET data

* This method includes DTR SORDETs in table ZSD_OUT_SORDET, which is then

* used as a datasource in BW and SCM. DTR SORDETs correspond to quantities in sales order

* types ZRTS and ZRTR.

DATA: lo_sordet TYPE REF TO zcl_sd_sordet.

CREATE OBJECT lo_sordet.



    im_data   = c_t_data[]


    ch_errors = c_t_messages[]



* Processing for Field ZZMVGR1 (Title Group) ZZNOISE_CAT (Noise Category)


LOOP AT c_t_data ASSIGNING <fs_data>.

* Get Title Group from MVKE (Sales Data for Material)

  SELECT SINGLE mvgr1 FROM  mvke

                      INTO  l_mvgr1

                      WHERE matnr = <fs_data>-matnr

                      AND   vkorg = <fs_data>-vkorg

                      AND   vtweg = <fs_data>-vtweg.

  IF sy-subrc EQ 0.

    <fs_data>-zzmvgr1 = l_mvgr1.


* Get Noise Category from custom table ZSD_KNA1

* NB This must match the selection in APO for Info Provider Z_NOISE

  IF <fs_data>-auart EQ zcl_sd_constants=>WHO_OTYPE_SPEC_ACCTS    "ZWHN

  OR <fs_data>-auart EQ zcl_sd_constants=>CSV_OTYPE_FOREIGN       "ZWHF

  or <fs_data>-auart EQ zcl_sd_constants=>DTC_OTYPE_PRIMARY.      "ZWHZ

    SELECT SINGLE noise_cat FROM  zsd_kna1

                            INTO  l_noise_cat

                            WHERE kunnr = <fs_data>-kunnr.

    IF sy-subrc EQ 0.

      <fs_data>-zznoise_cat = l_noise_cat.




* End D11K967555 Supply Chain Project



*loop at c_t_data into l_s_MCVBAP .                 "4.7- Unicode

LOOP AT c_t_data.                               "4.7+ Unicode

  MOVE-CORRESPONDING c_t_data TO l_s_mcvbap.     "4.7+ Unicode

  l_tabix = sy-tabix.

*     Lookup the G/L account and Costcentre from the requisition


                 INTO l_s_ebkn

                 FROM ebkn

                 WHERE banfn = l_s_mcvbap-vgbel

                   AND bnfpo = l_s_mcvbap-vgpos .

  IF sy-subrc = 0.

    MOVE l_s_ebkn-sakto TO l_s_mcvbap-submi .

    MOVE l_s_ebkn-kostl TO l_s_mcvbap-kostl .

  ELSE .

    MOVE space TO l_s_mcvbap-submi .


*     Lookup the Approver from the ZCOREAPPROVAL table (workflow)


                INTO t_uname

                FROM zcoreapproval

                WHERE quote = l_s_mcvbap-vgbel

                  AND action = 'A' .

  IF sy-subrc = 0.

    MOVE t_uname TO l_s_mcvbap-qmnum.


    MOVE space TO l_s_mcvbap-qmnum.


  MOVE-CORRESPONDING l_s_mcvbap TO c_t_data.

  "4.7+ Unicode

  MODIFY c_t_data INDEX l_tabix.

  "4.7+ Unicode

*modify c_t_data from l_s_mcvbap index l_tabix.

*"4.7- Unicode


METHOD mass_load_dtr_supply_return.

  TYPES: BEGIN OF ty_data_to_process,

                  kunnr TYPE kunnr,

                  prsdt TYPE prsdt,

                  vkorg TYPE vkorg,

         END OF ty_data_to_process,

         BEGIN OF ty_vbeln_to_process,

                  vbeln TYPE vbeln,

                  kunnr TYPE kunnr,

                  uadat TYPE audat,

                  prsdt TYPE prsdt,

         END OF ty_vbeln_to_process.

  DATA: le_exception TYPE REF TO zcx_edi_exception,

        ls_message TYPE balmi,

        lt_data_to_process TYPE SORTED TABLE OF ty_data_to_process WITH NON-UNIQUE KEY kunnr prsdt vkorg,

        ls_data_to_process TYPE ty_data_to_process,

        lt_dates TYPE STANDARD TABLE OF ty_data_to_process,

        lt_data_buffer TYPE STANDARD TABLE OF ty_data_to_process,

        lt_vbeln TYPE STANDARD TABLE OF ty_vbeln_to_process.

  FIELD-SYMBOLS: <fs_data> TYPE mc11va0itm,

                 <fs_vbeln> TYPE ty_vbeln_to_process,

                 <fs_data_buffer> TYPE zsd_sales_doc_tab.

* Get all retailers


*    im_refresh        = ''

*    im_ignore_deleted =

*    im_no_pressage_id =

      im_kunnr_only     = abap_true


* Get Pressage deletes

  dtr_get_mass_deletes( ).

  LOOP AT im_data ASSIGNING <fs_data>.

    IF <fs_data>-vkorg = c_dtr_sales_org.

      ls_data_to_process-kunnr = <fs_data>-kunnr. " Customer Numbr

      ls_data_to_process-prsdt = <fs_data>-prsdt. " Pricing Date

      ls_data_to_process-vkorg = <fs_data>-vkorg. " Sales Org

      COLLECT ls_data_to_process INTO lt_data_to_process.



  IF me->dtr_deleted_items[] IS NOT INITIAL.

    SELECT vbak~kunnr  " Ship-to Customer

           vbak~audat  " Document Date

           vbak~vkorg  " Sales Org

           INTO TABLE lt_data_buffer

           FROM vbak

           FOR ALL ENTRIES IN me->dtr_deleted_items[]

           WHERE vbak~vbeln = me->dtr_deleted_items-vbeln.

    LOOP AT lt_data_buffer INTO ls_data_to_process.

      IF ls_data_to_process-vkorg = c_dtr_sales_org.

        COLLECT ls_data_to_process INTO lt_data_to_process.




  LOOP AT lt_data_to_process INTO ls_data_to_process.

    CLEAR: ls_data_to_process-kunnr, ls_data_to_process-vkorg.

    COLLECT ls_data_to_process INTO lt_dates.


  SORT lt_dates.

  CHECK lt_data_to_process[] IS NOT INITIAL.

* BEGIN of performance enhancement

  IF lt_data_to_process[] IS NOT INITIAL.

    SELECT vbak~vbeln




      INTO TABLE lt_vbeln

      FROM vbak INNER JOIN vbkd ON vbak~vbeln = vbkd~vbeln

      FOR ALL ENTRIES IN lt_dates

      WHERE prsdt = lt_dates-prsdt.

    LOOP AT lt_vbeln ASSIGNING <fs_vbeln>.

      READ TABLE lt_data_to_process WITH TABLE KEY kunnr = <fs_vbeln>-kunnr

                                                   prsdt = <fs_vbeln>-prsdt

                                                   vkorg = c_dtr_sales_org

                                                   TRANSPORTING NO FIELDS.

      IF sy-subrc <> 0.

        DELETE lt_vbeln.




  CHECK lt_vbeln[] IS NOT INITIAL.

* Get all Sale Doc Items by Customer and Issue Date

  SELECT vbak~kunnr  " Ship-to Customer

         vbak~audat  " Document Date

         vbak~vbeln  " Sales Document Number

         vbak~auart  " Sales Document Type

         vbak~faksk  " Billing Block

         vbak~lifsk  " Delivery Block

         vbap~abgru  " Reason for rejection

         vbap~matnr  " Material Number

         vbap~kwmeng " Quantity

         vbap~vrkme  " Unit for quantity

         vbkd~prsdt  " Pricing Date

         vbap~posnr  " Sales Document Item Number

         vbak~augru  " Sales Order Reason

         vbuk~gbstk  " Sales Order overall Status

         vbak~vkorg  " Sales Org

         vbap~pstyv  " Item Category

         INTO TABLE me->sales_doc_buffer_audat[]

         FROM vbak

         INNER JOIN vbuk ON vbuk~vbeln = vbak~vbeln

         INNER JOIN vbap ON vbak~vbeln = vbap~vbeln

         INNER JOIN vbkd ON vbak~vbeln = vbkd~vbeln

*           INNER JOIN vbkd ON vbak~vbeln = vbkd~vbeln

**           FOR ALL entries IN lt_dates

**           WHERE vbak~kunnr = lt_data_to_process-kunnr

**           AND   vbak~audat = lt_data_to_process-datum

         FOR ALL entries IN lt_vbeln

         WHERE vbak~vbeln = lt_vbeln-vbeln      .

*           AND   vbkd~posnr = '000000'. " 0000 = Pricing Date of Document, not items

* Fix for Billing - remove any orders with Order Reason D99

  delete me->sales_doc_buffer_audat[] where augru = c_billing_fix_order_reason.

  INSERT LINES OF me->sales_doc_buffer_audat[] INTO TABLE me->sales_doc_buffer_prsdt[].

* END OF Performance enhancement

  LOOP AT lt_data_to_process INTO ls_data_to_process.



            im_issue_date = ls_data_to_process-prsdt

            im_customer   = ls_data_to_process-kunnr

* CR12,672 - want to include rejected orders for Sordet

            im_ignore_rejected = ' '


      CATCH zcx_edi_exception INTO le_exception.

        CLEAR ls_message.

        ls_message-msgty = 'E'.

        ls_message-msgno = le_exception->message_no.

        ls_message-msgid = sy-msgid.

        ls_message-msgv1 = sy-msgv1.

        ls_message-msgv2 = sy-msgv2.

        ls_message-msgv3 = sy-msgv3.

        ls_message-msgv4 = sy-msgv4.

        APPEND ls_message TO ch_errors.



* And do mass DB insert / update

  mass_update_sordet( ).



Former Member
0 Kudos

Looking at the job log, user exit code is clearly taking the time. But, the code seems to have been developed by an experienced ABAPer and no obvious problems appear in visual examination. If you are not an ABAPer, work with an ABAPer and do the following.

1) Run time analysis (SE30) on RSA3 on ECC system. That will show which statement is causing the performance problem.

2) Put a break-point in the user exit, run RSA3, and go step-by-step to see which statement is taking the time.

Once you know which statement is causing the delay, you can come up with a solution to improve the performance.

Active Contributor
0 Kudos

Problem with code.

There are select statement inside the Loop.

Please ask your abaper to tune the code and instead of select inside loop, ask him to use the read statement with binary search option.

Also there are too many loop statement, ask him to look for reducing/clubbing them, if possible.




Former Member
0 Kudos


Agree with VB, it look more like code problem.

As you said:

Normally it takes 2-3 mins but sometimes it takes 2-3 hrs to complete

I would suggest you to add a few message statements to write to job log, so you can check which part of the code cause the problem when it happen next times.

As mentioned by VB, loop is likely to have problem, so keep that in mind when adding message.