SAP READ Statements...
Hello Blog Readers,
This blog is for those who would like to know about the SAP ABAP READ statement varieties.
And, I hope you would enjoy this blog!! :-).
Please correct/suggest if any wrong observed/found.
From below examples,
Before ABAP 7.40 Code
** Read Statement using Index
Read Table <itab> into <wa> index <no>.
*** From above statement, It is clear to understand, that a internal table <itab> ***record is fetched into <wa> based on given Index number.
*** Make sure, the records exists else handle with exception cases to avoid run-time *** errors.
**Read Statement using with key & non binary search
Read Table <itab> into <wa> with key <Field1><operator><value>.
*** From above statement, It is observed a record is moved into <wa> from <itab>
*** based on key/non-key fields of on non-sorted <itab>.
**Read Statement using with key & binary search
Read Table <itab> into <wa> with key <f1><op><val> <f2><op><val> binary search.
*** Similar with above case, as this statement binary search is included due to ***<itab> is in sorted order. This also improves the performance compared to ***previous statement.
**Read Statement with table key
Read Table <itab> into <wa> with table key <keyname> components <f1><value><f2><value>.
*** Generally this statement is used for Sorted & Hashed tables declaration. As ***primary key/key fields have to be mentioned in internal table declaration.
*** <keyname> could be specified secondary key name along with components ***addition for non key fields else not available would ***consider as primary table ***keys.
*** Addition with this Using key can also be included.
** Read Statement with addition Transporting.
Read Table <itab> into <wa> with key <f1><op><val> transporting no fields/<f1><f2>... .
*** Here from above, when you want to check whether records exists in <itab>
***without any data copying into <wa>/ can be used to fetch only the required ***<fields> from <itab>/ get the index value i.e. increase the performance.
With/Above ABAP 7.40 Code
The explanation/description would be same as above. Statements changed.** Read Statement using Index
<wa> = <itab>[<Idx-no>].
**Read Statement using with key & non binary search
<wa> = <itab>[<f1> = <val> <f2> = <val>].
**Read Statement with table key
<wa> = <itab>[KEY <keyname><f1> <op> <val> <f2> <op> <val>].
**Read statement for records exists or not
If line_exists( <itab>[<f1><op><val>...] ).
Endif.
** Read index value
Data(Idx) = line_index( <itab>[ <f1><op><val>...) ).
Thanks.
Will get back to you soon..... :-)
Comments
Post a Comment