Code: Alles auswählen.
data: context_node type ref to if_wd_context_node,
element type ref to if_wd_context_element,
attribut type ..." Struktur des Kontext-Knoten
context_node = wd_context->get_context_node( name = 'Name des Kontext-Knoten').
element = context_node->get_element( ).
element->get_static_attributes()
Danke für den Code, könntest du mir den evtl. kurz erklären?jocoder hat geschrieben:Hallo,
hierzu brauchst du Objektorientierte Programmierung.
Soweit ich das richtig verstanden habe, geht es um ein Web-Dynproattribut enthält jetzt die ausgewählte TabellenzeileCode: Alles auswählen.
data: context_node type ref to if_wd_context_node, element type ref to if_wd_context_element, attribut type ..." Struktur des Kontext-Knoten context_node = wd_context->get_context_node( name = 'Name des Kontext-Knoten'). element = context_node->get_element( ). element->get_static_attributes()
Code: Alles auswählen.
method onaction_weiter.
data: context_node type ref to if_wd_context_node,
element type ref to if_wd_context_element,
attribut type ..." Struktur des Kontext-Knoten fachbereichnode
context_node = wd_context->get_context_node( name = wd_this->wdctx_fachbereichnode ).
element = context_node->get_element( ).
attribut = element->get_static_attributes().
Code: Alles auswählen.
wd_assist->update_fachbereich( fachbereich = attribut-fachbereich ).
endmethod " onaction_weiter
...
method update_fachbereich.
update my_table set abteilung = fachbereich where my_sql_clause.
if sy-subrc = 0.
commit work.
else.
rollback work.
endif.
endmethod.
Zunächst einmal Danke für deine Mühenjocoder hat geschrieben:Hier solltest du für den Knopf eine Aktion definieren.
Hier wird dann der Code implementiert.In der Struktur attribut steht dann die Tabellenzeilen, die der Benutzer ausgewählt hat.Code: Alles auswählen.
method onaction_weiter. data: context_node type ref to if_wd_context_node, element type ref to if_wd_context_element, attribut type ..." Struktur des Kontext-Knoten fachbereichnode context_node = wd_context->get_context_node( name = wd_this->wdctx_fachbereichnode ). element = context_node->get_element( ). attribut = element->get_static_attributes().
Jetzt kannst du ganz normal mit der Struktur attribut weiterarbeiten.
Die Struktur attribut hat den gleichen Typ wie der Context-Knoten fachbereichnode.
z.B. (wenn dein Context-Knoten ein Attribut fachbereich enthält):Wichtig bei Fortschreibung auf der Datenbank:Code: Alles auswählen.
wd_assist->update_fachbereich( fachbereich = attribut-fachbereich ). endmethod " onaction_weiter ... method update_fachbereich. update my_table set abteilung = fachbereich where my_sql_clause. if sy-subrc = 0. commit work. else. rollback work. endif. endmethod.
my_table wäre dann die Tabelle aus deinem Screenshoot.
my_sql_clause ist die where-Bedingung.
Beim Web-Dynpro sollte man immer ein explizites commit work aufrufen.
Code: Alles auswählen.
method ONACTIONONCLICK_EDIT .
DATA: context_node type ref to if_wd_context_node,
element type ref to if_wd_context_element,
attribut type zdb_bcm.
context_node = wd_context->get_context_node( NAME = wd_this->wdctx_main_node ).
element = context_node->get_element( ).
attribut = element->get_static_attributes( ).
wd_assist->update_fachbereich (fachbereich = attribut-fachbereich).
endmethod. "onactionclick_edit
Method update_fachbereich.
Update zdb_bcm set FACHBEREICH = fachbereich WHERE my_sql_clause.
IF sy-subrc = 0.
COMMIT WORK.
ELSE.
ROLLBACK WORK.
ENDIF.
ENDMETHOD.
Code: Alles auswählen.
get_child_node]
Code: Alles auswählen.
get_context_node
Code: Alles auswählen.
data: context_node type ref to if_wd_context_node,
element type ref to if_wd_context_element,
attribut type z_bemu_mcha_s. " Struktur des Kontext-Knoten fachbereichnode
Code: Alles auswählen.
data: context_node type ref to if_wd_context_node,
element type ref to if_wd_context_element,
attribut type wd_this->element_fachbereichnode." Struktur des Kontext-Knoten fachbereichnode
Code: Alles auswählen.
commit work
Code: Alles auswählen.
element->get_static_attributes( exporting static_attributes = attribut ).