cancel
Showing results for 
Search instead for 
Did you mean: 

How to delete a table row in the context?

achim_hauck2
Active Contributor
0 Kudos

Hi,

I've got a table in my context that I access with <TABLE-NAME>-<TABLE-COLUMN>[index].

For example <TABLE-NAME>-<TABLE-COLUMN>.dim delivers the amount of entries in this table.

Now I want to delete a specific row in this table without any ABAP-code. Is there a possibility to do this?

I tried to set the .dim = <old dimvalue - 1>, but the row seems to still exist, it's just empty.

There must be a method like 'delete', or am I wrong...?

kr, achim

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Hi Achim,

"Dim" is, in essence, a read-only property, so you should not modify it directly. To delete a row in a table, use deleteValue(name, index) function, which is defined in SAPXJutil.dll file.

I hope this helps.

Kind regards,

Alexander Pohoyda

achim_hauck2
Active Contributor
0 Kudos

Alexander,

could you provide an example please?

for example, if I have a code like this:


`repeat j from 1 to MYTABLE-MYCOLUMN1.dim`
   MYTABLE-MYCOLUMN1[j] = "value1";
   MYTABLE-MYCOLUMN2[j] = "value2";
`end`

and now assume, I want to delete the last row of the table, what would it look like?

`MYTABLE.deleteValue(MYCOLUMN1, j)` ???

kind regards, achim

0 Kudos

Hi Achim!

Sorry, I didn't watch this topic.

In your example you would write:

deleteValue("MYTABLE-MYCOLUMN1", MYTABLE-MYCOLUMN1.dim);

deleteValue("MYTABLE-MYCOLUMN2", MYTABLE-MYCOLUMN2.dim);

Kind regards,

Alexander Pohoyda

SAP AG, ITS Development Team