Skip to Content
0

UPDATE temporary table in AMDP Class Method

Oct 25, 2017 at 04:41 PM

300

avatar image
Former Member

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)
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Florian Pfeffer
Oct 26, 2017 at 03:11 PM
1

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:

do
begin
  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;
end;

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

Regards,
Florian

Show 3 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks Florian for the effort but AMDP has other limitations, and in documents AMDP is overlooked all the time.

Please see log in the screenshot, local table creation is not supported.

localtable.png (87.1 kB)
0

Too bad. Have you tried the index-based cell access too?

1
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;

0