Ausgabe von zwei Tabellen mit ALV

Alles rund um die Sprache ABAP®: Funktionsbausteine, Listen, ALV
11 Beiträge • Seite 1 von 1
11 Beiträge Seite 1 von 1

Ausgabe von zwei Tabellen mit ALV

Beitrag von Katinka (ForumUser / 3 / 0 / 0 ) »
Hallo zusammen,

ich möchte zwei interne Tabellen mittels ALV ausgeben.
Um eine Tabelle auszugeben nutze ich 'REUSE_ALV_GRID_DISPLAY'. Nur leider kann ich die Daten der zweiten Tabelle nicht auf dem gleichen Screen bekommen. Die Daten sollen getrennt dargestellt werden, da sie eine unterschiedliche Zuordnung haben, vom Aufbau sind sie identisch.

Vielen Dank für Deine/Eure Hilfe
Liebe Grüße aus dem Norden
Katinka

gesponsert
Stellenangebote auf ABAPforum.com schalten
kostenfrei für Ausbildungsberufe und Werksstudenten


Beitrag von RiffRaff (Specialist / 379 / 0 / 1 ) »
Hallo,

hab mir den FuBau zwar noch nicht angeschaut -
klingt aber, als währe er das Richtige für dich:

REUSE_DOUBLE_ALV


mfg
Richard

Beitrag von CoMi (ForumUser / 10 / 0 / 0 ) »
Hallo
habe es selbst nicht ausprobiert
würde mir aber mal das Beispielprogramm BALVBT01
anschauen der bildet 2 verschiedene tables auf einem Screen ab
Grüße aus dem sonnigen Süden
Cornelia :D

Beitrag von RiffRaff (Specialist / 379 / 0 / 1 ) »
Hallo

hätte mir den REUSE_DOUBLE_ALV auch gleich anschauen können. Ist leider nicht das was du möchtest.
Aber der Name war sooooo gut 8)

mfg
Richard

Beitrag von Gast ( / / 0 / 3 ) »
Hallo,
also für eine hierachische Liste kannst du den
REUSE_ALV_HIERSEQ_LIST_DISPLAY
verwenden.
Und hie rmal ein Kleines Beispiel das ich neulich mal geschrieben habe. Allerdings für 3 Grids auf einem Bild. Musst halt eines wieder "rauserfen"

*&---------------------------------------------------------------------*
*& Report ZZSDTEST_43 *
*& *
*&---------------------------------------------------------------------*
*& *
*& *
*&---------------------------------------------------------------------*

report zzsdtest_43.

class lcl_grid1 definition deferred.
class lcl_grid2 definition deferred.

data: zgrid1 type ref to cl_gui_alv_grid.
data: zgrid2 type ref to cl_gui_alv_grid.
data: zgrid3 type ref to cl_gui_alv_grid.
data: parent_grid1 type ref to cl_gui_custom_container.
data: parent_grid2 type ref to cl_gui_custom_container.
data: docking1 type ref to cl_gui_docking_container.
data: docking2 type ref to cl_gui_docking_container.
data: docking3 type ref to cl_gui_docking_container.
data: outtab_grid1 type table of mara.


*---------------------------------------------------------------------*
* CLASS lcl_grid_master
*---------------------------------------------------------------------*
class lcl_grid_master definition abstract.

public section.

protected section.

private section.

endclass. "lcl_grid_master


*---------------------------------------------------------------------*
* CLASS lcl_grid1 DEFINITION
*---------------------------------------------------------------------*
class lcl_grid1 definition inheriting from cl_gui_alv_grid.

public section.

methods: constructor importing i_parent
type ref to cl_gui_custom_container.

protected section.

private section.


methods: buc
for event before_user_command
of cl_gui_alv_grid.
methods: auc
for event after_user_command
of cl_gui_alv_grid.




endclass. "lcl_grid1 DEFINITION

*---------------------------------------------------------------------*
* CLASS lcl_grid1 IMPLEMENTATION
*---------------------------------------------------------------------*
class lcl_grid1 implementation.

method constructor.

call method super->constructor
exporting
i_parent = parent_grid1.


call method me->set_table_for_first_display
exporting
i_structure_name = 'MARA'
changing
it_outtab = outtab_grid1.


call method me->refresh_table_display.


endmethod. "construktor

method buc.

endmethod. "before_user_command

method auc.

endmethod. "auc

endclass. "lcl_grid1 IMPLEMENTATION

*---------------------------------------------------------------------*

*---------------------------------------------------------------------*
* CLASS lcl_grid2 DEFINITION
*---------------------------------------------------------------------*
class lcl_grid2 definition inheriting from cl_gui_alv_grid.

public section.

methods: constructor importing i_parent
type ref to cl_gui_custom_container.

protected section.

private section.



data: outtab_grid2 type table of mara.


endclass. "lcl_grid2 DEFINITION


* CLASS lcl_grid2 IMPLEMENTATION
*---------------------------------------------------------------------*
*
*---------------------------------------------------------------------*
class lcl_grid2 implementation.

method constructor.

call method super->constructor
exporting
i_parent = parent_grid2.

call method me->set_table_for_first_display
exporting
i_structure_name = 'MARA'
changing
it_outtab = outtab_grid2.


call method me->refresh_table_display.


endmethod. "construktor

endclass. "lcl_grid2 IMPLEMENTATION


start-of-selection.


set screen '0100'.

end-of-selection.

*&---------------------------------------------------------------------*
*& Module status_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module status_0100 output.

set pf-status '0100'.

if docking1 is initial.

* create object docking1
* EXPORTING
* PARENT =
* REPID =
* DYNNR =
* SIDE = DOCK_AT_LEFT
* EXTENSION = 50
* STYLE =
* LIFETIME = lifetime_default
* CAPTION =
* METRIC = 0
* RATIO =
* NO_AUTODEF_PROGID_DYNNR =
* NAME =
* EXCEPTIONS
* CNTL_ERROR = 1
* CNTL_SYSTEM_ERROR = 2
* CREATE_ERROR = 3
* LIFETIME_ERROR = 4
* LIFETIME_DYNPRO_DYNPRO_LINK = 5
* others = 6



create object docking1
exporting
ratio = 33
side = cl_gui_docking_container=>dock_at_top.

create object docking2
exporting
ratio = 33
side = cl_gui_docking_container=>dock_at_top.

create object docking3
exporting
ratio = 33
side = cl_gui_docking_container=>dock_at_top.

create object zgrid1
exporting i_parent = docking1.

create object zgrid2
exporting i_parent = docking2.

create object zgrid3
exporting i_parent = docking3.

call method zgrid1->set_table_for_first_display
exporting
i_structure_name = 'MARA'
changing
it_outtab = outtab_grid1.


call method zgrid2->set_table_for_first_display
exporting
i_structure_name = 'MARA'
changing
it_outtab = outtab_grid1.

call method zgrid3->set_table_for_first_display
exporting
i_structure_name = 'MARA'
changing
it_outtab = outtab_grid1.

call method zgrid1->refresh_table_display.

call method zgrid2->refresh_table_display.

call method zgrid3->refresh_table_display.

endif.

endmodule. " status_0100 OUTPUT

*&---------------------------------------------------------------------*
*& Module user_command_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
module user_command_0100 input.
data: extension1 type i,
extension2 type i,
extension3 type i.


case sy-ucomm.
when 'EXIT'.
leave program.

when 'UP'.

call method docking1->get_extension
importing
extension = extension1.

extension1 = extension1 - 20.


call method docking2->get_extension
importing
extension = extension2.

extension2 = extension2 + 10.

call method docking3->get_extension
importing
extension = extension3.

extension3 = extension3 + 10.

call method docking1->set_extension
exporting
extension = extension1.


call method docking2->set_extension
exporting
extension = extension2.

call method docking3->set_extension
exporting
extension = extension3.

when 'DOWN'.
call method docking1->get_extension
importing
extension = extension1.

extension1 = extension1 + 20.


call method docking2->get_extension
importing
extension = extension2.

extension2 = extension2 - 10.

call method docking3->get_extension
importing
extension = extension1.

extension3 = extension3 - 10.

call method docking1->set_extension
exporting
extension = extension1.


call method docking2->set_extension
exporting
extension = extension2.

call method docking3->set_extension
exporting
extension = extension3.

endcase.

Beitrag von bobo (ForumUser / 18 / 0 / 0 ) »
Warum muss es denn immer ein FuBa sein? bau dir doch einfach ein dynpro mit 2 containern und ruf die methoden von hand auf...

in meinen augen sind die REUSE-ALV-FB's eh schon wieder veraltet (jedenfalls ab 4.7)

REUSE_ALV_BLOCK_LIST_DISPLAY

Beitrag von Dele (Specialist / 307 / 4 / 47 ) »
Hallo Katinka,

ich würde den Funktionsbaustein REUSE_ALV_BLOCK_LIST_DISPLAY verwenden. Funktioniert sehr gut.

mfg dele

p.s. an bobo
Meiner Meinung nach sind die REUSE_ALV-Bausteine keineswegs veraltet und werden es auch nicht so schnell sein. Warum:
- Grid funktioniert nicht im Batch
- Grid verursacht viel Netzlast (schlecht für Home-Office)
- Manche Funktionen funktionieren meines Wissens nicht im Grid (dynamisches Anpassen Summenzeilen, Underline, New-Page)

Beitrag von babap (Expert / 681 / 1 / 1 ) »
Hallo,

ab 4.7 gibt es doch die Klasse CL_GUI_ALV_GRID.

in der REUSE-Library ist wunderbar "abzuschauen", wie man das macht.

Für den "Doppeleffekt" braucht man:
ein Dynpro, 2 Kontainer und 2 Grids.

In der lokalen Klasse LCL_EVENT_RECEIVER definiert man dann für jedes mögliche EVENT eben 2 Methoden, eine für jedes Grid.

Bei PBO muß man dann eben 2 Kontainer und 2 Grids erzeugen und für jedes die Events registrieren. Für die Events reicht ein Objekt von LCL_EVENT_RECEIVER.

Die Feldkataloge und Layout-Tabellen muß man natürlich 2-fach haben.

Und für jedes Grid natürlich eine getrennte Datentabelle.

Fazit: Man muß eben alle Objekte für die Grids verdoppeln.

Gemacht habe ich das schon und es klappt ohne Probleme.

Gruß
babap

Beitrag von Gast ( / / 0 / 3 ) »
oben in dem angegebenen report steht doch schon die Lösung. Sind dort eben 3 CL_GUI_ALV_GRIDS.
Report einfach mal probieren und auf nur 2 umbauen.
einen screen definieren und schon funzt es!

Re: REUSE_ALV_BLOCK_LIST_DISPLAY

Beitrag von Gast ( / / 0 / 3 ) »
Dele hat geschrieben:Hallo Katinka,

ich würde den Funktionsbaustein REUSE_ALV_BLOCK_LIST_DISPLAY verwenden. Funktioniert sehr gut.

mfg dele

p.s. an bobo
Meiner Meinung nach sind die REUSE_ALV-Bausteine keineswegs veraltet und werden es auch nicht so schnell sein. Warum:
- Grid funktioniert nicht im Batch
- Grid verursacht viel Netzlast (schlecht für Home-Office)
- Manche Funktionen funktionieren meines Wissens nicht im Grid (dynamisches Anpassen Summenzeilen, Underline, New-Page)
Der Block_List_Display stellt aber eben Listen und nicht Grids dar... Die meisten Kunden wollen aber grade die netten Funktionalitäten der Grids sehen ;)

Außerdem ist es mir schon oft passiert, dass ein Kunde im Nachhinein seine Anforderungen geändert hat und ich auf einmal ein 2tes Grid mit bestimmter Größe auf den Bildschirm bringen musste... In solchen Fällen kannst du dann praktisch von vorne anfangen, während ich einfach nur mein Dynpro anpassen - Stichwort: "vorausschauendes Programmieren" ;)

Beitrag von Gast ( / / 0 / 3 ) »
und noch zur Aussage das Grids nicht Hintergrundfähig sind :wink:

DATA: l_off TYPE i.

* Handelt es sich um eine Hintergrundverarbeitung?
CALL METHOD cl_gui_alv_grid=>offline
RECEIVING
e_offline = l_off.

IF l_off IS INITIAL.
* --> Keine Hintergrundverarbeitung

* Objekt Custom_Container (Control auf dem Dynpro) "erwecken"
CREATE OBJECT re_custom_container
EXPORTING
container_name = 'CTRL_ALV'. "g_container.
ENDIF.

* Objekt ALV auf dem Control "erwecken"
CREATE OBJECT re_alv
EXPORTING
* I_SHELLSTYLE = 0
* I_LIFETIME =
i_parent = re_custom_container
* I_APPL_EVENTS = space
* I_PARENTDBG =
* I_APPLOGPARENT =
* I_GRAPHICSPARENT =
* I_USE_VARIANT_CLASS = SPACE
* I_NAME =
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
others = 5
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

...

* Aufruf der Methode für ALV-OO-Ausgabe
CALL METHOD re_alv->set_table_for_first_display
EXPORTING
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE =
* I_CONSISTENCY_CHECK =
* i_structure_name =
is_variant = gs_variant
i_save = 'A'
* I_DEFAULT = 'X'
is_layout = gs_layout
* is_print =
* IT_SPECIAL_GROUPS =
* IT_TOOLBAR_EXCLUDING =
* IT_HYPERLINK =
* IT_ALV_GRAPHICS =
CHANGING
it_outtab = itab
it_fieldcatalog = gt_fieldcat
* it_sort =
* IT_FILTER =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

Seite 1 von 1

Vergleichbare Themen

7
Antw.
8358
Views
Select auf zwei Tabellen
von mip » 27.03.2008 16:05 • Verfasst in ABAP® für Anfänger
7
Antw.
3524
Views
Zwei Tabellen joinen (für ALV)?
von k4lisp3r4 » 22.01.2007 16:33 • Verfasst in ABAP® für Anfänger
3
Antw.
354
Views
Operieren mit zwei Tabellen
von LisaKremer » 22.01.2020 17:57 • Verfasst in ABAP® für Anfänger
12
Antw.
7444
Views
Zwei Tabellen zu einer Vereinigen
von CSelberg » 03.08.2018 11:39 • Verfasst in ABAP® für Anfänger
8
Antw.
1409
Views
Select über zwei Tabellen
von Michson1982 » 09.05.2019 13:32 • Verfasst in ABAP® für Anfänger

Newsletter Anmeldung

Keine Beiträge verpassen! Wöchentlich versenden wir lesenwerte Beiträge aus unserer Community.
Die letzte Ausgabe findest du hier.
Details zum Versandverfahren und zu Ihren Widerrufsmöglichkeiten findest du in unserer Datenschutzerklärung.