Posted: Mon Nov 05, 2007 3:48 pm Post subject: Demo: GFW: a milestone-trend analysis
REPORT GFW_PROG_MTA .
* data container
INCLUDE GFW_DC_MTA.
* text constants
include GFW_PROG_TEXT.
constants:
co_gfw_prog_title_mta type gfwdcprest-t_grpid value
'GFW-demo of a milestone-trend analysis'. "#EC NOTEXT
DATA: OK_CODE TYPE SY-UCOMM, FIRSTCALL TYPE I,
custom_container type ref to cl_gui_custom_container,
DC_INST TYPE REF TO LCL_DC_MTA,
DC_MANAGE TYPE REF TO IF_DC_MANAGEMENT,
MY_ID_AT_DC TYPE I, RETVAL TYPE SYMSGNO,
GP_INST TYPE REF TO CL_GUI_GP_PRES.
START-OF-SELECTION.
CALL SCREEN 100.
*&---------------------------------------------------------------------*
*& Module PBO_0100 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE PBO_0100 OUTPUT.
SET PF-STATUS '100'.
RETVAL = CL_GFW=>OK.
IF FIRSTCALL IS INITIAL.
* create, initialize and fill data container
CREATE OBJECT DC_INST.
DC_MANAGE = DC_INST.
CALL METHOD DC_MANAGE->INIT IMPORTING ID = MY_ID_AT_DC
RETVAL = RETVAL.
IF RETVAL <CL_GFW>OK.
CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = RETVAL.
CLEAR DC_INST.
CLEAR DC_MANAGE.
ELSE.
PERFORM FILL_DC CHANGING RETVAL.
IF RETVAL <CL_GFW>OK.
CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = RETVAL.
ELSE.
* create a container on the dynpro
create object custom_container exporting
container_name = 'CONTAINER'.
* create, initialize and activate graphic proxy
CREATE OBJECT GP_INST.
CALL METHOD GP_INST->IF_GRAPHIC_PROXY~INIT
EXPORTING parent = custom_container
DC = DC_INST
PROD_ID = CL_GUI_GP_PRES=>CO_PROD_CHART
FORCE_PROD = GFW_TRUE
IMPORTING RETVAL = RETVAL.
IF RETVAL = CL_GFW=>OK.
* set dc attributes
CALL METHOD GP_INST->SET_DC_NAMES
EXPORTING
OBJ_ID = 'OBJID'
DIM1 = 'X_VAL'
DIM2 = 'Y_VAL'
GRP_ID = 'GRPID'
IMPORTING RETVAL = RETVAL.
ENDIF. "// set dc attributes
* set customizing objects
IF RETVAL = CL_GFW=>OK.
perform set_customizing.
ENDIF.
IF RETVAL = CL_GFW=>OK.
CALL METHOD GP_INST->IF_GRAPHIC_PROXY~ACTIVATE
IMPORTING RETVAL = RETVAL.
ENDIF.
IF RETVAL <CL_GFW>OK.
CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = RETVAL.
ENDIF.
ENDIF. "//fill_dc ok
FIRSTCALL = 1.
ENDIF. "//create and init dc ok
ENDIF.
* **** distribute changes (to all subscribed graphic proxies)
IF NOT DC_MANAGE IS INITIAL.
CALL METHOD DC_MANAGE->DISTRIBUTE_CHANGES
IMPORTING RETVAL = RETVAL.
IF RETVAL <CL_GFW>OK.
CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = RETVAL.
ENDIF.
ENDIF.
ENDMODULE. " PBO_0100 OUTPUT
*&---------------------------------------------------------------------*
*& Module PAI_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE PAI_0100 INPUT.
OK_CODE = SY-UCOMM.
* activate event analyzis of object oriented control framework
CALL METHOD CL_GUI_CFW=>DISPATCH.
* handle other events
CASE OK_CODE.
WHEN 'BACK'.
CALL METHOD GP_INST->IF_GRAPHIC_PROXY~FREE
IMPORTING RETVAL = RETVAL.
LEAVE PROGRAM.
WHEN 'EXIT'.
CALL METHOD GP_INST->IF_GRAPHIC_PROXY~FREE
IMPORTING RETVAL = RETVAL.
LEAVE PROGRAM.
ENDCASE.
ENDMODULE. " PAI_0100 INPUT
*&---------------------------------------------------------------------*
*& Form FILL_DC
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <p2>E_GP_DCHANDLE.
EXIT.
ENDIF.
RETVAL = CL_GFW=>OK.
* insert first group (corresponding customizing class: cl_cu_values)
obj-objid = '100'.
obj-grpid = co_gfw_prog_series1.
obj-x_val = '19980101100000'.
obj-y_val = '19980104100000'.
call method dc_inst->set_obj_values
exporting id = my_id_at_dc
obj = obj
importing retval = retval.
if retval <cl_gfw>ok. exit. endif.
*&---------------------------------------------------------------------*
*& Form SET_CUSTOMIZING
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <p2>IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DISPLAY_CONTEXT=>co_bg_clr_plt_id
VALUE = 18. " grau
* copy display context into values
CALL METHOD bundle_diagram->IF_CUSTOMIZING~SET exporting
ATTR_ID = cl_cu_diagram=>co_display_context
VALUE = BUNDLE_DISPLAY.
* tell the proxy where to use the bundle
CALL METHOD GP_INST->IF_GRAPHIC_PROXY~ADD_CU_BUNDLE
EXPORTING PORT = IF_GRAPHIC_PROXY=>CO_PORT_DIAGRAM
BUNDLE = bundle_diagram
IMPORTING RETVAL = RETVAL.
* drawing area
CREATE OBJECT BUNDLE_DRAWING EXPORTING INSTANCE_ID = 'GFWMTA'.
* prepare display context for drawing area
CREATE OBJECT BUNDLE_DISPLAY EXPORTING INSTANCE_ID = 'dummy'.
* remove border line of drawing area
CALL METHOD BUNDLE_DISPLAY->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DISPLAY_CONTEXT=>co_bl_style
VALUE = 1. " no line
* set background color of drawing area
CALL METHOD BUNDLE_DISPLAY->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DISPLAY_CONTEXT=>co_bg_clr_plt_id
VALUE = 49. " hellgelb
* add display context to bundle_drawing
CALL METHOD BUNDLE_DRAWING->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DRAWING_AREA=>CO_DISPLAY_CONTEXT
VALUE = BUNDLE_DISPLAY.
* prepare legend context for drawing area
CREATE OBJECT BUNDLE_DISPLAY EXPORTING INSTANCE_ID = 'dummy'.
* change position of legend
CALL METHOD BUNDLE_DISPLAY->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DISPLAY_CONTEXT=>CO_PT_ALIGNMENT
VALUE = 5. " special MTA position
* set background color of legend
CALL METHOD BUNDLE_DISPLAY->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DISPLAY_CONTEXT=>co_bg_clr_plt_id
VALUE = 49. " hellgelb
* add legend context to bundle_drawing
CALL METHOD BUNDLE_DRAWING->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DRAWING_AREA=>CO_LEGEND_CONTEXT
VALUE = BUNDLE_DISPLAY.
* prepare title context for drawing area
CREATE OBJECT BUNDLE_DISPLAY EXPORTING INSTANCE_ID = 'dummy'.
* set font size
CALL METHOD BUNDLE_DISPLAY->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DISPLAY_CONTEXT=>CO_TF_SIZE
VALUE = 14.
* remove border line of title
CALL METHOD BUNDLE_DISPLAY->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DISPLAY_CONTEXT=>co_bl_style
VALUE = 1. " no line
* set background color of title
CALL METHOD BUNDLE_DISPLAY->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DISPLAY_CONTEXT=>co_bg_clr_plt_id
VALUE = 18. " grau
* add title context to bundle_drawing
CALL METHOD BUNDLE_DRAWING->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DRAWING_AREA=>CO_TITLE_CONTEXT
VALUE = BUNDLE_DISPLAY.
* set the title
CALL METHOD BUNDLE_DRAWING->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DRAWING_AREA=>CO_TITLE
VALUE = co_gfw_prog_title_mta.
* set triangle shape of drawing area
CALL METHOD BUNDLE_DRAWING->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DRAWING_AREA=>CO_COVERING
VALUE = 1. " covers left bottom edge
* tell the proxy where to use the bundle
CALL METHOD GP_INST->IF_GRAPHIC_PROXY~ADD_CU_BUNDLE
EXPORTING PORT = IF_GRAPHIC_PROXY=>CO_PORT_CHART
BUNDLE = BUNDLE_DRAWING
IMPORTING RETVAL = RETVAL.
* add title context to axis
CALL METHOD bundle_axis_x->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = cl_cu_axis=>CO_title_CONTEXT
VALUE = BUNDLE_DISPLAY.
* set date/time axis
CALL METHOD BUNDLE_AXIS_X->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_AXIS=>CO_SCALE_STYLE
VALUE = 3. " date/time axis
* move labels of axis to the top
CALL METHOD BUNDLE_AXIS_X->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_AXIS=>CO_LABEL_POSITION
VALUE = 4. " mta axis at the top
* tell the proxy where to use the bundle
CALL METHOD GP_INST->IF_GRAPHIC_PROXY~ADD_CU_BUNDLE
EXPORTING PORT = IF_GRAPHIC_PROXY=>CO_PORT_CHART_X_PRIM_AXIS
BUNDLE = BUNDLE_AXIS_X
IMPORTING RETVAL = RETVAL.
* set background color of scale
CALL METHOD BUNDLE_DISPLAY->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DISPLAY_CONTEXT=>co_bg_clr_plt_id
VALUE = 50. " ocker
* copy display context into scale
CALL METHOD bundle_scale_x->IF_CUSTOMIZING~SET exporting
ATTR_ID = cl_cu_scale=>co_display_context
VALUE = BUNDLE_DISPLAY.
* tell the proxy where to use the bundle
CALL METHOD GP_INST->IF_GRAPHIC_PROXY~ADD_CU_BUNDLE
EXPORTING PORT = IF_GRAPHIC_PROXY=>CO_PORT_CHART_X_PRIM_AXIS
BUNDLE = bundle_scale_x
IMPORTING RETVAL = RETVAL.
* add title context to axis
CALL METHOD bundle_axis_y->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = cl_cu_axis=>CO_title_CONTEXT
VALUE = BUNDLE_DISPLAY.
* set date/time axis
CALL METHOD BUNDLE_AXIS_Y->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_AXIS=>CO_SCALE_STYLE
VALUE = 3. " date/time axis
* move x-axis to the top
CALL METHOD BUNDLE_AXIS_Y->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_AXIS=>CO_INTERSECTION_POINT_TYPE
VALUE = 2. " maximum
* tell the proxy where to use the bundle
CALL METHOD GP_INST->IF_GRAPHIC_PROXY~ADD_CU_BUNDLE
EXPORTING PORT = IF_GRAPHIC_PROXY=>CO_PORT_CHART_Y_PRIM_AXIS
BUNDLE = BUNDLE_AXIS_Y
IMPORTING RETVAL = RETVAL.
* set background color of scale
CALL METHOD BUNDLE_DISPLAY->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DISPLAY_CONTEXT=>co_bg_clr_plt_id
VALUE = 50. " ocker
* copy display context into scale
CALL METHOD bundle_scale_y->IF_CUSTOMIZING~SET exporting
ATTR_ID = cl_cu_scale=>co_display_context
VALUE = BUNDLE_DISPLAY.
* tell the proxy where to use the bundle
CALL METHOD GP_INST->IF_GRAPHIC_PROXY~ADD_CU_BUNDLE
EXPORTING PORT = IF_GRAPHIC_PROXY=>CO_PORT_CHART_Y_PRIM_AXIS
BUNDLE = bundle_scale_y
IMPORTING RETVAL = RETVAL.
* grid lines (of primary x-axis) are set invisible
CREATE OBJECT bundle_grid_x EXPORTING INSTANCE_ID = 'GFWMTAX'.
* disable major grid lines
CALL METHOD bundle_display->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DISPLAY_CONTEXT=>co_visibility
VALUE = gfw_false.
* copy display context into grid
CALL METHOD bundle_grid_x->IF_CUSTOMIZING~SET exporting
ATTR_ID = cl_cu_grid=>co_major_context
VALUE = BUNDLE_DISPLAY.
* tell the proxy where to use the bundle
CALL METHOD GP_INST->IF_GRAPHIC_PROXY~ADD_CU_BUNDLE
EXPORTING PORT = IF_GRAPHIC_PROXY=>CO_PORT_CHART_X_PRIM_AXIS
BUNDLE = bundle_grid_x
IMPORTING RETVAL = RETVAL.
* grid lines (of primary y-axis) are set invisible
CREATE OBJECT bundle_grid_y EXPORTING INSTANCE_ID = 'GFWMTAY'.
* disable major grid lines
CALL METHOD bundle_display->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_DISPLAY_CONTEXT=>co_visibility
VALUE = gfw_false.
* copy display context into grid
CALL METHOD bundle_grid_y->IF_CUSTOMIZING~SET exporting
ATTR_ID = cl_cu_grid=>co_major_context
VALUE = BUNDLE_DISPLAY.
* tell the proxy where to use the bundle
CALL METHOD GP_INST->IF_GRAPHIC_PROXY~ADD_CU_BUNDLE
EXPORTING PORT = IF_GRAPHIC_PROXY=>CO_PORT_CHART_Y_PRIM_AXIS
BUNDLE = bundle_grid_y
IMPORTING RETVAL = RETVAL.
* set marker attributes
CALL METHOD bundle_display->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = cl_cu_display_context=>co_mr_style
VALUE = 2. " Raute
CALL METHOD bundle_display->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = cl_cu_display_context=>co_mr_bg_clr_plt_id
VALUE = 5. " green
* set color of group
CALL METHOD bundle_display->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = cl_cu_display_context=>co_bl_clr_plt_id
VALUE = 5. " green
* copy display context into values
CALL METHOD BUNDLE_VALUES1->IF_CUSTOMIZING~SET exporting
ATTR_ID = cl_cu_values=>co_curve_context
VALUE = BUNDLE_DISPLAY.
* set mta chart type
CALL METHOD BUNDLE_VALUES1->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_VALUES=>CO_STYLE
VALUE = 81. " milestone triangle
* tell the proxy where to use the bundle
CALL METHOD GP_INST->IF_GRAPHIC_PROXY~ADD_CU_BUNDLE
EXPORTING PORT = IF_GRAPHIC_PROXY=>CO_PORT_CHART
key = co_gfw_prog_series1
BUNDLE = BUNDLE_VALUES1
IMPORTING RETVAL = RETVAL.
* set marker attributes
CALL METHOD bundle_display->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = cl_cu_display_context=>co_mr_style
VALUE = 2. " Raute
CALL METHOD bundle_display->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = cl_cu_display_context=>co_mr_bg_clr_plt_id
VALUE = 7. " red
* set color of group
CALL METHOD bundle_display->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = cl_cu_display_context=>co_bl_clr_plt_id
VALUE = 7. " red
* copy display context into values
CALL METHOD BUNDLE_VALUES2->IF_CUSTOMIZING~SET exporting
ATTR_ID = cl_cu_values=>co_curve_context
VALUE = BUNDLE_DISPLAY.
* set mta chart type
CALL METHOD BUNDLE_VALUES2->IF_CUSTOMIZING~SET
EXPORTING ATTR_ID = CL_CU_VALUES=>CO_STYLE
VALUE = 81. " milestone triangle
* tell the proxy where to use the bundle
CALL METHOD GP_INST->IF_GRAPHIC_PROXY~ADD_CU_BUNDLE
EXPORTING PORT = IF_GRAPHIC_PROXY=>CO_PORT_CHART
key = co_gfw_prog_series2
BUNDLE = BUNDLE_VALUES2
IMPORTING RETVAL = RETVAL.
ENDFORM. " SET_CUSTOMIZING
****************************************************************
* This file was generated by Direct Download Enterprise. *
* Please do not change it manually. *
****************************************************************
%_DYNPRO
GFW_PROG_MTA
0100
620
40
%_HEADER
GFW_PROG_MTA 0100 0100 20 76192 36 0 0 27120 0G E 20020214141235
%_DESCRIPTION
Hauptdynpro
%_FIELDS
CONTAINER 75 00 00 00 30 00 2 3 0 0 0 19 U 1 1 102
CHAR 20 80 10 00 00 00 255 1 O 0 0 0 0 0 0 ____________________
%_FLOWLOGIC
PROCESS BEFORE OUTPUT.
MODULE PBO_0100.
*
PROCESS AFTER INPUT.
MODULE PAI_0100.
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.