Code: Alles auswählen.
data: begin of itab occurs 0,
matnr like mara-matnr,
maktg like makt-maktg,
end of itab.
Code: Alles auswählen.
data: begin of feld occurs 0,
feldname(50),
end of feld.
Code: Alles auswählen.
begin of itab occurs 0,
matnr like mara-matnr,
maktg like makt-maktg,
spalte1 type i,
spalte2 type i,
...
end of itab.
Code: Alles auswählen.
GENERATE SUBROUTINE POOL progtab NAME genprog MESSAGE message
LINE line WORD word.
Code: Alles auswählen.
DATA it_fieldcatalog TYPE lvc_t_fcat.
DATA wa_fcat TYPE lvc_s_fcat.
*
DATA ep_table TYPE REF TO data.
FIELD-SYMBOLS: <my_table> TYPE ANY TABLE.
FIELD-SYMBOLS: <struct>.
FIELD-SYMBOLS: <feld>.
* An dieser Stelle den Feldkatalog füllen
* z.B. wa_fcat-fieldname = 'FELD1'.
* wa_fcat-inttype = 'I'.
* append wa_fcat to it_fieldcatalog
* Hier erhält man dann eine Tabelle mit
* einem Feld namens 'FELD1' vom Typ I.
* andere Möglichkeit wäre die Felder mit
* Bezug auf DDIC-Objekte zu hinterlegen
* Einfach mal die Möglichkeiten des
* Feldkatalogs testen
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fieldcatalog
IMPORTING
ep_table = ep_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
ASSIGN ep_table->* TO <my_table>.
* auslesen läßt sich die Tabelle dann wieder mithilfe des Feldkatalogs.
LOOP at <my_table> ASSIGNING <struct>.
LOOP AT it_fieldcatalog INTO wa_fcat.
ASSIGN COMPONENT wa_fcat-fieldname OF STRUCTURE <struct> TO <feld>.
WRITE: <feld>.
ENDLOOP. ENDLOOP.
Code: Alles auswählen.
data wa_fcat type lvc_s_fcat.
data it_fieldcatalog type lvc_t_fcat.
field-symbols: <my_table> type any table.
wa_fcat-fieldname = 'matnr'.
wa_fcat-inttype = 'C'.
wa_fcat-intlen = 30.
append wa_fcat to it_fieldcatalog.
wa_fcat-fieldname = 'bezeichnung'.
wa_fcat-inttype = 'C'.
wa_fcat-intlen = 35.
append wa_fcat to it_fieldcatalog.
loop at datum_tab.
wa_fcat-fieldname = datum_tab-datum.
wa_fcat-inttype = 'I'.
append wa_fcat to it_fieldcatalog.
endloop.
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fieldcatalog
importing
ep_table = ep_table
exceptions
generate_subpool_dir_full = 1
others = 2.
assign ep_table->* to <my_table>.
Code: Alles auswählen.
data: tab type table of <my_table> with header line.
Code: Alles auswählen.
field-symbols: <my_table> type any table.
Code: Alles auswählen.
field-symbols: <my_table> type standard table.
Code: Alles auswählen.
data: new_line type ref to data.
field-symbols: <l_line> type any.
Code: Alles auswählen.
CREATE DATA new_line LIKE LINE OF <my_table>.
ASSIGN new_line->* TO <l_line>.
Code: Alles auswählen.
field-symbols: <field> type any.
assign component 'MATNR' of structure <l_line> to <field>
Standardtabelle wohl, aber es muß nicht mit Headerline sein. Der Funktionsbaustein nimmt sie auch ohne!!juli hat geschrieben:...
nun brauche ich aber eine standart Tabelle weil ich die später über einen Funktionsbaustein übergeben muss.
irgendwie so:...Code: Alles auswählen.
data: tab type table of <my_table> with header line.