SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Demo: Business Graphics Sales Comparison



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming -> Graphics
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Mon Nov 05, 2007 1:01 pm    Post subject: Demo: Business Graphics Sales Comparison Reply with quote

Code:
*----------------------------------------------------------------------*
* Beispiel mit Aufruf SAP Businessgrafik ueber Funktionbaustein  290191*
*----------------------------------------------------------------------*
REPORT G_BUSG_3.

*----------------------------------------------------------------------*
* Tabelle mit dem einer Textspalte (Bezeichnung 3. Dimension)          *
* und 6 * 5 Wertspalten (6 Werte fuer die 1., 5 Werte fuer die 2. Dim. *
* Eine Zeile entspricht jeweils einem Wert fuer die 3. Dimension       *
*----------------------------------------------------------------------*
DATA: BEGIN OF DATA  OCCURS 1,
        TEXT(25),
        Y1L1 TYPE P,
        Y2L1 TYPE P,
        Y3L1 TYPE P,
        Y4L1 TYPE P,
        Y5L1 TYPE P,
        Y6L1 TYPE P,
        Y1L2 TYPE P,
        Y2L2 TYPE P,
        Y3L2 TYPE P,
        Y4L2 TYPE P,
        Y5L2 TYPE P,
        Y6L2 TYPE P,
        Y1L3 TYPE P,
        Y2L3 TYPE P,
        Y3L3 TYPE P,
        Y4L3 TYPE P,
        Y5L3 TYPE P,
        Y6L3 TYPE P,
        Y1L4 TYPE P,
        Y2L4 TYPE P,
        Y3L4 TYPE P,
        Y4L4 TYPE P,
        Y5L4 TYPE P,
        Y6L4 TYPE P,
        Y1L5 TYPE P,
        Y2L5 TYPE P,
        Y3L5 TYPE P,
        Y4L5 TYPE P,
        Y5L5 TYPE P,
        Y6L5 TYPE P,
      END OF DATA.

*--- Optionen-Tabelle -------------------------------------------------*
DATA: BEGIN OF OPTS OCCURS 1,
         C(80) TYPE C,
      END OF OPTS.


DATA: TYEAR1(5) VALUE '#1988',
      TYEAR2(5) VALUE '#1989',
      TYEAR3(5) VALUE '#1990',
      TYEAR4(5) VALUE '#1991'.

DATA: TPROD1(9),
      TPROD2(9),
      TPROD3(9),
      TPROD4(9),
      TPROD5(9).

DATA: TITLE(25).

TITLE = TEXT-UMS.
TPROD1 = TEXT-P01.
TPROD2 = TEXT-P02.
TPROD3 = TEXT-P03.
TPROD4 = TEXT-P04.
TPROD5 = TEXT-P05.



SET PF-STATUS 'GRAF'.

DATA-TEXT  = TEXT-P01.
DATA-Y1L1 = 153470.
DATA-Y2L1 = 243470.
DATA-Y3L1 = 124567.
DATA-Y4L1 = 179037.
DATA-Y5L1 =      0.       "Dimension 1 auf 6 Werte auffuellen fuer
DATA-Y6L1 =      0.                    "Graph_4d
DATA-Y1L2 = 253430.
DATA-Y2L2 = 223440.
DATA-Y3L2 =  24567.
DATA-Y4L2 = 180037.
DATA-Y5L2 =      0.
DATA-Y6L2 =      0.
DATA-Y1L3 = 132470.
DATA-Y2L3 = 453470.
DATA-Y3L3 =  24456.
DATA-Y4L3 = 119807.
DATA-Y5L3 =      0.
DATA-Y6L3 =      0.
DATA-Y1L4 = 300430.
DATA-Y2L4 = 723110.
DATA-Y3L4 =  22767.
DATA-Y4L4 = 195522.
DATA-Y5L4 =      0.
DATA-Y6L4 =      0.
DATA-Y1L5 = 166970.
DATA-Y2L5 = 401470.
DATA-Y3L5 =  29967.
DATA-Y4L5 = 112957.
DATA-Y5L5 =      0.
DATA-Y6L5 =      0.
APPEND DATA.
DATA-TEXT  = TEXT-P02.
DATA-Y1L1 = 253150.
DATA-Y2L1 = 343570.
DATA-Y3L1 = 768867.
DATA-Y4L1 = 236790.
DATA-Y5L1 =      0.
DATA-Y6L1 =      0.
DATA-Y1L2 = 292150.
DATA-Y2L2 = 356570.
DATA-Y3L2 = 268867.
DATA-Y4L2 =  36790.
DATA-Y5L2 =      0.
DATA-Y6L2 =      0.
DATA-Y1L3 = 333150.
DATA-Y2L3 = 373570.
DATA-Y3L3 = 168867.
DATA-Y4L3 = 226790.
DATA-Y5L3 =      0.
DATA-Y6L3 =      0.
DATA-Y1L4 = 234150.
DATA-Y2L4 = 296570.
DATA-Y3L4 = 233867.
DATA-Y4L4 =  16790.
DATA-Y5L4 =      0.
DATA-Y6L4 =      0.
DATA-Y1L5 = 113150.
DATA-Y2L5 = 388570.
DATA-Y3L5 = 565867.
DATA-Y4L5 = 211790.
DATA-Y5L5 =      0.
DATA-Y6L5 =      0.
APPEND DATA.
DATA-TEXT  = TEXT-P03.
DATA-Y1L1 = 53470.
DATA-Y2L1 = 321560.
DATA-Y3L1 = 452456.
DATA-Y4L1 = 174695.
DATA-Y5L1 =      0.
DATA-Y6L1 =      0.
DATA-Y1L2 = 153470.
DATA-Y2L2 = 467560.
DATA-Y3L2 = 222456.
DATA-Y4L2 = 198695.
DATA-Y5L2 =      0.
DATA-Y6L2 =      0.
DATA-Y1L3 = 11470.
DATA-Y2L3 = 323560.
DATA-Y3L3 = 434456.
DATA-Y4L3 = 224695.
DATA-Y5L3 =      0.
DATA-Y6L3 =      0.
DATA-Y1L4 = 953470.
DATA-Y2L4 =  67560.
DATA-Y3L4 = 298456.
DATA-Y4L4 =  98695.
DATA-Y5L4 =      0.
DATA-Y6L4 =      0.
DATA-Y1L5 = 18470.
DATA-Y2L5 = 390560.
DATA-Y3L5 = 411456.
DATA-Y4L5 =  94695.
APPEND DATA.
DATA-TEXT  = TEXT-P04.
DATA-Y1L1 = 182000.
DATA-Y2L1 = 260570.
DATA-Y3L1 = 367356.
DATA-Y4L1 = 231850.
DATA-Y5L1 =      0.
DATA-Y6L1 =      0.
DATA-Y1L2 =  82500.
DATA-Y2L2 = 300560.
DATA-Y3L2 = 467109.
DATA-Y4L2 = 161850.
DATA-Y5L2 =      0.
DATA-Y6L2 =      0.
DATA-Y1L3 = 199000.
DATA-Y2L3 = 340570.
DATA-Y3L3 = 127356.
DATA-Y4L3 = 591850.
DATA-Y5L3 =      0.
DATA-Y6L3 =      0.
DATA-Y1L4 =  12500.
DATA-Y2L4 = 230560.
DATA-Y3L4 = 437109.
DATA-Y4L4 = 191850.
DATA-Y5L4 =      0.
DATA-Y6L4 =      0.
DATA-Y1L5 = 282000.
DATA-Y2L5 = 270570.
DATA-Y3L5 = 567356.
DATA-Y4L5 =  31850.
APPEND DATA.
DATA-TEXT  = TEXT-P05.
DATA-Y1L1 = 92410.
DATA-Y2L1 = 121350.
DATA-Y3L1 = 67356.
DATA-Y4L1 = 431891.
DATA-Y5L1 =      0.
DATA-Y6L1 =      0.
DATA-Y1L2 = 22410.
DATA-Y2L2 = 186350.
DATA-Y3L2 = 13356.
DATA-Y4L2 = 456501.
DATA-Y5L2 =      0.
DATA-Y6L2 =      0.
DATA-Y1L3 = 192410.
DATA-Y2L3 = 11350.
DATA-Y3L3 = 6356.
DATA-Y4L3 = 498891.
DATA-Y5L3 =      0.
DATA-Y6L3 =      0.
DATA-Y1L4 = 122410.
DATA-Y2L4 = 172350.
DATA-Y3L4 = 23356.
DATA-Y4L4 = 499501.
DATA-Y5L4 =      0.
DATA-Y6L4 =      0.
DATA-Y1L5 = 52410.
DATA-Y2L5 = 187350.
DATA-Y3L5 = 87356.
DATA-Y4L5 = 231891.
APPEND DATA.

*----------------------------------------------------------------------*
* Ausgabe einer Liste:                                                 *
* Fuer 5 Lдnder jeweils 4 Jahresspalten und 5 Produktzeilen            *
*----------------------------------------------------------------------*
WRITE: / TEXT-L01.
WRITE: / TEXT-P00,22 TYEAR1,39 TYEAR2,56 TYEAR3, 73 TYEAR4.
SKIP 2.
LOOP AT DATA.
  WRITE: / DATA-TEXT, 12 DATA-Y1L1,DATA-Y2L1,DATA-Y3L1,DATA-Y4L1.
ENDLOOP.

*----------------------------------------------------------------------*

SKIP.
ULINE.
WRITE: / TEXT-L02.
WRITE: / TEXT-P00,22 TYEAR1,39 TYEAR2,56 TYEAR3, 73 TYEAR4.
SKIP 2.
LOOP AT DATA.
  WRITE: / DATA-TEXT, 12 DATA-Y1L2,DATA-Y2L2,DATA-Y3L2,DATA-Y4L2.
ENDLOOP.

*----------------------------------------------------------------------*

NEW-PAGE.
WRITE: / TEXT-L03.
WRITE: / TEXT-P00,22 TYEAR1,39 TYEAR2,56 TYEAR3, 73 TYEAR4.
SKIP 2.
LOOP AT DATA.
  WRITE: / DATA-TEXT, 12 DATA-Y1L3,DATA-Y2L3,DATA-Y3L3,DATA-Y4L3.
ENDLOOP.

*----------------------------------------------------------------------*

SKIP.
ULINE.
WRITE: / TEXT-L04.
WRITE: / TEXT-P00,22 TYEAR1,39 TYEAR2,56 TYEAR3, 73 TYEAR4.
SKIP 2.
LOOP AT DATA.
  WRITE: / DATA-TEXT, 12 DATA-Y1L4,DATA-Y2L4,DATA-Y3L4,DATA-Y4L4.
ENDLOOP.

*----------------------------------------------------------------------*

NEW-PAGE.
WRITE: / TEXT-L05.
WRITE: / TEXT-P00,22 TYEAR1,39 TYEAR2,56 TYEAR3, 73 TYEAR4.
SKIP 2.
LOOP AT DATA.
  WRITE: / DATA-TEXT, 12 DATA-Y1L5,DATA-Y2L5,DATA-Y3L5,DATA-Y4L5.
ENDLOOP.

*----------------------------------------------------------------------*
* PF11: 2D-Graphik einer Zeile                                         *
*       Von der 3.Dimension (Lдnder) wird das 1. Objekt ausgewдhlt.    *
*----------------------------------------------------------------------*
AT PF05.                               "1-Jahr
  DATA: 2D_ROW VALUE '1'.

*--- Spaltentext-Tabelle ----------------------------------------------*
  DATA: BEGIN OF TYEAR OCCURS 1,
           C(20) TYPE C,
        END OF TYEAR.

*--- 2D-Graphiktyp: Tortendiagramm ------------------------------------*
  WRITE 'P2TYPE = PI' TO OPTS-C. APPEND OPTS.

*--- Spaltenbezeichnung mit in den Titel aufnehmen --------------------*
  CASE 2D_ROW.
    WHEN '1'.
      WRITE TPROD1 TO TITLE+7.
    WHEN '2'.
      WRITE TPROD2 TO TITLE+7.
    WHEN '3'.
      WRITE TPROD3 TO TITLE+7.
    WHEN '4'.
      WRITE TPROD4 TO TITLE+7.
    WHEN '5'.
      WRITE TPROD5 TO TITLE+7.
  ENDCASE.

  MOVE TYEAR1 TO TYEAR-C. APPEND TYEAR.
  MOVE TYEAR2 TO TYEAR-C. APPEND TYEAR.
  MOVE TYEAR3 TO TYEAR-C. APPEND TYEAR.
  MOVE TYEAR4 TO TYEAR-C. APPEND TYEAR.

  CALL FUNCTION 'GRAPH_MATRIX_2D'
       EXPORTING
            TITL       = TITLE
            VALT       = 'DM'
            NROW       = 2D_ROW
            MAIL_ALLOW = 'X'
       TABLES
            DATA       = DATA
            OPTS       = OPTS
            TCOL       = TYEAR.

*----------------------------------------------------------------------*
* PF12: 2D-Graphik einer Spalte                                        *
*       Von der 3.Dimension (Lдnder) wird das 1. Objekt ausgewдhlt.    *
*----------------------------------------------------------------------*
AT PF06.                               "1-Jahr

  DATA: 2D_COL VALUE '2'.

*--- 2D-Graphiktyp: Tortendiagramm ------------------------------------*
  WRITE 'P2TYPE = PI' TO OPTS-C. APPEND OPTS.

*--- Spaltenbezeichnung mit in den Titel aufnehmen --------------------*
  CASE 2D_COL.
    WHEN '1'.
      WRITE TYEAR1 TO TITLE+7.
    WHEN '2'.
      WRITE TYEAR2 TO TITLE+7.
    WHEN '3'.
      WRITE TYEAR3 TO TITLE+7.
    WHEN '4'.
      WRITE TYEAR4 TO TITLE+7.
  ENDCASE.

  CALL FUNCTION 'GRAPH_MATRIX_2D'
       EXPORTING
            TITL       = TITLE
            VALT       = 'DM'
            NCOL       = 2D_COL
            MAIL_ALLOW = 'X'
       TABLES
            DATA       = DATA
            OPTS       = OPTS
            TCOL       = TYEAR.
*----------------------------------------------------------------------*
* PF13: 3D-Graphik                                                     *
*       Von der 3.Dimension (Lдnder) wird das 1. Objekt ausgewдhlt.    *
*----------------------------------------------------------------------*
AT PF07.                               "3-Jahre
*--- Erstes Bild: 3D --------------------------------------------------*
  WRITE 'FIFRST = 3D' TO OPTS-C. APPEND OPTS.
*--- Art der Faerbung: abhaengig von den Zeilen------------------------*
  WRITE 'P3CTYP = RO' TO OPTS-C. APPEND OPTS.
  CALL FUNCTION 'GRAPH_MATRIX_3D'
       EXPORTING
            TITL       = TEXT-VGL
            VALT       = 'DM'
            DIM1       = TEXT-J00
            DIM2       = TEXT-P00
            COL1       = TYEAR1
            COL2       = TYEAR2
            COL4       = TYEAR4
            MAIL_ALLOW = 'X'
       TABLES
            DATA       = DATA
            OPTS       = OPTS.

*----------------------------------------------------------------------*
* PF14: 3D-Graphik                                                     *
*       Aufruf der 3D-Graphik mit nur einer Spalte fuehrt zu einem     *
*       automatischen Umschalten auf 2D-Graphik beim 1. Bild           *
*       Von der 3.Dimension (Lдnder) wird das 1. Objekt ausgewдhlt.    *
*----------------------------------------------------------------------*
AT PF08.                               "3-Jahre
*--- Erstes Bild: 3D --------------------------------------------------*
  WRITE 'FIFRST = 3D' TO OPTS-C. APPEND OPTS.
*--- Art der Faerbung: abhдngig von den Zeilen ------------------------*
  WRITE 'P3CTYP = RO' TO OPTS-C. APPEND OPTS.
*--- 2D-Graphiktyp: Vertikale Balken ----------------------------------*
  WRITE 'P2TYPE = VB' TO OPTS-C. APPEND OPTS.
  CALL FUNCTION 'GRAPH_MATRIX_3D'
       EXPORTING
            TITL       = TEXT-VGL
            VALT       = 'DM'
            DIM1       = TEXT-J00
            DIM2       = TEXT-P00
            COL2       = TYEAR2
            MAIL_ALLOW = 'X'
       TABLES
            DATA       = DATA
            OPTS       = OPTS.

*----------------------------------------------------------------------*
* PF15: 4D-Graphik                                                     *
*----------------------------------------------------------------------*
AT PF09.                               "3-Jahre, mehrere L#nder
*--- Erstes Bild: Auswaehlen ------------------------------------------*
  WRITE 'FIFRST = PU' TO OPTS-C. APPEND OPTS.
*--- 2D-Graphiktyp: Perspektivische Balken ----------------------------*
  WRITE 'P2TYPE = TD' TO OPTS-C. APPEND OPTS.
*--- Art der Faerbung: gleichmaessig ----------------------------------*
  WRITE 'P3CTYP = PL' TO OPTS-C. APPEND OPTS.
  CALL FUNCTION 'GRAPH_MATRIX_4D'
       EXPORTING
            TITL       = TEXT-VGL
            VALT       = 'DM'
            DIM1       = TEXT-J00
            DIM2       = TEXT-L00
            DIM3       = TEXT-P00
            DIM1_1     = TYEAR1
            DIM1_3     = TYEAR2
            DIM1_4     = TYEAR4
            DIM2_2     = TEXT-L02
            DIM2_3     = TEXT-L03
            DIM2_4     = TEXT-L04
            DIM2_5     = TEXT-L05
            MAIL_ALLOW = 'X'
       TABLES
            DATA       = DATA
            OPTS       = OPTS.
*----------------------------------------------------------------------*
* PF15: 4D-Graphik                                                     *
*       Aufruf der 3D-Graphik mit nur einer Spalte fuehrt zu einem     *
*       automatischen Umschalten auf 2D-Graphik beim 1. Bild           *
*----------------------------------------------------------------------*

*Text elements
*----------------------------------------------------------
* J00 Years
* L00 Countries
* L01 Germany
* L02 France
* L03 England
* L04 Italy
* L05 Spain
* P00 Products
* P01 Motors
* P02 Gear transmission
* P03 Tyres
* P04 Other
* P05 Repair
* UMS Sales
* VGL Sales comparison
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Dialog Programming -> Graphics All times are GMT + 4 Hours
Page 1 of 1

 
Jump 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.