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

Performance with internal table and processing Records

Former Member
0 Likes
806

Hi All

Can any one suggest some better ways to declare the internal table and effective statements to process the records in the internal table..

Kindly send model reports with the above criteria.

Thanks and Regards

Arun Joseph

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
611

Hi,

Go through this for better insight :

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm

  • Table declaration (old method)

DATA: BEGIN OF tab_ekpo OCCURS 0, "itab with header line

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

END OF tab_ekpo.

*Table declaration (new method n better)

TYPES: BEGIN OF t_ekpo,

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

END OF t_ekpo.

DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0, "itab

wa_ekpo TYPE t_ekpo. "work area (header line)

  • Build internal table and work area from existing internal table (obsolete now)

DATA: it_datatab LIKE tab_ekpo OCCURS 0,

wa_datatab LIKE LINE OF tab_ekpo.

  • Build internal table and work area from existing internal table,

  • adding additional fields

TYPES: BEGIN OF t_repdata.

INCLUDE STRUCTURE tab_ekpo. "could include EKKO table itself!!

TYPES: bukrs TYPE ekpo-werks,

bstyp TYPE ekpo-bukrs.

TYPES: END OF t_repdata.

DATA: it_repdata TYPE STANDARD TABLE OF t_repdata INITIAL SIZE 0, "itab

wa_repdata TYPE t_repdata.

4 REPLIES 4
Read only

Former Member
0 Likes
611

In case you have to LOOP through an internal table or you have to READ from an internal table, use FIELD-SYMBOLS instead of usual workareas.

When READing from internal table, make shure that the table is sorted or hashed and that you declared a good key.

reward points if helpful

Read only

Former Member
0 Likes
612

Hi,

Go through this for better insight :

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb366d358411d1829f0000e829fbfe/content.htm

  • Table declaration (old method)

DATA: BEGIN OF tab_ekpo OCCURS 0, "itab with header line

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

END OF tab_ekpo.

*Table declaration (new method n better)

TYPES: BEGIN OF t_ekpo,

ebeln TYPE ekpo-ebeln,

ebelp TYPE ekpo-ebelp,

END OF t_ekpo.

DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0, "itab

wa_ekpo TYPE t_ekpo. "work area (header line)

  • Build internal table and work area from existing internal table (obsolete now)

DATA: it_datatab LIKE tab_ekpo OCCURS 0,

wa_datatab LIKE LINE OF tab_ekpo.

  • Build internal table and work area from existing internal table,

  • adding additional fields

TYPES: BEGIN OF t_repdata.

INCLUDE STRUCTURE tab_ekpo. "could include EKKO table itself!!

TYPES: bukrs TYPE ekpo-werks,

bstyp TYPE ekpo-bukrs.

TYPES: END OF t_repdata.

DATA: it_repdata TYPE STANDARD TABLE OF t_repdata INITIAL SIZE 0, "itab

wa_repdata TYPE t_repdata.

Read only

0 Likes
611

Hi

Can you suggest me some better ways to process the internal table records??

I mean to say read table,collect, etc..

Thanks and Regards

Arun Joseph

Read only

0 Likes
611

1) Avoid nested loop, if possible.

if the internal table is large use binary search to read the entries otherwise u can read the entries directly.

or

for processing huge internal tables use parallel cursor concept.

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap%2bcode%2bfor%2bparallel%2bcursor%2b...

2) sort the internal table based on ur requirement. this will help u in faster retrieval of data.

3) With COLLECT lines with identical key are aggregated to one line, all numeric fields are summed up automatically

4) u can use "transporting" with READ statement if the internal table has more fields and required fields for processing are less.

5) u can use field-symbols for direct accessing of the internal table instead of populating the header.

6) avoid Selects in the Loop.