Drilldown auf ALV Tabelle

Die Objektorientierung mit ABAP®: Vererbung, Dynamische Programmierung, GUI Controls (u.a. ALV im OO).
19 Beiträge • Seite 1 von 2 (current) Nächste
19 Beiträge Seite 1 von 2 (current) Nächste

Drilldown auf ALV Tabelle

Beitrag von Spookykid (Specialist / 140 / 28 / 0 ) »
Hallo zusammen,

ich schreibe gerade an einem Programm in ABPAP Objects. Ich möchte gerne den Parameter i_callback_user_command Bestücken um Interaktionen mit der Liste zu verarbeiten. So weit ich gesehen habe, können jedoch nur Forms an den Parameter übergeben werden. Wie muss ich vorgehen, damit ich ein Drilldown auch im OO Kontext nutzen kann?

Code: Alles auswählen.

 call function 'REUSE_ALV_GRID_DISPLAY'
      exporting
        i_callback_program      = sy-repid
        i_callback_user_command = 'reaction'
        i_grid_title            = 'Overview'
        i_save                  = 'A'
        it_fieldcat             = lt_fcat
        is_layout               = gs_layout
      tables
        t_outtab                = g_s_resulttable.
    if sy-subrc <> 0.

    endif.

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


Re: Drilldown auf ALV Tabelle

Beitrag von zzcpak (Expert / 673 / 5 / 68 ) »
Wenn du schon in OO entwickelst, könntest du dir die Klassen CL_ALV* bzw. CL_SALV* mal ansehen. Ich habs selbst noch nicht oft verwendet, aber da dürfte alles dabei, was man für die Listverarbeitung braucht.

das könnte auch nützlich sein:
http://help.sap.com/saphelp_nw2004s/hel ... ameset.htm

Re: Drilldown auf ALV Tabelle

Beitrag von Spookykid (Specialist / 140 / 28 / 0 ) »
zzcpak hat geschrieben:Wenn du schon in OO entwickelst, könntest du dir die Klassen CL_ALV* bzw. CL_SALV* mal ansehen. Ich habs selbst noch nicht oft verwendet, aber da dürfte alles dabei, was man für die Listverarbeitung braucht.

das könnte auch nützlich sein:
http://help.sap.com/saphelp_nw2004s/hel ... ameset.htm

Danke, hat mir im Ersten Schritt weiter geholfen. Ich stoße nun aber auf ein weiteres Problem....

Code: Alles auswählen.

method on_double_click.
    data wa_result like line of g_s_resulttable.
    data dref type ref to data.
    field-symbols: <table> type any,
                   <field> type any.
    data tname type tabname.
    data tablename like table of tname.
    data: lt_fcat type slis_t_fieldcat_alv.
    data: ls_fcat type slis_fieldcat_alv.



    read table g_s_resulttable index row into wa_result.
    tname = wa_result-table.
    create data dref type (tname).
    assign  dref->* to <table>.



    select *
      into  <table>
      from (wa_result-table).

      append <table> to tablename.
      clear <table>.
    endselect.


    while sy-subrc = 0.
      assign component  sy-index of structure <table> to <field>.

*      append <field> to lt_fcat.
    endwhile.









    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
      exporting
        i_program_name   = sy-repid
        i_structure_name = 'tablename'
      changing
        ct_fieldcat      = lt_fcat
      exceptions
        programm_error   = 1
        others           = 2.




    call function 'REUSE_ALV_GRID_DISPLAY'
      exporting
        i_callback_program = sy-repid
        i_grid_title       = '2nd layer'
        i_save             = 'A'
        it_fieldcat        = lt_fcat
      tables
        t_outtab           = tablename.



  endmethod.                    "on_double_click
Folgende Methode erhält den String einen DDIC Tabellenname (wa_result-table) soll daraufhin den Inhalt ziehen und als alv ausgeben. Leider stoße ich beim Feldkatalog auf Probleme. Ich kann mit REUSE_ALV_FIELDCATALOG_MERGE den Feldkatalog nicht dynamisch leechen. Beim Zusammenbauen des Feldkats mit assign component sy-index ... gibt es auch Probleme da <field> nicht bestückt wird. Habt ihr mir einen Lösungsvorschlag?

Danke im Voraus

Re: Drilldown auf ALV Tabelle

Beitrag von black_adept (Top Expert / 4159 / 136 / 960 ) »
Hi Spookykid,
Spookykid hat geschrieben:Folgende Methode erhält den String einen DDIC Tabellenname (wa_result-table) soll daraufhin den Inhalt ziehen und als alv ausgeben.
a) der Satz ist unverständlich da grammatikalisch völliger Unsinn.
Spookykid hat geschrieben: Leider stoße ich beim Feldkatalog auf Probleme. Ich kann mit REUSE_ALV_FIELDCATALOG_MERGE den Feldkatalog nicht dynamisch leechen.
b) Was für Probleme? Was ist "dynamisches leechen"?
M.E. kann man sich den Feldkatalog mit dem o.a. Funktionsbaustein aufbauen lassen, auch wenn der Tabellenname nur in einem Feld steht (falls das die Frage gewesen sein sollte). Man darf dann aber keine ' um den Variablennamen setzen, der den Tabellennamen enthält.

c)
Spookykid hat geschrieben:Beim Zusammenbauen des Feldkats mit assign component sy-index ... gibt es auch Probleme da <field> nicht bestückt wird.
Womit sollte denn field bestückt werden? Hast du dir das mal im Debugger angeschaut?
live long and prosper
Stefan Schmöcker

email: stefan@schmoecker.de

Re: Drilldown auf ALV Tabelle

Beitrag von a-dead-trousers (Top Expert / 4483 / 231 / 1205 ) »
hi!

Deine Tabelle TABLENAME besitzt keine Struktur, folglich kannst du auch nicht mittels REUSE_ALV_FIELDCATALOG_MERGE einen Feldkatalog erstellen.
Die Tabelle enthällt nämlich nur Datenelemente.
Daher darf dein Feldkatalog auch nur aus einem Feld bestehen und zwar FIELDNAME='TABLE_LINE' und den musst du dir in dem Fall selber zusammenbauen.
TABLE_LINE ist übrigens ein internener ABAP-Pseudo-Name für die gesamte Tabellenzeile, den brauchst man meistens dann, so wie in deinem Fall, wenn die internen Tabelle keine Struktur besitzt sondern nur aus einem Datenfeld besteht. Vorallem wenn man wie bei READ TABLE einen Key benötigt (READ_TABLE ... WITH KEY TABLE_LINE = ... )

lg ADT
Theory is when you know something, but it doesn't work.
Practice is when something works, but you don't know why.
Programmers combine theory and practice: Nothing works and they don't know why.

ECC: 6.18
Basis: 7.50

Re: Drilldown auf ALV Tabelle

Beitrag von Spookykid (Specialist / 140 / 28 / 0 ) »
Als erstes möchte ich mich für meinen Post entschuldigen, welcher in Eile hingekritzelt wurde. Kommt nicht wieder vor ;-)

Ich konnte das Problem soweit lösen, jedoch stoße ich schon wieder auf das Nächste. Es geht darum, dass ich einzelne Zeilen meines ALVs einfärben möchte. Die einzufärbenden Zeilen habe ich in einer Tabelle (sy-tabix) in der zusätzlich noch die Farbe vermerkt wurde.

Ich habe nun schon einiges bzgl. dem Einfärben gelesen, leider hatte ich nicht das Gefühl, dass das Richtige für mich dabei war.

Ich habe wie gesagt eine Tabelle, die als ALV ausgegeben werden soll und eine, die die Farbe und einzufärbende Zeile beinhaltet.
Hat jemand eine Idee oder Code-Snippet?


Grüße Spookykid

Re: Drilldown auf ALV Tabelle

Beitrag von ralf.wenzel (Top Expert / 4009 / 208 / 282 ) »
Moin.

http://tinyurl.com/3nyehut

Guck dir mal den vierten Hit an (Google gibt dämlicherweise erst Treffer für "Zeile einfärben" an, was gar nicht gefragt ist)
Bild
Ralf Wenzel Heuristika SAP-Development -- 25 Jahre SAP-Entwickler • 20 Jahre Freiberufler
PublikationenUngarische NotationXing

Re: Drilldown auf ALV Tabelle

Beitrag von Spookykid (Specialist / 140 / 28 / 0 ) »
Habe ich schon durchgelesen... es wird aber immer auf ein Variabel vom Typ LVC_S_SCOL eingegangen. Ich will jedoch unabhängig von Spaltennamen die Zeilen einfärben.
Description

Code: Alles auswählen.

    class-methods on_double_click                 " DOUBLE_CLICK
         for event if_salv_events_actions_table~double_click
         of cl_salv_events_table
           importing row
                     column.
Implementation

Code: Alles auswählen.

method on_double_click.
    data wa_result like line of g_s_resulttable.
    data dref type ref to data.
    data tname type tabname.
    data: lt_fcat type slis_t_fieldcat_alv.
    data: ls_fcat type slis_fieldcat_alv.
    data ls_gridtitle type lvc_title.
    data: ls_dref_case  type ref to data.
    data: ls_dref_case1 type ref to data. " Identifizierugsmerkmal für CASE1
    data: ls_dref_case2 type ref to data. " Identifizierugsmerkmal für CASE2
    data: ls_dref_case3 type ref to data. " Identifizierugsmerkmal für CASE3
    data: ls_dref_case4 type ref to data. " Identifizierugsmerkmal für CASE4
    data:  begin of ls_tabix,
            tabix like sy-tabix,
            case type i,
           end of ls_tabix.
    data lt_tabix like table of ls_tabix. "Enthält die Idizes der betroffenen Zeilen.
    data otab type abap_sortorder_tab.
    data ls_lang type tabname.
    data ls_rowcol type LVC_S_ROW.
    data lt like table of ls_rowcol.
    field-symbols: <table> type standard table,
                   <field> type any,
                   <case>  type any table,
                   <case2> type any,
                   <row_case> type any.



**Anlegen der Tabellenstruktur ensprehchend der ausgewählten Zeile.
    read table g_s_resulttable index row into wa_result.
    tname = wa_result-table.
    create data dref type table of (tname).
    assign  dref->* to <table>.


*Befüllen der Tabelle
    select *
      into table <table>
      from (wa_result-table).



**Feldkatalog erstellen.
    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
      exporting
        i_program_name   = sy-repid
        i_structure_name = tname
      changing
        ct_fieldcat      = lt_fcat
      exceptions
        programm_error   = 1
        others           = 2.


    ls_gridtitle = wa_result-table.

**Analyse wird vorgenommen.
    secondlayer_display(
       exporting t_name = tname
       importing ls_dref_case1 = ls_dref_case1
                 ls_dref_case2 = ls_dref_case2
                 ls_dref_case3 = ls_dref_case3
                 ls_dref_case4 = ls_dref_case4
                 otab          = otab
       CHANGING  ls_lang       = ls_lang
                  ).


** Verarbeiten der importierten Analysetabellen.
** Die ausgewählte Tabelle wird wird auf den Inhalt der entsprechendnen "Fälle" 
**überpüft. Sy-Tabix und ensprechender Fall werden vermerkt. 
 create data ls_dref_case type table of (tname).
 ls_dref_case ?= ls_dref_case1.
 assign  ls_dref_case->* to <case>.

loop at <case> ASSIGNING <case2>.
  READ TABLE <table> from <case2> ASSIGNING <row_case> .

    ls_tabix-tabix = sy-tabix.
    ls_tabix-case  = 1.
  append ls_tabix to lt_tabix.
  endloop.



 create data ls_dref_case type table of (tname).
 ls_dref_case ?= ls_dref_case2.
 assign  ls_dref_case->* to <case>.

loop at <case> ASSIGNING <case2>.
  READ TABLE <table> from <case2> ASSIGNING <row_case> .

    ls_tabix-tabix = sy-tabix.
    ls_tabix-case  = 2.
  append ls_tabix to lt_tabix.
  endloop.

   create data ls_dref_case type table of (tname).
 ls_dref_case ?= ls_dref_case3.
 assign  ls_dref_case->* to <case>.

loop at <case> ASSIGNING <case2>.
  READ TABLE <table> from <case2> ASSIGNING <row_case> .

    ls_tabix-tabix = sy-tabix.
    ls_tabix-case  = 3.
  append ls_tabix to lt_tabix.
  endloop.

 create data ls_dref_case type table of (tname).
 ls_dref_case ?= ls_dref_case4.
 assign  ls_dref_case->* to <case>.

loop at <case> ASSIGNING <case2>.
  READ TABLE <table> from <case2> ASSIGNING <row_case> .

    ls_tabix-tabix = sy-tabix.
    ls_tabix-case  = 4.
  append ls_tabix to lt_tabix.
  endloop.

Re: Drilldown auf ALV Tabelle

Beitrag von ralf.wenzel (Top Expert / 4009 / 208 / 282 ) »
Ups, verlesen. Du willst die ZEILE einfärben, nicht die ZELLE. Dann lass den Spaltennamen leer.
Bild
Ralf Wenzel Heuristika SAP-Development -- 25 Jahre SAP-Entwickler • 20 Jahre Freiberufler
PublikationenUngarische NotationXing

Re: Drilldown auf ALV Tabelle

Beitrag von Spookykid (Specialist / 140 / 28 / 0 ) »
ralf.wenzel hat geschrieben:Ups, verlesen. Du willst die ZEILE einfärben, nicht die ZELLE. Dann lass den Spaltennamen leer.

Ich gehe davon aus, dass du diesen Weg im Hinterkopf hast?
http://help.sap.com/saphelp_tm80/helpda ... ontent.htm

Das Problem hierbei ist jedoch, dass ich meine Tabellen-Struktur nicht um ein char(4)- Feld erweitern kann. Ich weiß erst zur Laufzeit, um welche Struktur es geht.

Hast du hierzu einen Lösungsvorschlag?

Re: Drilldown auf ALV Tabelle

Beitrag von ralf.wenzel (Top Expert / 4009 / 208 / 282 ) »
Heißt das, du weißt ÜBERHAUPT nicht, welche Struktur die Tabelle hat? Warum baust du dir keine Struktur auf, die an das Feldsymbol per INCLUDE STRUCTURE die notwendige ALV-Struktur dranhängt (unabhängig davon, welche ALV-Struktur das ist).
Bild
Ralf Wenzel Heuristika SAP-Development -- 25 Jahre SAP-Entwickler • 20 Jahre Freiberufler
PublikationenUngarische NotationXing

Re: Drilldown auf ALV Tabelle

Beitrag von Spookykid (Specialist / 140 / 28 / 0 ) »
Richtig, ich habe keine Ahnung, welche Struktur ich habe. Ich erstelle zur Laufzeit die Tabelle und assigne sie auf <table>.

Code: Alles auswählen.

    read table g_s_resulttable index row into wa_result.
    tname = wa_result-table.
    create data dref type table of (tname).
    assign  dref->* to <table>.
Warum baust du dir keine Struktur auf, die an das Feldsymbol per INCLUDE STRUCTURE die notwendige ALV-Struktur dranhängt (unabhängig davon, welche ALV-Struktur das ist).
Könntest du hierzu ein Bsp machen?
Herzlichen Dank schon mal im Voraus.
lan_anal.gif
Durch Auswahl einer Reihe wird die methode on_double_click aufgerufen.

Re: Drilldown auf ALV Tabelle

Beitrag von black_adept (Top Expert / 4159 / 136 / 960 ) »
Spookykid hat geschrieben:Das Problem hierbei ist jedoch, dass ich meine Tabellen-Struktur nicht um ein char(4)- Feld erweitern kann. Ich weiß erst zur Laufzeit, um welche Struktur es geht.
Doch - das geht.

http://www.apentia-forum.de/viewtopic.php?f=3&t=22501

Folgende Benutzer bedankten sich beim Autor black_adept für den Beitrag:
Spookykid

live long and prosper
Stefan Schmöcker

email: stefan@schmoecker.de

Re: Drilldown auf ALV Tabelle

Beitrag von Spookykid (Specialist / 140 / 28 / 0 ) »
black_adept hat geschrieben:
Spookykid hat geschrieben:Das Problem hierbei ist jedoch, dass ich meine Tabellen-Struktur nicht um ein char(4)- Feld erweitern kann. Ich weiß erst zur Laufzeit, um welche Struktur es geht.
Doch - das geht.

http://www.apentia-forum.de/viewtopic.php?f=3&t=22501
wunderbar!

Re: Drilldown auf ALV Tabelle

Beitrag von Spookykid (Specialist / 140 / 28 / 0 ) »
Hallo,

leider stoße ich auf ein Casting Problem.
Deklaration:

Code: Alles auswählen.

class-methods extend_structure  importing p_structure type any table
                                              p_tabix type any table
                                    changing p_dref type ref to data.
Impl.

Code: Alles auswählen.

  method extend_structure.

    data:     cl_desc1            type ref to cl_abap_structdescr,
              t_component_table1  type cl_abap_structdescr=>component_table,


              cl_desc2            type ref to cl_abap_structdescr,
              t_component_table2  type cl_abap_structdescr=>component_table,

              cl_desc             type ref to cl_abap_structdescr,
              t_component_table   type cl_abap_structdescr=>component_table,

              dreftable           type ref to data.

    data      p_test               type ref to data.

    data:     begin of fix_part,
                linecolor(4) type c,
              end of fix_part.

    data      dref_temp type ref to data.

    data      lf_linecolor(4) type c.


    field-symbols: <oldtable> type table,
                   <ln_oldtable> type any,
                   <fs_table> type any,
                   <fs_tabix> like gs_tabix,
                   <p_dref>   type any,
                   <dreftable> type  table.

*Sicherung des Tabelleninhalts.
    create data dref_temp like table of p_structure.
    dref_temp ?= p_dref.

    cl_desc2 ?= cl_abap_typedescr=>describe_by_data( fix_part )        .
    t_component_table2 = cl_desc2->get_components( ).

    cl_desc1 ?= cl_abap_typedescr=>describe_by_data( p_structure )      <==============================================  .
    t_component_table1  = cl_desc1->get_components( ).
p_structure ist bei mir, anders als bei black_adepts Beispiel, eine Referenz auf eine Tablelle. Ich bekomme bei der Zuweisung

Code: Alles auswählen.

cl_desc1 ?= cl_abap_typedescr=>describe_by_data( p_structure )
eine Casting Exception gerworfen.
Habt ihr eine Idee, wie ich dies umgehen kann?

Vielen Dank im Voraus
Spookykid

Vergleichbare Themen

0
Antw.
1422
Views
DrillDown durch User-Klick auf Diagrammbalken möglich?
von freeze » 24.08.2008 14:27 • Verfasst in Dialogprogrammierung
5
Antw.
5209
Views
1
Antw.
4819
Views
2
Antw.
6398
Views
Join über Tabelle trotz Pool/Cluster Tabelle
von em.tie » 04.12.2006 18:38 • Verfasst in ABAP® für Anfänger

Aktuelle Forenbeiträge

Ermittlung der Arbeitstage (Mosid)
vor 3 Tagen von Radinator 11 / 45972
LSMW-Problem
vor einer Woche von DeathAndPain gelöst 6 / 3860
SFP (Adobe Forms) QR-Code wird nicht angezeigt
vor einer Woche von Sebastian82 gelöst 4 / 2341

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.

Aktuelle Forenbeiträge

Ermittlung der Arbeitstage (Mosid)
vor 3 Tagen von Radinator 11 / 45972
LSMW-Problem
vor einer Woche von DeathAndPain gelöst 6 / 3860
SFP (Adobe Forms) QR-Code wird nicht angezeigt
vor einer Woche von Sebastian82 gelöst 4 / 2341