cancel
Showing results for 
Search instead for 
Did you mean: 

Can I set value help for simple type generated by Model (aRFC)?

Former Member
0 Kudos

Hi, SDN fellows.

Referring to the WDP Value Help Tutorial in SDN, we can actually set the value helps to a simple type, and set the value attribute type to the simple type to rendered with the Drop Down Key UI component, like the following code:


//Access interface ISimpleTypeModifiable for modifying the attribute's datatype
    IWDAttributeInfo attributeInfo =
      wdContext.getNodeInfo().getAttribute(IPrivateMain.IContextElement.COUNTRY);
    ISimpleTypeModifiable countryType = attributeInfo.getModifiableSimpleType();

    // Set field label and populate valueset
    countryType.setFieldLabel("Country");
    IModifiableSimpleValueSet valueSet =
      countryType.getSVServices().getModifiableSimpleValueSet();
    for (int i = 0; i < 40; i++) {
      valueSet.put("Key_" + i, "Country " + i);
    }

    // initialize context value attribute 'Country'
    wdContext.currentContextElement().setCountry("Key_0");

My question is, since this is the simple type we defined in Local Dictionary, can we also do the same thing for the Simple Type in custom Data Dictionary generated by the model (adaptive RFC)?

My optimal goal is to assign a list of resultset (table of data with key and key description) to the simple type (of the custom Data Dictionary that generated by the import of an adaptive RFC) as a list of value help when rendered with the Drop Down By Key UI component.

In this case, can I just do the same thing like the code above?

Thanks for advise.

Kent

Accepted Solutions (1)

Accepted Solutions (1)

raja_thangamani
Active Contributor
0 Kudos

From my experience, If you are doing Model mapping then you can't use <i>getModifiableSimpleValueSet</i>.

You can do it for value node/Value attribute.

What i suggest you is, assign the value attribute to the dropdown list & then read or assign the value to RFC model using the code..

<i>* Reward each useful answer</i>

Raja T

Former Member
0 Kudos

Hi, Raja.

In my case, I am binding and mapping the model node (a table UI), say with these model attributes:

Machine Number as TextView

Machine Description as TextView

Machine Class as Input Field

Machine Type as Input Field

Failure Code as Drop Down By Key

Since I cannot set the modifiable simple type to the Failure Code, I will have to recreate the whole model node to value node, as the following (then map to the table UI):

Machine Number as TextView

Machine Description as TextView

Machine Class as Input Field

Machine Type as Input Field

Failure Code as Drop Down By Key

then programmatically set the value help of the Failure Code.

After the user process the table inputs, then again I recopy the value of the Value Node to the Model Node.

Is that right?

Or is that any way we can just create a FailureCode Value Node with FailureCode value attribute then combine to the model node to map to the table UI? Once user make the selection on the FailureCode value attribute, immediately I set it to the model attribute of

FailureCode?

Thanks for advise.

Kent

raja_thangamani
Active Contributor
0 Kudos

Since its in table, only Option 1 which you explained would be feasible.

Let me know if you need any more detail.

<b>*Reward each useful answer</b>

Raja T

luciano_leitedasilva
Contributor
0 Kudos

Hi kent,

There is an easy way to populate this Drop Down By Key using Model RFC values.

Im showing a simple code, that you can àpply to your case:

Put this code in the init method in your view:

IModifiableSimpleValueSet valueSet = wdThis.wdGetController().wdGetContext().getContext().getModifiableTypeOf("Node.Attribute").getSVServices().getModifiableSimpleValueSet();

for(Interact over the RFC model table result){

valueSet.put(key, value);

}

You can't use getModifiableSimpleValueSet over an attribute in the view, you have to use it over a attribute over the Conrtoller.

It works fine in all my projects.

Regards,

Luciano

Former Member
0 Kudos

Luciana,

I found out that we cannot set the value help to the model attribute of the model node. Your codes will only works for regular value attribute, as Raja stated at his previous message.

Thanks for your input.

Kent

luciano_leitedasilva
Contributor
0 Kudos

Hi Kent,

I've read the Raja post before send my post. Did you get in the code above? This work fine!

Regards,

Luciano

Former Member
0 Kudos

Luciano,

Did the "Node Attribute" of getModifiableTypeOf("Node.Attribute") is a attribute of the model node?What I am trying to do is copying a table of data from one RFC to another model attribute as a help value, but just copying values of model attribute to another "Value Attribute" as value help.

I tried to set the value help to the model attribute, but it did not really set the value.

Anyway, I will try it again, just to make sure I did not make mistake last time.

> Put this code in the init method in your view:

> IModifiableSimpleValueSet valueSet =

> wdThis.wdGet<your

> componet>Controller().wdGetContext().getContext().getM

> odifiableTypeOf("Node.Attribute").getSVServices().getM

> odifiableSimpleValueSet();

> for(Interact over the RFC model table result){

> valueSet.put(key, value);

> n't use getModifiableSimpleValueSet over an attribute

> in the view, you have to use it over a attribute over

> the Conrtoller.

luciano_leitedasilva
Contributor
0 Kudos

Kent,

Yes, that's it! Let me try explain better, Imagine, you have a RFC to create a Person. In the Person attributes I have the Country field. I create other RFC to get all Countries from the back-end. I want to set a value hel with these countries. Is like it your situation?

At the method init, the RFC ZGET_COUNRTIES is executed to brig all Countries. I do a loop over the table result to provide a help to the Country field at the form.

Put this at the init method:

IModifiableSimpleValueSet valueSet => wdThis.wdGet<your>componet>Controller().wdGetContext().getContext().getModifiableTypeOf("Node.Attribute").getSVServices().getModifiableSimpleValueSet();

for(Interact over the RFC model table result){

valueSet.put(key, value);

}

Don't use getModifiableSimpleValueSet over an attribute

in the view, you have to use it over a attribute over the Conrtoller.

This code work fine!

Regards,

Luciano

Answers (0)