cancel
Showing results for 
Search instead for 
Did you mean: 

Update DB table from internal table in AMDP

0 Kudos
729

Is it possible to update DB table from internal table in AMDP, If yes what is the syntax?

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hi Chandru,

The syntax below is working for me.

I am updating a custom database, from an internal table.

In my example, both custom db and table use the same key structure as EKBE. My requirement was to set a field POITM to 'X' on certain conditions. At the beginning of the procedure, I had identified the rows that needed to have POITM updated and stored them in the internal table ':t_history' . Then I updated the database from the internal table.

btw-I found this syntax from SAP Note 2241598.

 MERGE INTO zbw_mm_pohistory AS bw_history USING :t_history AS t_history
    ON  bw_history.ebeln = t_history.ebeln
    AND bw_history.ebelp = t_history.ebelp
    AND bw_history.zekkn = t_history.zekkn
    AND bw_history.vgabe = t_history.vgabe
    AND bw_history.gjahr = t_history.gjahr
    AND bw_history.belnr = t_history.belnr
    AND bw_history.buzei = t_history.buzei
    AND bw_history.budat = t_history.budat
    WHEN MATCHED THEN UPDATE SET bw_history.poitm = t_history.poitm;