cancel
Showing results for 
Search instead for 
Did you mean: 

Replication of new customer fields in order to R/3

Former Member
0 Kudos

Hi there,

Recently I managed to setup a replication of a customer master data field to R/3 from CRM using the Easy Enhancement Workbench to enhance the fields in CRM and the DE_BALE event to call a Z-function module to unpack the business document sent to R/3 and create an Idoc segment, which then eventually let standard SAP processing update the customer master data.

Now, there is a customer requirement to extend the order item in CRM and subsequently replicate these fields to R/3. The enhancement on the CRM side has already been done, and I can see that the new fields are packaged in the bDoc sent to sap, but how do I unpack the BAPIMTCS on the R/3 side? It appears that the DE_BALE event is not called, so is there another way to create a flow which somehow allows me to unpack the data sent from R/3 and eventually update the fields in VBAP that I need to update?

Best regards,

Anders

Accepted Solutions (1)

Accepted Solutions (1)

KaushalShah
Active Contributor
0 Kudos

If you have extended vbap on R3 side & trying to populate new fields, you can use BAPIPAREX structure which can carry such extensions both for header & item level.

You have to extend BAPE_VBAP & BAPE_VBAPX, VBAPKOM & VBAPKOMX on R3 side along with VBAP - all with the same fields.

On CRM side you can write code to populate BAPIPAREX with extra information.

Hope this helps.

Regards,

Kaushal

Former Member
0 Kudos

Hi Kaushal,

Thanks for the answer. All the fields that I need to populate in R/3 already exist, so the only thing needed is a user exit of some sort that would allow me to unpack the BAPIMTCS that I get from CRM and put it into an Idoc segment or an input table to a BAPI.

Is there such a user exit? It looks like the sample function module for event CRM0_300 does allow me to manipulate BAPIPAREX, but how does the system know where the put the values that I put in BAPIPAREX?

Best regards,

Anders

KaushalShah
Active Contributor
0 Kudos

If you are sending extra information for VBAP, you have to use structure bape_vbap. So, in bapiparex-structure you populate BAPE_VBAP. You have to extend BAPE_VBAP with the same custom fields, and populate bapiparex's valuepart1 field with order number, POSNR & custom information. Since fields of all extended structures are same, these information will automatically be taken from bapiparex to vbapkom to vbap.

So, you just need to write code on CRM side to populate bapiparex properly. On R3 side no code needs to be written.

Hope this helps.

Regards,

Kaushal

Former Member
0 Kudos

So to summarize, assuming that fields have been created in both CRM and R/3, I need to do the following:

1. Extend BAPE_VBAP with FIELDX and FIELDY

Expected result: BAPE_VBAP

VBELN

POSNR

FIELDX

FIELDY

2. Setup user exit SMOUTIL2 to call a functíon module

similar to SAMPLE_PROCESS_SMOUTIL2 in which I loop

through T_BAPIMTCS and read the new fields from the

business document and add a record to BAPIPAREX

containing:

Structure Valuepart1

BAPI_VBAP 0005000673000101006200623062006

And that should be it then, right? In the example above it is assumed that VBELN = 0005000673, POSNR = 00010, FIELDX = 10.06.2006 and FIELDY = 23.06.2006. Furthermore it is assumed that FIELDX and FIELDY are called FIELDX and FIELDY in R/3.

Best regards,

Anders

KaushalShah
Active Contributor
0 Kudos

Perfect. Just small correction.

POSNR should be length 6. So, instead of passing 00010, pass 000010. Also, pass values according to their lengths & leave extra space if needed. For ex. if length of fieldX is 10, then fieldy should start from 27 character onwards (10 for vbeln, 6 for posnr, 10 for fieldx).

One important thing. Similar to BAPE_VBAP, you need to extend BAPE_VBAPX as well. Add one char fields (with same names). This is required to let system know which fields have been changed.

So, BAPE_VBAPX will have fields:

VBELN

POSNR

FIELDX (char1)

FIELDY (char1)

And in BAPIPAREX you will have to pass two structures

BAPI_VBAP 00050006730000101006200623062006

BAPI_VBAPX 0005000673000010XX

Don't forget to extend VBAPKOM & VBAPKOMX

That's it.

Regards,

Kaushal

Former Member
0 Kudos

I have tried to implement the SMOUTIL2 user exit by defining an application as an entry in TBE24 and a reference to my function module in TPS34. For some reason it does not seem to be executed when an order is replicated to R/3. I have had a look at note 417906, but everything seems to be setup correctly. What could be wrong?

Rgds.

Anders

KaushalShah
Active Contributor
0 Kudos

Well, we didn't use that approach. Why not use CRM_DATAEXCHG_BADI to populate BAPIPAREX on CRM side?

Regards,

Kaushal

Former Member
0 Kudos

Thanks a lot. I searched for a while for documentation somewhere on the web of how to use SMOUTIL2 and I could only find evidence that it didn't work, so I decided to use the BADI you recommended and my initial test shows that it works as expected.

Thanks again for your advice and patience

./Anders

Former Member
0 Kudos

Hello all.

I want to do the same but with table VBAK. I fill the structure BAPIPAREX in the BADI.

Here are the two line that I have in BAPIPAREX

BAPE_VBAK | 0005000636XTEST

BAPE_VBAKX | 0005000636XX

The first field after the sales doc. number is a flag, and then a free text.

After the release of my quotation in CRM, the document is replicated to R3, except for my two fields.

The 4 structures have been extended with the necessary fields.

Is there another thing to do?

Thanks in advance.

Nicolas

Former Member
0 Kudos

Nobody to help me?

After some debugging, I see that the problem comes from FM

"SD_SALES_HEADER_MAINTAIN" in R3.

When the FM is called, the 2 fields are filled, but they are not saved into VBAK.

Answers (0)