cancel
Showing results for 
Search instead for 
Did you mean: 

C4C: Replication from ERP to C4C

siwei_yang
Participant
0 Kudos
262

Hi there,

we have implemented our validation logic for address by enhancing the BO AddressSnapshot. It will prevent saving an address if the address input by user is not valid.

But now we do not want to execute this part of logic in case of replication of an account from ERP to C4C, because It will make the replication failed.

However , I have no idea how to check if the current processing is triggered by a replication or just data inputing of user.

Is there any global or system variable like sy-uname in ABAP world ?

Can any one give some ideas ?

Thank you

Peter

Accepted Solutions (1)

Accepted Solutions (1)

former_member226
Employee
Employee

Hi,

You can identify if a use is manually changing or changes are done by a integraion user by very simple piece of code.

import AP.PC.IdentityManagement.Global;
var ident = Identity.Retrieve(Context.GetCurrentIdentityUUID());
if (ident.BusinessPartnerUUID.IsInitial())  // It is a technical User
{
	// Write Business Logic
}
else	// Manual change
{
	// Write Another Business Logic
}

Here we are just checking if the BP UUID of the user is initial or not. If it is initial then it is a technical user (Integration user based change) else it is a Service Agent or Employee(Manual change).

Thanks

Saurabh

Answers (1)

Answers (1)

michael-schulz
Participant
0 Kudos

Hello Peter,

with the Context ReuseLibrary you can get the user details, who is doing a change and triggering the script. If that's a UI user you'll find an employee for that Identity which Context gives you.

Hope that helps, Michael

siwei_yang
Participant
0 Kudos

Hi Michael,

thank you for your quick answer.

so it means that I will use the following code to get the current employee who is triggering the current script.

var cur_user =Context.GetCurrentIdentityUUID();
var emp = Employee.Retrieve(cur_user);

On the other hand, the variable emp will be initial, if the script is triggered by replication.

Am I right?

Best wishes

Peter