Skip to Content
0
Former Member
Jun 07, 2016 at 10:03 PM

Retrieve userID and print it in a created label

31 Views

Hello, i have an issue adding some code in Sap cloud application.

I have to retrieve the ID of the employee that creates an order in C4C and print it in a camp z (or "label") called CreatedECC. When an emp creates this order a form is created where you can see emp name, date, delivery status, creation date, created by, etc... here is where the label was added for me to retrieve the userID and print it. Im not sure if someone can help me with the code.

Im new to SAP application studio and ABAP so i dont entirely understand the code and that´s why i need help

**The code is:**

import ABSL;

import AP.CRM.Global;

// Get PlantID

var query_mapping;

var sel_param_mapping;

var result_mapping;

  1. this.IsConsistent = true;

var i = 0;

foreach (var item in this.Item)

{

if (!item.Plant.IsInitial())

{

item.Plant = item.Plant.ToUpperCase();

query_mapping = Plants.QueryByElements;

sel_param_mapping = query_mapping.CreateSelectionParams();

sel_param_mapping.Add(query_mapping.PlantID, "I", "EQ", item.Plant);

result_mapping = query_mapping.Execute(sel_param_mapping);

if (!result_mapping.GetFirst().IsSet())

{

raise MsgNoFoundPlantID.Create("E", item.Plant);

//this.IsConsistent = false;

i = 1;

}

}

}

if (i == 1)

{

this.IsConsistent = false;

}

I spoke with a partner via skype (i think he helped with the development) and he told me the steps i need to follow wich are:

**1.** Create the patch in the corresponding development. **Done.**

**2.** Add a reference object and select the customizing camp that was created for you

**3.** Add your code so that a variable would be equal to the value Context.GetCurrentIdentityUUID. Through that value you get the userID you need to print in the customizing camp ... And that is all. (I think i know how to do this last step but i can´t reference the customizing camp to print it)

I thank you in advance, hope anyone can help me. If you need more info let me know and i´ll try my best to share it