cancel
Showing results for 
Search instead for 
Did you mean: 

Use two different Bapis into one interactive form

Former Member
0 Kudos

Hello. I'm creating a form in which I need the result from two different bapis, but the interactive form element in the layout of the view allows me only one data source node.

The form i want to create is one in which appears some data from one employee (so I use BAPI_EMPLOYEE_GETDATA). The problem is that I also want to show the qualifications shown as result of the BAPI_QUALIFIC_GETLIST bapi. Those qualifications should correspond to the employee.

I have one solution in my mind. That one is: I could create a node containing the structure with all the elements I need from the two bapis. Then I could copy there the results from the context nodes that are mapped to the bapis.

I believe this is a common situation. Not only to my specific example but to many other forms.So, I think there should be a way to do it without programming it myself. Or perhaps a better solution than mine. My worry comes to my mind because all the facilities Web Dynpro and LifeCycle offer to create interactive forms and common web applications.

Thanks to anyone with some answers.}

Of course, I'll reward for them!

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

1) It's necessary to use only one data source, so, all values have to be in there.

2) To accomplish that, it is possible to create a method to copy one value from the bapis to the common data source and generate the code using a the relate attributes template.

3) The you can code an iteration to create a new node element(for the common data source), move next and and call the relating method you've just created.

Former Member
0 Kudos

Ok, as a result of your answers I started looking for some easy solution to coding as little as possible. As a workaround i found that it was easy to use the relate attribute template inside a relating method and call it iteratively as many times as i needed to copy the valuse, this way if you have manipulate many attributes or just a few it's anoly necesary to code an iteration calling to this generated method.

Thanks a lot for your answers!!

Former Member
0 Kudos

I mixed the to bapi nodes into a big node, but when I try to execute the application, the server throws me the following exception:

com.sap.tc.webdynpro.progmodel.context.ContextException:
Node(MezclaBapis.DataSource.Bapi_Employee_Getdata_Input):
cannot bind or add elements because the node has no valid parent

The code below is the one that generates the exception:

Bapi_Employee_Getdata_Input employee_model =
    new Bapi_Employee_Getdata_Input();

wdContext.nodeBapi_Employee_Getdata_Input()
    .bind(employee_model);

So I don't think it's going to be that easy using both bapis in the same interactive form. Any other suggestion?

Former Member
0 Kudos

Hi,

Try like this getting two model output node elements into mapped one node and mapped to UI element.

Other wise what are output values are coming from two BAPI's output values put into one context node and mapp it UI element.

Thanks,

Lohi.

Former Member
0 Kudos

Ok, that solution was the first I tried, but I couldn't put the two bapi models (not even one) into the generic parent node so it could be a single data source. That's when the the idea I wrote came to my mind.

But now that you said it again I tried once more. At first, as before, I couldn't. I was trying it in the view controller and WebDynpro give a message that says "Mapping of origin parent context node missing".

Then I tried to do the same thing but in the component controller. It was a successful try. Thanks a lot for the answer.

krishanu_biswas
Active Participant
0 Kudos

Hello Alejandro Monteverde,

There is one and only one data sink for an interactive form and that is the data source node for you. There is no possibility that we can define a second or third datasource node for our application. Having the above statement in mind, the only way we can fulfill our requirement is to have a common parent node as the datasource node which in turn may have any number of nodes (in your case you would probabaly think of segregating the results from two BAPIs to map to two different nodes). A third node can be added tomorrow if you need so.

The solution that you have mentioned will also work equally good. In your approach you will have all the related information will be contained within one node. Fair enough.

Its a matter of how do you want to best represent your data structure.

Thanking you,

Krishanu

Former Member
0 Kudos

I think Krishanu's solution is better one.