Posted: Mon Nov 05, 2007 1:04 pm Post subject: Demo: Hierarchy Graphics
Code:
REPORT GRHIER_1.
*
* Demonstration von GRAPH_HIERARCHY_MENUE
DATA: BEGIN OF MENU OCCURS 1,
TEXT(40),
END OF MENU.
DATA: BEGIN OF MTEXT OCCURS 1,
TEXT(60),
END OF MTEXT.
DATA: RETWIN(10).
DATA: RETBUF(40).
DATA: BEGIN OF HIER OCCURS 1,
ELKEY(11),
UEKEY(11),
ETEXT(20),
END OF HIER.
DATA: BEGIN OF PHIER OCCURS 1,
ELKEY(11),
UEKEY(11),
ETEXT(20),
END OF PHIER.
DATA: BEGIN OF BUSGDATA OCCURS 1,
ELKEY(11),
VAL1 TYPE P,
VAL2 TYPE P,
VAL3 TYPE P,
VAL4 TYPE P,
END OF BUSGDATA.
DATA RBUFFER(64).
DATA TEXT(64).
DATA INDEX LIKE SY-INDEX.
DATA M_TYP(1).
DATA: HIER_STAT, PHIER_STAT, TWIN1_STAT, BUSG_STAT.
FIELD-SYMBOLS: <F>.
DATA: BEGIN OF TCOL OCCURS 1,
TEXT(20),
END OF TCOL,
BEGIN OF GOPTS OCCURS 1,
C(20),
END OF GOPTS.
SET PF-STATUS 'GRAF'.
REFRESH MENU.
MENU = TEXT-M01. APPEND MENU.
MENU = TEXT-M02. APPEND MENU.
MENU = TEXT-M03. APPEND MENU.
MENU = TEXT-M04. APPEND MENU.
*ENU = 'Abmelden'. APPEND MENU.
AT PF08.
CLEAR HIER_STAT.
TWIN1_STAT = '2'.
BUSG_STAT = '2'.
PHIER_STAT = '2'.
REFRESH GOPTS.
REFRESH TCOL.
TCOL = TEXT-S01. APPEND TCOL.
TCOL = TEXT-S02. APPEND TCOL.
TCOL = TEXT-S03. APPEND TCOL.
TCOL = TEXT-S04. APPEND TCOL.
DATA FIRST.
DATA MENUNR.
DO.
CALL FUNCTION 'GRAPH_HIERARCHY_MENUE'
EXPORTING
TTEXT = TEXT-HI1
SUPER = 'X'
STAT = HIER_STAT
IMPORTING
MENNR = MENUNR
NODES = HIER-ELKEY
RWNID = RETWIN
M_TYP = M_TYP
RBUFF = RETBUF
TABLES
MENU = MENU
DATA = HIER.
CASE M_TYP.
WHEN 'D'.
EXIT.
WHEN 'Q'. "// CLOSE OF HIER2
PHIER_STAT = '2'. "// restart next time
WHEN ' '. "// ignore
WHEN '0'. "// message from non-HIER-Window
IF RETWIN(4) = 'BUSG'.
BUSG_STAT = '2'. "// restart next time
ENDIF.
IF RETWIN(4) = 'TEMA'.
TWIN1_STAT = '2'. "// restart next time
ENDIF.
WHEN 'I'.
HIER_STAT = '4'.
IF HIER-ELKEY NE SPACE.
READ TABLE BUSGDATA WITH KEY HIER-ELKEY.
INDEX = SY-TABIX.
READ TABLE HIER WITH KEY HIER-ELKEY.
ENDIF.
IF MENUNR NE SPACE.
CASE MENUNR.
WHEN '1'.
PERFORM DISPLAY_TEXT TABLES MTEXT USING HIER BUSGDATA.
CALL FUNCTION 'TEXT_MATRIX'
EXPORTING
RSIZE = '7'
TTEXT = TEXT-INF
CSIZE = '30'
STAT = TWIN1_STAT
TABLES
DATA = MTEXT.
TWIN1_STAT = '5'. " Daten nachlesen
WHEN '2'.
PERFORM DISPLAY_NODES USING HIER-ELKEY.
CALL FUNCTION 'GRAPH_HIERARCHY'
EXPORTING
TTEXT = TEXT-HI2
SMODE = '2'
STAT = PHIER_STAT
WINID = 'HIER2'
TABLES
DATA = PHIER.
PHIER_STAT = '5'.
WHEN '3'.
CALL FUNCTION 'GRAPH_MATRIX_2D'
EXPORTING
TITL = HIER-ETEXT
NROW = INDEX
STAT = BUSG_STAT
TABLES
DATA = BUSGDATA
TCOL = TCOL
OPTS = GOPTS.
BUSG_STAT = '5'.
WHEN '4'.
CALL FUNCTION 'GRAPH_DIALOG'
EXPORTING
CLOSE = 'X'.
ENDCASE.
ENDIF.
ENDCASE.
ENDDO.
*---------------------------------------------------------------------*
* FORM DISPLAY_NODES *
*---------------------------------------------------------------------*
* text *
*---------------------------------------------------------------------*
* ELKEY *
*---------------------------------------------------------------------*
FORM DISPLAY_NODES USING ELKEY.
FIELD-SYMBOLS: <1>,<2>.
DATA KEY(11).
DATA S.
MOVE ELKEY TO KEY. "Sichern Key !
REFRESH PHIER.
LOOP AT HIER.
IF HIER-ELKEY GE KEY.
ASSIGN KEY+10(1) TO <1>.
ASSIGN HIER-ELKEY+10(1) TO <2>.
IF <2> LE <1> AND S NE SPACE. EXIT. ENDIF.
S = 'X'.
MOVE HIER TO PHIER.
MOVE HIER-ELKEY TO PHIER-ETEXT.
APPEND PHIER.
ENDIF.
ENDLOOP.
ENDFORM.
*---------------------------------------------------------------------*
* FORM DISPLAY_TEXT *
*---------------------------------------------------------------------*
* text *
*---------------------------------------------------------------------*
* ELKEY *
*---------------------------------------------------------------------*
FORM DISPLAY_TEXT TABLES MTEXT STRUCTURE MTEXT USING ETEXT EDATA.
DATA: BEGIN OF TEXT,
ELKEY(11),
UEKEY(11),
ETEXT(20),
VAL1 TYPE P,
VAL2 TYPE P,
END OF TEXT.
DATA: BEGIN OF DATA,
ELKEY(11),
VAL1 TYPE P,
VAL2 TYPE P,
VAL3 TYPE P,
VAL4 TYPE P,
END OF DATA.
DATA FELD(40).
MOVE ETEXT TO TEXT.
MOVE EDATA TO DATA.
REFRESH MTEXT.
MOVE: TEXT-MM1 TO MTEXT-TEXT.
MOVE: TEXT-ELKEY TO MTEXT-TEXT+13.
APPEND MTEXT.
MOVE: TEXT-MM2 TO MTEXT-TEXT.
MOVE: TEXT-UEKEY TO MTEXT-TEXT+13.
APPEND MTEXT.
MOVE: TEXT-MM3 TO MTEXT-TEXT.
MOVE: TEXT-ETEXT TO MTEXT-TEXT+13.
APPEND MTEXT.
MOVE: TEXT-S01 TO MTEXT-TEXT.
MOVE: DATA-VAL1 TO MTEXT-TEXT+9(10).
APPEND MTEXT.
MOVE: TEXT-S02 TO MTEXT-TEXT.
MOVE: DATA-VAL2 TO MTEXT-TEXT+9(10).
APPEND MTEXT.
MOVE: TEXT-S03 TO MTEXT-TEXT.
MOVE: DATA-VAL3 TO MTEXT-TEXT+9(10).
APPEND MTEXT.
MOVE: TEXT-S04 TO MTEXT-TEXT.
MOVE: DATA-VAL4 TO MTEXT-TEXT+9(10).
APPEND MTEXT.
ENDFORM.
*Text elements
*----------------------------------------------------------
* S04 Column 4
* S03 Column 3
* S02 Column 2
* S01 Column 1
* MM3 Name:
* MM2 Higher-Level:
* MM1 Element :
* M04 Presentation Graphics
* M03 Subordinate Elements
* M02 Detail Data
* M01 Menu
* INF Info Window
* HI2 Subhierarchy
* HI1 Display Hierarchy
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.