Datensatz duplizieren (Workshop Hamburg) funktioniert nicht!
Rolf Walker
Guten Tag!Im Rahmen eines Workshops mit CoreSystem in Hamburg haben wir untenstehendes Beispiel gemacht, welches es mittels 'Function Button' erlaubt ein Kundenequipment' zu duplizieren!
Interessanterweise klappt das ganze bei uns auf dem Testsystem einwandfrei (Gleiche Anzahl und auch gleiche Bennenung der UDFs wie auf P-System) - jedoch wenn ich das ganze auf dem Prod.-System aufrufe kommt eine Fehlermeldung (siehe Screenshot).
Was könnte der Grund für die Meldung sein?
Vielen Dank für die Antwort!
Liebe Grüsse
Rolf Walker
Hier der Code:
//dupliziert kundenequipment
try
{
string code = TextEdit.GetFromUID(pVal.Form, "COR_INS").Value;
SAPbobsCOM.CustomerEquipmentCards original = (SAPbobsCOM.CustomerEquipmentCards)SwissAddonFramework.B1Connector.GetB1Connector().Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oCustomerEquipmentCards);
original.GetByKey(int.Parse(code));
SAPbobsCOM.CustomerEquipmentCards copy = (SAPbobsCOM.CustomerEquipmentCards)SwissAddonFramework.B1Connector.GetB1Connector().Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oCustomerEquipmentCards);
copy.CustomerCode = original.CustomerCode;
copy.CustomerName = original.CustomerName;
copy.ContactEmployeeCode = original.ContactEmployeeCode;
copy.StateCode = original.StateCode;
copy.InternalSerialNum = original.InternalSerialNum + "-neu";
copy.ManufacturerSerialNum = original.ManufacturerSerialNum + "-neu";
copy.ItemDescription = original.ItemDescription;
copy.City = original.City;
copy.ZipCode = original.ZipCode;
copy.InstallLocation = original.InstallLocation;
copy.ItemCode = original.ItemCode;
for(int i=0; i < original.UserFields.Fields.Count; i++)
copy.UserFields.Fields.Item(i).Value = original.UserFields.Fields.Item(i).Value;
int errorCode = copy.Add();
if(errorCode != 0)
{
StatusBar.WriteError("Fehler beim duplizieren: " + errorCode.ToString() + ": " + SwissAddonFramework.B1Connector.GetB1Connector().Company.GetLastErrorDescription());
}
else
{
string newCode = SwissAddonFramework.B1Connector.GetB1Connector().Company.GetNewObjectKey();
Form.OpenFormByKey("176", newCode);
}
}
catch(System.Exception ex)
{
StatusBar.WriteError("Fehler beim duplizieren: " + ex.Message);
}
Attachment
[url=http://www.coresystems.ch/wp-content/../wp-content/forum-image-uploads/rowasi/FehlerKEQDuplizieren.png]FehlerKEQDuplizieren.png[/url]
Michael Egloff
Halloder Fehler liegt in dieser Zeile:
string code = TextEdit.GetFromUID(pVal.Form, "COR_INS").Value;
Es ist nicht möglich, vom Feld COR_INS zu lesen. Gibt es dieses Feld in dem aktuellen System? Habt ihr evtl. mit dem Modul newitems dieses Feld am Workshop erstellt und du hast es nicht ins produktive System kopiert?
Rolf Walker
Hallo Michael!Danke für die Antwort!
Genau das war der Fehler. Das Feld habe ich im P-System nicht angelegt, resp. anders benennt wie im T-System.
Vielen Dank!
Gruss,
Rolf
0
Please sign in to leave a comment.
Comments
0 comments