OpenDocument by Code
Hello Coresuite Community,
I want to use the command “OpenDocument” from the Grid Configurator in a form which is created by self-written code, not by Grid Configurator. I use a eventhandler to catch the link to action from sap:
// declare grid column necessary for link creation
SwissAddonFramework.UI.Components.TextEditGridColumn o_f1_gc1 = null;
// -------------------------------------------------------------------------------------------------------------------------------------------------------
// create Link on Name column of grid
o_f1_gc1 = ((SwissAddonFramework.UI.Components.TextEditGridColumn) oGrid1.Columns["Belegnummer"].SpecificGridColumn);
o_f1_gc1.LinkObjectType = "2"; // this is just a dummy value!
SwissAddonFramework.UI.EventHandling.ItemEvents.LinkPressedEventHandler evGrid1 = null;
evGrid1 = delegate(SwissAddonFramework.UI.EventHandling.ItemEvents.LinkPressed o_f1_eventVal)
{
try
{
// deactivate SAP link to
o_f1_eventVal.ExecuteSAPAction = false;
// get docentry of selected row
string strDocEntry = oGrid1.GetValue("DocEntry", o_f1_eventVal.Row);
// get docentry of selected row
string strObjType = oGrid1.GetValue("ObjType", o_f1_eventVal.Row);
OpenDocument("$[$COR_G_001.ObjType.0]|$[$COR_G_001.DocEntry.Number]");
//OpenDocument("['" + strObjType + @"']|['" + strDocEntry + @"']");
}
catch(System.Exception o_ex)
{
string strErrorMessage = "Beleg öffnen, Error:\n" + o_ex.Message;
// show error in messagebox and statusbar and write to debug-file
MessageBox.Show(strErrorMessage, "OK");
StatusBar.WriteError(strErrorMessage);
Debug.WriteMessage(strErrorMessage, Debug.DebugLevel.Exception);
}
};
// add event to object
o_f1_gc1.AddHandler_LinkPressed(SwissAddonFramework.UI.Components.ModeComponent.FormModes.ALL, evGrid1);
The grid is created like that…
// Grid 1
Grid oGrid1 = Grid.CreateNew("COR_G_001");
oGrid1.Width = oRect.Width - 40; oGrid1.Height = oRect.Height - 40; oGrid1.Left = oRect.Left + 15; oGrid1.Top = oRect.Top + 30; oGrid1.FromPane = 1; oGrid1.ToPane = 1;
When I press now the link button on my document no. column on the grid, I get the error message:
Error in easy function opendocument….unknown element COR_G_001
Can somebody explain me whats wrong or how can I achieve the functionality like in the Grid Configurator?
Greetings Sebastian
0
Please sign in to leave a comment.
Comments
0 comments