Application Development 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: 

Problem with CL_GUI_GP_PRES and Customizing

Former Member
0 Kudos

Hello,

i made a ABAP for displaying a grahpic chart which works fine. But the chart is without any color.

[Screenshot|http://www.home.vr-web.de/markus.Marb/sap_problem.jpg]

I did the following coding in the customizing form.

FORM SET_CUSTo_auftrags_monitor.

data:

cuobj TYPE REF TO IF_CUSTOMIZING,

BUNDLE_DISPLAY TYPE REF TO CL_CU_DISPLAY_CONTEXT,

BUNDLE_SHEET TYPE REF TO CL_CU_DATA_SHEET,

BUNDLE_VALUES TYPE REF TO CL_CU_VALUES,

titel_auftrags_monitor(50) type c,

hilfsfeld_uhrzeit(15) type c,

hilfsfeld_datum(15) type c.

  • compiler needs them:

class cl_cu definition load.

class cl_cu_drawing_area definition load.

class cl_cu_display_context definition load.

class cl_cu_values definition load.

  • get customizing object for drawing area

CALL METHOD GP_INST->IF_GRAPHIC_PROXY~GET_CU_BUNDLE

EXPORTING PORT = IF_GRAPHIC_PROXY=>CO_PORT_CHART

BUNDLE_TYPE = CL_CU=>CO_CLSID_DRAWING_AREA

IMPORTING BUNDLE = cuobj.

if not cuobj is initial.

  • set the title

write: sy-datum to hilfsfeld_datum.

write: sy-uzeit to hilfsfeld_uhrzeit.

concatenate 'Stand:' hilfsfeld_datum hilfsfeld_uhrzeit into

titel_auftrags_monitor separated by space.

CALL METHOD cuobj->SET

EXPORTING ATTR_ID = CL_CU_DRAWING_AREA=>CO_TITLE

VALUE = titel_auftrags_monitor.

  • get title context of drawing area

call method cuobj->get

exporting attr_id = cl_cu_drawing_area=>co_title_context

importing value = BUNDLE_DISPLAY.

  • set visibility of title

CALL METHOD BUNDLE_DISPLAY->IF_CUSTOMIZING~SET

EXPORTING ATTR_ID = CL_CU_DISPLAY_CONTEXT=>co_visibility

VALUE = gfw_true.

  • copy display context into drawing area (title)

CALL METHOD cuobj->SET

EXPORTING ATTR_ID = CL_CU_drawing_area=>CO_title_CONTEXT

VALUE = BUNDLE_DISPLAY.

endif.

  • Settings for column 1

CALL METHOD GP_INST->IF_GRAPHIC_PROXY~GET_CU_BUNDLE

EXPORTING PORT = IF_GRAPHIC_PROXY=>CO_PORT_CHART

BUNDLE_TYPE = CL_CU=>CO_CLSID_VALUES

KEY = text_zeile1

IMPORTING BUNDLE = cuobj.

if not cuobj is initial.

  • prepare display context for values

call method cuobj->get

exporting attr_id = cl_cu_values=>co_curve_context

importing value = BUNDLE_DISPLAY.

  • set color of data series

CALL METHOD bundle_display->IF_CUSTOMIZING~SET

EXPORTING ATTR_ID = cl_cu_display_context=>co_bg_clr_plt_id

VALUE = 5. " green

  • copy display context into values

CALL METHOD cuobj->SET

exporting ATTR_ID = cl_cu_values=>co_curve_context

VALUE = BUNDLE_DISPLAY.

endif.

ENDFORM.

Thanks for your help

Kind regards

Markus

3 REPLIES 3

vijy_mukunthan
Active Contributor
0 Kudos

hi Markus Marb

Can you tell me how did you attach the screen shot in the thread. I am not getting any where mention about the screen shot.

Regards

vijay

narin_nandivada3
Active Contributor
0 Kudos

Hi Markus,

please check this thread... for sample program....

Check the color part in the thread...

Hope this would help you.

Good luck

Narin

kai_gutenkunst
Active Contributor
0 Kudos

Hi Markus,

if you just have started with your project then use the chart engine instead of the GFW!

All customizing settings (colors, chart types etc) are set via XML that can be easily created interactively using the SAP Chart Designer (see SDN - download). So you don' t have to bother about CL_CU_VALUES instances for settings the colors.

Regards, Kai