‎2011 Apr 27 3:46 PM
I would like to know what the perfomance issues if any the following code would cause:
select single matnr
from mean
into lv_matnr
where ean11 = lv_ean11
and eantp = 'UC'. "#EC *
if sy-subrc = 0. " If Same UPC existed / assigned to material then generate next UPC number
perform GET_NEXT_NUMBER. " Get Next number in the same number range
else.
V_UPC = lv_upc_chk.
endif.
The issue is that this code is in the form routine GET_NEXT_NUMBER and if the select to MEAN is successful it calls itself. If this happens many times wouldn't this have a negative effect on performance?
‎2011 Apr 27 3:58 PM
>
> I would like to know what the perfomance issues if any the following code would cause:
>
> select single matnr
> from mean
> into lv_matnr
> where ean11 = lv_ean11
> and eantp = 'UC'. "#EC *
> if sy-subrc = 0. " If Same UPC existed / assigned to material then generate next UPC number
> perform GET_NEXT_NUMBER. " Get Next number in the same number range
> else.
> V_UPC = lv_upc_chk.
> endif.
>
> The issue is that this code is in the form routine GET_NEXT_NUMBER and if the select to MEAN is successful it calls itself. If this happens many times wouldn't this have a negative effect on performance?
Unless you change lv_ean11 - This will be endless loop. Forget about performance but think about getting out from the routine.
if the value is changed then that is ok if it serves the purpose. This is a recursive call and cannot be eliminated if required.
‎2011 Apr 27 4:05 PM
Agreed. I should have included the code above this section where the NUMBER_GET_NEXT FM is called to build the next lv_ean11(UPC number) value used in the select. This process will continue until a matching UPC number is not found in MEAN.
‎2011 Apr 27 4:09 PM
that's alright, If you cannot eliminate the recursive call. as far as i know, there is no alternate to recursive