cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to read BCO data in SAP C4C SDK

madhurirawat19
Explorer
0 Kudos

bco-created-with-2-fields.pngbcc-with-finetuning-created.pngDear Team,

After creating BCO, BC view and all. I am trying to read BCO data in SDK but I am getting return value is zero.

Please find screen shot of it. where I am doing mistake please help me in it.

not-able-to-read-bco-data-in-sdk.png

Thanks and Regards,

MD

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Madhuri,

The initial code which you posted is as below which doesn't have the selection parameter in it.

var queryBCO = DEFAULTPROCESSOR.QueryByElements;

if ( queryBCO.Count() > 0 )

{

var selectBCO = queryBCO.CreateSelectionParams();

selectBCO.Add(queryBCO.DEFFALG, "I","EQ", "X"); // I am not able to get only X default value( point a)

var zparameters = queryBCO.Execute();

selectBCO.Clear();

I maintained the selection parameter as below on my reply.

var zparameters = queryBCO.Execute(selectBCO);

Please check the code in SDK and test it again. If you are still facing the error. Attach the screenshot of your code.

Answers (3)

Answers (3)

0 Kudos

Hi Madhuri,

Please find my answers highlighted in bold.

var queryBCO = DEFAULTPROCESSOR.QueryByElements;

if ( queryBCO.Count() > 0 )

{

var selectBCO = queryBCO.CreateSelectionParams();

selectBCO.Add(queryBCO.DEFFALG, "I","EQ", "X"); // I am not able to get only X default value( point a)

var zparameters = queryBCO.Execute(selectBCO); // You need to pass the selectionParameter into the Execute function.

selectBCO.Clear();

if (zparameters.Count() > 0)

{

var defprocessor = zparameters.GetFirst().ID;

if (!defprocessor.IsInitial())

{

var processor = this.ProcessorParty;

processor.PartyUUID = defprocessor.content;// it's adding extra zero as per UUID size but I want to pass only ID to processor ID. [You cannot pass a normal ID to an UUID field. Try fetching the UUID from the Account Object with the ID maintained in the BC set and then pass the retrieved UUID in the processor.PartyUUID].

}

madhurirawat19
Explorer
0 Kudos

Hi Sooriya,

Please find my query in bold.

selectBCO.Add(queryBCO.DEFFALG, "I","EQ", "X"); // I am not able to get only X default value( point a)

var zparameters = queryBCO.Execute(selectBCO); // You need to pass the selectionParameter into the Execute function.

My query is I am passing selectBCO, in above code , is it not the selection parameter? if not then should I do like this below

var abc = selectBCO.Add(queryBCO.DEFFALG, "I","EQ", "X"); // I am not able to get only X default value( point a)

var zparameters = queryBCO.Execute(abc); // Is it correct now?

Thanks and Regards,

MD.

madhurirawat19
Explorer

Hi sooriya,

Now it's working fine with bco filter also . Thank you for your support.

I need your help in 2nd point to read uuid.

I have tried with query to get employee uuid with respect to BC view ID but I am not able to get.

Can you please help me with association logic to read customer/employee data with respect to BC view ID as I am able to read BC view ID.

var defprocessor = zparameters.GetFirst().ID;// I am having emp ID here from BC view , data type I have shared in screen shot of BC view.

if (!defprocessor.IsInitial())

{

var processor = this.ProcessorParty;

processor.PartyUUID = defprocessor.content;// it's adding extra zero as per UUID size but I want to pass only ID to processor ID. [You cannot pass a normal ID to an UUID field. Try fetching the UUID from the Account Object with the ID maintained in the BC set and then pass the retrieved UUID in the processor.PartyUUID].

}

Thanks and Regards,

MD.

0 Kudos

Hi Madhuri,

var defprocessor = zparameters.GetFirst().ID;
//try the below if you want to pass the Employee's UUID to the ProcessorParty
var employee = Employee.Retrieve(ID);
if (employee.isset())
{
var empUUID = employee.UUID;
if (!empUUID.isinitial() && !defprocessor.IsInitial())
{
var processor = this.ProcessorParty;
processor.PartyUUID = empUUID ;
}
}
//try the below if you want to pass the Account's UUID to the ProcessorParty
var account = Customer.Retreive(ID);
if (account.isset())
{
var accUUID = account.UUID;
if (!accUUID.isinitial() && !defprocessor.IsInitial())
{
var processor = this.ProcessorParty;
processor.PartyUUID = accUUID;
}
}

Please note that the above code is on a high level and not the actual working code. So, I request you to verify the statements Also, I've used "Retrieve" statements and if it doesn't work then try Querybyelements from Employee & Customer object to retrieve the respective UUID and assign it to the PartyUUID.

Br,

Sooriya

madhurirawat19
Explorer
0 Kudos

Hi Sooriya,

I am writing this code in activity task bo. but above code retrieve(ID) /retrieve(defprocessor) notsupporting . So i have done code through query. Please find below code. But on bold line it's skipping the line in debugging .

var defprocessor = zparameters.GetFirst().ID;

if (!defprocessor.IsInitial())

{

var defquery = Employee.QueryByIdentification; // this line getting skipped in debugging . No idea why, cursor is not going to this line and after it, it's going inside of "if" condition with 0 value. I am trying to query on employee to get emp uuid because retrieve not getting activated successfully.

if ( defquery.Count() > 0 )

{

var selectBCO1 = defquery.CreateSelectionParams();

selectBCO1.Add(defquery.InternalID,"I","EQ", defprocessor.content);

var empdetail = defquery.Execute(selectBCO1);

if (empdetail.Count() > 0)

{

var empuuid = empdetail.GetFirst().UUID;

var processor = this.ProcessorParty;

processor.PartyUUID = empuuid.content;

}

}

}

Thanks and Regards,

MD.

0 Kudos

Hi Madhuri,

var defprocessor = zparameters.GetFirst().ID;
if (!defprocessor.IsInitial())
{
if ( defquery.Count() > 0 )
{
var selectBCO1 = defquery.CreateSelectionParams();
selectBCO1.Add(defquery.InternalID,"I","EQ", defprocessor.content);
var empdetail = defquery.Execute(selectBCO1);
if (empdetail.Count() > 0)
{
var empQuery = Employee.QueryByIdentification;
var selectParam = empQuery.CreateSelectionParams();
selectParam.Add(empQuery./*employee id from the queryByElements*/,"I","EQ" empdetail.getFirst().ID);
var resultSet = empQuery.Execute(selectParam);
if (resultSet.Count () > 0)
{
var empuuid = resultSet.GetFirst().UUID; // look for the UUID from the resultSet.
var processor = this.ProcessorParty;
processor.PartyUUID = empuuid.content;
}
}
}
}

For more information on the How to query an Object, please go through this link.

Thanks & Regards,

Sooriya

madhurirawat19
Explorer
0 Kudos

Thank you Sooriya for your quick support . Now it's working finewith use of statement

var query1 = Employee.Identification.QueryByEmployeeAttributes;

Can you please check my another issue by heading "Not able to pass account owner to contact Owner in SAP SDK C4C"

I have pasted my code there. Can you please correct me on it.

Thanks and Regards,

MD.

0 Kudos

Hi Madhuri,

Can you try the following steps and check again.

1. Open the .bac file and click on next and finish it.

2. Activate the .bac file.

3.. Right click on the "solution name" from the solution explorer and select the option "Deploy Business Configuration".

4. Retest again.

Kindly let me know of your results.

Br

Sooriya

madhurirawat19
Explorer
0 Kudos

Hi Sooriya,

I am able to read BCO data now after "deploy business configuration". Thankyou !! . Can you please support in 2 more query in same process.

a) Please find below code regarding to read BCO data. Now I am not able to get default filter value "X". As I have shared screen shot of BCC and BCO. Can you please help me in it . How to read only default value X row.

b) As per requirement BCO ID field need to be passed to Task processor and I have tried to pass into processor-> party uuid so It's taking 16digit . How to trim it or pass directly to processor ID.

var queryBCO = DEFAULTPROCESSOR.QueryByElements;

if ( queryBCO.Count() > 0 )

{

var selectBCO = queryBCO.CreateSelectionParams();

selectBCO.Add(queryBCO.DEFFALG, "I","EQ", "X"); // I am not able to get only X default value( point a)

var zparameters = queryBCO.Execute();

selectBCO.Clear();

if (zparameters.Count() > 0)

{

var defprocessor = zparameters.GetFirst().ID;

if (!defprocessor.IsInitial())

{

var processor = this.ProcessorParty;

processor.PartyUUID = defprocessor.content;// it's adding extra zero as per UUID size but I want to pass only ID to processor ID.

Thanks and Regards,

MD.

0 Kudos

Hi Madhuri,

Did you try deploying your solution and check the code again?

Also post the BCO and BCC screenshots.

Br

Sooriya.

madhurirawat19
Explorer
0 Kudos

Hi Sooriya,

I have completed below steps too after creating BCO and BCC. Please find attached screen shot of it . What do you mean Deploying the solution. It's on test system only.

In the UI designer, assign your BC view to the Business Configuration work center by doing the following:

Regards,

MD