Code: Alles auswählen.
loop at tab into wa.
create data dref type p decimals 3.
assign dref->* to <fs>.
<fs> = wa-spalte_2.
endloop.
Code: Alles auswählen.
types: begin of ty,
spalte_1(6) type c,
spalte_2 type p decimals 3,
end of ty,
tt type table of ty.
data hoehe type p decimals 3.
data laenge type p decimals 3.
data: tab type tt,
wa type ty.
FIELD-SYMBOLS <fs> type any.
wa-spalte_1 = 'LAENGE'.
wa-spalte_2 = '123.456'.
append wa to tab.
wa-spalte_1 = 'HOEHE'.
wa-spalte_2 = '654.421'.
append wa to tab.
loop at tab into wa.
assign (wa-spalte_1) to <fs>.
<fs> = wa-spalte_2.
endloop.
Die Antwort darauf ist ein ganz klares JEINlilly-joe hat geschrieben:Aber ich habe es jetzt schon richtig verstanden, dass es nicht möglich ist, während des Programmes neue Variablen zu deklarieren, die individuelle Namen haben?
Code: Alles auswählen.
types:
begin of ts_data,
NAME type CHAR30,
VALUE type ref to DATA,
end of ts_data,
tt_data type standard table of ts_data with default key.
data:
lt_data type tt_data.
field-symbols:
<la_field> type any,
<ls_data> type ts_data.
Code: Alles auswählen.
READ TABLE lt_data ASSIGNING <ls_data> WITH KEY NAME = 'HOEHE'.
if sy-subrc ne 0.
APPEND INITIAL LINE TO lt_data ASSIGNING <ls_data>.
<ls_data>-NAME = 'HOEHE'.
CREATE DATA <ls_data>-value TYPE p decimals 3.
endif.
ASSIGN <ls_data>-value->* to <la_field>.