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

Insert table in table

Former Member
0 Likes
496

hi

i have two table, one standard and the other one is sorted table.

first i move data into in the standard table.

how do i can move data from standard table in sorted table?


types: begin of t_komdat,
          kmnrch type zkomnr,
          vbeln type vbeln_vl,
       end of t_komdat.

data gt_komnr type table of t_komdat. "KommissionierNr.
data gt_komnr_sorted type sorted table of t_komdat with unique key kmnrch.



start-of-selection.

  select * from zsd_spediumsetz
           into corresponding fields of table
           gt_komnr order by kmnrch kmzlch.

  break-point.

  delete adjacent duplicates from gt_komnr comparing kmnrch.
  insert gt_komnr into gt_komnr_sorted.

  break-point.


end-of-selection.

4 REPLIES 4
Read only

dev_parbutteea
Active Contributor
0 Likes
467

Hi,

sort gt_komnr by kmnrch.

delete adjacent duplicates from gt_komnr comparing kmnrch.

append lines of gt_komnr to gt_komnr_sorted.

Read only

Former Member
0 Likes
467

first take data from standard table in to internal table then sort it with sort key and then insert all the data in to sorted table.

Read only

Former Member
0 Likes
467

Are both table of same structure if not use.

types: begin of t_komdat,
          kmnrch type zkomnr,
          vbeln type vbeln_vl,
       end of t_komdat.
 
data gt_komnr type table of t_komdat with header line. "KommissionierNr.
data gt_komnr_sorted type sorted table of t_komdat with unique key kmnrch with header line.
 
 
 
start-of-selection.
 
  select * from zsd_spediumsetz
           into corresponding fields of table
           gt_komnr.
 
  break-point.
  Sort gt_komnr by kmnrch.            " Use Sort statement.
  delete adjacent duplicates from gt_komnr comparing kmnrch.
  *insert gt_komnr into gt_komnr_sorted.

Loop at gt_komnr.
Move :gt_komnr-kmnrch to  gt_komnr_sorted-kmnrch,
         gt_komnr-vbeln to  gt_komnr_sorted-vbeln. 
Insert table gt_komnr_sorted[] from gt_komnr_sorted.
clear gt_komnr_sorted.
endloop.

Regards,

Gurpreet

Read only

Former Member
0 Likes
467

i do it with command move.

it great thanks