Performance Comparison PDF
Performance Comparison PDF
Performance Comparison PDF
Along with ASSIGNING addition for the itab processing, we have REFERENCE INTO. Let’s take a deep dive into its usage.
REFERENCE INTO
Since ABAP release 610 , we can specify the REFERENCE INTO with Internal table operations like LOOP, READ etc. In order to use the reference
variable, you need to define the variable using REF TO. The variable than be declared as the data reference object. Since you define the variable with
specific type, it has all the components of that type. Once the variable is referenced, you can then use the operator -> to access the individual components,
same as you try to access any attribute of an object.
SELECT *
FROM t100 INTO TABLE t_t100 UP TO 10 ROWS.
ENDLOOP.
Performance Comparison
Since you can also access the itab records using Workarea and Field-Symobls, I thought of extending the earlier program used in the article Use of Field-
Symbol vs WA to include the performance measurement of working with the Reference variable as well.
REPORT ztest_np_loop_reference.
*
DATA: i_bseg TYPE STANDARD TABLE OF bseg,
wa_bseg LIKE LINE OF i_bseg.
*
DATA: lv_flag TYPE flag,
lv_sta_time TYPE timestampl,
lv_end_time TYPE timestampl,
lv_diff_w TYPE p DECIMALS 5,
lv_diff_f LIKE lv_diff_w,
lv_diff_r LIKE lv_diff_w,
lv_save LIKE lv_diff_w.
*
FIELD-SYMBOLS: <fs_bseg> LIKE LINE OF i_bseg.
WRITE: / 'Done'.
Verdict
Field-symbols gives highest performance improvement compared to Workarea and Reference variable. Field-Symbols is still a winner of the race, when
there more data. So, if you are using FS, keep using it. If you want to use more object oriented like data access, use the REFERENCE INTO.
Tags
zevolving.com/2014/03/use-of-reference-variable-vs-workarea-vs-field-symbols/ 2/4
4 Comments
7/2/2019 Use of REFERENCE variable vs Workarea vs Field-Symbols | ABAP Help
Steve Oldner
# March 14th, 2014 at 5:19 am
Thanks for the performance compare. Now I need to try this myself!
Himansu Gyala
# March 19th, 2014 at 11:21 pm
I always try to use field symbols in my programs, but REFERENCE INTO is a new for me as I never used in my program. Like your this
post too
Regards,
Himansu
Hai Naimesh thank you for this code benchmark test, I learn so much from this tutorial. I think the reason why field symbol is faster is
because it doesn’t have to use modify to update afield, such as modify itab from ld_itab, whenever we assign a new value into -col
then it will automatically update the field.
bilen Cekic
# March 28th, 2014 at 12:35 am
on internal table looping, reference into is only for ppl who likes OO fetish.
field symobol is deferenced version of reference. To use reference on displaying, reading,writng you need to derefere (which means
converting to field symbol).
So be a good boy and use field symbol.
“ Comments on this Post are now closed. If you have something important to share, you can always contact me.
Subscribe
Keep in touch. We would do great working together.
1400
Subscribe to Email
Follow @zevolving
your email
Current Poll
Do you like Quality Assurance of your Build/Design?
YES. I live for it!
I don't mind
NO. I hate it
Vote
TOP
View Results
zevolving.com/2014/03/use-of-reference-variable-vs-workarea-vs-field-symbols/ 3/4
7/2/2019 Use of REFERENCE variable vs Workarea vs Field-Symbols | ABAP Help
Search
Search in Zevolving
zevolving.com is founded by and maintained by Naimesh Patel. You can help by submitting your articles via Write a Post. The site is built on Wordpress.
Happy Designing!
All product names are trademarks of their respective companies. zevolving.com is not affiliated with SAP AG.
TOP
zevolving.com/2014/03/use-of-reference-variable-vs-workarea-vs-field-symbols/ 4/4