Skip to Content
avatar image
Former Member

UPDATE temporary table in AMDP Class Method

Dear experts,

I need to change only one field in a dataset and upsert it to a physical db table with AMDP. This physical table has too many columns which I do not want to specify all fields, and also developers can add some fields in future and when a new field added I do not want to edit code again and again.

Please see ZAG_SIM is a physical table and lt_result temp table type of ZAG_SIM should read base version and copy this data changing version column entries.

Please advice why UPDATE command is not accepted in eclipse editor?

Thanks in advance,

Ergin Ozturk

update.png (80.6 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Oct 26, 2017 at 03:11 PM

    Updates on a table variable are not supported by the keyword UPDATE. Since HANA 2.0 SPS01 you can do updates with another syntax. Details can be found here. But personally I haven't tried it yet within an AMDP (maybe there are further restrictions).

    If you are not on a HANA revision level which supports that, you can use an index based cell access to update your column (of course a loop has to be done over all entries and each data record has to be accessed by its index).

    Another option would be to use a local temporary row table like that:

      create local temporary row table #test like "ZAG_SIM";
      insert into #test select * from "ZAG_SIM";
      update #test set "VERSION" = :lv_temp;
      drop table #test;

    You can try both options if you like and share your results on the performance.


    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Florian Pfeffer

      Thank you Florian,

      FOR loop with index access did the job.

      FOR i IN 1 .. :lv_counter DO

      lt_result.VERSION[:i] = :lv_temp ;

      END FOR;