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 c开发者_开发技巧ould deserialize the business object including all attributes that make up a specific business object instance?
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.
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:
- Retrieve the data you need using BAPIs and/or queries
- 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 - 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)
The SAP Business Connector uses XML documents to exchange SAP objects (between SAP and non-SAP systems). Maybe you can find some help in this article.
I don't know of a simple way to serialize BOR objects. However in many cases SAP have provided BAPI's that are Remote Enabled Function modules that can be called via the various SAP connectors or SOAP etc.
Taking BUS2032 as an example:
- Run transaction SWO1
- Enter BUS2032
- Click the Program button
- Search on
call function 'BAPI
You will find various BAPI's - in this case they all belong to function group 2032 that can be accessed via transaction SE80
Note that SAP is not always this accomodating in their naming standards, but the more mature the module the better the chance that they've already made some form of RFC or Webservice available for the module.
Of course you can also write your own RFC or webservice, but then you need to understand the business model and which attributes are needed.
精彩评论