Drag & Drop, ALV or Table Control to Tree Control
Hi Experts,
If i want Drag & Drop feature in ALV or Table Control to Tree Control
Hi,
refer to the link below:
http://help.sap.com/saphelp_46c/helpdata/fr/22/a3f5fbd2fe11d2b467006094192fe3/content.htm
With luck,
Pritam.
Similar Messages
-
Issue : drag and drop from list control to tree control
Hi,
I was trying a drag and drop from list control to tree control. I have used some sample data to populate list and tree controls .
It is working fine . except one problem ..
Prob : when i drag an item to tree control .. it gets added .. now tree contains (X+1) data in list .. say X is the inital number of nodes in a tree node.
now if i drag another item from list to last item in the tree node .. i.e at X+1 index. .. it throws null pointer exception.
I am considerably new in flex programming . looking for help from experts ..
Below is my code :
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="horizontal"
creationComplete="init()">
<mx:Script>
<![CDATA[
import mx.controls.listClasses.IListItemRenderer;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.utils.ObjectUtil;
import mx.collections.ICollectionView;
import mx.core.UIComponent;
import mx.managers.DragManager;
import mx.events.DragEvent;
import mx.controls.Alert;
import mx.controls.Label;
import mx.events.CloseEvent;
private var homePath:String="/home/e311394/dndTest/";
private var destPath:String="/home/e311394/dndDest/";
private var eid:String="e311394";
private var actn:String;
[Bindable]
private var cm:ContextMenu;
private var cmi:ContextMenuItem;
[Bindable]
private var dp:ArrayCollection;
private function init():void
cmi=new ContextMenuItem("Remove");
cmi.enabled=true;
cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, contextMenuItem_menuItemSelect);
cm=new ContextMenu();
cm.hideBuiltInItems();
cm.customItems=[cmi];
cm.addEventListener(ContextMenuEvent.MENU_SELECT, contextMenuItem_menuSelect);
list.contextMenu=cm;
private function contextMenuItem_menuSelect(evt:ContextMenuEvent):void
list.selectedIndex=lastRollOverIndex;
private function contextMenuItem_menuItemSelect(evt:ContextMenuEvent):void
var loclSelectedRow:Object=list.selectedItem;
var lostrSelectedMenuItem:String;
lostrSelectedMenuItem=evt.target.caption;
if (loclSelectedRow != null)
var obj:Object=new Object()
obj.label=loclSelectedRow.label as String;
//Alert.show(obj.label);
if (lostrSelectedMenuItem == "Remove")
if(loclSelectedRow!=null)
var pth:String=homePath.concat(loclSelectedRow.label);
//Alert.show(pth);
//FlexDnDRemoteService.process(eid,"delete",pth,"-");
var coll:ArrayCollection=list.dataProvider as ArrayCollection;
if (coll.contains(loclSelectedRow))
coll.removeItemAt(coll.getItemIndex(loclSelectedRow));
public function onTreeDragEnter(event:DragEvent):void
event.preventDefault();
DragManager.acceptDragDrop(event.target as UIComponent);
tree.showDropFeedback(event);
protected function onTreeDragOver(event:DragEvent):void
event.preventDefault();
event.currentTarget.hideDropFeedback(event);
try
var index:int=tree.calculateDropIndex(event);
catch (e:Error)
DragManager.showFeedback(DragManager.NONE);
return;
tree.selectedIndex=index;
var draggedOverItem:Object=tree.selectedItem;
public function onTreeDragExit(event:DragEvent):void
event.preventDefault();
tree.hideDropFeedback(event);
private function showAlert():void
Alert.yesLabel="Move";
Alert.noLabel="Copy";
Alert.buttonWidth=70;
Alert.show("Copy / Move ?", "Confirm", Alert.YES | Alert.NO | Alert.CANCEL, this, alertListener, null, Alert.OK);
private function alertListener(eventObj:CloseEvent):void
var result:Boolean=false;
if (eventObj.detail == Alert.CANCEL)
//Alert.show("CANCEL");
return;
if (eventObj.detail == Alert.YES)
//Alert.show("YES");
result=true;
else if (eventObj.detail == Alert.NO)
//Alert.show("NO");
result=false;
var index:int=tree.calculateDropIndex(treedropevt);
//Alert.show("Drop Pos" + index.toString());
/* var treeList:ArrayCollection=tree.dataProvider as ArrayCollection;
Alert.show(" index"+index+"Length "+treeList.length);
if(index > treeList.length)
Alert.show("Returning");
return;
var items:Array=new Array();
if (treedropevt.dragSource.hasFormat("items"))
items=items.concat(treedropevt.dragSource.dataForFormat("items") as Array);
var parentItem:Object;
parentItem=getObjectTarget();
/* if (tree.dataDescriptor.isBranch(tree.indexToItemRenderer(index).data))
parentItem=tree.indexToItemRenderer(index).data;
else
var dropParentPackage:Object = tree.mx_internal::_dropData.parent as Object;
Alert.show("HAck"+dropParentPackage.toString());
parentItem=tree.getParentItem(tree.indexToItemRenderer(index).data);
//Alert.show("Lenght "+ObjectUtil.getClassInfo(parentItem).properties.length);
//Alert.show("Lenght "+ObjectUtil.getClassInfo(parentItem).properties.length);
var position:int=0;
/* if(ObjectUtil.getClassInfo(parentItem).properties.length==0)
Alert.show("Returning");
return;
if (parentItem != null)
try
while (tree.indexToItemRenderer(index).data != parentItem)
//Alert.show(tree.indexToItemRenderer(index).data.toString());
if (index > 0)
index--;
//Alert.show("Insiade");
position++;
catch (e:Error)
Alert.show("Catch" + index.toString());
return;
for each (var item:Object in items)
var obj:Object=new Object()
obj.label=item.label as String;
if (parentItem != null)
//Alert.show("ADDED");
tree.dataDescriptor.addChildAt(parentItem, obj, position++);
else
//Alert.show("PARENT NULL");
tree.dataDescriptor.addChildAt(tree.selectedItem, obj, position++);
var spth:String=homePath.concat(item.label);
//Alert.show(spth);
var dpth:String=destPath.concat(item.label);
//Alert.show(dpth);
if (result == true)
removeItems();
//FlexDnDRemoteService.process(eid,"move",spth,dpth);
else
//FlexDnDRemoteService.process(eid,"copy",spth,dpth);
tree.validateNow();
public function getObjectTarget():Object
var dropData:Object=tree.mx_internal::_dropData as Object;
if (dropData.parent != null)
return dropData.parent;
else
// if there is not parent (root of the tree), I take the root directly
var renderer:IListItemRenderer=tree.indexToItemRenderer(0);
return renderer.data;
public function removeItems():void
//remove moved elements
var items:Array=treedropevt.dragSource.dataForFormat("items") as Array;
var coll:ArrayCollection=list.dataProvider as ArrayCollection;
for each (var item:Object in items)
if (coll.contains(item))
coll.removeItemAt(coll.getItemIndex(item));
private var treedropevt:DragEvent;
public function onTreeDragDrop(event:DragEvent):void
treedropevt=event;
showAlert();
event.preventDefault();
tree.hideDropFeedback(event);
public function resultHandler(event:ResultEvent):void
Alert.show("Success", "Status");
public function faultHandler(event:FaultEvent):void
Alert.show(event.fault.faultString, "Failure");
]]>
</mx:Script>
<mx:ArrayCollection id="listDP">
<mx:Object label="File1.dnd"/>
<mx:Object label="File2.dnd"/>
<mx:Object label="File3.dnd"/>
<mx:Object label="File4.dnd"/>
<mx:Object label="File5.dnd"/>
</mx:ArrayCollection>
<mx:Number id="lastRollOverIndex"/>
<!--
<mx:ArrayCollection id="treeDP">
<mx:Object label="/home">
<mx:children>
<mx:Object label="dummy1.ks"/>
<mx:Object label="dummy2.ks"/>
<mx:Object label="e493126">
<mx:children>
<mx:ArrayCollection>
<mx:Object label="/home/e493126/sample1.ks"/>
</mx:ArrayCollection>
</mx:children>
</mx:Object>
</mx:children>
</mx:Object>
</mx:ArrayCollection>
-->
<mx:ArrayCollection id="treeDP">
<mx:Object label="/dndDest">
<mx:children>
<mx:ArrayCollection>
<mx:Object label="sample1.ks"/>
<mx:Object label="sample2.ks"/>
<mx:Object label="sample3.ks"/>
<mx:Object label="sample4.ks"/>
<mx:Object label="sample5.ks"/>
<mx:Object label="sample6.ks"/>
</mx:ArrayCollection>
</mx:children>
</mx:Object>
</mx:ArrayCollection>
<mx:List id="list"
itemRollOver="lastRollOverIndex = event.rowIndex"
width="50%"
dragEnabled="true"
dataProvider="{listDP}"
labelField="label"
allowMultipleSelection="true"
dragMoveEnabled="false">
</mx:List>
<mx:Tree id="tree"
width="50%"
dragEnabled="true"
dataProvider="{treeDP}"
dragEnter="onTreeDragEnter(event)"
dragOver="onTreeDragOver(event)"
dragExit="onTreeDragExit(event)"
dragDrop="onTreeDragDrop(event)"
labelField="label"
liveScrolling="true">
</mx:Tree>
<mx:RemoteObject id="FlexDnDRemoteService"
showBusyCursor="true"
destination="FlexDnD">
<mx:method name="process"
result="resultHandler(event)"
fault="faultHandler(event)"/>
</mx:RemoteObject>
</mx:Application>
Thanks,
RajivYa , i have searched and have used the same code.
But needed to customize few things like:
stop dnd in same tree
drop some item into a folder ..( onto it ) etc
have achieved the same .. but this issue ..
i think the tree dataprovider (contents internally is not being updated .. only the UI)
any suggestions ?
- Rajiv -
Drag & Drop ALV row to a picture control
Hello. I'm trying to implement drag&drop functionality from an ALV grid to a picture/icon(CL_GUI_PICTURE). Anyone know if this is possible. I can't get my events to fire when dragging/dropping. I have been able to do it from ALV to ALV, but am getting stuck on ALV to Picture. I want some kind of "shopping cart" functionality like in ME22N, where the user can drag a PO from a list into the "shopping cart" picture/icon.
Anyone can help?
Regards,
Rich HeilmanGood afternoon!
I'm trying to do the same, to drag a node of a tree and drop it on a picture control. I have called the set_dragdrop_control and set_dragdrop_picture methods and I'm sure of the set handler statement, but no event is fired.
Can you help me?
Thank you,
Fabiano (from Brazil). -
Drag & Drop ViewObject as Table Exception
Hi,
When I drag & drop any view object onto the page, there are no problems when dropping it as a Form. When I drag & drop the same view object onto the page as a Table, however, a stack trace appears from JDeveloper. I have posted screen shots showing the differences:
Drop as Form (okay): http://i.imgur.com/nMgcb.png
Drop as Table (error): http://i.imgur.com/25836.png
This problem only happens with one specific application. All the other applications can drag & drop without problem.
Suggestions for where to look to resolve the problem would be fantastic. Here is the stack trace:
16-Mar-2010 9:57:34 AM oracle.adf.dt.managers.ApplicationManager findOrCreateDataControlInApplication
FINER: THROW
java.lang.ClassCastException: oracle.xml.parser.v2.XMLComment
at oracle.adf.dt.objects.JUDTApplication$3.run(JUDTApplication.java:590)
at oracle.adfdt.jdev.transaction.JDevTransactionManager$3.performTask(JDevTransactionManager.java:116)
at oracle.bali.xml.model.task.StandardTransactionTask.runThrowingXCE(StandardTransactionTask.java:167)
at oracle.bali.xml.model.task.StandardTransactionTask.run(StandardTransactionTask.java:98)
at oracle.adfdt.jdev.transaction.JDevTransactionManager.fetchUnderTransaction(JDevTransactionManager.java:110)
at oracle.adf.dt.objects.JUDTApplication.findDataControl(JUDTApplication.java:601)
at oracle.adf.dt.managers.ApplicationManager.findOrCreateDataControlInApplication(ApplicationManager.java:518)
at oracle.adf.dt.managers.IteratorManager.initializeIteratorBindingProperties(IteratorManager.java:419)
at oracle.adf.dt.managers.IteratorManager.createIteratorInstance(IteratorManager.java:401)
at oracle.adf.dt.managers.IteratorManager.findOrCreateIterator(IteratorManager.java:245)
at oracle.adf.dt.dbpanel.DataBindingManager$2.run(DataBindingManager.java:965)
at oracle.adfdt.jdev.transaction.JDevTransactionManager$3.performTask(JDevTransactionManager.java:116)
at oracle.bali.xml.model.task.StandardTransactionTask.runThrowingXCE(StandardTransactionTask.java:167)
at oracle.bali.xml.model.task.StandardTransactionTask.run(StandardTransactionTask.java:98)
at oracle.adfdt.jdev.transaction.JDevTransactionManager.fetchUnderTransaction(JDevTransactionManager.java:110)
at oracle.adf.dt.dbpanel.DataBindingManager.findOrCreateIteratorBinding(DataBindingManager.java:986)
at oracle.adf.dt.dbpanel.DataBindingManager$1.run(DataBindingManager.java:1033)
at oracle.adfdt.jdev.transaction.JDevTransactionManager$3.performTask(JDevTransactionManager.java:116)
at oracle.bali.xml.model.task.StandardTransactionTask.runThrowingXCE(StandardTransactionTask.java:167)
at oracle.bali.xml.model.task.StandardTransactionTask.run(StandardTransactionTask.java:98)
at oracle.adfdt.jdev.transaction.JDevTransactionManager.fetchUnderTransaction(JDevTransactionManager.java:110)
at oracle.adf.dt.dbpanel.DataBindingManager.createControlBinding(DataBindingManager.java:1111)
at oracle.adf.dt.dbpanel.DataBindingManager.createControlBinding(DataBindingManager.java:996)
at oracle.adfdt.view.common.binding.utils.ADFBindingUtils.createControlBinding(ADFBindingUtils.java:99)
at oracle.adfdtinternal.view.faces.binding.provider.ADFIteratorModelProvider.getTableBinding(ADFIteratorModelProvider.java:338)
at oracle.adfdtinternal.view.faces.binding.provider.ADFIteratorModelProvider.getIteratorBindingExpression(ADFIteratorModelProvider.java:83)
at oracle.adfdtinternal.view.faces.binding.binder.ADFCustomTableBinder.bind(ADFCustomTableBinder.java:78)
at oracle.adfdtinternal.view.common.binding.creator.XmlBasedCreatorInfo._bindDocumentFragment(XmlBasedCreatorInfo.java:483)
at oracle.adfdtinternal.view.common.binding.creator.XmlBasedCreatorInfo.createDocumentFragment(XmlBasedCreatorInfo.java:257)
at oracle.adfdtinternal.view.common.binding.datatransfer.ADFDocumentFragmentCreatorInfo.createDocumentFragment(ADFDocumentFragmentCreatorInfo.java:76)
at oracle.adfdtinternal.view.common.binding.operation.CreateOperation.apply(CreateOperation.java:96)
at oracle.bali.xml.model.datatransfer.operation.PerformOperationAction.actionPerformed(PerformOperationAction.java:39)
at oracle.bali.xml.share.ActionProxy.actionPerformed(ActionProxy.java:47)
at oracle.bali.xml.gui.swing.dnd.DropMenuInvoker$CleanupProxy.actionPerformed(DropMenuInvoker.java:235)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
java.lang.ClassCastException: oracle.xml.parser.v2.XMLComment
at oracle.adf.dt.objects.JUDTApplication$3.run(JUDTApplication.java:590)
at oracle.adfdt.jdev.transaction.JDevTransactionManager$3.performTask(JDevTransactionManager.java:116)
at oracle.bali.xml.model.task.StandardTransactionTask.runThrowingXCE(StandardTransactionTask.java:167)
at oracle.bali.xml.model.task.StandardTransactionTask.run(StandardTransactionTask.java:98)
at oracle.adfdt.jdev.transaction.JDevTransactionManager.fetchUnderTransaction(JDevTransactionManager.java:110)
at oracle.adf.dt.objects.JUDTApplication.findDataControl(JUDTApplication.java:601)
at oracle.adf.dt.managers.ApplicationManager.findOrCreateDataControlInApplication(ApplicationManager.java:518)
at oracle.adf.dt.managers.IteratorManager.initializeIteratorBindingProperties(IteratorManager.java:419)
at oracle.adf.dt.managers.IteratorManager.createIteratorInstance(IteratorManager.java:401)
at oracle.adf.dt.managers.IteratorManager.findOrCreateIterator(IteratorManager.java:245)
at oracle.adf.dt.dbpanel.DataBindingManager$2.run(DataBindingManager.java:965)
at oracle.adfdt.jdev.transaction.JDevTransactionManager$3.performTask(JDevTransactionManager.java:116)
at oracle.bali.xml.model.task.StandardTransactionTask.runThrowingXCE(StandardTransactionTask.java:167)
at oracle.bali.xml.model.task.StandardTransactionTask.run(StandardTransactionTask.java:98)
at oracle.adfdt.jdev.transaction.JDevTransactionManager.fetchUnderTransaction(JDevTransactionManager.java:110)
at oracle.adf.dt.dbpanel.DataBindingManager.findOrCreateIteratorBinding(DataBindingManager.java:986)
at oracle.adf.dt.dbpanel.DataBindingManager$1.run(DataBindingManager.java:1033)
at oracle.adfdt.jdev.transaction.JDevTransactionManager$3.performTask(JDevTransactionManager.java:116)
at oracle.bali.xml.model.task.StandardTransactionTask.runThrowingXCE(StandardTransactionTask.java:167)
at oracle.bali.xml.model.task.StandardTransactionTask.run(StandardTransactionTask.java:98)
at oracle.adfdt.jdev.transaction.JDevTransactionManager.fetchUnderTransaction(JDevTransactionManager.java:110)
at oracle.adf.dt.dbpanel.DataBindingManager.createControlBinding(DataBindingManager.java:1111)
at oracle.adf.dt.dbpanel.DataBindingManager.createControlBinding(DataBindingManager.java:996)
at oracle.adfdt.view.common.binding.utils.ADFBindingUtils.createControlBinding(ADFBindingUtils.java:99)
at oracle.adfdtinternal.view.faces.binding.provider.ADFIteratorModelProvider.getTableBinding(ADFIteratorModelProvider.java:338)
at oracle.adfdtinternal.view.faces.binding.provider.ADFIteratorModelProvider.getIteratorBindingExpression(ADFIteratorModelProvider.java:83)
at oracle.adfdtinternal.view.faces.binding.binder.ADFCustomTableBinder.bind(ADFCustomTableBinder.java:78)
at oracle.adfdtinternal.view.common.binding.creator.XmlBasedCreatorInfo._bindDocumentFragment(XmlBasedCreatorInfo.java:483)
at oracle.adfdtinternal.view.common.binding.creator.XmlBasedCreatorInfo.createDocumentFragment(XmlBasedCreatorInfo.java:257)
at oracle.adfdtinternal.view.common.binding.datatransfer.ADFDocumentFragmentCreatorInfo.createDocumentFragment(ADFDocumentFragmentCreatorInfo.java:76)
at oracle.adfdtinternal.view.common.binding.operation.CreateOperation.apply(CreateOperation.java:96)
at oracle.bali.xml.model.datatransfer.operation.PerformOperationAction.actionPerformed(PerformOperationAction.java:39)
at oracle.bali.xml.share.ActionProxy.actionPerformed(ActionProxy.java:47)
at oracle.bali.xml.gui.swing.dnd.DropMenuInvoker$CleanupProxy.actionPerformed(DropMenuInvoker.java:235)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
16-Mar-2010 9:57:34 AM oracle.adf.dt.managers.IteratorManager createIteratorInstance
FINER: THROW
java.lang.NullPointerException
at oracle.adf.dt.managers.IteratorManager.initializeIteratorBindingProperties(IteratorManager.java:422)
at oracle.adf.dt.managers.IteratorManager.createIteratorInstance(IteratorManager.java:401)
at oracle.adf.dt.managers.IteratorManager.findOrCreateIterator(IteratorManager.java:245)
at oracle.adf.dt.dbpanel.DataBindingManager$2.run(DataBindingManager.java:965)
at oracle.adfdt.jdev.transaction.JDevTransactionManager$3.performTask(JDevTransactionManager.java:116)
at oracle.bali.xml.model.task.StandardTransactionTask.runThrowingXCE(StandardTransactionTask.java:167)
at oracle.bali.xml.model.task.StandardTransactionTask.run(StandardTransactionTask.java:98)
at oracle.adfdt.jdev.transaction.JDevTransactionManager.fetchUnderTransaction(JDevTransactionManager.java:110)
at oracle.adf.dt.dbpanel.DataBindingManager.findOrCreateIteratorBinding(DataBindingManager.java:986)
at oracle.adf.dt.dbpanel.DataBindingManager$1.run(DataBindingManager.java:1033)
at oracle.adfdt.jdev.transaction.JDevTransactionManager$3.performTask(JDevTransactionManager.java:116)
at oracle.bali.xml.model.task.StandardTransactionTask.runThrowingXCE(StandardTransactionTask.java:167)
at oracle.bali.xml.model.task.StandardTransactionTask.run(StandardTransactionTask.java:98)
at oracle.adfdt.jdev.transaction.JDevTransactionManager.fetchUnderTransaction(JDevTransactionManager.java:110)
at oracle.adf.dt.dbpanel.DataBindingManager.createControlBinding(DataBindingManager.java:1111)
at oracle.adf.dt.dbpanel.DataBindingManager.createControlBinding(DataBindingManager.java:996)
at oracle.adfdt.view.common.binding.utils.ADFBindingUtils.createControlBinding(ADFBindingUtils.java:99)
at oracle.adfdtinternal.view.faces.binding.provider.ADFIteratorModelProvider.getTableBinding(ADFIteratorModelProvider.java:338)
at oracle.adfdtinternal.view.faces.binding.provider.ADFIteratorModelProvider.getIteratorBindingExpression(ADFIteratorModelProvider.java:83)
at oracle.adfdtinternal.view.faces.binding.binder.ADFCustomTableBinder.bind(ADFCustomTableBinder.java:78)
at oracle.adfdtinternal.view.common.binding.creator.XmlBasedCreatorInfo._bindDocumentFragment(XmlBasedCreatorInfo.java:483)
at oracle.adfdtinternal.view.common.binding.creator.XmlBasedCreatorInfo.createDocumentFragment(XmlBasedCreatorInfo.java:257)
at oracle.adfdtinternal.view.common.binding.datatransfer.ADFDocumentFragmentCreatorInfo.createDocumentFragment(ADFDocumentFragmentCreatorInfo.java:76)
at oracle.adfdtinternal.view.common.binding.operation.CreateOperation.apply(CreateOperation.java:96)
at oracle.bali.xml.model.datatransfer.operation.PerformOperationAction.actionPerformed(PerformOperationAction.java:39)
at oracle.bali.xml.share.ActionProxy.actionPerformed(ActionProxy.java:47)
at oracle.bali.xml.gui.swing.dnd.DropMenuInvoker$CleanupProxy.actionPerformed(DropMenuInvoker.java:235)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
java.lang.NullPointerException
at oracle.adf.dt.managers.IteratorManager.initializeIteratorBindingProperties(IteratorManager.java:422)
at oracle.adf.dt.managers.IteratorManager.createIteratorInstance(IteratorManager.java:401)
at oracle.adf.dt.managers.IteratorManager.findOrCreateIterator(IteratorManager.java:245)
at oracle.adf.dt.dbpanel.DataBindingManager$2.run(DataBindingManager.java:965)
at oracle.adfdt.jdev.transaction.JDevTransactionManager$3.performTask(JDevTransactionManager.java:116)
at oracle.bali.xml.model.task.StandardTransactionTask.runThrowingXCE(StandardTransactionTask.java:167)
at oracle.bali.xml.model.task.StandardTransactionTask.run(StandardTransactionTask.java:98)
at oracle.adfdt.jdev.transaction.JDevTransactionManager.fetchUnderTransaction(JDevTransactionManager.java:110)
at oracle.adf.dt.dbpanel.DataBindingManager.findOrCreateIteratorBinding(DataBindingManager.java:986)
at oracle.adf.dt.dbpanel.DataBindingManager$1.run(DataBindingManager.java:1033)
at oracle.adfdt.jdev.transaction.JDevTransactionManager$3.performTask(JDevTransactionManager.java:116)
at oracle.bali.xml.model.task.StandardTransactionTask.runThrowingXCE(StandardTransactionTask.java:167)
at oracle.bali.xml.model.task.StandardTransactionTask.run(StandardTransactionTask.java:98)
at oracle.adfdt.jdev.transaction.JDevTransactionManager.fetchUnderTransaction(JDevTransactionManager.java:110)
at oracle.adf.dt.dbpanel.DataBindingManager.createControlBinding(DataBindingManager.java:1111)
at oracle.adf.dt.dbpanel.DataBindingManager.createControlBinding(DataBindingManager.java:996)
at oracle.adfdt.view.common.binding.utils.ADFBindingUtils.createControlBinding(ADFBindingUtils.java:99)
at oracle.adfdtinternal.view.faces.binding.provider.ADFIteratorModelProvider.getTableBinding(ADFIteratorModelProvider.java:338)
at oracle.adfdtinternal.view.faces.binding.provider.ADFIteratorModelProvider.getIteratorBindingExpression(ADFIteratorModelProvider.java:83)
at oracle.adfdtinternal.view.faces.binding.binder.ADFCustomTableBinder.bind(ADFCustomTableBinder.java:78)
at oracle.adfdtinternal.view.common.binding.creator.XmlBasedCreatorInfo._bindDocumentFragment(XmlBasedCreatorInfo.java:483)
at oracle.adfdtinternal.view.common.binding.creator.XmlBasedCreatorInfo.createDocumentFragment(XmlBasedCreatorInfo.java:257)
at oracle.adfdtinternal.view.common.binding.datatransfer.ADFDocumentFragmentCreatorInfo.createDocumentFragment(ADFDocumentFragmentCreatorInfo.java:76)
at oracle.adfdtinternal.view.common.binding.operation.CreateOperation.apply(CreateOperation.java:96)
at oracle.bali.xml.model.datatransfer.operation.PerformOperationAction.actionPerformed(PerformOperationAction.java:39)
at oracle.bali.xml.share.ActionProxy.actionPerformed(ActionProxy.java:47)
at oracle.bali.xml.gui.swing.dnd.DropMenuInvoker$CleanupProxy.actionPerformed(DropMenuInvoker.java:235)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)Edited by: Dolphin on Mar 16, 2010 10:11 AMThere was an XML comment inside the data bindings file (DataBindings.cpx).
-
Control Framework tree control event not trigerring
The event handle_node_double_click is not trigerring on the tree controls . I want to display the contents of the nodes on the text editor on trigerring of this event
*& Report ZCONTROLS_TREE_TEDIT_SPITTER
REPORT zcontrols_tree_tedit_spitter.
DATA : editor TYPE REF TO cl_gui_textedit,
tree TYPE REF TO cl_gui_simple_tree.
DATA : container TYPE REF TO cl_gui_custom_container,
splitter TYPE REF TO cl_gui_easy_splitter_container,
right TYPE REF TO cl_gui_container,
left TYPE REF TO cl_gui_container.
DATA : node_itab LIKE node_str OCCURS 0.
CLASS EVENT_HANDLER DEFINITION
CLASS event_handler DEFINITION.
PUBLIC SECTION.
METHODS : handle_node_double_click
FOR EVENT NODE_DOUBLE_CLICK OF cl_gui_simple_tree
IMPORTING node_key.
ENDCLASS. "EVENT_HANDLER DEFINITION
CLASS EVENT_HANDLER IMPLEMENTATION
CLASS event_handler IMPLEMENTATION.
METHOD handle_node_double_click.
perform node_double_click using node_key.
ENDMETHOD. "HANDLE_NODE_DOUBLE_CLICK
ENDCLASS. "EVENT_HANDLER IMPLEMENTATION
data : handler1 type ref to event_handler.
START-OF-SELECTION.
CALL SCREEN 9001.
*& Module start OUTPUT
text
MODULE start OUTPUT.
SET PF-STATUS 'ZSTAT1'.
IF container IS INITIAL.
CREATE OBJECT container
EXPORTING
container_name = 'CONTAINER_NAME'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CREATE OBJECT splitter
EXPORTING
parent = container
orientation = 1
name = 'Mohit'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
left = splitter->top_left_container.
right = splitter->bottom_right_container.
CREATE OBJECT editor
EXPORTING
parent = right
name = 'MohitEditor'
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
gui_type_not_supported = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CREATE OBJECT tree
EXPORTING
parent = left
node_selection_mode = tree->node_sel_mode_single
name = 'MohitTree'
EXCEPTIONS
lifetime_error = 1
cntl_system_error = 2
create_error = 3
failed = 4
illegal_node_selection_mode = 5
OTHERS = 6
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
PERFORM fill_tree.
CALL METHOD tree->add_nodes
EXPORTING
table_structure_name = 'NODE_STR'
node_table = node_itab
EXCEPTIONS
error_in_node_table = 1
failed = 2
dp_error = 3
table_structure_name_not_found = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
create object handler1.
set handler handler1->handle_node_double_click for tree.
ENDIF.
ENDMODULE. " start OUTPUT
*& Module USER_COMMAND_9001 INPUT
text
MODULE user_command_9001 INPUT.
CALL METHOD cl_gui_cfw=>dispatch.
ENDMODULE. " USER_COMMAND_9001 INPUT
*& Form fill_tree
text
--> p1 text
<-- p2 text
FORM fill_tree .
DATA : node LIKE node_str.
CLEAR node.
node-node_key = 'head_mohit'.
node-isfolder = 'X'.
node-text = 'Mohit'.
APPEND node TO node_itab.
CLEAR node.
node-node_key = 'Child1'.
node-relatkey = 'head_mohit'.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-text = 'Mohit is the best '.
APPEND node TO node_itab.
CLEAR node.
node-node_key = 'Child2'.
node-relatkey = 'head_mohit'.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-text = 'Mohit is the bestest '.
APPEND node TO node_itab.
CLEAR node.
node-node_key = 'head_JAIN'.
node-isfolder = 'X'.
node-text = 'jAIN'.
APPEND node TO node_itab.
CLEAR node.
node-node_key = 'Child3'.
node-relatkey = 'head_JAIN'.
node-relatship = cl_gui_simple_tree=>relat_next_sibling.
node-text = 'cnh INDIA '.
APPEND node TO node_itab.
CLEAR node.
node-node_key = 'Child4'.
node-relatkey = 'head_JAIN'.
node-relatship = cl_gui_simple_tree=>relat_last_child.
node-text = 'SAP '.
APPEND node TO node_itab.
ENDFORM. " fill_tree
*& Form node_double_click
text
-->P_NODE_KEY text
form node_double_click using p_node_key type TV_NODEKEY.
DATA : node LIKE node_str.
DATA textline(256).
DATA text_table LIKE STANDARD TABLE OF textline.
READ TABLE node_itab WITH KEY node_key = p_node_key
INTO node.
endform. " node_double_click
*& Module exit INPUT
text
module exit input.
CASE sy-ucomm.
WHEN 'EXIT'.
LEAVE PROGRAM.
ENDCASE.
endmodule. " exit INPUTHello Mohit
Here is a sample routine (taken from BCALV_TREE_02) which you have to add and adapt for your report. It does two things:
1. Register events that should be handled (required but not sufficient for event handling)
2. Set event handler for registered events
The first step is different from ALV grid controls because here all events are already registered with the control (not the control framework).
Set the event handler (statement SET HANDLER) registers the event handling with the control framework.
FORM register_events.
*§4. Event registration: tell ALV Tree which events shall be passed
* from frontend to backend.
DATA: lt_events TYPE cntl_simple_events,
l_event TYPE cntl_simple_event,
l_event_receiver TYPE REF TO lcl_tree_event_receiver.
*§4a. Frontend registration(i): get already registered tree events.
* The following four tree events registers ALV Tree in the constructor
* method itself.
* - cl_gui_column_tree=>eventid_expand_no_children
* (needed to load data to frontend when a user expands a node)
* - cl_gui_column_tree=>eventid_header_context_men_req
* (needed for header context menu)
* - cl_gui_column_tree=>eventid_header_click
* (allows selection of columns (only when item selection activated))
* - cl_gui_column_tree=>eventid_item_keypress
* (needed for F1-Help (only when item selection activated))
* Nevertheless you have to provide their IDs again if you register
* additional events with SET_REGISTERED_EVENTS (see below).
* To do so, call first method GET_REGISTERED_EVENTS (this way,
* all already registered events remain registered, even your own):
call method g_alv_tree->get_registered_events
importing events = lt_events.
* (If you do not these events will be deregistered!!!).
* You do not have to register events of the toolbar again.
*§4b. Frontend registration(ii): add additional event ids
l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
APPEND l_event TO lt_events.
*§4c. Frontend registration(iii):provide new event table to alv tree
CALL METHOD g_alv_tree->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
*§4d. Register events on backend (ABAP Objects event handling)
CREATE OBJECT l_event_receiver.
SET HANDLER l_event_receiver->handle_node_double_click FOR g_alv_tree.
ENDFORM. " register_events
Regards
Uwe -
Drag and drop ALV to table control
Hi all,
Does anyone know if it is possible to program the drag-and-drop functionality from an ALV list to a table control? I would like to have this feature to let the user enter data on 1 screen. On the left part the user sees an ALV list and on the right the user sees the online transaction. I would like the user to enter data simply by drag and drop instead of having to enter the data.
Does someone has a sample program for this?
Regards,
KrisHi Kris
I can download the programs and send them to you, but you should give me your e-mail.
Anyway you can use Drag and Drop if you build your table control by ALV, i.e. ALV GRID.
But I'm using 4.7 and I don't know how class CL_GUI_ALV_GRID is in your release, I believe the release 4.6B is one of first release whit this class.
Max -
Drag & drop from sorted table view to outline view in AppleScript Studio
I want to make a drag and drop from a sorted table view to an outline view in applescript Studio.
Problem is that the data are copied from the data source of the table view,
wich is unsorted, rather than from the table view itself that is sorted.
So I have the wrong data droped.
The element wich is passed from the table view thru the outline view is the row number. Then the script find the data of the corresponding row of the data source of the table view(unsorted).
I want the script, using the row number, to get the content of the displayed row of the table view (sorted).
Any help welcome.I want to make a drag and drop from a sorted table view to an outline view in applescript Studio.
Problem is that the data are copied from the data source of the table view,
wich is unsorted, rather than from the table view itself that is sorted.
So I have the wrong data droped.
The element wich is passed from the table view thru the outline view is the row number. Then the script find the data of the corresponding row of the data source of the table view(unsorted).
I want the script, using the row number, to get the content of the displayed row of the table view (sorted).
Any help welcome. -
Re-create Tree control drag and drop move
Hello,
Ive got a tree control where dragEnabled=true and I have
custom handlers for dragEnter, dragOver, and dragDrop so that I can
drag/drop from datagrid's to the tree and it works fine.
The issue is now the built in tree functionality for moving
nodes around within the tree is gone. When I set dropEnabled=true
it breaks the ability to drop from the datagrid to the tree.
How can i keep the ability to move tree nodes within the tree
and also be able to drag and drop from a datagrid onto the tree?
Thanks for any help!While doing more testing I found the solution.. seriously...
dont know how I should have known this one...
on Tree dragOver handler:
if( from.id == 'data_grid' ) event.preventDefault(); -
I have implemented drag & drop using a datagrid and a list control. The items that need to be dragged are a simple value object that conatin data. Everything works as far as the drag/drop operations, however, I need to be able to know which item has been dropped. It's probably simple, but I can't find it. Can anyone help?
Just give each item an id
and listen to the
<s:List id="destList"
dragDrop="destList_dragDropHandler(event)" -
Drag and Drop between two ALV Tree Controls
Hello all,
I have designed a spilt control of two ALV Trees using CL_GUI_ALV_TREE.
I have a top node as the Sales order Number and the child node as the items belonging to that sales order number.
Now i need to drag and drop the lines from one sales order to another.
Also these drag drop can take place between the nodes of the two different trees.
Can someone provide with a detail example as i need to complete the same urgently.
Regards,
ArunOnce check the Below code For tree to tree drag an drop
* CLASS lcl_main DEFINITION
CLASS lcl_main DEFINITION.
PUBLIC SECTION.
* Types
TYPES:
BEGIN OF t_ekpo,
ebeln TYPE ebeln,
ebelp TYPE ebelp,
END OF t_ekpo.
TYPES:
BEGIN OF t_vbap,
vbeln TYPE vbeln,
posnr TYPE vbelp,
END OF t_vbap.
* Internal Tables
DATA:
i_ekpo TYPE STANDARD TABLE OF t_ekpo,
i_ekpo_op TYPE STANDARD TABLE OF t_ekpo,
i_vbap TYPE STANDARD TABLE OF t_vbap,
i_vbap_op TYPE STANDARD TABLE OF t_vbap,
i_fcat_ekpo TYPE lvc_t_fcat,
i_fcat_vbap TYPE lvc_t_fcat.
* Work Areas
DATA:
wa_ekpo TYPE t_ekpo,
wa_ekpo1 TYPE t_ekpo,
wa_vbap TYPE t_vbap,
wa_vbap1 TYPE t_vbap.
* Data Declarations
DATA:
g_ebeln TYPE ebeln,
g_vbeln TYPE vbeln_va.
DATA: g_variant TYPE disvariant,
g_hierarchy_header TYPE treev_hhdr,
g_handle_drag TYPE i,
g_handle_drop TYPE i.
* Class data
DATA:
splitter TYPE REF TO cl_gui_splitter_container,
container TYPE REF TO cl_gui_custom_container,
container_1 TYPE REF TO cl_gui_container,
container_2 TYPE REF TO cl_gui_container,
tree1 TYPE REF TO cl_gui_alv_tree,
tree2 TYPE REF TO cl_gui_alv_tree,
g_drag TYPE REF TO cl_dragdrop,
g_drop TYPE REF TO cl_dragdrop.
* Constants
CONSTANTS:
c_30(2) TYPE c VALUE '30'.
* Methods
METHODS:
get_data, " Data Fatch
build_display, " Display Container
display_ekpo, " Ekpo table display
display_vbap, " Vbap table display
add_node_ekpo " Add node to Ekpo
IMPORTING table TYPE t_ekpo
key TYPE lvc_nkey
text TYPE lvc_value
flag TYPE c
CHANGING i_key TYPE lvc_nkey,
add_node_vbap " Add node to vbap
IMPORTING table TYPE t_vbap
key TYPE lvc_nkey
text TYPE lvc_value
flag TYPE c
CHANGING i_key TYPE lvc_nkey,
dnd_behaviour, " Drag and drop behavour
register_events_ekpo, " Register Events Ekpo
register_events_vbap, " Register events vbap
handle_drag_multiple " Drag Multiple Values
FOR EVENT on_drag_multiple
OF cl_gui_alv_tree
IMPORTING sender node_key_table fieldname drag_drop_object,
handle_drop " Drop the values
FOR EVENT on_drop
OF cl_gui_alv_tree
IMPORTING sender node_key drag_drop_object,
add_node_drop " Add node to Drop Node
IMPORTING table TYPE t_ekpo
key TYPE lvc_nkey
text TYPE lvc_value
CHANGING i_key TYPE lvc_nkey.
ENDCLASS. " Lcl_main DEFINITION
* CLASS LCL_DRAGOBJ DEFINITION
* Drag And drop Structure
CLASS lcl_dragobj DEFINITION INHERITING FROM lcl_main FINAL.
PUBLIC SECTION.
* Types
TYPES: BEGIN OF t_node_info,
l_ekpo TYPE t_ekpo,
l_node_text TYPE lvc_value,
l_node_key TYPE lvc_nkey,
END OF t_node_info.
* Data
DATA: i_node_info TYPE TABLE OF t_node_info,
wa_node_info TYPE t_node_info.
ENDCLASS. " LCL_DRAGOBJ DEFINITION
* Object Declarations
DATA obj_main TYPE REF TO lcl_main.
* Initialization *
INITIALIZATION.
CREATE OBJECT obj_main.
* Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME.
SELECT-OPTIONS:
s_ebeln FOR obj_main->g_ebeln,
s_vbeln FOR obj_main->g_vbeln MATCHCODE OBJECT cs_vbeln.
SELECTION-SCREEN END OF BLOCK block1.
* Start of Selection *
START-OF-SELECTION.
* Call Screen
CALL SCREEN 100.
* CLASS lcl_main IMPLEMENTATION
* Local class Implementation
CLASS lcl_main IMPLEMENTATION.
* Get Data *
METHOD get_data.
* Data from Ekpo
SELECT ebeln
ebelp
FROM ekpo
UP TO 100 ROWS
INTO TABLE i_ekpo
WHERE ebeln IN s_ebeln.
* Data from Vbap
SELECT vbeln
posnr
FROM vbap
UP TO 100 ROWS
INTO TABLE i_vbap
WHERE vbeln IN s_vbeln.
ENDMETHOD. " Get_data
* Build Display *
METHOD build_display.
* Create Container
CREATE OBJECT container
EXPORTING
container_name = 'CUST_CONT'.
* Split the container
CREATE OBJECT splitter
EXPORTING
parent = container
rows = 1
columns = 2.
CALL METHOD splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = container_1.
CALL METHOD splitter->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = container_2.
* create tree control
CREATE OBJECT tree1
EXPORTING
parent = container_1
node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple
item_selection = 'X'
no_html_header = 'X'
no_toolbar = 'X'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
IF sy-subrc NE 0.
CLEAR sy-subrc.
ENDIF. " IF sy-subrc NE 0.
CREATE OBJECT tree2
EXPORTING
parent = container_2
node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple
item_selection = 'X'
no_html_header = 'X'
no_toolbar = 'X'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
IF sy-subrc NE 0.
CLEAR sy-subrc.
ENDIF. " IF sy-subrc NE 0.
g_variant-report = sy-repid.
g_variant-handle = space.
g_variant-log_group = space.
g_variant-username = space.
g_variant-text = space.
g_variant-dependvars = space.
* Call method for get data
CALL METHOD get_data.
* Drap And Drop behaviour method
CALL METHOD dnd_behaviour.
* Display the Ekpo table
CALL METHOD obj_main->display_ekpo.
* Diaplay the vbap table
CALL METHOD obj_main->display_vbap.
CALL METHOD tree1->frontend_update.
CALL METHOD tree2->frontend_update.
ENDMETHOD. " Build_display
* Display EKPO *
METHOD display_ekpo.
* Data
DATA:
l_key1 TYPE lvc_nkey,
l_key2 TYPE lvc_nkey,
l_key3 TYPE lvc_nkey,
l_node_text TYPE lvc_value.
* ALV control service modules
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_buffer_active = 'X'
i_structure_name = 'EKPO'
i_client_never_display = 'X'
i_bypassing_buffer = space
CHANGING
ct_fieldcat = i_fcat_ekpo
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc EQ 0.
DELETE i_fcat_ekpo FROM 4.
ENDIF. " IF sy-subrc EQ 0.
g_hierarchy_header-heading = 'Purchase Order Details'(001).
g_hierarchy_header-tooltip = 'Purchase Order'(002).
g_hierarchy_header-width = c_30.
g_hierarchy_header-width_pix = ' '.
* Diaply
CALL METHOD tree1->set_table_for_first_display
EXPORTING
is_hierarchy_header = g_hierarchy_header
is_variant = g_variant
CHANGING
it_outtab = obj_main->i_ekpo_op
it_fieldcatalog = i_fcat_ekpo.
LOOP AT i_ekpo INTO wa_ekpo1.
MOVE wa_ekpo1 TO wa_ekpo.
l_key1 = ''.
AT NEW ebeln.
MOVE wa_ekpo-ebeln TO l_node_text.
* Call method for Add Node to Ekpo
CALL METHOD add_node_ekpo
EXPORTING
table = wa_ekpo
key = l_key1
text = l_node_text
flag = space
CHANGING
i_key = l_key2.
ENDAT.
CLEAR l_node_text.
MOVE wa_ekpo-ebelp TO l_node_text.
* Call method for Add Node to Ekpo
CALL METHOD add_node_ekpo
EXPORTING
table = wa_ekpo
key = l_key2
text = l_node_text
flag = 'X'
CHANGING
i_key = l_key3.
ENDLOOP. " LOOP AT i_ekpo INTO wa_ekpo1.
* Call method For Register events
CALL METHOD register_events_ekpo.
ENDMETHOD. " Display_ekpo
* Display VBAP *
METHOD display_vbap.
* Data
DATA:
l_key1 TYPE lvc_nkey,
l_key2 TYPE lvc_nkey,
l_key3 TYPE lvc_nkey,
l_node_text TYPE lvc_value.
REFRESH i_fcat_vbap.
* ALV control service modules
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_buffer_active = 'X'
i_structure_name = 'VBAP'
i_client_never_display = 'X'
i_bypassing_buffer = space
CHANGING
ct_fieldcat = i_fcat_vbap
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc EQ 0.
DELETE i_fcat_vbap FROM 4.
ENDIF. " IF sy-subrc EQ 0.
g_hierarchy_header-heading = 'Sales Order Details'(003).
g_hierarchy_header-tooltip = 'Sales Order'(004).
g_hierarchy_header-width = c_30.
g_hierarchy_header-width_pix = ' '.
* Display
CALL METHOD tree2->set_table_for_first_display
EXPORTING
is_hierarchy_header = g_hierarchy_header
is_variant = g_variant
CHANGING
it_outtab = obj_main->i_vbap_op
it_fieldcatalog = i_fcat_vbap.
LOOP AT i_vbap INTO wa_vbap1.
MOVE wa_vbap1 TO wa_vbap.
l_key1 = ''.
AT NEW vbeln.
MOVE wa_vbap-vbeln TO l_node_text.
* Call method for Add Node to vbap
CALL METHOD add_node_vbap
EXPORTING
table = wa_vbap
key = l_key1
text = l_node_text
flag = 'X'
CHANGING
i_key = l_key2.
ENDAT.
CLEAR l_node_text.
MOVE wa_vbap-posnr TO l_node_text.
* Call method for Add Node to vbap
CALL METHOD add_node_vbap
EXPORTING
table = wa_vbap
key = l_key2
text = l_node_text
flag = space
CHANGING
i_key = l_key3.
ENDLOOP. " LOOP AT i_vbap INTO wa_vbap1.
* Call method For Register events
CALL METHOD register_events_vbap.
ENDMETHOD. " Display_vbap
* Add Node to Ekko *
METHOD add_node_ekpo.
* Data
DATA: l_layout_node TYPE lvc_s_layn.
IF flag = 'X'.
l_layout_node-dragdropid = g_handle_drag.
ENDIF. " IF flag = 'X'.
* Add node to tree1
CALL METHOD tree1->add_node
EXPORTING
i_relat_node_key = key
i_relationship = cl_gui_column_tree=>relat_last_child
is_outtab_line = table
i_node_text = text
is_node_layout = l_layout_node
IMPORTING
e_new_node_key = i_key
EXCEPTIONS
relat_node_not_found = 1
node_not_found = 2
OTHERS = 3.
IF sy-subrc NE 0.
CLEAR sy-subrc.
ENDIF. " IF sy-subrc NE 0.
ENDMETHOD. " Add_node_ekpo
* Add Node to Vbap *
METHOD add_node_vbap.
* Data
DATA: l_layout_node TYPE lvc_s_layn.
IF flag = 'X'.
l_layout_node-dragdropid = g_handle_drop.
ENDIF. " IF flag = 'X'.
* Add node for tree2
CALL METHOD tree2->add_node
EXPORTING
i_relat_node_key = key
i_relationship = cl_gui_column_tree=>relat_last_child
is_outtab_line = table
i_node_text = text
is_node_layout = l_layout_node
IMPORTING
e_new_node_key = i_key
EXCEPTIONS
relat_node_not_found = 1
node_not_found = 2
OTHERS = 3.
IF sy-subrc NE 0.
CLEAR sy-subrc.
ENDIF. " IF sy-subrc NE 0.
ENDMETHOD. " Add_node_vbap
* Dnd behaviour *
METHOD dnd_behaviour.
* Data
DATA: effect TYPE i,
l_flavor TYPE c VALUE 'f'.
* For drag
CREATE OBJECT g_drag.
effect = cl_dragdrop=>copy.
CALL METHOD g_drag->add
EXPORTING
flavor = l_flavor
dragsrc = 'X'
droptarget = ' '
effect = effect
effect_in_ctrl = effect.
CALL METHOD g_drag->get_handle
IMPORTING
handle = g_handle_drag.
* For Drop
CREATE OBJECT g_drop.
effect = cl_dragdrop=>copy.
CALL METHOD g_drop->add
EXPORTING
flavor = l_flavor
dragsrc = ' '
droptarget = 'X'
effect = effect
effect_in_ctrl = effect.
CALL METHOD g_drop->get_handle
IMPORTING
handle = g_handle_drop.
ENDMETHOD. " Dnd_behaviour
* register events *
METHOD register_events_ekpo.
* Data
DATA: lt_events TYPE cntl_simple_events.
* Tree events registers ALV Tree
CALL METHOD tree1->get_registered_events
IMPORTING
events = lt_events.
* Register events on frontend
CALL METHOD tree1->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
IF sy-subrc NE 0.
CLEAR sy-subrc.
ENDIF. " IF sy-subrc NE 0.
* Event Handling
SET HANDLER obj_main->handle_drag_multiple FOR tree1.
ENDMETHOD. " Register_events_ekpo
* register events *
METHOD register_events_vbap.
* Data
DATA: lt_events TYPE cntl_simple_events.
* Tree events registers ALV Tree
CALL METHOD tree2->get_registered_events
IMPORTING
events = lt_events.
* Register events on frontend
CALL METHOD tree2->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
IF sy-subrc NE 0.
CLEAR sy-subrc.
ENDIF. " IF sy-subrc NE 0.
* Event
SET HANDLER obj_main->handle_drop FOR tree2.
ENDMETHOD. " Register_events_vbap
* Handle drag multiple Values *
METHOD handle_drag_multiple.
* Data
DATA: dataobj TYPE REF TO lcl_dragobj,
l_node_key TYPE lvc_nkey,
l_ekpo TYPE t_ekpo,
l_node_text TYPE lvc_value,
l_node_layout TYPE lvc_s_layn.
* Create and fill dataobject for event ON_DROP.
CREATE OBJECT dataobj.
* Loop the Node key Table
LOOP AT node_key_table INTO l_node_key.
CALL METHOD sender->get_outtab_line
EXPORTING
i_node_key = l_node_key
IMPORTING
e_outtab_line = l_ekpo
e_node_text = l_node_text
es_node_layout = l_node_layout.
IF l_node_layout-isfolder NE 'X'.
dataobj->wa_node_info-l_node_key = l_node_key.
dataobj->wa_node_info-l_ekpo = l_ekpo.
dataobj->wa_node_info-l_node_text = l_node_text.
APPEND dataobj->wa_node_info TO dataobj->i_node_info.
ENDIF. " IF l_node_layout-isfolder NE 'X'.
ENDLOOP. " LOOP AT node_key_table INTO l_node_key
drag_drop_object->object = dataobj.
ENDMETHOD. " Handle_drag_multiple
* Handle drop multiple Values *
METHOD handle_drop.
DATA: dataobj TYPE REF TO lcl_dragobj,
l_new_key TYPE lvc_nkey,
l_node_text TYPE lvc_value.
CATCH SYSTEM-EXCEPTIONS move_cast_error = 1.
* ON_DROP
dataobj ?= drag_drop_object->object.
LOOP AT dataobj->i_node_info INTO dataobj->wa_node_info.
MOVE dataobj->wa_node_info-l_node_text TO l_node_text.
* Call method for Add Node to vbap
CALL METHOD add_node_drop
EXPORTING
table = dataobj->wa_node_info-l_ekpo
key = node_key
text = l_node_text
CHANGING
i_key = l_new_key.
ENDLOOP. " LOOP AT dataobj->i_node_info INTO dataobj->wa_node_inf
* Expand the node
CALL METHOD sender->expand_node
EXPORTING
i_node_key = node_key
CALL METHOD sender->frontend_update.
ENDCATCH.
IF sy-subrc NE 0.
CALL METHOD drag_drop_object->abort.
ENDIF. " IF sy-subrc NE 0
ENDMETHOD. " Handle_drop
* Add Node to drop *
METHOD add_node_drop.
* Add node to drop tree
CALL METHOD tree2->add_node
EXPORTING
i_relat_node_key = key
i_relationship = cl_gui_column_tree=>relat_last_child
is_outtab_line = table
i_node_text = text
* is_node_layout = l_layout_node
IMPORTING
e_new_node_key = i_key
EXCEPTIONS
relat_node_not_found = 1
node_not_found = 2
OTHERS = 3.
IF sy-subrc NE 0.
CLEAR sy-subrc.
ENDIF. " IF sy-subrc NE 0
ENDMETHOD. " Add_node_drop
ENDCLASS. " lcl_main IMPLEMENTATION
*& Module STATUS_0100 OUTPUT
* Screen 100 Pbo
MODULE status_0100 OUTPUT.
SET PF-STATUS 'BACK'.
* SET TITLEBAR 'xxx'.
CALL METHOD obj_main->build_display.
ENDMODULE. " Status_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* Screen 100 Pai
MODULE user_command_0100 INPUT.
IF sy-ucomm EQ 'BACK'.
LEAVE TO SCREEN 0.
ENDIF. " IF sy-ucomm EQ 'BACK'
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Report ZBPS_TREE_DRAG_DROP
REPORT zbps_tree_drag_drop.
* CLASS lcl_main DEFINITION
CLASS lcl_main DEFINITION.
PUBLIC SECTION.
* Types
TYPES:
BEGIN OF t_ekpo,
ebeln TYPE ebeln,
ebelp TYPE ebelp,
END OF t_ekpo.
TYPES:
BEGIN OF t_vbap,
vbeln TYPE vbeln,
posnr TYPE vbelp,
END OF t_vbap.
* Internal Tables
DATA:
i_ekpo TYPE STANDARD TABLE OF t_ekpo,
i_ekpo_op TYPE STANDARD TABLE OF t_ekpo,
i_vbap TYPE STANDARD TABLE OF t_vbap,
i_vbap_op TYPE STANDARD TABLE OF t_vbap,
i_fcat_ekpo TYPE lvc_t_fcat,
i_fcat_vbap TYPE lvc_t_fcat.
* Work Areas
DATA:
wa_ekpo TYPE t_ekpo,
wa_ekpo1 TYPE t_ekpo,
wa_vbap TYPE t_vbap,
wa_vbap1 TYPE t_vbap.
* Data Declarations
DATA:
g_ebeln TYPE ebeln,
g_vbeln TYPE vbeln_va.
DATA: g_variant TYPE disvariant,
g_hierarchy_header TYPE treev_hhdr,
g_handle_drag TYPE i,
g_handle_drop TYPE i.
* Class data
DATA:
splitter TYPE REF TO cl_gui_splitter_container,
container TYPE REF TO cl_gui_custom_container,
container_1 TYPE REF TO cl_gui_container,
container_2 TYPE REF TO cl_gui_container,
tree1 TYPE REF TO cl_gui_alv_tree,
tree2 TYPE REF TO cl_gui_alv_tree,
g_drag TYPE REF TO cl_dragdrop,
g_drop TYPE REF TO cl_dragdrop.
* Constants
CONSTANTS:
c_30(2) TYPE c VALUE '30'.
* Methods
METHODS:
get_data, " Data Fatch
build_display, " Display Container
display_ekpo, " Ekpo table display
display_vbap, " Vbap table display
add_node_ekpo " Add node to Ekpo
IMPORTING table TYPE t_ekpo
key TYPE lvc_nkey
text TYPE lvc_value
flag TYPE c
CHANGING i_key TYPE lvc_nkey,
add_node_vbap " Add node to vbap
IMPORTING table TYPE t_vbap
key TYPE lvc_nkey
text TYPE lvc_value
flag TYPE c
CHANGING i_key TYPE lvc_nkey,
dnd_behaviour, " Drag and drop behavour
register_events_ekpo, " Register Events Ekpo
register_events_vbap, " Register events vbap
handle_drag_multiple " Drag Multiple Values
FOR EVENT on_drag_multiple
OF cl_gui_alv_tree
IMPORTING sender node_key_table fieldname drag_drop_object,
handle_drop " Drop the values
FOR EVENT on_drop
OF cl_gui_alv_tree
IMPORTING sender node_key drag_drop_object,
add_node_drop " Add node to Drop Node
IMPORTING table TYPE t_ekpo
key TYPE lvc_nkey
text TYPE lvc_value
CHANGING i_key TYPE lvc_nkey.
ENDCLASS. " Lcl_main DEFINITION
* CLASS LCL_DRAGOBJ DEFINITION
* Drag And drop Structure
CLASS lcl_dragobj DEFINITION INHERITING FROM lcl_main FINAL.
PUBLIC SECTION.
* Types
TYPES: BEGIN OF t_node_info,
l_ekpo TYPE t_ekpo,
l_node_text TYPE lvc_value,
l_node_key TYPE lvc_nkey,
END OF t_node_info.
* Data
DATA: i_node_info TYPE TABLE OF t_node_info,
wa_node_info TYPE t_node_info.
ENDCLASS. " LCL_DRAGOBJ DEFINITION
* Object Declarations
DATA obj_main TYPE REF TO lcl_main.
* Initialization *
INITIALIZATION.
CREATE OBJECT obj_main.
* Selection Screen *
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME.
SELECT-OPTIONS:
s_ebeln FOR obj_main->g_ebeln,
s_vbeln FOR obj_main->g_vbeln MATCHCODE OBJECT cs_vbeln.
SELECTION-SCREEN END OF BLOCK block1.
* Start of Selection *
START-OF-SELECTION.
* Call Screen
CALL SCREEN 100.
* CLASS lcl_main IMPLEMENTATION
* Local class Implementation
CLASS lcl_main IMPLEMENTATION.
* Get Data *
METHOD get_data.
* Data from Ekpo
SELECT ebeln
ebelp
FROM ekpo
UP TO 100 ROWS
INTO TABLE i_ekpo
WHERE ebeln IN s_ebeln.
* Data from Vbap
SELECT vbeln
posnr
FROM vbap
UP TO 100 ROWS
INTO TABLE i_vbap
WHERE vbeln IN s_vbeln.
ENDMETHOD. " Get_data
* Build Display *
METHOD build_display.
* Create Container
CREATE OBJECT container
EXPORTING
container_name = 'CUST_CONT'.
* Split the container
CREATE OBJECT splitter
EXPORTING
parent = container
rows = 1
columns = 2.
CALL METHOD splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = container_1.
CALL METHOD splitter->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = container_2.
* create tree control
CREATE OBJECT tree1
EXPORTING
parent = container_1
node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple
item_selection = 'X'
no_html_header = 'X'
no_toolbar = 'X'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
IF sy-subrc NE 0.
CLEAR sy-subrc.
ENDIF. " IF sy-subrc NE 0.
CREATE OBJECT tree2
EXPORTING
parent = container_2
node_selection_mode = cl_gui_column_tree=>node_sel_mode_multiple
item_selection = 'X'
no_html_header = 'X'
no_toolbar = 'X'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
IF sy-subrc NE 0.
CLEAR sy-subrc.
ENDIF. " IF sy-subrc NE 0.
g_variant-report = sy-repid.
g_variant-handle = space.
g_variant-log_group = space.
g_variant-username = space.
g_variant-text = space.
g_variant-dependvars = space.
* Call method for get data
CALL METHOD get_data.
* Drap And Drop behaviour method
CALL METHOD dnd_behaviour.
* Display the Ekpo table
CALL METHOD obj_main->display_ekpo.
* Diaplay the vbap table
CALL METHOD obj_main->display_vbap.
CALL METHOD tree1->frontend_update.
CALL METHOD tree2->frontend_update.
ENDMETHOD. " Build_display
* Display EKPO *
METHOD display_ekpo.
* Data
DATA:
l_key1 TYPE lvc_nkey,
l_key2 TYPE lvc_nkey,
l_key3 TYPE lvc_nkey,
l_node_text TYPE lvc_value.
* ALV control service modules
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_buffer_active = 'X'
i_structure_name = 'EKPO'
i_client_never_display = 'X'
i_bypassing_buffer = space
CHANGING
ct_fieldcat = i_fcat_ekpo
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc EQ 0.
DELETE i_fcat_ekpo FROM 4.
ENDIF. " IF sy-subrc EQ 0.
g_hierarchy_header-heading = 'Purchase Order Details'(001).
g_hierarchy_header-tooltip = 'Purchase Order'(002).
g_hierarchy_header-width = c_30.
g_hierarchy_header-width_pix = ' '.
* Diaply
CALL METHOD tree1->set_table_for_first_display
EXPORTING
is_hierarchy_header = g_hierarchy_header
is_variant = g_variant
CHANGING
it_outtab = obj_main->i_ekpo_op
it_fieldcatalog = i_fcat_ekpo.
LOOP AT i_ekpo INTO wa_ekpo1.
MOVE wa_ekpo1 TO wa_ekpo.
l_key1 = ''.
AT NEW ebeln.
MOVE wa_ekpo-ebeln TO l_node_text.
* Call method for Add Node to Ekpo
CALL METHOD add_node_ekpo
EXPORTING
table = wa_ekpo
key = l_key1
text = l_node_text
flag = space
CHANGING
i_key = l_key2.
ENDAT.
CLEAR l_node_text.
MOVE wa_ekpo-ebelp TO l_node_text.
* Call method for Add Node to Ekpo
CALL METHOD add_node_ekpo
EXPORTING
table = wa_ekpo
key = l_key2
text = l_node_text
flag = 'X'
CHANGING
i_key = l_key3.
ENDLOOP. " LOOP AT i_ekpo INTO wa_ekpo1.
* Call method For Register events
CALL METHOD register_events_ekpo.
ENDMETHOD. " Display_ekpo
* Display VBAP *
METHOD display_vbap.
* Data
DATA:
l_key1 TYPE lvc_nkey,
l_key2 TYPE lvc_nkey,
l_key3 TYPE lvc_nkey,
l_node_text TYPE lvc_value.
REFRESH i_fcat_vbap.
* ALV control service modules
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_buffer_active = 'X'
i_structure_name = 'VBAP'
i_client_never_display = 'X'
i_bypassing_buffer = space
CHANGING
ct_fieldcat = i_fcat_vbap
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc EQ 0.
DELETE i_fcat_vbap FROM 4.
ENDIF. " IF sy-subrc EQ 0.
g_hierarchy_header-heading = 'Sales Order Details'(003).
g_hierarchy_header-tooltip = 'Sales Order'(004).
g_hierarchy_header-width = c_30.
g_hierarchy_header-width_pix = ' '.
* Display
CALL METHOD tree2->set_table_for_first_display
EXPORTING
is_hierarchy_header = g_hierarchy_header
is_variant = g_variant
CHANGING
it_outtab = obj_main->i_vbap_op
it_fieldcatalog = i_fcat_vbap.
LOOP AT i_vbap INTO wa_vbap1.
MOVE wa_vbap1 TO wa_vbap.
l_key1 = ''.
AT NEW vbeln.
MOVE wa_vbap-vbeln TO l_node_text.
* Call method for Add Node to vbap
CALL METHOD add_node_vbap
EXPORTING
table = wa_vbap
key = l_key1
text = l_node_text
flag = 'X'
CHANGING
i_key = l_key2.
ENDAT.
CLEAR l_node_text.
MOVE wa_vbap-posnr TO l_node_text.
* Call method for Add Node to vbap
CALL METHOD add_node_vbap
EXPORTING
table = wa_vbap
key = l_key2
text = l_node_text
flag = space
CHANGING
i_key = l_key3.
ENDLOOP. " LOOP AT i_vbap INTO wa_vbap1.
* Call method For Register events
CALL METHOD register_events_vbap.
ENDMETHOD. " Display_vbap
* Add Node to Ekko *
METHOD add_node_ekpo.
* Data
DATA: l_layout_node TYPE lvc_s_layn.
IF flag = 'X'.
l_layout_node-dragdropid = g_handle_drag.
ENDIF. " IF flag = 'X'.
* Add node to tree1
CALL METHOD tree1->add_node
EXPORTING
i_relat_node_key = key
i_relationship = cl_gui_column_tree=>relat_last_child
is_outtab_line = table
i_node_text = text
is_node_layout = l_layout_node
IMPORTING
e_new_node_key = i_key
EXCEPTIONS
relat_node_not_found = 1
node_not_found = 2
OTHERS = 3.
IF sy-subrc NE 0.
CLEAR sy-subrc.
ENDIF. " IF sy-subrc NE 0.
ENDMETHOD. " Add_node_ekpo
* Add Node to Vbap *
METHOD add_node_vbap.
* Data
DATA: l_layout_node TYPE lvc_s_layn.
IF flag = 'X'.
l_layout_node-dragdropid = g_handle_drop.
ENDIF. " IF flag = 'X'.
* Add node for tree2
CALL METHOD t -
How can I drag and drop an item from one Tree control to another in LabVIEW 7.1?
You can use the mouse up and down event on the two tree controls but the problem is making the correct selection in the second tree control. I want to be able to switch over to the selection bar of the second tree control so that I can place my item in the correct position. I know all possible workarounds with double-clicks and so on... but I really want a windows drag and drop.
This is what I have for the moment. Please check the library below. I need to activate the selection bar of the second tree control somehow to get the position in the control. The VI below is written in LV 7.1
Attachments:
Drag&Drop.llb 65 KBHi Jones,
As far as I know this feature is currently not supported by the Tree control. A workaround, would be to use the vertical position of the mouse in the button up event to determine what line you�re dropping the item.
If you would like the Tree control to include the drag and drop feature, please submit this as a Product Suggestion under the feedback at www.ni.com/contact.
Good luck!
Best regards,
Philip C.
Applications Engineer
National Instruments
www.ni.com/ask
- Philip Courtois, Thinkbot Solutions -
Drag and Drop between the Two Tree controls
Hi all,
I am Flex newbie. Can anyone please send me the drag and drop
example between the Two Tree controls.
Thank you
-Nagaraju"ndendukuri" <[email protected]> wrote in
message
news:gdnbtt$7tt$[email protected]..
> Hi all,
>
> I am Flex newbie. Can anyone please send me the drag and
drop example
> between the Two Tree controls.
>
http://flexdiary.blogspot.com/2008/07/getting-help-in-flex-builder.html -
ALV Grid Drag & Drop - Cell-specific
Hi ABAPers,
I've referred SAP Standard program / SDN forum and got some logic for ALV Drag & Drop for row-specific, Column-specific and for Trees. But I didn't get for Cell-specific.
My requirement is :
If the user drags a particular cell to another cell in an ALV-grid, then that Cell value should be copied to the 'Dropped-Cell' in the ALV Grid and should be saved to that particular Internal Table.I have referred the SAP standard program BCALV_DND_03 which does from a different tree to a cell. My requirement is from the same ALV grid Table.
I've also referred BCALV_DND_04 which is useful. But here, it does it for the whole row.
Can anyone please help me in this?
Thanks a lot.
Best Regards,
SowmyaTOP INCLUDE:
DATA: BEGIN OF g_t_plan_alv_m OCCURS 0,
header,
count(5).
INCLUDE STRUCTURE g_ze6spw_plan_alv.
DATA: handle_style TYPE lvc_t_styl,
handle_dragdrop TYPE lvc_t_drdr,
tabcolor TYPE lvc_t_scol.
DATA: END OF g_t_plan_alv_m.
CLASS cl_gui_resources DEFINITION LOAD.
CLASS lcl_events_dragdrop DEFINITION DEFERRED.
DATA:
BEGIN OF g_ty_s_outtab OCCURS 0,
header,
count(5).
INCLUDE STRUCTURE g_ze6spw_plan_alv.
DATA: handle_style TYPE lvc_t_styl,
handle_dragdrop TYPE lvc_t_drdr,
tabcolor TYPE lvc_t_scol,
END OF g_ty_s_outtab.
DATA: g_field TYPE lvc_fname.
DATA:
gr_events TYPE REF TO lcl_events_dragdrop,
gr_dragdrop TYPE REF TO cl_dragdrop,
gr_dragdrop_background TYPE REF TO cl_dragdrop.
CLASS lcl_events_dragdrop DEFINITION.
PUBLIC SECTION.
DATA: m_grid TYPE i.
METHODS:
ondrag FOR EVENT ondrag
OF cl_gui_alv_grid
IMPORTING e_row
e_column
es_row_no
e_dragdropobj,
ondrop FOR EVENT ondrop
OF cl_gui_alv_grid
IMPORTING e_row
e_column
es_row_no
e_dragdropobj,
ondropcomplete FOR EVENT ondropcomplete
OF cl_gui_alv_grid
IMPORTING e_row
e_column
es_row_no
e_dragdropobj,
ondropgetflavor FOR EVENT ondropgetflavor
OF cl_gui_alv_grid
IMPORTING e_row
e_column
es_row_no
e_dragdropobj
e_flavors.
ENDCLASS. "LCL_DRAGDROP DEFINITION
* CLASS lcl_dragdrop_obj DEFINITION
CLASS lcl_dragdrop_obj DEFINITION.
PUBLIC SECTION.
DATA: line LIKE g_ty_s_outtab,
index TYPE i.
ENDCLASS. "lcl_dragdrop_obj DEFINITION
CLASS lcl_events_dragdrop IMPLEMENTATION.
METHOD ondrag.
PERFORM event_ondrag USING e_row
e_column
e_dragdropobj.
ENDMETHOD. "ondrag
METHOD ondrop.
PERFORM event_ondrop USING e_row
e_column
e_dragdropobj.
ENDMETHOD. "ondrop
METHOD ondropcomplete.
PERFORM event_ondropcomplete USING e_row
e_column
e_dragdropobj.
ENDMETHOD. "ondropcomplete
METHOD ondropgetflavor.
PERFORM event_ondropgetflavor USING e_row
e_column
es_row_no
e_dragdropobj
e_flavors.
ENDMETHOD. "ondropgetflavor
ENDCLASS. "LCL_objdragdropapp IMPLEMENTATION
FORM set_drag_drop.
DATA: l_effect TYPE i,
l_dragdrop_handle TYPE i,
ls_dragdrop TYPE lvc_s_dd01,
ls_drag_cell TYPE lvc_s_drdr,
lt_drag_cells TYPE lvc_t_drdr,
ls_fcat TYPE lvc_s_fcat,
l_field TYPE lvc_fname,
l_source TYPE char1,
l_target TYPE char1,
l_alv_exclude_tab TYPE ui_functions,
l_variant TYPE disvariant.
FIELD-SYMBOLS: <fs_brcp> TYPE zreceipt,
<fs_bisu> TYPE z_supply.
CREATE OBJECT gr_dragdrop.
CREATE OBJECT gr_dragdrop_background.
CREATE OBJECT gr_events.
SET HANDLER gr_events->ondrag
FOR g_plan_alv.
SET HANDLER gr_events->ondrop
FOR g_plan_alv.
SET HANDLER gr_events->ondropcomplete
FOR g_plan_alv.
SET HANDLER gr_events->ondropgetflavor
FOR g_plan_alv.
LOOP AT g_t_plan_alv_m.
MOVE-CORRESPONDING g_t_plan_alv_m TO g_ty_s_outtab.
APPEND g_ty_s_outtab.
ENDLOOP.
l_effect = cl_dragdrop=>move + cl_dragdrop=>copy.
CALL METHOD gr_dragdrop->add
EXPORTING
flavor = 'Line' "#EC NOTEXT
dragsrc = c_on
droptarget = c_on
effect = l_effect.
CALL METHOD gr_dragdrop->get_handle
IMPORTING
handle = l_dragdrop_handle.
ls_dragdrop-cntr_ddid = l_dragdrop_handle. "auch bei leerem Grid
ls_dragdrop-grid_ddid = space.
ls_dragdrop-col_ddid = space.
ls_dragdrop-row_ddid = space.
ls_dragdrop-fieldname = 'HANDLE_DRAGDROP'.
g_plan_layo-s_dragdrop = ls_dragdrop.
LOOP AT g_t_mat_index.
*Bulk Issues
CONCATENATE c_plan_alvm c_bisu g_t_mat_index-index INTO l_field.
ASSIGN (l_field) TO <fs_bisu>.
CLEAR l_field.
*Bulk Receipts
CONCATENATE c_plan_alvm c_brcp g_t_mat_index-index INTO l_field.
ASSIGN (l_field) TO <fs_brcp>.
CLEAR l_field.
ls_drag_cell-fieldname = <fs_brcp>."l_field.
ls_drag_cell-dragdropid = l_dragdrop_handle.
INSERT ls_drag_cell INTO TABLE lt_drag_cells.
CLEAR ls_drag_cell.
ls_drag_cell-fieldname = <fs_bisu>."l_field. 9th May
ls_drag_cell-dragdropid = l_dragdrop_handle.
INSERT ls_drag_cell INTO TABLE lt_drag_cells.
CLEAR ls_drag_cell.
ENDLOOP.
DATA: l_index TYPE i,
l_erg TYPE i.
LOOP AT g_t_plan_alv_m.
l_index = sy-tabix.
l_erg = sy-tabix MOD 2.
IF l_erg EQ 0.
g_t_plan_alv_m-handle_dragdrop = lt_drag_cells.
g_t_plan_alv_m-tabcolor = lt_tabcolor.
MODIFY g_t_plan_alv_m INDEX l_index "FROM ls_outtab
TRANSPORTING handle_dragdrop
tabcolor.
ENDIF.
ENDLOOP.
LOOP AT g_t_plan_alv_m.
l_index = sy-tabix.
l_erg = sy-tabix MOD 2.
IF l_erg EQ 0.
g_t_plan_alv_m-handle_dragdrop = lt_drag_cells.
g_t_plan_alv_m-tabcolor = lt_tabcolor.
MODIFY g_t_plan_alv_m INDEX l_index "FROM ls_outtab
TRANSPORTING handle_dragdrop
tabcolor.
ENDIF.
ENDLOOP.
CALL METHOD g_plan_alv->set_table_for_first_display
EXPORTING
is_variant = l_variant
i_save = g_save
is_layout = g_plan_layo
it_toolbar_excluding = l_alv_exclude_tab[]
CHANGING
it_outtab = g_t_plan_alv_m[]"gt_outtab_source[]
it_fieldcatalog = g_t_plan_fcat[].
ENDFORM. " DRAGDROP
FORM event_ondrag USING e_row TYPE lvc_s_row
e_column TYPE lvc_s_col
e_dragdropobj TYPE REF TO
cl_dragdropobject. "#EC
DATA:
l_obj TYPE REF TO lcl_dragdrop_obj.
CREATE OBJECT l_obj.
READ TABLE g_t_plan_alv_m INDEX e_row-index. "9thMay
IF sy-subrc EQ 0.
l_obj->line = g_t_plan_alv_m."ls_outtab.
l_obj->index = e_row-index.
e_dragdropobj->object = l_obj.
ENDIF.
ENDFORM. " EVENT_ONDRAG
FORM event_ondrop USING e_row TYPE lvc_s_row
e_column TYPE lvc_s_col
e_dragdropobj TYPE REF TO
cl_dragdropobject. "#EC
DATA: l_obj TYPE REF TO lcl_dragdrop_obj,
ls_outtab LIKE g_ty_s_outtab.
CREATE OBJECT l_obj.
IF e_row-index IS INITIAL.
e_row-index = 1.
ENDIF.
CATCH SYSTEM-EXCEPTIONS move_cast_error = 1.
l_obj ?= e_dragdropobj->object.
ls_outtab = l_obj->line.
MODIFY g_t_plan_alv_m INDEX e_row-index.
ENDCATCH.
IF sy-subrc <> 0.
CALL METHOD e_dragdropobj->abort.
ENDIF.
ENDFORM. " EVENT_ONDROP
*& Form EVENT_ONDROPCOMPLETE
* -->P_E_ROW text
* -->P_E_COLUMN text
* -->P_E_DRAGDROPOBJ text
FORM event_ondropcomplete USING e_row type lvc_s_row
e_column type lvc_s_col
e_dragdropobj type ref to
cl_dragdropobject."#EC
data: l_obj type ref to lcl_dragdrop_obj,
ls_stable type lvc_s_stbl,
lr_grid type ref to cl_gui_alv_grid.
ls_stable-row = c_on."con_true.
ls_stable-col = c_on."con_true.
catch system-exceptions move_cast_error = 1.
l_obj ?= e_dragdropobj->object.
endcatch.
lr_grid ?= e_dragdropobj->droptargetctrl.
call method lr_grid->refresh_table_display
exporting
is_stable = ls_stable.
ENDFORM. " EVENT_ONDROPCOMPLETE
*& Form EVENT_ONDROPGETFLAVOR
* -->P_E_ROW text
* -->P_E_COLUMN text
* -->P_ES_ROW_NO text
* -->P_E_DRAGDROPOBJ text
* -->P_E_FLAVORS text
FORM event_ondropgetflavor USING p_e_row
p_e_column
p_es_row_no
p_e_dragdropobj
p_e_flavors.
ENDFORM. " EVENT_ONDROPGETFLAVOR -
How to use the drop event of the tree control in LabVIEW 8.20?
Hi,
I am using the two tree controls in my application to provide a option for the user to drag and drop item from one tree to the other. I have to validate the user selection. I tried to capture the user drop event using the event structure. The problem I am facing is, I am not able to drop the item even though i have wired a constant true to the filter(Accepted?) in the event case. I have enable the property(Allow droping) in the right menu of the tree control also.
While configuring an event case for (drop, drag entered and some thing like this) only I am getting the problem otherwise it is working fine.
What do i need to do to caprture the drop event ?
Is there any way to avoid the item duplication while droping a new item in the tree control ?
or how can i do this?
Thanks,
Pandiarajan RHi Pandiarajan,
I hope you are doing well today! There is a lengthy discussion on the Tree Control Drag & Drop feature at this forums post including contributions from the developer of the Drag & Drop feature:
Tree Control Drag & Drop in LabVIEW 8
By avoiding item duplication, do you mean that you don't want the same item to be in the old tree control or do you not want more than one item in the new tree control?
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies -
Problem with Drag & Drop and multiselection in tables
Hi,
we have a problem concerning drag and drop and multiselection in tables. It is not possible to drag a multiselection of table rows, as the selection event is recognized or handled before the drag event. So before the drag starts, the selection will be changed and only a single row is selected at the position where you started the drag with a mouse click.
There was also a java bug with the id 4521075 regarding this problem a couple of years ago. See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4521075.
This bug has been resolved but in our application we have not enabled drag by setting setDragEnabled(true) on the table as we have an own implementation of a DragSource (which is the table component), and a DragGestureRecognizer to control mimetype and data to be dragged.
So my question is: Is there any solution for this case without calling setDragEnabled(true) on the table? Or is it possible to enable drag on the table and override some method where the drag recognition happens and the transferable object is created?
Thanks,Thanks for reply,
Steps to reproduce the problem:
1) user clicks the ascending sorting icon in the table(the button get disabled after sorting the table).
2) After sorting user drag and drop some row over another row.
3) Now the table is no longer sorted.
4) If user again wants to sort the table now, he cannot do it because the sorting button is still disabled.
So I want the user to sort the table again, without refreshing the page
Thanks and Regards,
Tarun
Maybe you are looking for
-
Keyboard error in Dreamweaver CS3
Dreamweaver part of the CS3 suite was working perfectly. Then... recently certain keys on my keyboard won't type at all. This is only in Dreamweaver. Puzzled as never encounterd this before (changed keyboard etc but same result) I dont usually work i
-
I have two sites created in iWeb; one personal and one a sample for my work. My personal site gets published to .mac, but I just wanted my sample work site published to a file. I selected the work site and then Publish to Folder, but BOTH of my sites
-
Open forms from Workflow Notification
Hello All, I understand that we can have a 'Form' type attribute to have a link of the form displayed in the workflow notifications. And my requirement was to open a particular PO in the forms if the user clicks on the corresponding link in his notif
-
Interfaces and implementing them
public interface foo{ public int blah(); public interface foo2{ public int blah2() how would I go around implementing foo and foo2
-
Using blend modes with adjustment layers. I am having trouble getting the results I want by using a screen or multiply blend modes with adjustment layers. When I use the brush to reveal the hidden image, I am not gettting consistant darkness or lig