cancel
Showing results for 
Search instead for 
Did you mean: 

SAP C4C - Use KUT field in ABSL query

0 Kudos

Hello experts,

I'm looking for a way to use a custom field defined via KUT in an ABSL query in the Cloud Application Studio.

I've read the following posts, but they don't give a definitive answer:

https://archive.sap.com/discussions/thread/3871694 https://answers.sap.com/questions/215431/sap-c4c-extend-kut-field-to-query-and-using-on-sdk.html

The field is an extension field on the Customer Business Object and is already made available via a .ref file in the Cloud Application Studio.

query2 = Customer.QueryByIdentification;
param2 = query2.CreateSelectionParams();
param2.Add(query2.HeaderExtSubChannel.content, "I", "EQ", this.AccountType.content);
result2 = query2.Execute(param2);

Above code is what I'm trying.

Where "HeaderExtSubChannel" is the extension field defined via KUT.
But... It's not working.

Any suggestions are more than welcome!

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Hi Glenn,

Add the KUT field to the QueryCustomerIn Service by going into KUT field definition -> Services tab. Once field is added to the query, you can check the same in Code completion in SDK as well

Regards,

AbdulRasheed

0 Kudos

Thank you Abdul!

I will try it out and let you know if it worked!

0 Kudos

Abdul,

This is the correct answer! Thank you very much!

Kind Regards,

Glenn

Answers (2)

Answers (2)

jensniemeyer
Participant
0 Kudos

Hello,

I am using also KUT fields in my QuerybyElements.

My impression is, that KUT fields are not indexed, so full table scan happens, If I rund a query on such field.

How can I add the KUT to be indexed by the HANA DB?

Jens

JOSC_ITLAB
Participant
0 Kudos

Hello Glenn,

You have to implement a reference to Customer-Specific Fields. This is an object addable in the add new item Pop-Up.

There you have to select the Key User Tool created fields.

Now you should be able to select them.

Kind Regards,

Johannes

0 Kudos

Hello Johannes,

First of all, thank you very much for the reply.

However, like I said I already made a reference to Customer-Specific Field. And I've checked the "HeaderExtSubChannel" field there.

"The field is an extension field on the Customer Business Object and is already made available via a .ref file in the Cloud Application Studio."


And I can access the field in ABSL code in general.

E.g. works:

var subChannel = Customer.HeaderExtSubChannel

But I can't use it in a query!


When you define an extension field via the Cloud Application Studio (instead of via KUT), you can annotate the field with an extension scenario. In that extension scenario you can check the options to enable the extension field for query.

So I need some way to achieve the same for the KUT field.

JOSC_ITLAB
Participant
0 Kudos

Hello Glenn,

did you try to debug your coding?

Try to test with an InternalID of a customer first and check if the system repsonds at all.

If the query with the KUT field does not run into errors, it might doesnt find any customer with a filled field.

Kind Regards,

Johannes

0 Kudos

Johannes,

No that's not the problem...

In code below when I type "query2." and use code completion, the field isn't even showing up.
While all other extension fields are showing up. That's because they are made with the Studio and are included in the Extension Scenairo.

param2.Add(query2.HeaderExtSubChannel.content, "I", "EQ", this.AccountType.content);