Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Get info about index of insert into table

$
0
0

Hi Experts,

 

we to get the index on which position a table line should be inserted into an internal table.

For example have a look on the code snippet. We want to get the line number (here: sy-tabix) in which the new ls_but line

is inserted in table lt_but_sort.

 

Do you know an easy way to do this? And is it possible to get this information without actually inserting the line

into the internal table?


Thanks and best regards

Axel

 

data: lt_but TYPE TABLE OF but000,

      lt_but_sort TYPE SORTED TABLE OF but000 with UNIQUE KEY partner,

      ls_but TYPE  but000,

      lv_int TYPE i.

 

 

SELECT *

  from but000

  into CORRESPONDING FIELDS OF TABLE lt_but.

 

 

READ TABLE lt_but

  into ls_but

  INDEX 5000.

 

 

ls_but-NAME_LAST = 'test'.

ls_but-partner = '0000003047'.

 

 

lt_but_sort = lt_but.

insert ls_but into TABLE lt_but_sort.

 

 

READ TABLE lt_but_sort

  into ls_but

  with key partner = ls_but-partner.

 

 

write sy-tabix.


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>