Posted: Mon Nov 05, 2007 2:40 pm Post subject: Demo: Activation of the Cluster Editor (Enhanced Version)
Code:
REPORT grcnetc2 MESSAGE-ID cg.
INCLUDE lcnetdat. "allg. Datendeklarationen
INCLUDE lcnetcon. "Konstanten
INCLUDE sgrccnst. "Allgemeine Konstanten
DATA: BEGIN OF all_boxes OCCURS 0.
INCLUDE STRUCTURE net_boxes.
DATA: END OF all_boxes.
DATA: BEGIN OF all_frames OCCURS 0.
INCLUDE STRUCTURE net_frames.
DATA: END OF all_frames.
DATA: BEGIN OF all_bvals OCCURS 0.
INCLUDE STRUCTURE net_nvals.
DATA: END OF all_bvals.
DATA: BEGIN OF all_fvals OCCURS 0.
INCLUDE STRUCTURE net_cvals.
DATA: END OF all_fvals.
DATA: BEGIN OF scroll_tab OCCURS 0,
flag(1) TYPE c,
END OF scroll_tab.
DATA: count TYPE i,
entry_act TYPE i,
entry_to TYPE i,
entry_new TYPE i,
line_count TYPE i VALUE 4,
line_count_1 TYPE i VALUE 10,
ok-code(4) TYPE c,
anz_f LIKE sy-tabix,
anz_b LIKE sy-tabix,
anzahl LIKE sy-tabix.
PARAMETER: prf_grup LIKE tcngt-prf_gruppe DEFAULT 'DEMO',
prf_name LIKE tcngt-prf_name DEFAULT '000000000001',
prf_indx LIKE tcngt-prf_index DEFAULT '1'.
CASE m_typ.
WHEN net_const-m_typ_d. "Graphic Window has been closed
EXIT.
WHEN net_const-m_typ_i. "Message recieved
stat = net_const-stat_4. "wait for input
CLEAR abap_cmd.
CASE gr_mes.
*----------------------------------------------------------------------*
WHEN net_const-doubleclicked.
abap_cmd = net_const-ask_for_modify.
* Doppelklick auf eine Box
DESCRIBE TABLE boxes_tab LINES anzahl.
IF anzahl <> 0.
PERFORM init_0100.
CALL SCREEN 100 STARTING AT 10 10 ENDING AT 56 29.
CLEAR boxes_tab.
REFRESH boxes_tab.
ENDIF. "if ANZAHL is initial
* Doppelklick auf einen Frame
DESCRIBE TABLE frames_tab LINES anzahl.
IF anzahl <> 0.
PERFORM init_0200.
CALL SCREEN 200 STARTING AT 10 10 ENDING AT 57 29.
CLEAR frames_tab.
REFRESH frames_tab.
ENDIF. "if ANZAHL is initial
* Speichertabellen fьr den Grafikinhalt updaten
PERFORM cluster_logic USING abap_cmd.
*----------------------------------------------------------------------*
WHEN net_const-ask_for_visible.
abap_cmd = gr_mes.
*----------------------------------------------------------------------*
WHEN net_const-ask_for_invisible.
abap_cmd = gr_mes.
*----------------------------------------------------------------------*
WHEN 'XBO1'. "Selektionen ermitteln
abap_cmd = net_const-get_selection.
*----------------------------------------------------------------------*
WHEN net_const-get_selection. "Selected objects
DESCRIBE TABLE boxes_tab LINES anz_b.
DESCRIBE TABLE frames_tab LINES anz_f.
* Maximale Anzahl der selektierten Objekte bestimmen
anzahl = anz_b.
IF anzahl < anz_f.
anzahl = anz_f.
ENDIF.
* Falls kein Objekt selektiert wurde
IF anzahl = 0.
status_text = text-011.
ELSE. "Es wurde mindestens ein Objekt selektiert
CLEAR scroll_tab.
REFRESH scroll_tab.
* Fьllen der Hilfstabelle fьr das Scrollen
DO anzahl TIMES.
APPEND scroll_tab.
ENDDO.
* Id's der Cluster und Boxen werden sortiert ausgegeben
SORT frames_tab BY id.
SORT boxes_tab BY id.
entry_act = 1.
CALL SCREEN 102 STARTING AT 10 10 ENDING AT 37 23.
REFRESH frames_tab.
REFRESH boxes_tab.
ENDIF. "if ANZAHL = 0
*----------------------------------------------------------------------*
WHEN net_const-ask_for_back.
abap_cmd = gr_mes.
*----------------------------------------------------------------------*
WHEN net_const-ask_for_exit.
abap_cmd = gr_mes.
*----------------------------------------------------------------------*
WHEN net_const-ask_for_quit.
abap_cmd = gr_mes.
*&---------------------------------------------------------------------*
*& Form MAKE_FRAMES
*&---------------------------------------------------------------------*
* Erzeugen der Frames *
*----------------------------------------------------------------------*
* <-> FRAMES
* <FVALS> ABAP_CMD *
*---------------------------------------------------------------------*
FORM cluster_logic USING abap_cmd LIKE net_graph-abap_cmd.
CASE abap_cmd.
WHEN space. "Neuladen
REFRESH: all_boxes, all_bvals, all_frames, all_fvals.
LOOP AT boxes_tab.
MOVE-CORRESPONDING boxes_tab TO all_boxes.
APPEND all_boxes.
ENDLOOP.
LOOP AT bvals_tab.
MOVE-CORRESPONDING bvals_tab TO all_bvals.
APPEND all_bvals.
ENDLOOP.
LOOP AT frames_tab.
MOVE-CORRESPONDING frames_tab TO all_frames.
APPEND all_frames.
ENDLOOP.
LOOP AT fvals_tab.
MOVE-CORRESPONDING fvals_tab TO all_fvals.
APPEND all_fvals.
ENDLOOP.
WHEN net_const-ask_for_modify. "Modifizieren
LOOP AT bvals_tab.
LOOP AT all_bvals WHERE id = bvals_tab-id
AND fl = bvals_tab-fl.
MOVE-CORRESPONDING bvals_tab TO all_bvals.
MODIFY all_bvals.
EXIT.
ENDLOOP.
IF NOT sy-subrc IS INITIAL.
MOVE-CORRESPONDING bvals_tab TO all_bvals.
APPEND all_bvals.
ENDIF.
ENDLOOP.
LOOP AT fvals_tab.
LOOP AT all_fvals WHERE id = fvals_tab-id
AND fl = fvals_tab-fl.
MOVE-CORRESPONDING fvals_tab TO all_fvals.
MODIFY all_fvals.
EXIT.
ENDLOOP. "loop at ALL_FVALS
IF NOT sy-subrc IS INITIAL.
MOVE-CORRESPONDING fvals_tab TO all_fvals.
APPEND all_fvals.
ENDIF.
ENDLOOP. "loop at FVALS_TAB
ENDCASE.
ENDFORM. "form CLUSTER_LOGIC
*----------------------------------------------------------------------*
* Form INIT_0100 *
*----------------------------------------------------------------------*
* Initialisierung der Tabellen BOXES_TAB und BVALS_TAB fьr die Anzeige *
* der Inhalte der Box, die per Doppelklick selektiert wurde. *
*----------------------------------------------------------------------*
FORM init_0100.
entry_act = 1.
READ TABLE boxes_tab INDEX 1.
LOOP AT all_boxes WHERE id = boxes_tab-id.
MOVE-CORRESPONDING all_boxes TO boxes_tab.
MODIFY boxes_tab INDEX 1.
EXIT.
ENDLOOP.
LOOP AT all_bvals WHERE id = boxes_tab-id.
MOVE-CORRESPONDING all_bvals TO bvals_tab.
APPEND bvals_tab.
ENDLOOP.
SORT bvals_tab.
ENDFORM. " INIT_0100
*----------------------------------------------------------------------*
* Form INIT_0200 *
*----------------------------------------------------------------------*
* Initialisierung der Tabellen FRAMES_TAB und FVALS_TAB fьr die *
* Anzeige der Inhalte des Frame, der per Doppelklick selektiert wurde. *
*----------------------------------------------------------------------*
FORM init_0200.
entry_act = 1.
READ TABLE frames_tab INDEX 1.
LOOP AT all_frames WHERE id = frames_tab-id.
MOVE-CORRESPONDING all_frames TO frames_tab.
MODIFY frames_tab INDEX 1.
EXIT.
ENDLOOP.
LOOP AT all_fvals WHERE id = frames_tab-id.
MOVE-CORRESPONDING all_fvals TO fvals_tab.
APPEND fvals_tab.
ENDLOOP.
SORT fvals_tab.
ENDFORM. " INIT_0200
*&---------------------------------------------------------------------*
*& Form SET_CUA_STATUS
*&---------------------------------------------------------------------*
* Setzen der CUA-Oberflдche *
*----------------------------------------------------------------------*
FORM set_cua_status.
DATA: BEGIN OF excluding_tab OCCURS 0.
INCLUDE STRUCTURE sgrcexclud.
DATA: END OF excluding_tab.
DATA: prog LIKE sy-repid.
prog = sy-repid.
* CUA-Status
CALL FUNCTION 'GRAPH_SET_CUA_STATUS'
EXPORTING
program = prog
status = 'GRAFIK'
TABLES
excluding = excluding_tab
EXCEPTIONS
inv_cua_info = 1.
LOOP AT FVALS_TAB CURSOR ENTRY_ACT.
ENDLOOP.
*
PROCESS AFTER INPUT.
LOOP AT FVALS_TAB.
CHAIN.
FIELD: FVALS_TAB-FL.
FIELD: FVALS_TAB-VAL.
MODULE MODIFY_TAB_0200 ON CHAIN-REQUEST.
ENDCHAIN.
ENDLOOP.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.