how to setup Beam End in Niagara System by C++

I create Niagara System by tutorial Beam Effect and trying to set Beam End in code like:

NiagaraComponent->SetNiagaraVariablePosition( FString( “User.BeamStart” ), GetActorLocation() );
//NiagaraComponent->SetNiagaraVariablePosition( FString( “User.Beam_End” ), end );
NiagaraComponent->SetNiagaraVariableActor( FString( “User.Beam_End” ), Target );

I try use position traget and use Actor but it’s dosnt work. But if I set Source Actor in Niagara Component(by tutorial) to any Actor it’s work. How i can set position or Actor in code?

NiagaraComponent->SetNiagaraVariablePosition( FString( “User.Beam_End” ), Target->GetActorLocation() );

Assuming your User.Beam_End expects position data, not an actual actor reference