‎2009 Aug 14 9:11 AM
Hello All,
Is SHIFT v_variable LEFT DELETING LEADING '0' better than CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'.
Please reply with reasons.
Thanks,
Nitu Kumari
‎2009 Aug 14 3:16 PM
Nitu,
Calling a function module would have a greater cost performance vise, however you are splitting hairs here. The difference will not be tangible unless you are processing a huge number of records. Ideally when you process such a large volume of records (so as to have a tangible difference) you would be doing it in a background processing run not in the foreground because it could time out.
It does not really matter. Take your pick. The function module gives you the convenience of re-using a tried and tested logic. Re-inventing the wheel would cost you more in terms of time.
‎2009 Aug 14 12:23 PM
Hi,
There is certainly a significant performance difference - of course that will only be meaningful with mass processing
I ran a test with 1 million iterations using input field '000000012345':
- SHIFT LEFT: 160 ms average
- call function: 1950 ms average
Rgds,
Mark
‎2009 Aug 14 1:44 PM
It's not better or worse, it's different. Try v_variable = '000ABCDE'.
Thomas
‎2009 Aug 14 2:23 PM
The important thing is that the logic is different in both, so which to use depends on your specific requirements. If I know the string will only contain numerics, I generally avoid the exit. (But then I have gotten in trouble when the string suddenly contained alphas.)
Rob
‎2009 Aug 14 3:16 PM
Nitu,
Calling a function module would have a greater cost performance vise, however you are splitting hairs here. The difference will not be tangible unless you are processing a huge number of records. Ideally when you process such a large volume of records (so as to have a tangible difference) you would be doing it in a background processing run not in the foreground because it could time out.
It does not really matter. Take your pick. The function module gives you the convenience of re-using a tried and tested logic. Re-inventing the wheel would cost you more in terms of time.
‎2009 Aug 17 12:58 PM
Hello Nitu,
Output will be same and code written inside will be similar. The additional thing in calling Function module is time taking. so SHIFT LEFT DELETING is suggestable
‎2009 Aug 31 2:44 PM
>
> Hello Nitu,
>
> Output will be same and code written inside will be similar. The additional thing in calling Function module is time taking. so SHIFT LEFT DELETING is suggestable
That's incorrect. Try doing both with '12345678' and '1234ABCD'.
Rob
‎2009 Aug 18 10:14 AM
Hi Nitu,
Try executing the below code, you can see the difference,
ATA: V_VAR TYPE CHAR20.
V_VAR = '001234'.
SHIFT v_var LEFT DELETING LEADING '0'.
WRITE:/ 'NUMERIC:SHIFT', V_VAR.
V_VAR = '001234'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = V_VAR
IMPORTING
OUTPUT = V_VAR
.
WRITE:/ 'NUMERIC:EXIT', V_VAR.
V_VAR = '00ABCD'.
SHIFT v_var LEFT DELETING LEADING '0'.
WRITE:/ 'CHAR:SHIFT', V_VAR.
V_VAR = '00ABCD'.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
INPUT = V_VAR
IMPORTING
OUTPUT = V_VAR
.
WRITE:/ 'CHAR:EXIT', V_VAR.
I suggest to remove the 0s manually with 'SHIFT' instead of EXIT.
Rgds,
Sripal