Open document handling (DocuView) for other datasource/table than caller

Open document handling (DocuView) for other datasource/table than caller

Sometimes there’s requirement to open document handling from one form to shows the documents for other datasource/table.

Eg. From Purchase order form, open the document handling of the vendor (VendTable) instead of for the purchase order (PurchTable).

It can be achieved with the following 4 steps:

  1. Add the related table as datasource in the form
  2. Add a boolean global variable to ‘ClassDeclaration’
  3. Overwrite the method ‘docCursor’
  4. Add a button and overwrite the ‘clicked’ method

1. Add the related table as datasource in the form

2. Add a boolean global variable to ‘ClassDeclaration’
class FormRun extends ObjectRun
{
boolean      vendDoc;
}

3. Overwrite the method ‘docCursor’
public Common docCursor()
{
Common docCursor;
;

docCursor = super();

if(vendDoc)
docCursor = vendTable;

return docCursor;
}

4. Add a button and overwrite the ‘clicked’ method
void clicked()
{
super();

vendDoc = true;

if (!infolog.docu().isDocuViewSet())
infolog.docu().note(element);
else
infolog.docu().setActive();

vendDoc = false;
}