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

using transporting and without transporting

Former Member
0 Likes
939

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
902

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 .

7 REPLIES 7
Read only

Former Member
0 Likes
902

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

Read only

Former Member
0 Likes
903

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 .

Read only

0 Likes
902

swastik can u be more clear what exactly happens when i use a) logic and when i use b) logic.

Regards,

Priyanka.

Read only

0 Likes
902

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

Read only

Former Member
0 Likes
902

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

Read only

Former Member
0 Likes
902

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.

Read only

Former Member
0 Likes
902

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