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

simple itab question

Former Member
0 Likes
545

hi

i have two itabs

ITAB1 with NAME field.

ITAB2 with NAME and MARKS fields.

if name in itab2 matches name in itab1 , i should assign marks 100 to that name.

i thought of coding this way.

loop at itab1.

loop at itab2 where name = itab1-name.

itab2-marks = 100.

endloop.

modify itab2.

endloop.

is it a right way of using modify command.

is there any way i can improve performance by sort method.

1 ACCEPTED SOLUTION
Read only

ferry_lianto
Active Contributor
0 Likes
525

Hi,

Please try this.


LOOP AT ITAB2.
  READ TABLE ITAB1 WITH KEY NAME = ITAB2-NAME.
  IF SY-SUBRC = 0.
    ITAB2-MARKS = 100.
    MODIFY ITAB2.
  ENDIF.
ENDLOOP.

Regards,

Ferry Lianto

4 REPLIES 4
Read only

Former Member
0 Likes
525

sort itab1 by name

sort itab2 by name.

loop at itab2.

read table itab1 with key name = itab2-name binary search.

if sy-subrc eq 0.

itab2-marks = 100.

<<update itab2.

endif.

endloop.

Read only

Former Member
0 Likes
525

HI,

check this..

loop at itab1.

loop at itab2 where name = itab1-name.

itab2-marks = 100.

<b>modify itab2 transporting marks.</b>

endloop.

endloop.

Regards

SAB

Read only

ferry_lianto
Active Contributor
0 Likes
526

Hi,

Please try this.


LOOP AT ITAB2.
  READ TABLE ITAB1 WITH KEY NAME = ITAB2-NAME.
  IF SY-SUBRC = 0.
    ITAB2-MARKS = 100.
    MODIFY ITAB2.
  ENDIF.
ENDLOOP.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
525

thanks friends.