Skip to Content

Method call in End Routine (Taking Longer Time)

Hi Experts,

For a requirement, i have written an end routine in which I calling one method and it is taking longer time ( more than 1 day for 2lakh records )

This method been written on top of one DSO and is used to change incoming base unit to standard one like example KG to Litre.

Can you suggest some alternative to this. Like without using any routine i can change units.

Thanks,

Sumadhur Saxena

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Nov 03, 2015 at 07:21 AM

    This is the code available in se24 for get_uom_conversiom


    METHOD get_uom_conversion.

       DATA convert_flag TYPE n value 0.

       DATA temp_dimid TYPE dimid.

       DATA temp_qty TYPE F.

       CLEAR wa_t006.

       cv_final_unit = iv_target_unit.

       CALL METHOD zbw_uom_conversion=>convert_uom

         EXPORTING

           iv_logsys          = iv_logsys

           iv_soursystem      = iv_soursystem

           iv_matnr           = iv_matnr

           iv_target_unit     = iv_target_unit

           iv_base_unit       = iv_base_unit

           iv_base_quantity   = iv_base_quantity

           iv_test            = 'X'

         IMPORTING

           ev_returncode      = ev_returncode

         CHANGING

           cv_target_quantity = cv_target_quantity.

       IF ev_returncode EQ 0.

         cv_final_unit = iv_target_unit.

         convert_flag = 1.

       ELSE.

         READ TABLE i_t006 INTO wa_t006

         WITH KEY w_msehi = iv_base_unit.

         IF sy-subrc EQ 0.

           temp_qty = iv_base_quantity *

                               ( wa_t006-w_zaehl / wa_t006-w_nennr ) *

                               ( 10 ** wa_t006-w_exp10 ).

           temp_dimid = wa_t006-w_dimid.

           READ TABLE i_t006 INTO wa_t006

           WITH KEY w_msehi = iv_target_unit

                    w_dimid = temp_dimid.

           IF sy-subrc EQ 0.

           convert_flag = 1.

             cv_target_quantity = temp_qty *

                                 ( wa_t006-w_nennr / wa_t006-w_zaehl ) *

                                 ( 10 ** wa_t006-w_exp10 ).

             EV_RETURNCODE = 0.

           ENDIF.

         ENDIF.

       ENDIF.

    IF ( convert_flag = 0 ).

           cv_target_quantity = 0.

           cv_final_unit = iv_target_unit.

           EV_RETURNCODE = 0.

           convert_flag = 3.

    endif.

    ENDMETHOD.




    Below code for ZBW_UOM_CONVERSION attached here.


    Add comment
    10|10000 characters needed characters exceeded

    • Hello Sumadhur,

      Do you have authorization to change above code??

      If yes then you can optimize the code:-

      change select query

            SELECT * FROM /bic/adomdo06700

            INTO CORRESPONDING FIELDS OF TABLE ct_domdo067

            WHERE logsys = iv_logsys.

      *** change select * to limited field which you want

      ***   remove into correspoding of fields to into table

      ** wherever there they using read table no where Binary search is used...

         (before binary search SORT table based on mentioned WITH KEY Conditions)

      Regards,

      Hitesh

  • Nov 02, 2015 at 02:09 PM

    Hi Sumadhar

    Please paste your code here. We could check and enhance it for better performance.

    Unit conversions could be handled in query level as well. But it depends on your data. Provide the code and then lets analyse and decide how to proceed.

    Regards

    Karthik

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 03, 2015 at 05:22 AM

    Hello Sumadhur,

    as suggested by kartik,

    you can create curr. conversion is t. code RSCUR and the use at bex level.

    OR

    share code, we can check and try to optimize it.

    Regards,

    Hitesh


    Capture.PNG (56.8 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Nov 03, 2015 at 06:51 AM

    Hi

    PLease find the below code been written in end routine.

    We have existing method :get_uom_conversion. This method been built on top of one DSO and been written with many logic as per business requirement.

    We are just calling in our end routine based on data come from source. Even to process 50,000 record , its taking more than 6+ hrs for same.

    loop at RESULT_PACKAGE ASSIGNING <result_fields>.

          clear l_rep_qty.

          clear l_unit.

          call method zcl_bw_g0i_fcv=>get_uom_conversion

               exporting

                 iv_logsys          = <RESULT_FIELDS>-logsys

                 iv_soursystem      = <RESULT_FIELDS>-soursystem

                 iv_matnr           = <RESULT_FIELDS>-/BIC/XXXXCX

                 iv_base_unit       = <RESULT_FIELDS>-base_uom

                 iv_base_quantity   = <RESULT_FIELDS>-/BIC/GI000XXXX

               changing

                 cv_target_quantity = l_rep_qty

                 cv_final_unit      = l_unit.

          <RESULT_FIELDS>-base_uom = l_unit.

          <RESULT_FIELDS>-/BIC/GI000XXXX = l_rep_qty.

        endloop.

    Add comment
    10|10000 characters needed characters exceeded