on 11-02-2015 2:04 PM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sumadhur
The code has been made in a very complicated way, may be because it was developed before many years or the system itself was complicated that time.
All you need to do now is to get a single DSO (may be domdo067) or an infoobject (0material -because materail master will have all conversion factors in it) where you will get the conversion factor information.
Once you are sure that 0material has all the required information, select those required fields into an internal table. read the table based on the result fields and do the conversion.
This way will be very fast and very reliable as well. Please check and let us know if you have such DSO/master data which has got all the information.
Regards
Karthik
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.