Thursday, November 22, 2007

ABAP - Easy Graph to use

I'll introduce some code snippet to use easily.
of course, there are lots of program sourse using graph in T-CODE GRAL.

But, I think the function 'GFW_PRES_SHOW' is powerful and easy to use...

This code snippet shows how to use function GFW_PRES_SHOW.

...data gathering

*__Make data format

DATA: lv_cnt(2), lv_text(30).

REFRESH values.
REFRESH column_texts.

SORT it_gra BY zcono.

*__Row definition

LOOP AT it_gra.
lv_cnt = sy-tabix.
CONCATENATE 'VALUES-VAL' lv_cnt INTO lv_text.
CONDENSE lv_text.
ASSIGN (lv_text) TO .
= it_gra-cnt.
ENDLOOP.

*___Row Text

values-rowtxt = '??????'.
APPEND values.

*__Column definition

LOOP AT it_gra.
column_texts-coltxt = it_gra-zcono.
APPEND column_texts.
ENDLOOP.

*___Call graph function

CALL FUNCTION 'GFW_PRES_SHOW'
EXPORTING
presentation_type = 31 "graph type 31 = pie type, 8 or 1 = bar chart
parent = contc "Custom Container
TABLES
values = values "row data(Maximun 32)
column_texts = column_texts " column definition
EXCEPTIONS
error_occurred = 1
OTHERS = 2.

.....



see images here

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/Snippets/ABAP4+Tuning+Checklist&

No comments:

Blog Archive