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

Graphical display

Former Member
0 Likes
624

hi,

I am unsing one of the standard program for one of graphical display requirement. The code is below.I am getting graph without colors. could any one of them help me in this to set colors?.

report Z_GRAPHICDISP_TEST .

  • data container

include gfw_dc_pres.

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_pres,

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.

  • USAGE allowed in SAP internal test reports, only

include applg_auto_test_init.

call screen 100.

  • USAGE allowed in SAP internal test reports, only

include applg_auto_test_form.

&----


*& 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 graphics 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.

firstcall = 1.

endif.

endif.

  • **** distribute changes (to all subscribed graphics 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.

  • USAGE allowed in SAP internal test reports, only

perform auto_test_pbo using 'EXIT'.

endmodule. " PBO_0100 OUTPUT

&----


*& Module PAI_0100 INPUT

&----


  • text

----


module pai_0100 input.

ok_code = sy-ucomm.

  • activate event analysis 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 text

----


form fill_dc changing value(retval) type symsgno.

data: obj type gfwdcpres,

objtable type standard table of gfwdcpres.

  • fill dc with initial data

if dc_inst is initial.

retval = cl_gfw=>e_gp_dchandle.

exit.

endif.

retval = cl_gfw=>ok.

data series(20) type c.

data : begin of itab occurs 0,

object_type type char40,

obj_count type char30,

cur_count type char30,

end of itab.

select OBJ_TYP OBJ_CNT CUR_OBJ into table itab from ZCTS_CUP_SUMMARY..

series = 'TOTAL OBJECTS'.

loop at itab.

obj-grpid = series.

obj-x_val = itab-object_type.

obj-y_val = itab-obj_count.

append obj to objtable.

endloop.

series = 'CYURRENT STATUS'.

loop at itab.

obj-grpid = series.

obj-x_val = itab-object_type.

obj-y_val = itab-cur_count.

append obj to objtable.

endloop.

call method dc_inst->set_obj_tab

exporting objtab = objtable

importing retval = retval.

endform. " FILL_DC

&----


*& Form SET_CUSTOMIZING

&----


form set_customizing.

data: groups type gfw_grpid_list,

text type gfwcuvac

value 'STATUS REPORT'. "#EC NOTEXT

  • let the proxy create customizing-bundles for groups and other stuff

  • append co_gfw_prog_series1 to groups.

  • append co_gfw_prog_series2 to groups.

call method gp_inst->create_customizing

exporting instance_id = 'GFW_PROG_DC_PERFORMANCE'

grpids = groups

title = text

importing retval = retval.

if retval <> cl_gfw=>ok.

call method cl_gfw=>show_msg exporting msgno = retval.

exit.

endif.

endform.

Edited by: M M on Feb 13, 2009 7:12 AM

2 REPLIES 2
Read only

kai_gutenkunst
Product and Topic Expert
Product and Topic Expert
0 Likes
534

Hi,

before digging into details of GFW programming let me recommend to use the chart engine instead. See report GRAPHICS_GUI_CE_DEMO. You can set the chart settings (e.g. the colors) very easy by interactively using the SAP Chart Designer (available in SDN-Downloads).

Regards, Kai

Read only

0 Likes
534

Hi,

Yes. I too got the solution and by using the same program which you have mentioned in reply. Thank you for the info.

Regards

MM