Skip to Content

FormatConversionBean – One Bean to rule them all!

Update 9 Sep 2018: FormatConversionBean now available in CPI as well

Update 19 May 2015: Added new converter Base64EncodeConverter

Update 30 Apr 2015: Added new converter Base64DecodeConverter


Over the past months, I have introduced various custom adapter modules that are configurable and reusable; aiming to handle various format conversions to/from XML that are not available in standard adapter modules.

I have recently refactored the different modules and consolidated them into a single module, FormatConversionBean. The benefits of this refactoring are:-

  • Single point of entry for the different types of conversion
  • Refactoring of factory class utilizing ConverterFactory allows dynamic instantiation of converters
  • Easily extensible to new converter formats by extending class AbstractModuleConverter
  • Conforms to the Open Close Principle whereby new converters can be added without modification to existing code

Converter Class List

Below is the comprehensive list of the converter classes that are part of FormatConversionBean now. This list will be updated as and when new converter classes are introduced in the future.

Usage of Module in Communication Channel

Module Processing Sequence

Number Module Name Type Module Key

<Depending on position of module in chain>

1) Asynchronous scenario,

Normally before the last module in channels

2) Synchronous scenario,

Before last module to convert request payload

After last module to convert response payload

Custom_AF_Modules/FormatConversionBean Local Enterprise Bean <Any Arbitrary Value>

Module Configuration

For configuration of parameters, refer to parameter list of each converter.

Source Code and Deployment Archive

The Java source codes for the module are located in the following GitHub repositories.

GitHub repository for equalize-xpi-modules

The EAR file for deployment (compiled on NWDS 7.31 SP13 Patch 0) is also available from the latest repository release below. The EAR file can be deployed directly on PI/PO systems with versions that are same/higher than 7.31 SP13 or 7.4 SP8.

Latest release for repository equalize-xpi-modules

To set up the EJB/EAR projects on NWDS for further customization, refer to the following.

Further Reference

If you plan to download the source codes into your own NWDS installation to make changes and/or develop new modules, the following blog would be useful for performing testing in NWDS prior to deployment into the PI system.

Standalone testing of Adapter Module in NWDS

Guide on EAR deployment via NWDS

Deploying .EAR files Using NWDS

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

      Thanks for your comment. You are the first to inform me that the modules' EAR file has been successfully deployed and I really appreciate this feedback. It is good to know that it is working on other systems apart from mine.


      Eng Swee

  • Nice work Eng Swee!

    I don't have any specific needs for this now but I will have to remember it for the future.


    Ryan Crosby

  • Hi Eng Swee Yeoh and Avinash Ayanala ,

    I am working currently on a requirement where the input is proxy and output is a file in excel format. I am using SAP PI 7.31 .

    I have some queries related to this.

    Is the below the correct EAR that we need to deploy or it contains only the JSON2XML converter. My exact need is to convert XML to EXCEL but I want to try the FormatConversionBean as a whole since it contains the entire module and I would not have to deploy any other separately. So do we need to deploy only the below EAR file? 

    I will provide feedback and updates once I am done.

    Please do let me know.



  • Hi Eng, can you help me please with this issue

    I am using the Adapter Module success, in the receiver channel

    but i need to send some header values:

    Cache-Control: no-cache

    Content-Type: application/json

    Application-Secret: 6474b25daaaaaaaaaacc7c9c892195352354facd

    where can i send it?

    what is the better channel type soap http (axis)

    the content is in the right way, you can see in the immage

    thanks a lot2015-04-28 13_43_34-Message Editor - SAP NetWeaver Administrator.png

    2015-04-28 13_43_34-Message Editor - SAP NetWeaver Administrator.png
    • Hi Juan

      Thanks for your interest in FormatConversionBean. Glad to know that the JSON transformation is working well for you.

      As to your query regarding custom HTTP headers, since it's unrelated to this module, I'd suggest that you open a new thread in the forum for this issue instead.

      As always, please provide as much details/screenshots as possible in the thread, i.e. PI/PO version & SP, scenario overview & details, adapter types, error messages, etc.


      Eng Swee

  • Hi Eng Swee,

    Feedback on my trial.

    Deployed EAR in PO server 7.31, so far tested excel2xml working well, able to convert accordingly to xml. Nice! Many end users still love excel for manual upload, this will help a lot.

    Your blog, example and github code is very useful and inspiring. Thanks again.


    Yee Loon

    • Dear Yee Loon

      Thanks for your feedback. I am very pleased to hear that is is working well. Please feel free to let me know if you do encounter any issues if you do get around to testing the modules more.

      Best regards,

      Eng Swee

  • HI Eng Swee Yeoh,

    Firstly, let me congratulate you on the blog. It is awesome and very helpful.

    I deployed the module and tested the Deep flat to XML conversion. I wanted to report a small bug. On the variable for fixedFieldLengths since you are doing a number format check after removing commas, the module will throw error any time you exceed 2,147,483,647 which is the maximum value int type supports. May be you can use a string.matches("\\d+?");

    Once again, amazing work 🙂



    • Hi Varun

      Thanks for your kind comments and also the feedback regarding the bug.

      Would you be able to provide some more details so that I can try to reproduce it? Can you provide screenshots of the module configuration as well as the error you are getting?


      Eng Swee

      • Hi Eng Swee Yeoh,

        To reproduce the error, you just need to do an FCC for a fixed field length file and you need to ensure that the recordset.fixedFieldLengths parameter has a value which exceeds 2147483647 after you remove the commas. I think if you test with a file having 5 columns with each column having a fixed length of 25, you should get the error.

        The exact location of error is at the class on line 54. I removed the try/catch block and used the below snippet. It worked like a charm 🙂



        throw new ModuleException("Maintain only integers separated by commas for '" + fieldFixedLengthsName);


        • Hi Varun

          Ah, thanks for elaborating further. I've fixed the bug accordingly and published a new release for the EAR file as well as the source code.

          Thanks again for reporting the bug. It is much appreciated! 🙂


          Eng Swee

  • Hi Eng Swee Yeoh,

    Tried DeepPlain2XML and XML2DeepPlain in the File and JMS adapters and they worked great.

    Thanks for the detailed blog it was very helpful.

  • Hi Eng Swee,

    Thank you for developing and sharing this module - very helpful, and your efforts are very much appreciated. Recently we used it for XML to JSON conversion in JMS based integration scenario - worked perfectly well.

    One question to you. Manifest contained in a project, specifies implementation vendor ID = "". As a result, corresponding component gets deployed with vendor = "", which is normally reserved / used by SAP standard components. Would you suggest downloading source code provided by you, adopting manifest and building deployable, or may you adjust vendor identifier to something different from "" and rebuild EAR so that it already contains custom vendor identifier?



    • Hi Vadim

      Thank you for your feedback. I'm really glad to hear that the conversion worked well.

      Regarding the Manifest file, to be honest, this is something that I'm not that familiar with. I checked both the EAR and EJB projects - there is no manifest file maintained in the EAR project and the one in the EJB project does not specify the vendor ID (very little info in that file).

      It looks like the MANIFEST.MF file within the EAR deployable file is automatically generated when I perform Export > SAP EAR file for the EAR project. I guess I can of course manually edit the entry in the generated EAR file, but do you know if there is some other automatic way to achieve this - maybe manually maintaining a manifest file in the EAR project?

      Have you adjusted the vendor identifier before for some custom adapter module that you have developed? Let me know if you do, I'm all up for modifying it accordingly for the EAR files I provide.


      Eng Swee

      • Hi Eng Swee,

        I was able to achieve this in the past by adding the following tag into the application-j2ee-engine.xml for the EAR file:



        Ryan Crosby

      • Hi Eng Swee,

        I assume, if manifest files (MANIFEST.MF and SAP_MANIFEST.MF) are not present in project structure, then NWDS auto-generates them when building EJB and EAR projects, and uses standard attribute values (this is where vendor = "" comes from). Since in built EAR file, after I decompile it, I can see manifest files: decompiled.png

        I resolved this issue by explicit creation of manifest files within a project. I didn't create them in NWDS (but it is worth trying this - probably, it will be much simpler), but used build tools and specified what kind of manifest file I would like to assemble when building EJB project. To be more precise, I used Gradle ( in order to automate bundling the deployable. In Gradle script, I made use of Java plugin and its property manifest, where I provided attributes and their custom values which I want to put into manifest file. Usage of Gradle purely for this task may be a bit overkilling - but I used Gradle also for dependency management (especially when adapter module / custom job was using external libraries and I wanted to insert some of them, but not all, into the same deployable) and entire compilation and assembly of JARs and EARs, so manifest creation was just one of tasks of executed Gradle script.



        / decompiled.png
      • Hi Vadim, Ryan

        Thank you so much for both your feedback. I've definitely learnt something new 🙂

        I've managed to adjust the value generated in the MANIFEST.MF file by adding the provider name into the application-j2ee-engine.xml file as suggested by Ryan. That worked really well and once it's deployed into the SAP system, the vendor value is reflected correctly in the different views in NWA.

        I've updated the source code and also released a new EAR file in the GitHub repository for this change.

        Thanks also for the info on Gradle. Will definitely have to look into it at some point! 😉


        Eng Swee

  • Thank you

    The information provided by you became great help to me.

    But i was occur problem in my source of NWDS and Is not find in

    Where is find JAVA Source? and .jar download url?



    • Hi Bang

      Glad to know this was helpful for you.

      The pre-packaged Adapter library that comes with NWDS 7.31 are reduced versions and do not contain all classes for some packages. As such, you will need to get the full JAR file for from your PI server.

      Refer screenshot below that shows the package and classes that are in that JAR file. This will enable to compile successfully.


      Refer to the following Wiki on where to get that file in your PI system.

      Where to get the libraries for XI development - Process Integration - SCN Wiki

      After you have retrieved that file, create a User Library in NWDS (give it any name) that includes that JAR file. Then add the newly created User Library to the EJB project's build path.


      Eng Swee

      • Dear Eng

        Thank you, kind explanation for me

        Is not found MessageLogger.class in in PI 7.3

        So, i'm going to after annotation in MessageLogger.class



  • Hi Eng,


    Very nice work with providing us this wholesome solution.

    I am planning to use this solution for my below requirement. I have JSON file which i will need to read and update that data into Database tables.


    So can you please let me know once i read this file using File adapter and custom JSONtoXML converter module, how can i map it to the database tables?


    Also i will let you know once i deploy your module in our server, we are on SAP PO 7.4 SP9 how does it work out.




  • Any idea how can i deploy the EAR file on SAP PO 7.4? I do not need to make any changes in the code you provided or any enhancements, hence if you can let me know how to deploy it directly on SAP PO.


    Do i still need to have NWDS to deploy the file on the server?





    Hi Eng Swee,

    I have been fan of this bean and I have been using this quiet a number of times.

    Recently, I ran into trouble when I am using xml2json converter in this bean, when I am passing 800 + rows of XML, total of 1700kb , it takes around 9 minutes to perform the conversion.

    Do you think it is normal ?





  • /
      • Hello Rajesh,

        No for deploying - adapter modules or EAR files - I always use the NWDS.

        There is a "deploy view" in NWDS you can use also for external files such as EAR files. It works well and is really practical.

        BEst regards, Peter

  • Hi Eng Swee,


    We got the below error while installing  the file directly   using SUM.

    Are we missing anything?


    Component cannot be installed. Component is not part of any existing software components.


    Thanks in Advance.




  • Hello Eng Swee,


    Thank you for this wonderful solution. As in the steps I downloaded the EAR file from GitHub ( and deployed it directly in my PO system using Deployment perspective of NWDS . I have PO 7.5 system.

    I intend to use DynamicAttributeChangeBean. But when I give this in the receiver channel module, the log shows error -

    "Unable to obtain EJB home interface [Root exception is java.lang.NoSuchMethodException:]"

    The Deployment seems to be correct -



    Is there any post step that needs to be done or if I have missed anything.

    Thanks in Advance.




    • Try and check in the JNDI Browser and/or Application Modules in NWA to see if the EJB Modules are listed there. I don't have access to a PI system at the moment so can't provide more details.


      Also, double check your module configuration (sequence, name, type, etc).

  • /
  • HI Eng,

    I am working on Proxy to REST sync interface. I have few input fields which has value '/' in it ex: ( AOUS/12 and some date fields(23/04/2020).

    at the JSON output payload it is coming as AOUS\/12 and dates are coming as 23\/04\/2020.

    there is an addition of '\' in between. I tried to declare the field as "string" in custom xml/JSON coversion rules. but still its not working. i also tried to declare the field as "Date" in the datatype but still no luck because in the mapping its correctly populated.

    the issue is coming at the REST channel while converting XML to JSON format.

    Can you please help me how to get rid of this extra '\' at the channel level.






  • Hi Eng,

    First of all thank you for this useful blog, it is very helpful.

    I have been dealing with a project which i need to send a zipped file to rest api. My problem is the content of the file must be in json.

    I am using rest receiver and "AF_Modules/MessageTransformBean" and "AF_Modules/PayloadZipBean" modules, you can see in screenshots.

    can you help me with some advice on this please?


  • Hello Eng

    Thank you for creating this amazing module. I have been using it successfully to convert relatively small xml files to excel.

    In one scenario I am also using the payloadZipBean module to unzip the file before it passes to the FormatConversionBean. All of this works great for small files. However, I have a case with a large xml file(200mb) which causes the Receiver File adapter to hang with the following error:

    • Adding message to blacklist. Reason: Message (in delivering state) found during startup
    • Message added to blacklist
    • Moved message to the non-delivered state. Reason: Blacklisted message (in delivering state) found during startup

    It appears the conversion is taking too long for the large file to convert and the message gets stuck in Delivering then blacklisted. If I remove the FormatConversionBean I am able to process the file successfully as an xml. Do we have a known fix for this use case?

    Thanks for reading and I look forward to your reply.



    • Hi Steve,


      200MB is definitely a big file, and the module has never been tested for such use case. Maybe the memory handling is not optimised for it.


      I am no longer actively working with PI, so I would suggest that you clone the Git repository and try to test it locally, and make any fixes as required.


      All the best!

      Eng Swee