New Items: Use normal table data


Hello Forum,


if you make right click on a Offer Form, you have the menu Item "Eingangs- und Abschlußbemerkung", translated into english: Header and Footer. If you look at the System Informations of this fields, it says they are getting their data from table OINV column Footer and column Header. But thats not true! If you put data their, they are the same for every offer. In reality the footer and header are written to OQUT.Header and OQUT.Footer.


So my first question:

The systeminformation are filled by handmade data? In most cases the are correct... in some cases someone was sleeping while working?


I want to place the footer and header fiels on the offer form. I was using the New Items menu. I created two textboxes and set OQUT as table and Header and Footer as Column. But instead of showing me the actual footer and header, they are showing me the row number of the offer. I can look into the demo database and I see whats in the DB. I get the the same behavior if I want to show CardCode and CardName, they are only showing the row number and not the customer number and name.


My second question:

In the menu "New Items", how can show database fields that are already in SAP B1? What have I write to table and column?






Anders Olsson

Hi Martin,


You are right, the header and footer data is stored in the OQUT table. I cannot answer why the system information shows OINV, you would have to ask SAP about that. It's not a coresuite feature.


To your other question, how can you show database fields that are already in SAP?

With NewItems you cannot. See the New Items section in customize F1 Help:

"With Table name and Column name you can reference data from UDFs. However, it is not possible to display system data in two places."

This is not a limitation we have come up with but it comes from SAP. If you code the same functionality using the UI API in the SAP SDK using databind objects you would end up with the same dilemma.

The problem linking two fields to the same data source is which one should take presedence? If you change Field 1 and Field 2 linked to the same data source, which one will be saved?


To get around this limitation you would have to add unlinked fields and overwrite the database fields with your own data post save. 

On FormDataLoad, you must query the database for Header and Footer and set your fields accordingly.

After the quotation has been saved you will have to update the quotation object using the DI API.

You can do this with an Optimizer rule. Set the Event Type to FormDataModify and make sure Before Event is unticked.


Here is some basic code that you can elaborate on:


int docEntry = int.Parse(pVal.BusinessObjectKeyString);
SAPbobsCOM.Documents doc = (SAPbobsCOM.Documents) SwissAddonFramework.B1Connector.GetB1Connector().Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oQuotations);
doc.OpeningRemarks = "Header data goes here...";
doc.ClosingRemarks = "Footer data goes here...";




Thanks Anders for the help, I will try it :)


Some remarks: I created the rule, delivered it to the customer and all works fine. But you know the customers....


If you start the dialog from the main menu, the rule works. But If you put the invoice ID or the base data ID into the search field on the right upper search fiel on the B1 desktop, an error occurs: The unbound user defined field I created to display the header cannot be found. If dialogs are started in this way another startup routine seems to be in place.


The solution is to use the FormLoadComplete event and test the rules in the future with this strange way.


If I save the value two times in a row I get this error message:

Daten wurden durch einen anderen Benutzer oder eine andere Operation modifiziert; öffnen Sie das Fenster erneut, um fortzufahren  'Angebot' (OQUT) (ODBC -2039)  [Meldung 131-183]


Translated into english: Data was written by another user oder operation, reopen the window to proceed.


Currently I'm using this workaround:

CurrentForm.Mode = SwissAddonFramework.UI.Components.ModeComponent.FormModes.OK;
MenuItem.GetFromUID("1289").Activate(); // Datensatz davor laden
MenuItem.GetFromUID("1288").Activate(); // Datensatz danach laden -> Ausgangsdatensatz

But now the save process takes longer and it doesnt look fine.



The rule for saving into the DB:

try {
    Form CurrentForm = pVal.Form;
    // Den Angebotsdatensatz holen:
    int docEntry = int.Parse(pVal.BusinessObjectKeyString);
    SAPbobsCOM.Documents doc = (SAPbobsCOM.Documents)

    // Die neue Kopfzeile hineinschreiben und DB-Update.
    ExtendedTextEdit txtHeader = ExtendedTextEdit.GetFromUID(CurrentForm, "NI_00012");
    doc.OpeningRemarks = txtHeader.Value;
    // Neu Laden erzwingen um einen Bug zu beseitigen wenn zweimal hintereinander gespeichert wird:
    CurrentForm.Mode = SwissAddonFramework.UI.Components.ModeComponent.FormModes.OK;
    MenuItem.GetFromUID("1289").Activate(); // Datensatz davor laden
    MenuItem.GetFromUID("1288").Activate(); // Datensatz danach laden -> Ausgangsdatensatz
} catch (Exception e) {



Please sign in to leave a comment.

Didn't find what you were looking for?

New post