‎2009 Mar 26 4:57 AM
Hi Guru's,
Please advice which is da best amoung the below said.
Normally I feel more comfortable using the second one is there any problem using the second one??
Please let me know..
1.
TYPES: BEGIN OF typ_item,
matnr TYPE matnr,
werks TYPE werks_d,
END OF typ_item.
DATA: gt_item TYPE TABLE OF typ_item,
gs_item TYPE typ_item,
gt_where TYPE TABLE OF string.2.
DATA: begin of itab occurs 0,
matnr like mara-matnr,
werks like marc-werks,
end of itab.3.
TYPES : BEGIN OF typ_mara,
matnr type mara-matnr,
werks type marc-werks,
end of typ_mara.
data: typ_mara type table of mara with header line.Thanks
Raj
‎2009 Mar 26 5:06 AM
Hi Raj,
The data decalration preferably should be like:
Types: Begin of t_tab,
field1 type c,
field2 type c,
End of t_tab.
Data: It_tab type standard table of t_tab,
wa_tab type t_tab.
Then for fetching the data you can do like:
Loop at it_tab into wa_tab.
Endloop.
Hope it helps
Regards
Mansi
‎2009 Mar 26 4:58 AM
‎2009 Mar 26 5:00 AM
If you look it from performance point of view First one is the better option.
You can check the same from SE30 - tips and tricks in application toolbar.
‎2009 Mar 26 5:02 AM
Hi,
Methods 2 and 3 are obsolete statements which make use of internal tables with header line concept and are only for demo purposes.
Method 1 is latest way and can be implemented.
Methods 2 and 3 usage will give u Extended program check error in obsolete statements.
‎2009 Mar 26 5:03 AM
Hi,
First one is the best approach.
Declare a type first.
Create an internal table without header line.
Instead of header line create a work area.
And use loop from internal table into work area.
Regards,
Tarun
‎2009 Mar 26 5:04 AM
Hi Raj,
The first one will give better performance than the remaining ones.
It will be performance drain if we work with internal tables having header lines.It will be better if we create one work area for that internal table and use that.
Also occurs 0 and header line statements may become obsolete in the upcoming versions.
Hope it will be useful.
Regards,
Lakshman
‎2009 Mar 26 5:06 AM
Hi Raj,
The data decalration preferably should be like:
Types: Begin of t_tab,
field1 type c,
field2 type c,
End of t_tab.
Data: It_tab type standard table of t_tab,
wa_tab type t_tab.
Then for fetching the data you can do like:
Loop at it_tab into wa_tab.
Endloop.
Hope it helps
Regards
Mansi
‎2009 Mar 26 6:57 AM
Hi,
Thank you for your advice !!
But normally I use the second one and I feel more comfortable in it but now I would like to
change to first one. When I use like I fetch the records by using ALL ENTRIES ,
APPENDING SECOND ITAB TO FIRST ITAB , SELECT SINGLE etc ....
my question is if Iam changing to second one will there be change in logical flow ?
Also please advice purpose of gt_where TYPE TABLE OF string in the below said.
also advice me where is da headerline and pupose of declaring it seperately..
TYPES: BEGIN OF typ_item,
matnr TYPE matnr,
werks TYPE werks_d,
END OF typ_item.
DATA: gt_item TYPE TABLE OF typ_item,
gs_item TYPE typ_item,
gt_where TYPE TABLE OF string.Thanks
Raj
Edited by: Raj rockss on Mar 26, 2009 7:58 AM
‎2009 Mar 26 7:08 AM
Hi Raj,
The second method is not preferable in the new version 6.0,
In the second option it will create you an internal table with header line,
so you while looping it you are not required to write:
loop at itab into wa,
you can only write:
Your select query into itab.
loop at itab.
Append second itab from first itab on some condition.
Endloop
And gt_where type table of string will make
you an internal table gt_where without header line.
Hope it helps
Regards
Mansi
‎2009 Mar 26 9:53 AM
‎2009 Mar 26 5:12 AM
Hi:
1st is the best option, since this is the way to declare the internal table as a local object, which further effects the performanance.
So use 1st only.
Regards
Shashi
‎2009 Mar 26 5:22 AM
first one is the best one
and also if u use the internal table with header line u vll face some problems and lots of confusion
table and work area are shud be different to make it clear an easy to understand.
second and third are obsolete now and can be used gives no performance issue.
its like goto wich is obsolete hope u got it.
‎2009 Mar 26 5:24 AM
First one is the best approach as we should always prefer TYPE declaration instead of LIKE.
‎2009 Mar 26 5:59 AM
Hello,
The first one is the best approach.
The other two appraches should not be used as they have become obsolete.
‎2009 Mar 26 8:12 AM
U should not use 2 nd and 3 rd one it is old now.
use this
Types: Begin of ls_tab,
matnr type mara-matnr,
mtart type mara-mtart,
End of ls_tab.
Data: It_tab type standard table of ls_tab,
wa_tab type ls_tab.
then for processing use like
Loop at lt_tab into wa_tab.
logic
Endloop.
Regards
‎2009 Mar 26 9:52 AM