This website is not affiliated with, sponsored by, or approved by SAP AG.

Internal tables in abap classes

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

Internal tables in abap classes

Postby halam » Fri Nov 27, 2015 4:09 am

Hi all,

I'd like to ask you what is the best practise for internal table definition in ABAP classes in SE24.
Let's say I have 2 methods and each method will read data from MARA table and process this data in different way.
Both methods will read same columns from MARA table so internal table can have same structure.

Where should be the internal table LT_MARA declared?

1. would you declare it 2times, in each method separately like local method variable using
DATA: LT_MARA type table of MARA.

OR

2. would you create an attribute in class with table type MARA?

OR

3. it doesn't matter and I can choose any approach mentioned above?

Could you please explain shortly why you preffer selected solution?

Thank you.
halam
 
Posts: 49
Joined: Wed Nov 13, 2002 5:08 am

Re: Internal tables in abap classes

Postby Gothmog » Mon Nov 30, 2015 5:40 am

Is the data used only within each method? If yes, local data.
However, the table type can be defined in the class, and used in both method.
68 74 74 70 3a 2f 2f 74 69 6e 79 75 72 6c 2e 63 6f 6d 2f 62 64 6f 37 6d 77 67
Gothmog
 
Posts: 1941
Joined: Wed Sep 12, 2007 4:46 am
Location: Probably not home


Return to ABAP

Who is online

Users browsing this forum: Google [Bot] and 8 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.