Part 2: XML-based Gantt customizing
Part 3: ABAP-based Chart engine
After loading both the customizing (.xml file in Part 2) and the chart data (end of Part 2 and Part 3) into iXML document objects, we now need to bundle these two using the IGS and render the output graphic.
To obtain this, we use class method RENDER_GRAPHIC, encapsulating the following source code:
data:
lo_igs_ce type ref to cl_igs_chart_engine,
lo_global type ref to if_ixml_element,
lo_visibility type ref to if_ixml_element,
ls_image type W3MIME,
lv_image type string,
lv_line type string,
lv_string type string value is initial.
field-symbols:
<fs_document> type ref to if_ixml_document.
" adjust Business Graphic customizing for PDF printout
read table mt_customizing[] index 1 assigning <fs_document>.
lo_global = <fs_document>->find_from_path( '/SAPChartCustomizing/GlobalSettings' ).
lv_string = iv_height. " dependent on the size of the graphic inside the PDF. E.g. 480
<fs_document>->create_simple_element( name = 'Height' parent = lo_global value = lv_string ). clear lv_string.
lv_string = iv_width. " dependent on the size of the graphic inside the PDF. E.g. 640
<fs_document>->create_simple_element( name = 'Width' parent = lo_global value = lv_string ). clear lv_string.
lo_visibility = <fs_document>->find_from_path( '/SAPChartCustomizing/Elements/ChartElements/Background/Visibility' ).
lo_visibility->if_ixml_node~set_value( 'false' ).
" create business graphic directly to receive image raw format
create object lo_igs_ce
exporting
destination = 'IGS_RFC_DEST'.
lo_igs_ce->set_data( mr_chart_data ).
lo_igs_ce->set_customizing( custom_docs = mt_customizing[] ).
lo_igs_ce->execute( exceptions others = 1 ).
if sy-subrc is initial.
" get image and convert to XSTRING
lo_igs_ce->get_image(
importing image = et_image[]
image_size = ev_image_size
image_type = ev_image_type ).
loop at et_image[] into ls_image.
lv_line = ls_image-line.
concatenate lv_image lv_line into lv_image.
endloop.
" this is basically the final output
ev_image_xstring = lv_image.
lo_visibility->if_ixml_node~set_value( 'true' ).
endif.
The end result looks like this:
Even though it’s not so fancy as the “real thing”, it is still a starting point and from the functional perspective, a working solution.
For any kind of questions, don’t hesitate to contact me!
Tudor