Code: Alles auswählen.
* call ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'SFLIGHT'
TABLES
t_outtab = lt_sflight
EXCEPTIONS
program_error = 1
OTHERS = 2.
Code: Alles auswählen.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SFLIGHT'
CHANGING
ct_fieldcat = lt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Code: Alles auswählen.
TYPE-POOLS slis.
Code: Alles auswählen.
DELETE lt_fieldcat WHERE NOT ( fieldname = 'CARRID'
OR fieldname = 'CONNID'
OR fieldname = 'FLDATE'
OR fieldname = 'PLANETYPE').
Code: Alles auswählen.
* call ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = lt_fieldcat
TABLES
t_outtab = lt_poarch
EXCEPTIONS
program_error = 1
OTHERS = 2.
Code: Alles auswählen.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'SRESULT'
* i_structure_name
* i_client_never_display
i_inclname = 'ZMADDOGTOP'
CHANGING
ct_fieldcat = lt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Code: Alles auswählen.
*&--------------------------------------------------------------------*
*& Form DO_TOP_OF_PAGE
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
FORM do_top_of_page.
DATA: ls_line TYPE slis_listheader,
lt_top_of_page TYPE TABLE OF slis_listheader.
* Listenüberschrift: Typ H
CLEAR ls_line.
ls_line-typ = 'H'.
* LS_LINE-KEY: not used for this type
ls_line-info = 'Na'.
APPEND ls_line TO lt_top_of_page.
* Kopfinfo: Typ S
CLEAR ls_line.
ls_line-typ = 'S'.
ls_line-key = 'wie'.
ls_line-info = 'gehts'.
APPEND ls_line TO lt_top_of_page.
* Aktionsinfo: Typ A
CLEAR ls_line.
ls_line-typ = 'A'.
* LS_LINE-KEY: not used for this type
ls_line-info = 'so?'.
APPEND ls_line TO lt_top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = lt_top_of_page.
ENDFORM. "DO_TOP_OF_PAGE
Code: Alles auswählen.
*&--------------------------------------------------------------------*
*& Form set_event_for_alv
*&--------------------------------------------------------------------*
* text
*---------------------------------------------------------------------*
* -->LT_EVENTS text
*---------------------------------------------------------------------*
FORM set_event_for_alv USING lt_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = lt_events.
* prüfen, ob das event für den listentyp 0 gibt.
READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
* wenn ja dann unseren Perform setzten.
MOVE 'DO_TOP_OF_PAGE' TO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.
ENDFORM. "set_event_for_alv
Code: Alles auswählen.
* call ALV
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = lt_fieldcat
it_events = lt_events
TABLES
t_outtab = lt_poarch
EXCEPTIONS
program_error = 1
OTHERS = 2.
Hi,Azreal hat geschrieben:<snip>
Setzt man den FuBa Aufruf einfach vor den 'REUSE_ALV_GRID_DISPLAY' so erscheint erst unser hübscher ALV. Erst nachdem man auf Back oder F3 geklickt hat, sieht man die gewünschten Kommentare. Und genau hier kommt das Eventing vom ALV GRID ins Spiel.
<snip>
Und das war?s auch schon. Nun haben wir einen ALV der nur die Daten aus unserem Fieldcatalog hat und eine entsprechende Listenüberschrift.
ps. als anhang findet ihr das im Punkt 4 beschriebene Programm
meinte ich eigentlich... Das passiert, wenn man das eventing vom Alv Grid nicht berücksichtigt bzw den FuBa 'REUSE_ALV_COMMENTARY_WRITE' nicht im TOPOFPAGE event des alv grids aufrufst.<snip>
Setzt man den FuBa Aufruf einfach vor den 'REUSE_ALV_GRID_DISPLAY' so erscheint erst unser hübscher ALV. Erst nachdem man auf Back oder F3 geklickt hat, sieht man die gewünschten Kommentare. Und genau hier kommt das Eventing vom ALV GRID ins Spiel.
Code: Alles auswählen.
*>>>> START OF DELETION <<<<<
* build up ALV...
DATA: lt_events TYPE slis_t_event.
PERFORM set_event_for_alv USING lt_events.
*>>>> END OF DELETION <<<<<<<
*>>>> START OF INSERTION <<<<
PERFORM do_top_of_page.
*>>>> END OF INSERTION <<<<<<
Code: Alles auswählen.
*>>>> START OF DELETION <<<<<
PERFORM set_event_for_alv USING lt_events.
*>>>> END OF DELETION <<<<<<<
*>>>> START OF INSERTION <<<<
PERFORM do_top_of_page.
*>>>> END OF INSERTION <<<<<<
Code: Alles auswählen.
REUSE_ALV_GRID_DISPLAY
EXPORTING
i_callback_program = sy-repid
it_fieldcat = lt_fieldcat
it_events = lt_events
Code: Alles auswählen.
* BEGIN OF DELETION
* call ALV
*CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
* EXPORTING
* i_callback_program = sy-repid
* it_fieldcat = lt_fieldcat
* it_events = lt_events
* END OF DELETION
* BEGIN OF INSERTION
* call ALV
DATA: prog LIKE sy-repid.
prog = sy-repid.
* END OF INSERTION
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = prog
it_fieldcat = lt_fieldcat
it_events = lt_events
* END OF INSERTION
Code: Alles auswählen.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = alv_repid
i_callback_user_command = 'USER_COMMAND'
is_layout = alv_layout
it_fieldcat = alv_fieldcat
i_default = 'X'
i_save = alv_save
is_variant = variante
Code: Alles auswählen.
initialization.
variant_save = 'A'.
clear variante.
variante-report = sy-repid.
* Default-Variante holen:
def_variante = variante.
call function 'REUSE_ALV_VARIANT_DEFAULT_GET'
exporting
i_save = variant_save
changing
cs_variant = def_variante
exceptions
not_found = 2.
if sy-subrc = 0.
p_vari = def_variante-variant.
endif.
Code: Alles auswählen.
call function 'REUSE_ALV_VARIANT_F4'
exporting
is_variant = variante
i_save = variant_save
* it_default_fieldcat =
importing
e_exit = variant_exit
es_variant = def_variante
exceptions
not_found = 2.
if sy-subrc = 2.
message id sy-msgid type 'S' number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
else.
if variant_exit = space.
p_vari = def_variante-variant.
endif.
endif.
Code: Alles auswählen.
if not p_vari is initial.
move variante to def_variante.
move p_vari to def_variante-variant.
call function 'REUSE_ALV_VARIANT_EXISTENCE'
exporting
i_save = variant_save
changing
cs_variant = def_variante.
variante = def_variante.
else.
clear variante.
variante-report = sy-repid.
endif.
Code: Alles auswählen.
form user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
if r_ucomm = '&IC1'. "Doppelklick im Feld
IF rs_selfield-value = ''.
MESSAGE s398(00) WITH text-005 rs_selfield-fieldname '' ''.
* da wird nur Meldung ausgegeben, an welches Feld ist geklopft.
ELSE.
fld = rs_selfield-fieldname.
inx = rs_selfield-tabindex.
case fld.
when 'EBELN'.
set parameter id 'BES' field rs_selfield-value.
call transaction 'ME22' and skip first screen.
...
Code: Alles auswählen.
I_CALLBACK_PF_STATUS_SET
Code: Alles auswählen.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'SRESULT'
* i_structure_name
* i_client_never_display
i_inclname = 'ZMADDOGTOP'
CHANGING
ct_fieldcat = lt_fieldcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.