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

Need to Process Large Internal Tables Efficiently

Former Member
0 Likes
472

I have two internal tables, T_EKKO(for PO Header data) and T_EKPO(for PO Item data). These tables carry data for 10 PO's with at least 1 line item in each one.

The requirement is to write the following fields on the result screen:

Line 1: PO Number.-

Line 2:PO Item, Article Number.

What is the most efficient way to do this?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
449

Hi,

You can use parallel processing techinque..

Ex.

SORT T_EKPO BY EBELN.

DATA: V_TABIX TYPE SYTABIX.

LOOP AT T_EKKO.

WRITE: / 'PO Number - ', T_EKKO-EBELN.

READ TABLE T_EKPO TRANSPORTING NO FIELDS

WITH KEY EBELN = T_EKKO-EBELN

BINARY SEARCH.

IF SY-SUBRC = 0.

  • Store the row number.

V_TABIX = SY-TABIX.

LOOP AT T_EKPO FROM V_TABIX.

  • Exit condition.

IF T_EKPO-EBELN <> T_EKKO-EBELN.

EXIT.

ENDIF.

WRITE: / 'PO item', T_EKPO-EBELP.

.......

ENDLOOP.

ENDIF.

ENDLOOP.

Thanks,

Naren

I have two internal tables, T_EKKO(for PO Header data) and T_EKPO(for PO Item data). These tables carry data for 10 PO's with at least 1 line item in each one.

The requirement is to write the following fields on the result screen:

Line 1: PO Number.-

Line 2:PO Item, Article Number.

What is the most efficient way to do this?

4 REPLIES 4
Read only

Former Member
0 Likes
450

Hi,

You can use parallel processing techinque..

Ex.

SORT T_EKPO BY EBELN.

DATA: V_TABIX TYPE SYTABIX.

LOOP AT T_EKKO.

WRITE: / 'PO Number - ', T_EKKO-EBELN.

READ TABLE T_EKPO TRANSPORTING NO FIELDS

WITH KEY EBELN = T_EKKO-EBELN

BINARY SEARCH.

IF SY-SUBRC = 0.

  • Store the row number.

V_TABIX = SY-TABIX.

LOOP AT T_EKPO FROM V_TABIX.

  • Exit condition.

IF T_EKPO-EBELN <> T_EKKO-EBELN.

EXIT.

ENDIF.

WRITE: / 'PO item', T_EKPO-EBELP.

.......

ENDLOOP.

ENDIF.

ENDLOOP.

Thanks,

Naren

Read only

Former Member
0 Likes
449

For small tables like this, it doesn't really matter, but for larger ones, check this:

/people/rob.burbank/blog/2006/02/07/performance-of-nested-loops

Rob

Read only

suresh_datti
Active Contributor
0 Likes
449

try this..

sort t_ekko.

delete adjacent duplicates from t_ekko.

sort t_ekpo.

loop at t_ekko.

write: / t_ekko-ebeln.

read table t_ekpo with key ebeln = t_ekko-ebeln

binary search.

if sy-subrc eq 0.

write: / t_ekpo-EBELP,t_ekpo-EAN11.

endif.

endloop.

~Suresh

Read only

0 Likes
449

But in t_ekpo table you can have more than 1 record....