Code: Alles auswählen.
data: itab type standard table of text200 with header line.
itab = 'Peter'.
append itab.
itab = 'Hans'.
append itab.
itab = 'Uli'.
append itab.
itab = 'Gerd'.
append itab.
loop at itab.
write: / itab.
endloop.
With header line erzeugt eine interne Tabelle mit Kopfzeile. Damit spart man sich einen Arbeitsbereich (workarea).bohne hat geschrieben:Hi!
Mir ist da noch einiges unklar.
Der Typ von "'peter'" ist nicht in den Typ von "itab " konvertierbar.
weil "with header line" fehlt. Was ist "with header line"
So lautet die Fehlermeldung!
Wie bereits erwähnt: Nein, eine interne Tabelle muß sich nicht auf eine bereits bestehende Tabelle beziehen. Bitte schau Dir dazu die F1-Hilfe zum Befehl 'types' an. Damit können lokale Typen im Programm definiert werden, auf deren Basis man ebenfalls eine interne Tabelle definieren kann.bohne hat geschrieben: Außerdem muss eine interne Tabelle sich immer eine auf bereits bestehende Tabelle beziehen.
"Text200" gibt es bereits im Sytstem.
Das kannst Du, aber nur, wenn Du vorher 'hallo' als Datenelement(Struktur) definiert hast (mit types), z.B.:bohne hat geschrieben: Warum kann ich z.B nicht sagen
data: itab type standard table of hallo.
itab = 'Hans'.
append itab.
loop at itab.
write: / itab.
endloop.
Grüße
Code: Alles auswählen.
types: begin of hallo,
feld1(100) type c,
end of hallo.
Code: Alles auswählen.
REPORT ZINTERN .
types: begin of hallo,
feld1(100) type c,
end of hallo.
data: itab type standard table of hallo.
itab = 'Hans'.
append itab.
loop at itab.
write: / itab.
endloop.
Code: Alles auswählen.
REPORT ZINTERN .
types: begin of hallo,
feld1(100) type c,
end of hallo.
data: itab type standard table of hallo.
itab[] = 'Hans'.
append itab.
loop at itab.
write: / itab.
endloop.
Code: Alles auswählen.
data: itab type standard table of text200 with header line. " definiert Tabelle und Kopfzeile
itab = 'Peter'. "hier füllst du die Kopfzeile, nicht die Tabelle !!!
append itab. "hier hängst du die Kopfzeile an die Tabelle
...
...
loop at itab. "der loop stellt die Daten der Tabelle in die Kopfzeile
write: / itab. "hier gibst du die Kopfzeile(!) aus
endloop.
Code: Alles auswählen.
types: begin of hallo,
feld1(100) type c,
end of hallo.
data: itab type standard table of hallo.
Code: Alles auswählen.
itab = 'Hans'.
Code: Alles auswählen.
types: begin of hallo,
feld1(100) type c,
end of hallo.
data: itab type standard table of hallo. "die Tabelle
data: zwischen type hallo. "der eigene Datenbereich
zwischen = 'Hans'. "füllt den Datenbereich
append zwischen to itab. "hängt selbstdef. Datenbereich an Tabelle itab an
...
...
loop at itab into zwischen. " der loop stellt die Daten in den selbstdefinierten Arbeitsbereich
write: / zwischen. "schreibe Datenbereich
endloop.
Code: Alles auswählen.
Code:
types: begin of hallo,
vorname(100) type c,
nachname(100) type c,
comment(200) type c
end of hallo.
data: itab type standard table of hallo.
data: wa type hallo.
Code: Alles auswählen.
wa-vornahme = 'ernst'.
wa-nachnahme = 'august'.
wa-comment = 'kein kommentar'.
append wa to hallo.
Code: Alles auswählen.
types: begin of hallo,
vorname(100) type c,
nachname(100) type c,
comment(200) type c
end of hallo.
data: itab type standard table of hallo occurs 0 with header line.
* hier wird die Kopfzeile gefüllt, analog zu WA aus dem vorigen Beispiel, d.h. mit der Tabelle hat das eigentlich nix zu tun
hallo-vornahme = 'ernst'.
hallo-nachnahme = 'august'.
hallo-comment = 'kein kommentar'.
* hier wird die Kopfzeile an die Tabelle angehängt.
append hallo.
Code: Alles auswählen.
REPORT ZNEU .
types: begin of hallo,
vorname(100) type c,
nachname(100) type c,
comment(200) type c,
end of hallo.
data: itab type standard table of hallo occurs 0 with header line.
hallo-vorname = 'ernst'.
hallo-nachname = 'august'.
hallo-comment = 'kein kommentar'.
append hallo.
loop at hallo.
write: / hallo.
endloop.
Code: Alles auswählen.
REPORT ZNEU .
types: begin of hallo,
vorname(100) type c,
nachname(100) type c,
comment(200) type c,
end of hallo.
data: itab type standard table of hallo.
data: wa type hallo.
wa-vorname = 'ernst'.
wa-nachname = 'august'.
wa-comment = 'kein kommentar'.
append wa to hallo.
Code: Alles auswählen.
types: begin of hallo,
vorname(100) type c,
nachname(100) type c,
comment(200) type c,
end of hallo.
data: itab type hallo occurs 0 with header line.
itab-vorname = 'ernst'.
itab-nachname = 'august'.
itab-comment = 'kein kommentar'.
append itab.
loop at itab.
write: / itab.
endloop.
Code: Alles auswählen.
append wa to itab.
Die Angabe occurs 0 ist nicht vorgesehen
Code: Alles auswählen.
REPORT ZNEU .
types: begin of hallo,
vorname(100) type c,
nachname(100) type c,
comment(200) type c,
end of hallo.
data: itab type standard table of hallo occurs 0 with header line.
hallo-vorname = 'ernst'.
hallo-nachname = 'august'.
hallo-comment = 'kein kommentar'.
append hallo.
loop at hallo.
write: / hallo.
endloop.
soweit geklappt nun kann ich aber den Inhalt nicht ausgebenappend wa to itab.
loop at itab.
Code: Alles auswählen.
REPORT ZNEU .
types: begin of hallo,
vorname(100) type c,
nachname(100) type c,
comment(200) type c,
end of hallo.
data: itab type standard table of hallo.
data: wa type hallo.
wa-vorname = 'ernst'.
wa-nachname = 'august'.
wa-comment = 'kein kommentar'.
append wa to itab.
loop at itab.
write: / itab.
endloop.