Posted: Mon Nov 05, 2007 1:47 pm Post subject: Demo: Hierarchy Graphics in Maintenance Mode
Code:
PROGRAM HIER_BO2 MESSAGE-ID CG.
INCLUDE LCNETDAT. "allg. Datendeklarationen
INCLUDE LCNETCON. "Konstanten
DATA: BEGIN OF ALL_NODES_TAB OCCURS 0. "Alle Knoten
INCLUDE STRUCTURE CHG_INODES.
DATA: END OF ALL_NODES_TAB.
DATA: BEGIN OF ALL_NVALS_TAB OCCURS 0. "Werte zu allen Knoten
INCLUDE STRUCTURE NET_NVALS.
DATA: END OF ALL_NVALS_TAB.
DATA: BEGIN OF COLLAPSED_NODES_TAB OCCURS 0. "Kollabierte Knoten
INCLUDE STRUCTURE CHG_INODES.
DATA: END OF COLLAPSED_NODES_TAB.
DATA: BEGIN OF FIELD_TAB OCCURS 0, "Modifizieren der Knoten und Kanten
ID LIKE CNG_INODES-ID,
FL LIKE NET_NVALS-FL,
VAL LIKE NET_NVALS-VAL,
COLOR LIKE THLT-BG_COL,
END OF FIELD_TAB.
DATA: BEGIN OF NODE_LINE, "Modifizieren der Knoten und Kanten
ID LIKE CNG_INODES-ID,
TYPE LIKE CNG_INODES-TYPE,
END OF NODE_LINE.
DATA: ANZ TYPE I,
COLLAPSED_NODE_TYPE LIKE CHG_NODES-TYPE VALUE '9',
COUNT TYPE I,
ENTRY_ACT LIKE SY-TABIX,
ENTRY_TO LIKE SY-TABIX,
ENTRY_NEW LIKE SY-TABIX,
LINE_COUNT LIKE SY-TABIX VALUE 4,
LINE_COUNT_1 LIKE SY-TABIX VALUE 10,
OK_CODE(4) TYPE C,
SAVE_OK_CODE LIKE OK_CODE.
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'.
*----------------------------------------------------------------------*
WHEN NET_CONST-ASK_FOR_MODIFY.
LG_MES = GR_MES.
ABAP_CMD = GR_MES.
IF MODE = NET_CONST-TEXT_MODE.
* Feldnamen in Textindizes umwandeln
PERFORM FIELD_TO_TEXTINDEX_NVALS TABLES NVALS_TAB
ALL_NODES_TAB.
PERFORM INIT_0100 TABLES NVALS_TAB ALL_NODES_TAB.
ENTRY_ACT = 1.
CALL SCREEN 100 STARTING AT 10 10 ENDING AT 71 21.
* Bei Farbфnderung Textindex in Feldnamen umwandeln
PERFORM FIELD_TO_TEXTINDEX_NVALS TABLES NVALS_TAB
ALL_NODES_TAB.
STATUS_TEXT = TEXT-005. "Knoten geфndert
ENDIF.
*----------------------------------------------------------------------*
WHEN NET_CONST-DOUBLECLICKED.
LG_MES = NET_CONST-ASK_FOR_MODIFY.
ABAP_CMD = NET_CONST-ASK_FOR_MODIFY.
CLEAR NVALS_TAB.
REFRESH NVALS_TAB.
READ TABLE HIER_NODES_TAB INDEX 1.
LOOP AT ALL_NVALS_TAB WHERE ID = HIER_NODES_TAB-ID.
MOVE-CORRESPONDING ALL_NVALS_TAB TO NVALS_TAB.
APPEND NVALS_TAB.
ENDLOOP.
CLEAR HIER_NODES_TAB.
REFRESH HIER_NODES_TAB.
PERFORM INIT_0100 TABLES NVALS_TAB ALL_NODES_TAB.
ENTRY_ACT = 1.
CALL SCREEN 100 STARTING AT 10 10 ENDING AT 71 21.
* Bei Farbфnderung Textindex in Feldnamen umwandeln
PERFORM FIELD_TO_TEXTINDEX_NVALS TABLES NVALS_TAB
ALL_NODES_TAB.
STATUS_TEXT = TEXT-005. "Knoten geфndert
*----------------------------------------------------------------------*
WHEN NET_CONST-ASK_FOR_VER_ALIGN.
LG_MES = NET_CONST-DO_NOTHING.
ABAP_CMD = GR_MES.
*----------------------------------------------------------------------*
WHEN NET_CONST-ASK_FOR_HOR_ALIGN.
LG_MES = NET_CONST-DO_NOTHING.
ABAP_CMD = GR_MES.
*----------------------------------------------------------------------*
WHEN NET_CONST-ASK_FOR_EXPAND.
LG_MES = NET_CONST-ASK_FOR_MODIFY.
ABAP_CMD = GR_MES.
LOOP AT NVALS_TAB WHERE FL = NET_CONST-OUTLINING
AND VAL = NET_CONST-EXPAND.
LOOP AT COLLAPSED_NODES_TAB WHERE ID = NVALS_TAB-ID.
NVALS_TAB-FL = NET_CONST-TYPE.
NVALS_TAB-VAL = COLLAPSED_NODES_TAB-TYPE.
APPEND NVALS_TAB.
DELETE COLLAPSED_NODES_TAB.
ENDLOOP. "loop at COLLAPSED_NODES_TAB
ENDLOOP. "loop at NVALS_TAB
*----------------------------------------------------------------------*
WHEN NET_CONST-ASK_FOR_COLLAPS.
LG_MES = NET_CONST-ASK_FOR_MODIFY.
ABAP_CMD = GR_MES.
LOOP AT NVALS_TAB WHERE FL = NET_CONST-OUTLINING
AND VAL = NET_CONST-COLLAPS.
LOOP AT ALL_NODES_TAB WHERE ID = NVALS_TAB-ID.
COLLAPSED_NODES_TAB = ALL_NODES_TAB.
APPEND COLLAPSED_NODES_TAB.
ENDLOOP. "loop at ALL_NODES_TAB
*---------------------------------------------------------------------*
* FORM INIT_0100 *
*---------------------------------------------------------------------*
* Initialisieren des Dynpros zum Фndern der Knoten *
*---------------------------------------------------------------------*
FORM INIT_0100 TABLES NVALS STRUCTURE NET_NVALS
ALL_NODES STRUCTURE CHG_INODES.
CLEAR: FIELD_TAB,
NODE_LINE.
REFRESH: FIELD_TAB.
READ TABLE NVALS INDEX 1.
LOOP AT ALL_NODES WHERE ID = NVALS-ID.
NODE_LINE-ID = NVALS-ID.
NODE_LINE-TYPE = ALL_NODES-TYPE.
ENDLOOP.
LOOP AT NVALS.
FIELD_TAB = NVALS.
APPEND FIELD_TAB.
ENDLOOP.
SORT FIELD_TAB.
ENDFORM. "form INIT_0100
*---------------------------------------------------------------------*
* FORM INIT_0104 *
*---------------------------------------------------------------------*
* Ermitteln der Knotenanordnung *
*---------------------------------------------------------------------*
FORM INIT_0104 TABLES NODES STRUCTURE CHG_NODES
ALL_NODES STRUCTURE CHG_INODES.
REFRESH NODES.
LOOP AT ALL_NODES.
CLEAR NODES.
MOVE-CORRESPONDING ALL_NODES TO NODES.
APPEND NODES.
ENDLOOP.
SORT NODES BY ID.
ENDFORM. "form INIT_0104
*---------------------------------------------------------------------*
* FORM SET_CUA_STATUS. *
*---------------------------------------------------------------------*
* Pflegen der CUA-Oberflфche ќber den CUA-Painter *
*---------------------------------------------------------------------*
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.
FREE EXCLUDING_TAB.
* Fenstertitel
SET TITLEBAR '006'.
ENDFORM. "form SET_CUA_STATUS
*---------------------------------------------------------------------*
* FORM SET_TITLE_BOX *
*---------------------------------------------------------------------*
* Setzen der Titelbox fќr's Drucken *
*---------------------------------------------------------------------*
FORM SET_TITLE_BOX TABLES BOXES STRUCTURE NET_BOXES
BVALS STRUCTURE NET_NVALS.
LOOP AT FIELD_TAB.
CLEAR NVALS_TAB.
MOVE-CORRESPONDING FIELD_TAB TO NVALS_TAB.
APPEND NVALS_TAB.
IF FIELD_TAB-COLOR <> SPACE.
CLEAR NVALS_TAB.
READ TABLE NVALS_TAB INDEX SY-TABIX.
WRITE NVALS_TAB-FL TO NVALS_TAB-VAL.
WRITE '/' TO NVALS_TAB-VAL+2(1).
WRITE FIELD_TAB-COLOR TO NVALS_TAB-VAL+3.
CONDENSE NVALS_TAB-VAL NO-GAPS.
NVALS_TAB-FL = NET_CONST-COLOR.
APPEND NVALS_TAB.
ENDIF.
ENDLOOP.
SET SCREEN 0.
LEAVE SCREEN.
WHEN 'ABBR'.
CLEAR: NVALS_TAB, FIELD_TAB.
REFRESH: NVALS_TAB, FIELD_TAB.
SET SCREEN 0.
LEAVE SCREEN.
WHEN OTHERS.
DESCRIBE TABLE FIELD_TAB LINES ENTRY_TO.
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.