1

Is there a way to insert single record in db table without using structure as data holder.

I was thinking something like

INSERT INTO table(filed1, field2) VALUES (value1, value2).

Is something like this possible in abap? thx

Munez NS
  • 1,011
  • 1
  • 12
  • 31

2 Answers2

2

No, this is not possible because you can't specify individual target fields with OpenSQL INSERT statements. You might be able to work around the need for a temporary structure on the right-hand side by using a VALUE type( ... ) operator, but I haven't tried that yet.

vwegert
  • 18,371
  • 3
  • 37
  • 55
0

You should try to create a structure dynamically.

using CL_ABAP_STRUCTDESCR=>CREATE, specifying a list of components (list of column) and their types, you get dynamically a description of your structure that you can use to create a data reference.

Quick pseudo-code:

DATA coldescr TYPE REF TO cl_abap_structdescr.
DATA cols TYPE REF TO data.
FIELD-SYMBOLS <cols> TYPE any.

coldescr = cl_abap_structdescr=>create(  ).

CREATE DATA cols TYPE HANDLE coldescr.

ASSIGN cols->* TO <cols>.

You can use <cols> in you insert select stmt.

jerome
  • 173
  • 1
  • 7