cancel
Showing results for 
Search instead for 
Did you mean: 

Context Master Detail with Bapi

Former Member
0 Kudos

Hi,

I am creating a Master Detail application. I have list of orders retrieved using a BAPI. Based on user selection of any order, I would like to call another BAPI to retrieve item details. I know that I can use context programming. But I think I did not understand this fully.

Could some one clarify or give sample code for the following.

1) How do I get order number from the row retrieved[using getLeadSelection gives me current row selected]. where are the row values stored and how i can retrieve. Basically, where I need to put the coding?

2) How do I pass this order number and where I put the coding to execute second BAPI with this number and get back the results

3) I would like to used tabbed display to show the results, do I need to take any additional step apart from mapping to get the desired output.

Thanks for your help.

Raju

Message was edited by: Raju Datla

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

In addition it is also a good thing to use supply functions for these kinds of tasks

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/documents/a1-8-4/web dynpro tutorial and sample applications.faq

Search string Supply Function in page

Regards

Pran

Former Member
0 Kudos

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.

Armin

Former Member
0 Kudos

Thanks Armin,

I will try the solution today and let you know of the results.

Pran,

Thanks for your link. I wil try and let you know of the outcome.

Regards

Raju

Former Member
0 Kudos

Armin,

Thanks for your help. It works to an extend that first click on any item retrieves first row not the selected row. Do you think I might be missing something?

Supply function is not appearing in view context. Do you think supply function is part of custom controller not view. Any way my action is captured using table's onLeadSelect.

Thanks

Raju

Armin,

Further to above I noticed that always first row details are retrieved. It seems the code is not picking up currently selected node.

The code I used is

wdContext.node..().get...ElementAt(wdContext.getLeadSelection()).getAttributeValue("....").toString()

;

Can you or some one correct me if I am using wrong method.

Thanks

raju

Message was edited by: Raju Datla

Former Member
0 Kudos

To create a supply function, you have to go to the context editor and fill the value "supplyFunction" in the property sheet of the context node. Supply functions normally should be placed in custom controllers as they are not view-specific.

Are you calling invalidate() after calling into the model?

Armin

Former Member
0 Kudos

Thanks Armin,

It looks like I am getting the first row of data irrespective of my click on any row. I noticed it a while ago. Then my code seems not retrieving currently selected row. Do you think I should use supply function? or can you have a look at the code I pasted in my previous post and am I missing anything?

Regards,

Raju

Former Member
0 Kudos

Perhaps you are calling the BAPI for getting the order items always for the first order?

If you have stored the orders in a context node "Orders", the selected order is at index

wdContext.nodeOrders().getLeadSelection()

Just a guess.

Armin

Former Member
0 Kudos

Good Armin,

Thanks for your help.

I have to try using supply function which I will do later.

I am assigning the points and by the way if you come across any pattern development, please do let me know. I want to develop a search pattern to search order(sales or po or service, etc) after being used in an application

Thanks once again,

Raju