cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic access to attributes of the object at runtime

VishnAndr
Active Contributor
0 Kudos

Dear Experts,

We'd like to program our logic in SDK in ABSL in the following manner:

Based on certain conditions we need to access one of z-amount fields created for a standard object. It should be dynamic access, e.g. the decision which field to take is made at runtime.

Like in ABAP world:
ASSIGN COMPONENT comp OF STRUCTURE struc TO <fs>.

or something similar.

Is it achievable in SDK using ABSL?

Accepted Solutions (1)

Accepted Solutions (1)

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Andrei,

The same dynamic is not possible with ABSL.
Please describe your requirement in more details.
Maybe we can find a solution. 🙂

Bye,
. Horst

VishnAndr
Active Contributor
0 Kudos

Hi Horst,

Easy. We have a custom integration done via pressing a button. We have an action assigned to this button. Button is required because only the user knows when he wants to replicate the object.

Action behind the button gathers the data to be sent out via outbound web service (SOAP) call.

And we need to pass a table of pricing conditions among all other things. e.g. "condition type - amount" pairs.

These amounts are basically 10 KUT fields defined in the object.

The reason for dynamic access: we'd like to have a mapping like

KUTField1 = ConditionType5

KUTField2 = ConditionType41

etc.

To make the future life easier when power user will add another KUT field for another amount he will be able to easily map KUT field to Condition type. Mapping part is achievable, no issues. But this power user doesn't have and doesn't want to have access to SDK to add a "hardcoded" mapping for the new field.

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Andrei,

What about an additional Extension Field which defines the mapping?
TypeCode which is based on "ContitionType1", "ConditionType2", ...

HTH,
. Horst

VishnAndr
Active Contributor
0 Kudos

Hi Horst,

The mapping is not the issue. I've done it via BCO and "code-description" there represents my "KUTField-ConditionType" mapping. All good.

Basically I'd like to do the following:

1. GetAllDescriptions for my BCO maintained in Fine-tuning. It will mean I have all pairs to map. E.g mapping table.

2. Loop through this mapping table.

3. For each entry in the mapping table I would read an attribute from the actual object instance (e.g. particular KUT field on each step of the loop) and move its value into conditions table with corresponding condition type.

So the issue is in step 3. How to read an attribute dynamically from the object once I know its technical name?

HorstSchaude
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hello Andrei,

Got it.
So you have the name of the Extension Field as string and you need something like

var myExtensionField = myNode.GetElementByName( "KUTField1" );
if (!myExtensionField.IsInitial()) myExtensionField = ....

Sorry, this is not available in ABSL. 😞

Bye,
. Horst

Answers (0)