Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'

Former Member
0 Likes
6,021

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,519

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.

7 REPLIES 7
Read only

Former Member
0 Likes
3,519

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

Read only

ThomasZloch
Active Contributor
0 Likes
3,519

It's not better or worse, it's different. Try v_variable = '000ABCDE'.

Thomas

Read only

Former Member
0 Likes
3,519

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

Read only

Former Member
0 Likes
3,520

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.

Read only

Former Member
0 Likes
3,519

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

Read only

0 Likes
3,519

>

> 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

Read only

Former Member
0 Likes
3,519

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