Application Development 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 first value from internal table when it starts with AA.

anjalikushwah
Explorer
0 Kudos
303

Hi Gurus,

I have a requirement :

:70:INV. CD FR.15.03.23

INV. AA3330010084 FR.24.01.23

INV. AA3330037073 FR.10.03.23

INV. AA3330037120 FR.10.03.23

:70:INV. CN FR.10.03.23

INV. CD FR.15.03.23

INV. AA2730034833 FR.10.03.23

INV. AA2730035101 FR.10.03.23

These values mentioned above are present in internal table ,I want to read first value from this which starts with AA and append it to new internal table.

1 ACCEPTED SOLUTION

VXLozano
Active Contributor
0 Kudos
195

If you are in a new system:

select single field_list
  from @first_itab as itab
  where field like 'AA%'
  order by your_field_here
  appending table @second_itab. "or whatever 

If you are in an old system, try something like (dirt, I know)

sort first_itab by your_field_here.
loop at first_itab into your_wa where your_field CP 'AA*'.
  "insert your wa into your table or wherever
  exit.
endloop.

I'm pretty sure there will be better answers. Feel free to follow them when you see them, these ones are just fast drafts.

1 REPLY 1

VXLozano
Active Contributor
0 Kudos
196

If you are in a new system:

select single field_list
  from @first_itab as itab
  where field like 'AA%'
  order by your_field_here
  appending table @second_itab. "or whatever 

If you are in an old system, try something like (dirt, I know)

sort first_itab by your_field_here.
loop at first_itab into your_wa where your_field CP 'AA*'.
  "insert your wa into your table or wherever
  exit.
endloop.

I'm pretty sure there will be better answers. Feel free to follow them when you see them, these ones are just fast drafts.