cancel
Showing results for 
Search instead for 
Did you mean: 

[Business Graphics] Translation of captions

guillaume-hrc
Active Contributor
0 Kudos

Hi,

I have some Business Graphics elements in my Web Dynpro component.

I used the Chart Designer to customize the appearance and add some titles (chart, X-axis, ...) but - to my opinion - this result in an XML file located in the MIME repository: SAP/BC/WebDynpro/SAP/Zxxx/4OQN7xxxxxx.xml

Now, I have to make available in 5 languages.

Does anyone know how should I proceed to translate the texts that are embedded within this XML file... ?

Should I keep the XML file and implement another layer for the translation trough METHODHANDLER attribute (reference variable of type IF_WD_BUSIN_GRAPHICS_MTD_HNDL) of the Business Graphics control in the WDDOMODIFYVIEW( )?

I guess this should be possible to load the initial XML file, use regular expressions to change the various captions, and inject the modified XML??

--> this looks very much like what is done in report GRAPHICS_IGS_CE_TEST...

Thanks in advance.

Best regards,

Guillaume

Edited by: Guillaume Garcia on Feb 7, 2012 6:32 PM / Report GRAPHICS_IGS_CE_TEST

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Download your initial XML, translate, upload with name business_graphic_customization_<LANG(1)>.xml


method WDDOMODIFYVIEW .
  data:
      lr_bg_control type ref to cl_wd_business_graphics,
      lr_bg_method_handler type ref to IF_WD_BUSIN_GRAPHICS_MTD_HNDL.

  check first_time = abap_true.
  lr_bg_control ?= view->get_element( 'CHART' ).
  lr_bg_method_handler ?= lr_bg_control->_method_handler.

  DATA pict_wa   TYPE xstring.
  DATA mime_api TYPE REF TO if_mr_api.

DATA: mr      TYPE REF TO if_mr_api,
      lurl    TYPE        string.
	  
* get name of component
data: l_component type ref to if_wd_component,
      l_component_info type ref to if_wd_rr_component,
      l_name type string.

l_component = wd_comp_controller->wd_get_api( ).
l_component_info = l_component->get_component_info( ).
l_name = l_component_info->get_name( ).

* get mime object
  mr = cl_mime_repository_api=>get_api( ).
  CL_WD_UTILITIES=>CONSTRUCT_WD_URL( exporting APPLICATION_NAME = l_name
                                               importing OUT_LOCAL_URL    = lurl ).
  mime_api = cl_mime_repository_api=>get_api( ).
  
  concatenate lurl '/business_graphic_customization_' sy-langu '.xml' into lurl.
  mime_api->get( EXPORTING i_url = lurl
                 IMPORTING e_content = pict_wa
                 EXCEPTIONS OTHERS = 4 ).


  data : DOCUMENT TYPE REF TO CL_xml_document.
  CREATE OBJECT DOCUMENT.

  DOCUMENT->PARSE_XSTRING( pict_wa ).
  lr_bg_method_handler->SET_DIRECT_CUSTOMIZING_MODE( abap_true ).
  lr_bg_method_handler->ADD_DIRECT_CUSTOMIZING( exporting I_CUSTOMIZING = DOCUMENT->M_DOCUMENT ).
endmethod.

Answers (0)