0

I need to copy a huge table in SAP ERP software. Usually I split the table up with modulo 100 and copy it step by step. This works only if I have a number field as primary field I can use.

But in the table COSS there is no such field I can use. Is there a way to generate a number out of a string in SQL or is there another way to split a table in smaller pieces?

Thanks

Example:

 method get_coep.

    select  * from coep using client @gv_client
       where mod( cast( cast( belnr as numc( 10 ) ) as dec( 10, 0 ) ) , 100 ) = @iv_mod
       into table @et_return
       connection (gv_conn).

  endmethod.
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Tommehh
  • 872
  • 1
  • 17
  • 44
  • What are the reasons for copying the data chunk-wise? In many scenarios a `CREATE TABLE ... LIKE ... WITH DATA` is a very efficient way to copy a table. – Lars Br. Feb 09 '19 at 23:13
  • I'm doing it chunk-wise because otherwise I get a "out of memory" exception – Tommehh Feb 11 '19 at 06:41
  • If you get OOM errors when copying the data it means that your HANA system is undersized for keeping both the original and the copy data in memory at the same time. Copying data in chunk-wise really is a plaster here. One option to circumvent this can be to partition the target table so that the individual partitions can be memory managed individually. BTW: is this on S/4HANA? If so, `COSS` is likely a compatibility view and other options are available to get extracts from it. Also: what's the purpose of the copy in the first place? – Lars Br. Feb 11 '19 at 23:19
  • no, we are actually on ECC with HANA. the reason is that we work currently on two systems but want the reporting to be done from one – Tommehh Feb 13 '19 at 06:32
  • Can you extend the question with what the table copy has to do with the reporting in another system? You could access the table data in the other system via Smart Data Access (SDA) without having to copy the data. – Lars Br. Feb 13 '19 at 09:15
  • On HANA, the column store table behind COSS view is COSS_BAK table and it has keys defined. You can use one or first few columns among these key columns – Eralper Feb 13 '19 at 09:51
  • @LarsBr. can you explain what SDA is and how to use it? – Tommehh Feb 13 '19 at 10:39
  • Smart Data Access is basically connection to other data platforms like Linked Servers in SQL Server – Eralper Feb 13 '19 at 12:01
  • Yes I am using this via "connection". But I definately need a View in the other system for that. The only solution I found to create a view of a table from another system is by copying it. – Tommehh Feb 14 '19 at 08:58

0 Answers0