ICh habe ein Report geschrieben der Daten aus eine SAP Tabelle nach Excel transportiert. der Excel wird sofort aufgemacht und die daten werden auch korrekt übermittelt. Nun habe ich das Problem das ich es nicht hinkirege wenn ich einen Titel mitübergeben will. Es klappt ergendwie nicht.
hat jemand eine Idee?
die spaltennamen habe ich hingekriegt aber den titel schaffe ich ergendwie nicht.
soll ca. so aussehen
Aufträge 2006 (Titel)
auftrag pos datum menge umsatz lieferung usw.
FORM downloadtable USING value(intable) type c
value(separator) type c
value(withheader) type c
value(datei_pfad) type string.
data: refintable TYPE REF TO data,
waouttable type string,
sbuffer type string,
itouttable like TABLE OF waouttable,
descintable type REF TO cl_abap_tabledescr,
descinstruc type REF TO cl_abap_structdescr.
FIELD-SYMBOLS:
<fsintable> TYPE ANY TABLE,
<fsinworkarea> TYPE ANY,
<fscompstruc> TYPE abap_compdescr,
<fsoutvalue> TYPE ANY.
try.
" §01 Interne Tabelle mit gleicher Struktur
" wie gewählte Datenbanktabelle anlegen,
" über ein Feldsymbol adressierbar machen und füllen
CREATE DATA refintable TYPE STANDARD TABLE OF (intable).
ASSIGN refintable->* to <fsintable>.
select * from (intable) into TABLE <fsintable>.
" §02 Beschreibung der internene Tabelle sowie
" deren Strukturkomponenten über RTTI holen
descintable ?= cl_abap_typedescr=>describe_by_data( <fsintable> ).
" §03 Strukturkomponenten lesen und durch
" Trennzeichnen getrennt in Ausgabezeile sammeln
if not withheader is initial. "and datei_pfad is not initial.
concatenate 'TabellenName: ' intable into waouttable SEPARATED BY space.
* append waouttable.
WRITE: / waouttable.
APPEND waouttable to itouttable.
clear waouttable.
loop at descinstruc->components
ASSIGNING <fscompstruc>.
CONCATENATE waouttable <fscompstruc>-name separator into waouttable.
endloop.
WRITE: / waouttable.
APPEND waouttable to itouttable.
clear waouttable.
endif.
" §04 alle Datensaetze der Eingabetabelle abarbeiten
loop at <fsintable> ASSIGNING <fsinworkarea>.
" §05 alle Feldinhalte des Aktuellen
" Datensatzes sammeln
loop at descinstruc->components
ASSIGNING <fscompstruc>.
ASSIGN COMPONENT <fscompstruc>-name
of STRUCTURE <fsinworkarea> to <fsoutvalue>.
sbuffer = <fsoutvalue>.
CONDENSE sbuffer.
CONCATENATE waouttable sbuffer separator into waouttable.
endloop.
WRITE: / waouttable.
APPEND waouttable to itouttable.
clear waouttable.
endloop.