Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problems with GFW Classes

Former Member
0 Likes
1,224

Hi

I use the GFW classes to show a chart ! I works fine! When I leave the dynpro who show the chart, I call the method CALL METHOD GP_INST->IF_GRAPHIC_PROXY~FREE.

When I call this Dynpro again It dow not show the chart not again! The Problem is that the USER can edit the chart Data in the dynpro which call the dynpro who show the chart!

What can I do that the user can edit the data? When I do not call CALL METHOD GP_INST->IF_GRAPHIC_PROXY~FREE. Than the Chart do not consider the new Data in the Chart! How I can delete teh data of a Chart ??

Thanx for help??

sicnerly

Arne

3 REPLIES 3
Read only

kai_gutenkunst
Product and Topic Expert
Product and Topic Expert
0 Likes
705

Hi,

in addition to calling free of the graphics proxy I assume that you have to do the same with your gui container instance. This should help when calling the chart again.

I am not sure how the users should edit the data in your application. But have you already checked the report GFW_DEMO_PRES? After pushing a button to display a chart you can easily change the values within the table: the chart is refreshed accordingly! Have a look at the source code of this report.

Hope that helps

Regards, Kai

Read only

Former Member
0 Likes
705

Hi,

create a graph using FM GFW_PRES_SHOW.

look at demo program GFW_DEMO_PRES1

FU GFW_PRES_SHOW

____________________________________________________

Text

GFW: Simple display of a business graphic using the GFW

Functionality

GFW = Graphical Framework

GFW_PRES_SHOW is the GFW function module for business graphics.

It can display one(!) ActiveX or JAVABean ("control") graphic and includes a fallback strategy for the platforms on which controls cannot be run. On platforms that do not support controls the graphic is started as an external program (SAPBUSG).

The graphic product used by the function module is determined by product management, which is filled by SAP and enables the customer to change the priorities of the products used.

The function module has IMPORTING and TABLES parameters and EXCEPTIONS.

Parameters

CONTAINER or PARENT (importing)

Container object in which the graphic is to be placed (PARENT must have the data type TYPE REF TO CL_GUI_CONTAINER).

TOP (importing)

Alignment/upper edge of the parent object

LEFT (importing)

Alignment/left hand edge of the parent object

HEIGHT (importing)

Height of the control

WIDTH (importing)

Width of the control

PRESENTATION_TYPE (importing)

Diagram type = type in which all data series are represented (lines, points, vertical bar, pie ...)

The presentation type is determined by the constants in type group GFW (please refer to the documentation for the parameter PRESENTATION_TYPE).

If the PRESENTATION_TYPE is GFW_PRESTYPE_PIE_CHART make sure that the texts in the table parameters ROW_LABELS/COLUMN_LABELS are 20 characters or less, otherwise the sections of the pie are displayed white.

HEADER (importing)

Header (plot area)

ORIENTATION (importing)

Specifies how the data tables are interpreted

X_AXIS_TITLE (importing)

Title/label for the X-axis

Y_AXIS_TITLE (importing)

Title/label for the Y-axis

FORMAT (importing)

Format of requested export

VALUES, COLUMN_TEXTS (changing)

Tables with the data to be displayed

ROW_LABELS, COLUMN_LABELS (changing)

Table contains headings for the unique texts for the rows/columns

Example

Program DEMO_GFW_PRES_SHOW

Notes

The constants of the GFW type pool must be used because the content of the constants may change!

If you want to display several graphics with GFW function modules simultaneously, you can use the MULT function module (here: GFWPRES_SHOW_MULT).

Requirements that go beyond the range of functions described here (in particular, forcing a specific graphic product and interaction) can be programmed directly using the GFW ABAP Objects Framework.

Regards

Read only

Former Member
0 Likes
705

hi this is the code

retval = cl_gfw=>ok.

  • if dc_manage is initial.

*erstellen und initallieren des Datencontainers

CREATE OBJECT dc_inst.

if sy-subrc <> 0.

clear dc_inst.

else.

dc_manage = dc_inst.

call method dc_manage->init

IMPORTING

id = my_id_at_dc

retval = retval.

if retval <> cl_gfw=>ok.

clear dc_inst.

clear dc_manage.

else.

**kann man mit Daten füllen

endif.

endif.

  • endif.

if retval <> cl_gfw=>ok.

call method cl_gfw=>show_msg

EXPORTING

msgno = retval.

endif.

*****ENDE Erstellen eines Datencontainers

*Dem Datencontainer mitteilen, das Änderungen der Daten der Grafik mitgeteilt werden

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.

*Aktivierung des Multiplexers

CALL METHOD cl_gfw_mux=>activate

IMPORTING

retval = retval.

*Überprüfen ob start des Multiplexers erfolgreich war

if retval <> cl_gfw=>ok.

CALL METHOD cl_gfw=>show_msg

EXPORTING

msgno = retval.

endif.

*Objekt Chart daten anlegen!

  • IF Chart_Daten IS INITIAL.

CREATE OBJECT Chart_Daten.

  • ENDIF.

*________________________________

*Daten für den Chart füllen

Loop at IT_erg_anz where selected ne 'X'.

read table it_erg into wa_erg index sy-tabix.

CALL METHOD Chart_Daten->fuellen

EXPORTING

DC_MANAGE = dc_manage

wa_data = wa_erg

IMPORTING

RETVAL = retval.

CALL METHOD Chart_Daten->fuellen_ogw

EXPORTING

DC_MANAGE = dc_manage

wa_data = wa_erg

IMPORTING

RETVAL = retval.

CALL METHOD Chart_Daten->fuellen_ugw

EXPORTING

DC_MANAGE = dc_manage

wa_data = wa_erg

IMPORTING

RETVAL = retval.

endloop.

*----

-


*Container erzeugen

create object custom_container

exporting container_name = 'LINE_DIAGRAMM'.

*DEM Grafik-proxy die Attribute mitteilen

CREATE OBJECT GP_INST.

  • create, initialize and activate graphics proxy

CREATE OBJECT GP_INST.

CALL METHOD GP_INST->IF_GRAPHIC_PROXY~INIT

EXPORTING DC = DC_INST

PARENT = CUSTOM_CONTAINER

prod_id = cl_gui_gp_pres=>co_prod_chart

IMPORTING RETVAL = RETVAL.

IF RETVAL = CL_GFW=>OK.

  • set DC names

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 names

*----

-


*setzen von customizing einstellungen

  • set default display context

create object bundle_display exporting instance_id = 'GFWTA'.

  • set background color

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_bg_clr_plt_id

value = 18. " grey

    • gitterraster

  • call method bundle_display->if_customizing~set

  • exporting attr_id = cl_cu_display_context=>co_visibility

  • value = 1.

  • disable lines

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_bl_style

value = 1. " no line

  • call method bundle_display->if_customizing~set

  • exporting attr_id = cl_cu_display_context=>co_pt_alignment

  • value = '4'.

  • 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_display

importing retval = retval.

  • drawing area (used to set chart title)

create object bundle_drawing exporting instance_id = 'GFWTAS'.

  • set title

call method bundle_drawing->if_customizing~set

exporting attr_id = cl_cu_drawing_area=>co_title

value = uschrift.

*call method bundle_drawing->if_customizing~set

  • exporting attr_id = cl_cu_drawing_area=>CO_LEGEND_CONTEXT

  • value = 1.

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

Für Chart 1***********************************************

  • values (group 1)

create object bundle_values1 exporting instance_id = 'GFWTA1'.

  • prepare display context for values

create object bundle_display exporting instance_id = 'dummy'.

  • set color of line and markers

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_bl_clr_plt_id

value = 1. " schwarz

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_mr_style

value = 2.

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_mr_bg_clr_plt_id

value = 1.

  • 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 chart type

call method bundle_values1->if_customizing~set

exporting attr_id = cl_cu_values=>co_style

value = 34. " xy scatter

  • 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 = 'Mittelwert'

bundle = bundle_values1

importing retval = retval.

Für unterer Grenzertwert***********************************************

  • values (group 1)

create object bundle_values1 exporting instance_id = 'GFWTA2'.

  • prepare display context for values

create object bundle_display exporting instance_id = 'dummy'.

  • set color of line and markers

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_bl_clr_plt_id

value = 3. " rot

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_mr_style

value = 0.

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_mr_bg_clr_plt_id

value = 2.

  • 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 chart type

call method bundle_values1->if_customizing~set

exporting attr_id = cl_cu_values=>co_style

value = 34. " xy scatter

  • 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 = 'u.Grenzwert' "Name

bundle = bundle_values1

importing retval = retval.

*Für oberer Grenzertwert***********************************************

  • values (group 1)

create object bundle_values1 exporting instance_id = 'GFWTA3'.

  • prepare display context for values

create object bundle_display exporting instance_id = 'dummy'.

  • set color of line and markers

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_bl_clr_plt_id

value = 7. " schwarz

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_mr_style

value = 0.

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_mr_bg_clr_plt_id

value = 2.

  • 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 chart type

call method bundle_values1->if_customizing~set

exporting attr_id = cl_cu_values=>co_style

value = 34. " xy scatter

  • 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 = 'o.Grenzwert' "Name

bundle = bundle_values1

importing retval = retval.

****X-ACHSE

  • primary x-axis

create object bundle_axis_x exporting instance_id = 'GFWTA_X'.

  • prepare display context for axis title

create object bundle_display exporting instance_id = 'dummy'.

  • disable axis title

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_bl_style

value = 1.

call method bundle_axis_x->if_customizing~set

exporting attr_id = cl_cu_axis=>co_title

value = 'Zähler'.

  • enable scrollbar of axis and set view port

call method bundle_axis_x->if_customizing~set

exporting attr_id = cl_cu_axis=>CO_VISIBLE_CATEGORIES_AUTO

value = gfw_false.

call method bundle_axis_x->if_customizing~set

exporting attr_id = cl_cu_axis=>CO_VISIBLE_CATEGORIES

value = 7.

call method bundle_axis_x->if_customizing~set

exporting attr_id = cl_cu_axis=>CO_START_CATEGORY

value = 1.

.

  • copy display context into axis

call method bundle_axis_x->if_customizing~set

exporting attr_id = cl_cu_axis=>co_title_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_axis_x

importing retval = retval.

***X-ACHSE GRID

create object bundle_grid_x exporting instance_id = 'GFWTA_X_GRID'.

  • prepare display context for grid

create object bundle_display exporting instance_id = 'dummy'.

  • minor grid lines should be invisible

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_visibility

value = gfw_false.

  • copy display context into grid (for minor lines)

call method bundle_grid_x->if_customizing~set

exporting attr_id = cl_cu_grid=>co_minor_context

value = bundle_display.

  • copy display context into grid (for major lines)

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.

***Y-ACHSE GRID

create object bundle_grid_y exporting instance_id = 'GFWTAYGRID'.

  • prepare display context for grid

create object bundle_display exporting instance_id = 'dummy'.

  • minor grid lines should be invisible

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_visibility

value = gfw_false.

  • copy display context into grid (for minor lines)

call method bundle_grid_y->if_customizing~set

exporting attr_id = cl_cu_grid=>co_minor_context

value = bundle_display.

  • copy display context into grid (for major lines)

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.

*Y_ACHSE----

-


  • primary y-axis

create object bundle_axis_y exporting instance_id = 'GFWTA_Y'.

create object bundle_display exporting instance_id = 'dummy'.

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_visibility

value = gfw_false.

*min range title

CALL METHOD BUNDLE_AXIS_Y->IF_CUSTOMIZING~SET

EXPORTING ATTR_ID = CL_CU_AXIS=>CO_MIN_RANGE_TITLE

VALUE = 'MIN'.

CALL METHOD BUNDLE_AXIS_Y->IF_CUSTOMIZING~SET

EXPORTING ATTR_ID = CL_CU_AXIS=>CO_MIN_RANGE_VALUE

VALUE = 400.

CALL METHOD BUNDLE_AXIS_Y->IF_CUSTOMIZING~SET

EXPORTING ATTR_ID = CL_CU_AXIS=>CO_RANGE_CONTEXT

VALUE = BUNDLE_DISPLAY.

  • prepare display context for axis title

create object bundle_display exporting instance_id = 'dummy'.

  • axis title

call method bundle_display->if_customizing~set

exporting attr_id = cl_cu_display_context=>co_bl_style

value = 1.

call method bundle_axis_y->if_customizing~set

exporting attr_id = cl_cu_axis=>co_title

value = wa_erg_anz-prueflosa.

  • copy display context into axis

call method bundle_axis_y->if_customizing~set

exporting attr_id = cl_cu_axis=>co_title_context

value = bundle_display.

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.

*_______________________________________________________________

*__________________________________________________

  • CALL METHOD GP_INST->FREE.

IF RETVAL <> CL_GFW=>OK.

CALL METHOD GP_INST->IF_GRAPHIC_PROXY~FREE. "//ignore return value(keep 1st)

CALL METHOD dc_manage->FREE.

CLEAR GP_INST.

free gp_inst.

ELSE.

CALL METHOD GP_INST->IF_GRAPHIC_PROXY~ACTIVATE

IMPORTING RETVAL = RETVAL.

CALL METHOD dc_manage->FREE.

ENDIF.

IF RETVAL <> CL_GFW=>OK.

CALL METHOD CL_GFW=>SHOW_MSG EXPORTING MSGNO = RETVAL.

free gp_inst.

ENDIF.

*CALL METHOD GP_INST->if_dc_access~del_object.

abt user command this code will be executed:

when 'BACK'.

CALL METHOD GP_INST->IF_GRAPHIC_PROXY~FREE. "//ignore return value(keep 1st)

CALL METHOD dc_manage->FREE.

CLEAR GP_INST.

free gp_inst.

CLEAR dc_manage.

free dc_manage.

leave to screen 0.