‎2008 Sep 05 9:35 AM
Hi friends,
can any one differenciate between the below 2 codes.
code :
data: i_vbak like vbak occurs 0 with header line.
data: i_vbap like vbap occurs 0 with header line.
*************************************************************************
a) Sort I_vbap by vbeln.
Loop at i_vbak.
read table i_vbap with key
vbeln = i_vbak-vbeln binary search.
If sy-subrc = 0 and i_vbap-posnr = u201800010u2019.
endif.
endloop.
*****************************************************************************
b) Sort I_vbap by vbeln.
Loop at i_vbak.
read table i_vbap transporting posnr with key
vbeln = i_vbak-vbeln binary search.
If sy-subrc = 0 and i_vbap-posnr = u201800010u2019.
endif.
endloop.
*******************************************************************************
what will happen if i use transporting and if i dont use transporting.
which one is preferable.
can any one suggest me.
Regards,
Priyanka.
‎2008 Sep 05 9:40 AM
Hi Priyanka,
If you do not use TRANSPORTING <> FILEDS, then all the fileds of the selected selected records will be copied to the Internal table work area.
If you use TRANSPORTING, only the selected fileds from the table will be move to the work area, hence performance will be better.
As you are checking only posnr value, you can use transporting posnr .
‎2008 Sep 05 9:40 AM
Probably the second one is better since only one field would to transferred to the header as compared to all fields in the option 1.
~Piyush Patil
‎2008 Sep 05 9:40 AM
Hi Priyanka,
If you do not use TRANSPORTING <> FILEDS, then all the fileds of the selected selected records will be copied to the Internal table work area.
If you use TRANSPORTING, only the selected fileds from the table will be move to the work area, hence performance will be better.
As you are checking only posnr value, you can use transporting posnr .
‎2008 Sep 05 9:48 AM
swastik can u be more clear what exactly happens when i use a) logic and when i use b) logic.
Regards,
Priyanka.
‎2008 Sep 05 9:53 AM
hiii
a) Sort I_vbap by vbeln.
Loop at i_vbak.
read table i_vbap with key
vbeln = i_vbak-vbeln binary search.
If sy-subrc = 0 and i_vbap-posnr = u201800010u2019.
endif.
endloop.
here when you use this logic using READ statement all the fields of i_vbap table will be fetched and then if condition is there then it will process further but here whole data of i_vbap table will be read.
b) Sort I_vbap by vbeln.
Loop at i_vbak.
read table i_vbap transporting posnr with key
vbeln = i_vbak-vbeln binary search.
If sy-subrc = 0 and i_vbap-posnr = u201800010u2019.
here when you use this logic using READ statement only POSNR field of i_vbap table will be fetched and then if condition is there then it will process further but here not whole data of i_vbap table will be read. so it will improve performance
regards
twinkal
‎2008 Sep 05 9:41 AM
hiii
if we use READ syntax with out transporting, we will fetch all the fields unnecesserly
so try using TRANSPORTING in READ statment
now we get posnr fields only while fetching.
so by using TRANSPORTING in READ statment performance can be improved.
regards
twinkal
‎2008 Sep 05 9:41 AM
hi
when you use 'read table' statement with 'transporting' addition
program reads and passes only those fields that you explicitly wrote.
in this case 'read table' statement works a little faster.
‎2008 Sep 05 9:42 AM
Hi,
There is no difference in the code you have provided....
If you use Transporting.....Fields mentioned after the key word will only be having the data after the read statement.
Any 1 can be used based on the requirement...
Regards,
Kunjal