Posted: Mon Nov 05, 2007 1:12 pm Post subject: Demo: Bar Chart in Maintenance Mode
Code:
REPORT BARCBO02.
INCLUDE SGRCCNST. "Allgemeine Konstanten der Grafik
INCLUDE LBARCCON. "Konstanten zum Balkenplan
INCLUDE BARCDATA. "Allgemeine Datendeklarationen
* Objekttabellen zum Halten der Grafikdaten im ABAP (Verprobungen)
DATA: ALL_BOXES LIKE BCBOXES OCCURS 0 WITH HEADER LINE, "Boxen
ALL_BOX_VALS LIKE BCVALS OCCURS 0 WITH HEADER LINE, "Attrib.
ALL_LINKS LIKE BCLINKS OCCURS 0 WITH HEADER LINE, "Kanten
ALL_LINK_VALS LIKE BCNVALS OCCURS 0 WITH HEADER LINE, "Kanten
ALL_NODES LIKE BCNODES OCCURS 0 WITH HEADER LINE, "Knoten
ALL_NODE_VALS LIKE BCNVALS OCCURS 0 WITH HEADER LINE, "Attrib.
ALL_POSITIONS LIKE BCPOSITION OCCURS 0 WITH HEADER LINE. "Posit.
* Temporдre Tabellen
DATA: TMP_BOXES LIKE BCBOXES OCCURS 0 WITH HEADER LINE, "Boxen
TMP_NODES LIKE BCNODES OCCURS 0 WITH HEADER LINE. "Knoten
* Weitere Tabellen
DATA: BEGIN OF LAYER_TYPES OCCURS 0, "Verwendete Layertypen
TYPE LIKE TBCL-TYPE,
END OF LAYER_TYPES.
DATA: BEGIN OF EXCLUDING_TAB OCCURS 0. "CUA-AnschluЯ
INCLUDE STRUCTURE SGRCEXCLUD.
DATA: END OF EXCLUDING_TAB.
DATA: ACT_BOX_ID LIKE BCBOXES-ID,
ACT_NODE_ID LIKE BCNODES-ID,
ACT_LINK_ID LIKE BCLINKS-ID,
ANZ TYPE I,
CHART LIKE BCCHART-ID,
ERRNO(2) TYPE C,
FIRSTDATE LIKE TBCL-FIRSTDATE,
FL LIKE BCVALS-FL,
LAYER_TYPE LIKE TBCL-TYPE,
LAYER_KIND LIKE TBCL-LAYER_TYPE,
MAX_POS LIKE BCPOSITION-ROW_NUMBER,
SECONDDATE LIKE TBCL-SECONDDATE,
SECTION LIKE BCSECTION-ID,
SYMBOLTYPE LIKE TBCL-SYMBOLTYPE,
VAL LIKE BCVALS-VAL.
PARAMETER: GRUPPE LIKE TBCGT-PRF_GRUPPE DEFAULT 'DEMO',
NAME LIKE TBCGT-PRF_NAME DEFAULT '000000000001',
INDEX LIKE TBCGT-PRF_INDEX DEFAULT '2'.
WHEN SGRC_CONST-M_TYP_I. "Benutzerkommando
* Verzweigen gemдЯ Grafik
CASE RWNID(4).
WHEN BC_CONST-DEF_ID. "Balkenplan
* Auswertung der Daten von der Grafik
CALL FUNCTION 'BARC_GRAPHIC_PAI'
IMPORTING
GRAPH_CMD = GRAPH_CMD
LAYER_TYPE = LAYER_KIND
SYMBOLTYPE = SYMBOLTYPE
TABLES
BOXES = BOXES
BOX_VALS = BOX_VALS
DELETIONS = DELETIONS
NODES = NODES
NODE_VALS = NODE_VALS
POSITIONS = POSITIONS
LINKS = LINKS
LINK_VALS = LINK_VALS
EXCEPTIONS
INV_WINID = 1.
CLEAR: ABAP_CMD, STATUS_TEXT.
STAT = SGRC_CONST-STAT_4. "Wait for input
* Auswertung des Benutzerkommandos
CASE GRAPH_CMD.
*----------------------------------------------------------------------*
WHEN BC_CONST-ASK_FOR_INSERT. "einfьgen
ABAP_CMD = GRAPH_CMD.
*---------------------------------------------------------------------*
* FORM GET_LAYER_TYPES *
*---------------------------------------------------------------------*
* Ermitteln der Layertypen (DB) *
*---------------------------------------------------------------------*
FORM GET_LAYER_TYPES TABLES LAYER_TYPES STRUCTURE LAYER_TYPES
USING PROFILE LIKE GRAPH_PROFILE.
DATA: BEGIN OF TMP_TBCA OCCURS 0.
INCLUDE STRUCTURE TBCA.
DATA: END OF TMP_TBCA.
DATA: BEGIN OF TMP_TBCC OCCURS 0.
INCLUDE STRUCTURE TBCC.
DATA: END OF TMP_TBCC.
DATA: BEGIN OF TMP_TBCF OCCURS 0.
INCLUDE STRUCTURE TBCF.
DATA: END OF TMP_TBCF.
DATA: BEGIN OF TMP_TBCL OCCURS 0.
INCLUDE STRUCTURE TBCL.
DATA: END OF TMP_TBCL.
DATA: BEGIN OF TMP_TFAT OCCURS 0.
INCLUDE STRUCTURE TFAT.
DATA: END OF TMP_TFAT.
DATA: BEGIN OF TMP_TFMT OCCURS 0.
INCLUDE STRUCTURE TFMT.
DATA: END OF TMP_TFMT.
DATA: BEGIN OF TMP_THLT OCCURS 0.
INCLUDE STRUCTURE THLT.
DATA: END OF TMP_THLT.
CALL FUNCTION 'BARC_GET_PROFILE_CONTENTS'
EXPORTING
GET_TBCA_DEFS = SPACE
GET_TBCC_DEFS = SPACE
GET_TBCF_DEFS = SPACE
GET_TBCL_DEFS = 'x'
GET_TBCO_DEFS = SPACE
GET_TFAT_DEFS = SPACE
GET_TFMT_DEFS = SPACE
GET_THLT_DEFS = SPACE
PROFILE = PROFILE
TABLES
TBCA_DEFS = TMP_TBCA
TBCC_DEFS = TMP_TBCC
TBCF_DEFS = TMP_TBCF
TBCL_DEFS = TMP_TBCL
TFAT_DEFS = TMP_TFAT
TFMT_DEFS = TMP_TFMT
THLT_DEFS = TMP_THLT
EXCEPTIONS
INV_TBCA_DEFS = 01
INV_TBCC_DEFS = 02
INV_TBCF_DEFS = 03
INV_TBCG_DEFS = 04
INV_TBCL_DEFS = 05
INV_TBCO_DEFS = 06.
*---------------------------------------------------------------------*
* FORM MAKE_BOX *
*---------------------------------------------------------------------*
* Erzeugen einer Box *
*---------------------------------------------------------------------*
FORM MAKE_BOX TABLES BOXES STRUCTURE BCBOXES
BOX_VALS STRUCTURE BCVALS
POSITIONS STRUCTURE BCPOSITION
USING CHART LIKE BCCHART-ID
FORMAT
COLOR
TEXT
ROW TYPE I.
*---------------------------------------------------------------------*
* FORM MAKE_NEXT_LAYER_TYPE *
*---------------------------------------------------------------------*
* Erzeugen des nдchsten Layertyps *
*---------------------------------------------------------------------*
FORM MAKE_NEXT_LAYER_TYPE TABLES LAYER_TYPES STRUCTURE LAYER_TYPES
USING PROFILE LIKE GRAPH_PROFILE
L_TYPE LIKE TBCL-TYPE.
DATA: I TYPE I,
N(2) TYPE N.
CLEAR L_TYPE.
DESCRIBE TABLE LAYER_TYPES LINES ANZ.
IF ANZ = 0.
* Layertypen aus DB holen
PERFORM GET_LAYER_TYPES TABLES LAYER_TYPES
USING PROFILE.
ENDIF. "if ANZ = 0
DO.
I = I + 1.
IF I > 99.
EXIT.
ENDIF.
N = I.
READ TABLE LAYER_TYPES WITH KEY N.
IF NOT SY-SUBRC IS INITIAL.
L_TYPE = N.
EXIT.
ENDIF.
ENDDO.
IF NOT L_TYPE IS INITIAL.
LAYER_TYPES-TYPE = L_TYPE.
APPEND LAYER_TYPES.
ENDIF.
ENDFORM. "MAKE_NEXT_LAYER_TYPE
*---------------------------------------------------------------------*
* FORM SET_BOXES *
*---------------------------------------------------------------------*
* Erzeugen der Boxen fьr den Tabellenteil der Grafik *
*---------------------------------------------------------------------*
FORM SET_BOXES TABLES BOXES STRUCTURE BCBOXES
BOX_VALS STRUCTURE BCVALS
POSITIONS STRUCTURE BCPOSITION
USING CHART LIKE BCCHART-ID.
*---------------------------------------------------------------------*
* 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 '001'.
ENDFORM. "form SET_CUA_STATUS
*---------------------------------------------------------------------*
* FORM SET_NODES *
*---------------------------------------------------------------------*
* Erzeugen der Knoten, Setzen der Layer *
*---------------------------------------------------------------------*
FORM SET_NODES TABLES NODES STRUCTURE BCNODES
NODE_VALS STRUCTURE BCNVALS
POSITIONS STRUCTURE BCPOSITION
USING CHART LIKE BCCHART-ID.
*Text elements
*----------------------------------------------------------
* 001 Boxes
* 002 Box number 1
* 003 Box number 2
* 004 Box number 3
* 005 Box number 4
* 006 Box number 5
* 007 Box already exists in the line
* 008 Box
* 009 No layer type available
* 010 No text index available
* 013 No free layer type available
*Selection texts
*----------------------------------------------------------
* GRUPPE Graphic profile group
* INDEX Graphic profile index
* NAME Graphic profile name
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.