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

comparing internal table data

Former Member
0 Likes
398

I need to transfer the respective rates to internal table (it_ekko) from another intrenal table (it_trfrate) . it_trfrate has MATNR AND TRFRATE fields. what ever material currently in loop, I want to searche the whole table it_trfrate for that MATNR and pick that rate and transfer it to it_ekko.

*************************************************************************************

WHAT DO i MAKE CHANGE IN MY CODE.

LOOP AT IT_TRFRATE.

IF IT_EKKO-MATNR_LI in IT_TRFRATE AND N = 1.

IT_EKKO-TRFRATE = IT_TRFRATE-TRFRATE.

N = N + 1.

ENDIF.

ENDLOOP.

**************************************************************************************

THANKS.

kHAN

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
383

Hi!

LOOP AT it_ekko.

n = 1.

LOOP AT IT_TRFRATE WHERE matnr = it_ekko-matnr.

IF N = 1.

IT_EKKO-TRFRATE = IT_TRFRATE-TRFRATE.

N = N + 1.

ENDIF.

ENDLOOP.

ENDLOOP.

Regards

Tamá

2 REPLIES 2
Read only

Former Member
0 Likes
384

Hi!

LOOP AT it_ekko.

n = 1.

LOOP AT IT_TRFRATE WHERE matnr = it_ekko-matnr.

IF N = 1.

IT_EKKO-TRFRATE = IT_TRFRATE-TRFRATE.

N = N + 1.

ENDIF.

ENDLOOP.

ENDLOOP.

Regards

Tamá

Read only

Former Member
0 Likes
383

try this way...

sort it_ekko by matnr.

sort it_trfrate by matnr.

loop at it_ekko.

l_tabix = sy-tabix.

read table it_trfrate with key matnr = it_ekko-matnr binary search.

if sy-subrc = 0.

it_ekko-trfrate = it_trfrate-trfrate.

modify it_ekko index l_tabix.

endif.

clear: it_ekko, it_trfrate.

endloop.