on 01-19-2006 7:43 AM
Hi Everyone,
The two tables in the BAPI share an common field, I want to join the two tables with the common fields, and show/edit it in ONE table in my web dynpro view.
Is there a way to do this, thank you very much!
Regards,
Xiaoming Yang
Hi,
I think, that the simplest solution is implement new rfc function and in this function accomplish data join. Table operation in ABAP are simply to realize (furthermore separation between view and model is better)
Bogdan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I assume your problem is like this:
You have TableA:
PK A1 A2
0 1 1
And table B:
PK B1 B2
0 2 2
Then you will display 2 rows namely:
PK A1 A2 B1 B2
0 1 1
0 2 2
Is my assumption right?
If i understand your problem correctly, you are asking for something to be available at design time to merge two tables?
Well, i guess you need to code for it!
You need to form a table via code, and then populate this table based on your logic. Form columns, attributes etc and fill and add the rows/rowelements according to your key.
I wrote a similar code which you can use for your help:
[code]
public static void wdDoModifyView(IPrivateIntDemandCompView wdThis, IPrivateIntDemandCompView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)
{
//@@begin wdDoModifyView
IPrivateIntDemandCompView.IMergedNodeNode mergedNode = wdContext.nodeMergedNode();
IPrivateIntDemandCompView.IMergedNodeElement mergedNodeElement = null;
rootCount = wdContext.nodeResult().size();
wdContext.currentContextElement().setTemp(rootCount);
wdContext.currentContextElement().setTestStr(wdContext.nodeResult().getResultElementAt(0).getPLANID() + "");
for (int i=0; i<rootCount; i++){
wdContext.nodeResult().setLeadSelection(i);
//wdContext.nodeResult().setSelected(i, true);
rootCellPlanID = wdContext.nodeResult().getResultElementAt(i).getPLANID() + "";
rootCellUsername = wdContext.nodeResult().getResultElementAt(i).getUSERNAME() + "";
rootUUID = wdContext.nodeResult().getResultElementAt(i).getIDField() + "";
//wdContext.currentInputParameter_nElement().setIDField(rootUUID);
//planningQuery.execute();
planningCount = wdContext.nodeResult().nodePLANNINGLEVEL().size();
wdContext.currentContextElement().setTemp1(planningCount);
for (int j = 0; j<planningCount; j++){
mergedNodeElement = mergedNode.createMergedNodeElement();
//wdContext.nodeResult().nodePLANNINGLEVEL().setLeadSelection(j);
//planningCellAggLevel = wdContext.nodeResult_n().getResult_nElementAt(j).getAGGREGATIONLEVEL() + "";
//planningCellAggLevel = wdContext.nodeResult().nodePLANNINGLEVEL().currentPLANNINGLEVELElement().getAGGREGATIONLEVEL() + "";
planningCellAggLevel = wdContext.nodeResult().nodePLANNINGLEVEL().getPLANNINGLEVELElementAt(j).getAGGREGATIONLEVEL() + "";
mergedNodeElement.setPLANID(rootCellPlanID);
mergedNodeElement.setUSERNAME(rootCellUsername);
mergedNodeElement.setAGGREGATIONLEVEL(planningCellAggLevel);
mergedNode.addElement(mergedNodeElement);
}
}
//My experiment - Begins
/*IWDTable table = (IWDTable) view.createElement(IWDTable.class, null);
table.bindDataSource("Root$ROOTQUERY");
IWDTextView editor = null;
IWDTableColumn column1 = (IWDTableColumn)view.createElement(IWDTableColumn.class, null);
table.addGroupedColumn(column1);
IWDTableColumn column2 = (IWDTableColumn)view.createElement(IWDTableColumn.class, null);
table.addGroupedColumn(column2);
IWDTableColumn column3 = (IWDTableColumn)view.createElement(IWDTableColumn.class, null);
table.addGroupedColumn(column3);
//for (int i = 0; i<rootCount; i++){
IWDTextView editor1 = (IWDTextView) view.createElement(IWDTextView.class, null);
editor1.bindText("Root$ROOTQUERY.result.PLANID");
column1.setTableCellEditor(editor1);
IWDTextView editor2 = (IWDTextView) view.createElement(IWDTextView.class, null);
editor2.bindText("Root$ROOTQUERY.result.USERNAME");
column2.setTableCellEditor(editor2);
IWDTextView editor3 = (IWDTextView) view.createElement(IWDTextView.class, null);
editor3.bindText("Root$ROOTQUERY.result.PLANNINGLEVEL.AGGREGATIONLEVEL");
column3.setTableCellEditor(editor3);
IWDUIElementContainer root = (IWDUIElementContainer) view.getRootElement();
root.addChild(table);*/
//}
// My experiment - Ends
//@@end
[/code]
Regards,
Dev
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Devashish,
Thank you very much!
You have TableA:
PK A1 A2
0 1 1
And table B:
PK B1 B2
0 2 2
What I want is to display:
Then you will display 2 rows namely:
PK A1 A2 B1 B2
0 1 1 2 2
and not just display, I want input these value to certain table in BAPI correctly.
Thank you very much for your code, I will have a detail study.
Regards,
Xiaoming Yang
Hello xiaoming yang,
you can use supply function for the node in which you want to combine two nodes.
1. Create a new VALUE NODE in the view's context.
2. Write a Supply Function and get the values from both the BAPI nodes which ruturns the values
3. Bind the VALUE NODE to the table
Balakrishnan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
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.