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

internal table logic-

Former Member
0 Likes
468

dear friends,

I have an internal table like below,

F1-F2-F3.(itab1)

2 ---7

3 -


9

based on the above internal table i am using the query to get the F3 field

for all entries in itab1 where F1= itab1-f1.

after getting the F3 value i need to update F3 field in the internal table itab1.

pls give provide me the code for the above

thanks in advance

karthik

1 ACCEPTED SOLUTION
Read only

Clemenss
Active Contributor
0 Likes
450

Hi karthik,

the logic has been given by you.

if F1 is a unique field on the database as in your itab, it could be

data:
  ls_itab  like line of itab.
field-symbols:
  <itab>  like line of itab.
sort itab by f1.
select f1 f3 into corresponding fields of ls_itab
  from <database_table> 
  for all entries in itab1 where F1= itab1-f1.
  read table itab assigning <itab>
    with key f1 = ls_itab-f1
    BINARY SEARCH.
  check sy-subrc = 0.
  <itab>-f3 = ls_itab-f3.
endselect.

Regards,

Clemens

3 REPLIES 3
Read only

Former Member
0 Likes
450
loop at itab1 into wa_itab1.
  
     read table itab2 with key f1 = wa_itab-f1.
       if sy-subrc eq 0.
           wa_itab1-F3 = itab2-F3.
           modify itab1 from wa_itab1.
       endif.

endloop.
Read only

Former Member
0 Likes
450

Hey Karthik,

Can u elaborate on exactly what u want????

Read only

Clemenss
Active Contributor
0 Likes
451

Hi karthik,

the logic has been given by you.

if F1 is a unique field on the database as in your itab, it could be

data:
  ls_itab  like line of itab.
field-symbols:
  <itab>  like line of itab.
sort itab by f1.
select f1 f3 into corresponding fields of ls_itab
  from <database_table> 
  for all entries in itab1 where F1= itab1-f1.
  read table itab assigning <itab>
    with key f1 = ls_itab-f1
    BINARY SEARCH.
  check sy-subrc = 0.
  <itab>-f3 = ls_itab-f3.
endselect.

Regards,

Clemens