‎2009 Apr 14 9:32 AM
Hi Friends,
Their are 3 ways we declare internal table using field string or not using like below.
1)
types: begin of ty_fs,
a type ztable-a,
b type ztable-b,
------------>
------------>
------------->
end of ty_fs.
data: it_fs type standard table of ty_fs intial size 0.2)
types: begin of ty_fs.
include structure ztable.
types : end of ty_fs.
data: it_fs type standard table of ty_fs intial size 0.3)
tables: ztable.
data: it_fs type standard table of ztable intial size 0.Please suggest which way is better in memory consuming and performance wise.
thanks®ards,
kat.
Edited by: Matt on Apr 14, 2009 10:33 AM - added tags
‎2009 Apr 14 9:35 AM
Tables will use more memory because you've declared an additional work area. You don't need it for your third option. Otherwise there is no difference.
Defining TYPES and then creating data using those types is better programming.
For this precise definition I'd use
data: it_fs type standard table of ztable..( initial size is not necessary ).
But if you want performance, then according to what the requirements are, you'd be better of with SORTED or HASHED tables.
matt
‎2009 Apr 14 9:37 AM
Hi,
1st method of declaring an internal table is good coding, since u need only certain fields its good coding to declare only those particular fields in the structure instead of INCLUDING the whole structure...
If we want whole structure then u can go for 3rd method instead of the other two...
Regards,.
Pavan
‎2009 Apr 14 9:39 AM
Here the first way includes all the fields of the table.
Edited by: kat k on Apr 14, 2009 10:41 AM
‎2009 Apr 14 9:43 AM
Hi,
Try declaring this way.
Example:
TYPES: BEGIN OF ty_ukmbp,
partner TYPE ukmbp_cms-partner,
check_rule TYPE ukmbp_cms-check_rule,
credit_group TYPE ukmbp_cms-credit_group,
END OF ty_ukmbp.
DATA : t_ukmbp TYPE STANDARD TABLE OF ty_ukmbp.
DATA : wa_ukmbp TYPE ty_ukmbp.
Clear: wa_ukmbp.
Note: Always try to clear the work area after using it.
Thanks,
Babu Kilari
‎2009 Apr 14 9:46 AM
Hi Babu,
here i'm just only concerned with the internal table declarations and no other code excluding i mentioned above.
thanks,
kat.
‎2009 Apr 14 9:49 AM
Then,
Go for the first option which you have mentioned(Similar to the one that i have mentioned)
Thanks,
Babu Kilari
‎2009 Apr 14 9:47 AM
Hello,
below process is the best for declaring internal table.
types: begin of ty_fs,
matnr type matnr,
werks type werks_d,
..............................
..............................
end of ty_fs.
data: itab_fs type standard table of ty_fs, " internal table without header lline
wa_fs type ty_fs. " work area of your internal table.
You can measure runtime analysis in the following path.
SE38>Environment>Examples-->Performance Examples.
Then type your code and execute to meausre comparative runtime.
Regards
Arindam
‎2009 Apr 14 9:52 AM
‎2009 Apr 14 10:02 AM