cancel
Showing results for 
Search instead for 
Did you mean: 

map drop down to web service

Former Member
0 Kudos

Hello,

I exposed a BAPI for creating business partners as a web service. Now I would like to set the title (Mr., Ms.) using a dropdown box. Thus I created a value attribute with a corresponding enum type and bound this to the dropdown box. Is it possible to map the dropdown box to a controller model attribute that maps to the web serivce? In the moment I have to hand code this relation using:


wdContext.currentXXXElement.setXXX(
    wdContext.currentContextElement()getXXX()
);

Thanks,

Felix

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Felix,

I gues it's not possible why bcz your context attribute type is enum type . But your model attribute type is some thing else.

So it may not be possible.

If attributes are same type, it may be possible.

Did you try with mapping?

Rgds

SS

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Felix,

Try this you can create a value attribute(which will be mandatory in this case).

Create a simple type of builtin type String and set it as the type of value attribute use the following code to populate its enumeration.

You can use the following code:


IModifiableValueSet valset = wdContext.getNode("NodeName").getNodeInfo().getAttribute("").getSVServices().getModifiableValueSet();
valset.put("key","value");

This most be the most practical case becaue the code would be generic and just need to change the node and the attribute name.

Regards

Amit

[

Message was edited by:

Amit Kesari

Former Member
0 Kudos

Hello Amit,

thanks for your reply! I found your suggestion also in other threads. But as far as I understand this solution does not solve my mapping problem as I can not map the value attribute to a model attribute of the controller.

Regards,

Felix

Former Member
0 Kudos

Hi,

No need of using different context attribute.you can directly map the model attribute to view context through component controller.

Firstly use DropDownByIndex.

map the controller attribute to the view context.

Now map the context attribute that will contain values to the texts property of dropdownbyindex.

Former Member
0 Kudos

Hello Shriram,

but the view context attribute is only a string and does not contain any values.

Regards,

Felix

Former Member
0 Kudos

Hi,

Map the context of Model to Controller and from controller to view.

and then to DropDownByIndex.

Former Member
0 Kudos

Hello Sridhar, hello Shriram,

Thanks for your answer. I tried your suggestion. But it does not work for me as the input for the web service is only of type string. There is no table containing the list (mr., ms.) and this data has to come from somewhere...

Regards,

Felix

Former Member
0 Kudos

Hi,

I am sorry i though the title values come from BAPI, but then what i feel is you have used dictionary to populate those values in the view.

And since in your view title is enum and the input to BAPI is string, it can be done programmatically only.

Former Member
0 Kudos

Hi Felix,

This would not be nessecary.Look if you've a model attribute of type list getting exposed from the webservice you can directly bind it to the UI element(DD) and make sure that the objects in the list are of type string.

It will work.

regards

Amit

Former Member
0 Kudos

Hello Amit,

thanks for your answer! The problem is: I do not get a list from the web service.

regards,

Felix

Former Member
0 Kudos

Hello Sridhar,

no unfortunately context mapping is not possible although it actually should be as my enum type is actually only a restriction of type string,

regards,

Felix

Former Member
0 Kudos

Hi Felix,

Copy model attribute from Component Controller to View Context.

Insert DropDownByIndex UI element in the view , bind DropDownByIndex with that view context model attribute.

No need to difine any attributes or EnumTypes.

Hope you understood.

Rgds

-SS