Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

AET is the starting point

If you are thinking about enhancing the CRM Web-Ui (of CRM7.0) you will have heard about the appliacation enhancement toolset (AET). It offers a flexible and easy way to add custom fields to the Web-UI screens. The tool itself even runs within the Web-UI, so it's even some kind of WYSIWIG.

Extending CRM is nice, but you will shurely come to the point, where you need to exchange those fields with the ERP backend system.
This is what we will do for the salesorder head (vbak), as a sample. It works pretty much the same way for the item level (vbap).
Please note that other objects are implemented totaly different in the CRM's "R/3-Adaptor", so the solution shown here will not work for each and every object.

Checking the box, that's it!

When reading through the docu, you might get the impression, that all you need to do, to exchange a field with the ERP-backend is checking the checkbox in AET.
Well, this is a good starting point (you have to check the checkbox, yes!) but as you will notice, your data will not appear in ERP.

So there is something more to do, so from now on Step by step...

 

0. Understanding the Salesorder exchange object

As the salesorder in CRM is a "one order" document, it is transfered trough the "BUS_TRANS_MESSAGE" Bdoc. As this bdoc is not only used to transfer salesdocuments, SAP used a BADI "CRM_BUS20001_R3A" to offer flexible and different upload functionality. The implementation "CRM_SALSESDOCU_R3A" is the one in charge for uploading sales documents, so whenever you have some trouble with the upload, this Badi is a good starting point for debugging.

For the mapping inbetween the bdoc and bapimtcs structures there is another BAPI you should know the "CRM_DATAEXCHG_BADI".
There is a implementation "CRM_BTX_FIELDEXT" doing the mapping for the fields you added in AET AND!! ERP, this is what I will show. (If this implementation is not active, activate it, otherwise nothing will work!)
Beside that there is a sample implementation "CRM_BTX_EEW_DATAEX" coming from the "easy enhancement workbench" (this was never easy :-)) You can use this for your own mapping implementations, or if you have restrictions so that you cannot use the generic mapper. Please implement note 1458476 before copying the sample code, as it contains errors 🙂

 

0.5 Understanding "BAPI_SALESORDER_CHANGE" and "CRS_SEND_TO_SERVER"

You should get familiar with those two function modules.
So please read trough the documentation of the BAPI, especialy the part where the enhancement of VBAK, VBAP and VBEP is described, because this is what the CRM-Adapter uses in order to hand over the fields to ERP!

The "CRS_SEND_TO_SERVER" is the generic outbound module, when data is send from ERP to CRM, so whenever you are missing some data on the CRM side, check if it has been packed into the BAPIMTCS container by setting a breakpoint here.

 

1. Extend the ERP Structures

If you have read through the docu of the "BAPI_SALESORDER_CHANGE" it should be pretty clear. You will have to do the following:

- Add the field added with AET to a customer structure (z-structure), keep the generated names and the order of the fields!!

- Append your structure to the table vbak

- Append your structure to the structure VBAKKOZ

- Append your structure to the structure BAPE_VBAK

- Create a second structure with the same name of your first structure followed by an "x". This is the checkbox structure. Add the fields once again, keep the order of the fileds, and use a Character 1 data type for every field.

- Append the X-Structure to the structures VBAKKOZX and BAPE_VBAKX

 

2. Extend the CRM-Structures

Usualy you don't have to do anything here, but at least you should check the structures "CRMT_BTX_EEW_BAPE_VBAK" and "CRMT_BTX_EEW_BAPE_VBAKX"
Your fields should be there as well, if not, did you realy check the R/3 checkbox when creating the field in AET??

Well anyway you could still append some other custom fields here, that you haven't added with AET, but maybe manualy. They will be exchanged as well, but of course they have to exist within the bdoc!

 

3. Implement note 578653

YES! I'm not joking, you may say that this note is not valid any more, but in fact it is, read through it, check the tables and the download object and you will see!

 

4. Et voila

This is it, now you should see your data beeing exchanged between CRM and ERP.

 

5. Troubleshooting

Ok, if it still doesn't work, some hints for troubleshooting.

First you should check the direction causing the trouble, is it from ERP to CRM, then:
Put a breakpoint in "CRS_SEND_TO_SERVER". Change a custom field using the transaction (va02), check if there is a "BAPIPAREX" line in the BAPIMTCS container table. If not, check the structures as in 1 described carefuly. If BAPIPAREX is there check if it still exists after the call of the filter module, if it disapears, go back to 3.
This is usualy about it.

If there is some trouble when you change the field in CRM, saying it is not downloaded to ERP, please check the BDOC in SMW01.
If it is filled correctly there, place a breakpoint in method CRM_DATAEXCH_AFTER_BAPI_FILL of the class CL_IM_CRM_BTX_FIELDEXT. Well the coding is difficult to read, as it is very generic, but still you should see, that your fields are getting mapped into ct_bapiparex table. If not, check 2.