Skip to Content

Introduction

I have written about my experiences with IGS Charting in the past.

BSP – a Developer’s Journal: Part X – IGS Charting

  data:  ixml          type ref to if_ixml,

         document      type ref to if_ixml_document,

         streamfactory type ref to if_ixml_stream_factory,

         istream       type ref to if_ixml_istream,

         parser        type ref to if_ixml_parser.

  • create the ixml main factory

  ixml = cl_ixml=>create( ).

*– create the initial document

  document = ixml->create_document( ).

*– create the stream factory

  streamfactory = ixml->create_stream_factory( ).

*– create an input stream for the table

  istream = streamfactory->create_istream_xstring( xml ).

*– create the parser

  parser = ixml->create_parser( stream_factory = streamfactory

                                istream        = istream

                                document       = document ).

*– parse the stream

  if parser->parse( ) ne 0.

  endif.

  call method istream->close( )

Now we need to find the spot in the XML that we want to manipulate. I first wanted to find my ChartAxes section. Within there I have multiple Value Axes, so I need to process them one at time.


data: body type ref to if_ixml_element.
data: items type ref to if_ixml_node_collection,
item type ref to if_ixml_element,
element type ref to if_ixml_element,
node type ref to if_ixml_node,
val type string,
idx type i,
len type i.
body = document->find_from_name( name = 'ChartAxes' ).
items = body->get_elements_by_tag_name( name = 'ValueAxis' ).
len = items->

get_length( )..

  do len times.

  •   get item

    idx = sy-index – 1.

    item ?= items->get_item( index = idx ).

    if auto_metric = abap_true.

      clear element.

      element = item->find_from_name( name = ‘MinimumAutomatic’ ).

      element->set_value( ‘true’ ).

      clear element.

      element = item->find_from_name( name = ‘MaximumAutomatic’ ).

      element->set_value( ‘true’ ).

    else.

      clear element.

      element = item->find_from_name( name = ‘MinimumAutomatic’ ).

      element->set_value( ‘false’ ).

      clear element.

      element = item->find_from_name( name = ‘MaximumAutomatic’ ).

      element->set_value( ‘false’ ).

    endif.

    ….

  enddo.   

Finally we can end with the code necessary to convert our new XML back into a binary string.


clear xml.
data: ostream type ref to if_ixml_ostream.
ostream = streamfactory->create_ostream_xstring( xml ).
call method document->render( ostream = ostream ).

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Former Member
    Thomas,
    This weblog has been of great help to me. Thanks so much.
    Does IGS charting offer us the flexibility to enter the scale? For eg, If I wanted my chart to range from 2 to 10 with intervals of 1.5, is it possible? I understand that we can give the minimum and maximum values, but not sure if we can give the interval itself

    Thanks
    Ganesh.S

    (0) 
    1. Thomas Jung Post author
      I haven’t seen a way that you can specifically set the interval – but you might want to have a look at the Grid Line properties under the Value Axis.  You can play with the Major Ticks (Major tick gap probably) and see if that doesn’t get you close to what you want.
      (0) 

Leave a Reply