on 11-05-2004 1:29 AM
Hi,
I have made some webdynpro examples with easy functionality: execute 1 bapi and show results in a table.
Now I need to do real things: execute the first bapi, read a value from a field and put it in a variable, then execute the 2nd. bapi with that parameter (variable), and so forth.. =(
Anybody could give me a clue ? some general steps, or code,etc.
I really appreciate your help !!!!
Thanks and regards from Mexico ! 😃
Diego
Hi
To pass an input to a BAPI you need to do the following
If the proxies generated while importing your Model are say "Bapi_Input" and "Bapi_Output"
Code Snippet :
Bapi_Input inp = new Bapi_Input();
//Bind input to the model
wdContext.nodeBapi_InputElement.bind(inp);
//Set Parameter Name
inp.set<ParameterName>
After binding the Input to the Model we need to use the instance object "inp" in our case and then use the set<Parameter> method.
II . Passing input to a BAPI containing a Structure
If your Import Parameters to the BAPI are in the form of a Structure then you will have a separate proxy class generated for that Structure when you import the model.
In that case we need to instantiate that class and then set the Parameter values.
Say if the Structure name is "ZStruct", the proxy class generated would be "ZStruct".We can then instantiate the structure as shown.
ZStruct s = new ZStruct();
//Set the Parameter name
s.set<ParameterName>
Then add the Structure back to the input instance that was bound.
inp.add(s);
Hope that gives you some understanding on how to pass values to the BAPI.
regards
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
It seems most of got stuck up with this problem. There is a posting(still open as I am testing the solution and thread name is 'Context Master Detail with Bapi') about this and there were some proposed solutions.
Armin suggested the following which I am still trying to get working. I think the procedure is the same when working with 2 or more BAPIs and I am reproducing the solution from Armin's comments.
To react on a table's lead selection change, you could define an action / event handler in the view controller and use table.setOnLeadSelect(action) to handle the lead selection change.
To get the new selected row / node element, you can either use the event parameter "row", which is the index of the new selected row, or take the lead selection of the table's data source node.
The data of the selected row are the attribute values of the node element at the lead selection (in the table's data source node).
In the event handler, you can call a method of a custom controller (or component controller), that calls the BAPI or whatever model function for getting the detail data.
If you want to use a tab strip, you can either put all tab contents into one view, or you can use view container UI elements and separate views in each tab.
Is it possible for some to upload an example with full code where one Bapi retrieves the results and based on the selection of row (say sales order/purchase order), second bapi gets the details about the same.
Regards,
Raju
Diego,
I am not quite understand executing the BAPI for n number of times.
I built an example, where it retrieves orders from SAP using a BAPI. For each click on order by the user, it calls second BAPI to retrieve order details. The number of times BAPI executed depends on the number of times user chooses order (different order).
In case you have to call a BAPI n number of times to retrieve all the data once, I may create a bespoke RFC and calling BAPI and storing the information in a table. Finally I can get the results through export.
The above way, I am calling BAPI only once from WD side and within R/3 it loops through the number of times the BAPI is requested.
Can you explain once again your case.
Regards,
Raju
Hi Diego,
as far as I understand you problem, you can just execute the first BAPI, then you will have the result values in the according context elements. From there you can retrieve them and use them to call the next BAPI.
Is this what you mean?
BR
Daniel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.