Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How To Serialize SAP Business Objects?

First I have to clarify that I'm not referring to the company Business Objects recently acquired by SAP. Instead I'm referring to business objects as defined in the SAP Business Object Repository (BOR), e.g. SalesOrder (BUS2032).

So what would be the preferred approach to serialize such a business object in the SAP system so that a third party system could deserialize the business object including all attributes that make up a specific business object instance?

like image 994
Tom Avatar asked Oct 28 '09 04:10

Tom


2 Answers

According to this article you need to use the IF_SERIALIZABLE_OBJECT interface. I'm guessing your business object doesn't already implement that interface so you may have to extend it to a custom business object and implement the IF_SERIALIZABLE_OBJECT interface there.

like image 192
BenV Avatar answered Sep 19 '22 17:09

BenV


I'd say IDocs, but I see you don't want to use the SAP generated representations. Which means you'll have to write your own implementation using ABAP. In a nutshell:

  1. Retrieve the data you need using BAPIs and/or queries
  2. Stick all the data onto one or more custom classes (zcl_sales_order, zcl_sales_order_position, etc.), which you design according to your needs
  3. Serialize the instance into an XML representation using the call transformation statement (though this will still contain some SAP-specific formatting), or write your own serialization method (this is probably what you need)
like image 44
René Avatar answered Sep 20 '22 17:09

René