Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
stephenjohannes
Active Contributor
0 Kudos

What is the XIF adapter?

In release CRM 3.X SAP introduced a new adapter for the CRM middleware as a mechanism to load and retrieve data from a CRM system. This adapter was called the eXternal InterFace Adapter or XIF for short. The adapter is series of API’s that provide external access to the CRM middleware.

Traditionally in the R/3 development we used BAPI’s to change data externally. The XIF concept is similar to BAPI’s with the exception that it was designed for multiple layers of access. The three primary access methods are RFC, IDOC and SOAP. These access methods provide the necessary means to use the XIF adapter.

Getting Started with XIF the easy way:

First off, using the XIF IDOC’s or RFC’s is merely a mapping exercise. I have seen many questions on how to map the function module parameters. There is an easy way to do this regardless of how you are using XIF.

I recommend using LSMW to determine your mapping. The benefits of this tool, is you can build a mapping to the XIF adapter without writing any code. This allows for rapid tweaking of the mapping to see how things will work.

Now unlike many other things delivered by SAP, the documentation for the XIF contains 90% of what you need in order to use it, for either RFC or IDOC. The key part is how SAP names the XIF function modules and some of your most common business objects:

SAP follows the convention for the inbound XIF function modules:
CRMXIF_*_SAVE

Where * = Business Object

The most common and useful objects are:

  • ORDER – Business Transactions
  • PARTNER – Business Partner
  • PRODUCT_MATERIAL – please note that in CRM terminology that the PRODUCT object is actually a CRM product catalog. PRODUCT_MATERIAL is what we would consider equivalent to an R/3 material master.
If you look at the code for each function module the general outline looks quite similar:
  1. Determine where the message is being imported
  2. Build a BDOC header for the corresponding BDOC object
  3. Map the XIF structure to a corresponding BDOC structure
  4. Start the middleware flow passing in our newly generated BDOC
  5. Determine errors and call commit work or rollback depending on success or error.

Now this requires middleware on the CRM system to be configured. We do not need to point CRM to an R/3 backend, but we do need to define a site type defined for the XIF adapter.

After keeping this all in mind here is the recipe for building the LSMW project:

  1. Create a new project
  2. Setup IDOC inbound processing for the project
  3. In LSMW define the business transfer as IDOC processing
  4. Create a test data structure
  5. Map the values to the test structure
  6. Convert in the test file and determine if successfully
  7. Adjust the mapping and re-run until successful

Now the details for each step

I am not going to cover in detail the exact steps for each part of the process. I am going to cover the pain points which are not obvious, during the setup in LSMW. For now a good working knowledge of LSMW along with the notes below will lead you to success.

LSMW Project

You will require a new LSMW project to be setup. The most difficult parts of the initial configuration will be the IDOC Inbound Processing Setup and a few issues with mapping.

IDOC Inbound Processing

This is the key to make this work. From the main screen of LSMW choose the menu option:
Settings->IDOC Inbound processing

We need to make sure we have two things setup on this screen: a file port and a partner number. The file port should follow the standard setup for LSMW usage. For the partner number a partner needs to be maintained that has the XIF message type on the Outbound and Inbound Parameters. For Products use message type: CRMXIF_PRODUCT_MATERIAL_SAVE. The Basic type on the IDOC type will be CRMXIF_PRODUCT_MATERIAL_SAVE01.

LSMW Data Object Definition

The object data definition should be of message type CRMXIF_PRODUCT_MATERIAL_SAVE, and basic type CRMXIF_PRODUCT_MATERIAL_SAVE01.

Test data structure

The minimum data to load a product master in CRM is typically a product id code, description, and base unit of measure. Your file will need to contain this data at a minimum.

Mapping files to test structure

Products in CRM are different from your typical R/3 material. A product in CRM does not have any attributes until assigned to a category. Therefore we will need to assign our product to a category in order for it to load. The hierarchy will will commonly use is 'R3PRODSTYP' and category id of 'MAT_FERT'. This corresponds to finished goods type of R/3. If you are not connected to an R/3 system you will need to setup a product hierarchy and assign the basic product views to that category.

Another point to make is that all segments you map will require at least a logical system identifier. The easiest way to handle this is to retrieve the current logical system from T000 with a small mapping routine in LSMW. The logical system indicates where the data originated from, and in this case we want the logical system to show that CRM is the origin of this data.

A project that I built to load a product with an ID, description and UOM mapped the following segments

  • E101COMXIF_PRODUCT_MATERIAL
  • E101COMXIF_PR_S_COMM_PR_MAT
  • E116COMXIF_PRODUCT_S_ADMIN
  • E101OMXIF_PRD_S_COMM_PR_MAT
  • E101MXIF_PRD_SX_COMM_PR_MAT
  • E101COMXIF_PR_S_CATEGORIES
  • E101COMXIF_PRODUCT_S_ADMIN
  • E101COMXIF_PRD_S_CATEGORIES
  • E101COMXIF_PR_S_SHORT_TEXT
  • E102COMXIF_PRODUCT_S_ADMIN
  • E101COMXIF_PRD_S_SHORT_TEXT
  • E101COMXIF_PR_S_UNIT
  • E103COMXIF_PRODUCT_S_ADMIN
  • E101MXIF_PRD_S_COMM_PR_UNIT
  • E101XIF_PRD_SX_COMM_PR_UNIT

CRM Middleware Setup

In transaction SMOEAC you will need to define a new site for the XIF. Create a new site of type External Interface for IDOC's. You will then need to maintain under the site attributes the EDI partner setup for your LSMW project.

Conclusion

The final issue is the mapping and trying to decipher the XIF data structures. In general this again is relatively straight forward. If you understand CRM data structures and underlying tables then you will have no problem. If you don’t understand the CRM data structures then mapping will be difficult at the least. We may cover CRM data structures in a future blog.

15 Comments