Basic Data Synchronization

This page provides information about the Basic Data Synchronization concept.

IFS provides a functionality to synchronize basic data throughout a set of companies. Currently there are several basic data windows supported by this functionality in Enterprise and Accounting Rules.

Use this page when you want to add more basic data windows to have this capability of synchronizing data.
 

Contents

 

Register Basic Data Windows

When you want to add the synchronization functionality to a basic data window the first step is to register the window in the Basic_Data_Window_Tab.

To do this, you will need to enter the window information in the BasicDataSyncLU.ins in the relevant component. The name of the file should be  <Component>BasicDataSyncLU.ins. If the relevant component does not have an existing file please refer the example and create a new ins file.

The call to insert window and LU information should have the following information.

Note:

...
Attribute_Row_('LuName', 'Window Name');
...


Refer example in RegistrationExample.ins

 

Server Changes

There are several new methods that should be written in the plsql file to support the synchronization functionality.

 

Public Methods

Parameter Name Comment
source_company_ source company ID
target_company_list_ list of target companies
key1_list_ list of key one after the company ID
key2_list_ list of key two after the company ID
update_method_list_ update method list
copy_type_ manual or automatic synchronization
attr_ attribute string

Note:

...
Client_SYS.Add_To_Attr('ATTRIBUTE_LIST', attribute_list_, attr1_);
Client_SYS.Add_To_Attr('ATTRIBUTE_VALUE_LIST', attribute_value_list_, attr1_);
...

All keys except the company ID should be added to the attribute string.
 

Refer example in ServerMethodsExample.plsql

 

Protected Methods

Parameter Name Comment
attr_ attribute string

Note:

...
ELSIF (name_ = 'ATTRIBUTE_LIST') THEN
   attribute_list_ := value_;
ELSIF (name_ = 'ATTRIBUTE_VALUE_LIST') THEN
   attribute_value_list_ := value_;
...

All keys except the company ID should be added to parameters as shown above.
 

Refer example in ServerMethodsExample.plsql
 

Parameter Name Comment
source_company_ source company ID
target_company_list_ list of target companies
key1_list_ list of key one after the company ID
key2_list_ list of key two after the company ID
update_method_list_ update method list
copy_type_ manual or automatic synchronization
attr_ attribute string

Note:

...
i_ := 0;
ptr_ := NULL;
WHILE Get_Next_Record_Sep_Val___(value_, ptr_, attribute_list_) LOOP
   ref_accounting_attribute_val_(i_).attribute := value_;
   i_ := i_ + 1;
END LOOP;
...

This should be done for all the keys of the LU except the company ID.

Refer example in ServerMethodsExample.plsql

 

Private Methods

Parameter Name Comment
source_company_ source company ID
target_company_ target company ID
key1_ key one after the company ID
key2_ key two after the company ID
update_method_ update method
log_id_ id of the log created to show information regarding the synchronization
attr_ attribute string

Note:

...
log_key_ := key1_ || '^' || key2_;
...

The keys other than the company ID should be added to the log_key_.

Refer example in ServerMethodsExample.plsql

 

Implementation Methods

This method is used to extract the value from the list keys sent in. This is called from method Copy_To_Companies_.

 

...
IF (App_Context_Sys.Find_Value(lu_name_||'.copy_to_company_', 'FALSE') != 'TRUE') THEN
   IF (Company_Basic_Data_Window_API.Check_Copy_From_Company(remrec_.company, lu_name_)) THEN
      Error_SYS.Record_General(lu_name_, 'NODIRECTREMOVE: A record cannot be removed as :P1 window has been set up for copying data only from source company in Basic Data Synchronization window.', Basic_Data_Window_API.Get_Window(lu_name_));
   END IF;
END IF;
...

        This should be added as pre-processing code.

 

...
IF (App_Context_Sys.Find_Value(lu_name_||'.copy_to_company_', 'FALSE') != 'TRUE') THEN
   IF (Company_Basic_Data_Window_API.Check_Copy_From_Company(newrec_.company, lu_name_)) THEN
      Error_SYS.Record_General(lu_name_, 'NODIRECTINSERT: A record cannot be entered/modified as :P1 window has been set up for copying data only from source company in Basic Data Synchronization window.', Basic_Data_Window_API.Get_Window(lu_name_));
   END IF;
END IF;
...

        This should be added as pre-processing code.

        Refer examples in ServerMethodsExample.plsql

 

Client Changes

These client changes should be done to support Basic Data Synchronization in the relevant client files.

There is a new class inside Enterp which should be imported when implementing the client part of this functionality.

Name of the class: cCopyToCompany

The above class contains 3 public methods.

These methods should be called from the inquire and execute event handlers of the menu options for manual copy and from DataSourceSaveCheckOk() method and PM_DataSourceSave window action for automatic copy.

CopyToCompanies

This method can be used to copy data only from one data source. Not suitable to copy data from two sources at the same time like a master detail window.

Parameter Name Comment
nWhat method inquire or execute
hWndTBLWindow window handler
sLU Logical Unit
sPackage Package Name
nCols key set (key columns set for tbw and tbl, key fields set for form window)
sSourceCompany source company ID
sType copy type (automatic or manual)
sAttr array of the attribute list
sInfo Copy status (SUCCESSFUL, PARTIALLY_SUCCESSFUL OR ERROR)
sWindow window name
nLogId Log ID
sDlgOpen = null specify whether the copy dialog is open or not. (This parameter uses copy data from two data sources at the same time. This could be ignored)
nColsComp = null target companies list (This uses copy data from two data sources at the same time. This could be ignored)

 

CopyToCompanies

This method can be used to copy data from two data sources at the same time. This is suitable for master detail windows.

Parameter Name Comment
nWhat method inquire or execute
hWndTBLWindow window handler - first data source
sLU Logical Unit - first data source
sPackage Package Name - first data source
nCols key set (key columns set for tbw and tbl, key fields set for form window) - first data source
sSourceCompany source company ID
sType copy type (automatic or manual)
sAttr array of the attribute list - first data source
sInfo Copy status (SUCCESSFUL, PARTIALLY_SUCCESSFUL OR ERROR) - first data source
sWindow window name - first data source
nLogId Log ID - first data source
hWndTBLWindow2 window handler - second data source
sLu2 Logical Unit - second data source
sPackage2 Package Name - second data source
nCols2 key set (key columns set for tbw and tbl, key fields set for form window) - second data source
sAttr2 array of the attribute list - second data source
sInfo2 Copy status (SUCCESSFUL, PARTIALLY_SUCCESSFUL OR ERROR) - second data source
sWindow2 window name - second data source
nLogId2 Log ID - second data source

 

NavigateToCopyBasicDataLog

This method should be used to show the status of the action and to get user confirmation to open the history log window.

Parameter Name Comment
sAllInfo Copy status (SUCCESSFUL, PARTIALLY_SUCCESSFUL OR ERROR)
sParams window name

 

Examples from tbwAttribute.cs

...
public new SalBoolean DataSourceSaveCheckOk()
{
   #region Actions
   DbPLSQLBlock(@" {0} := &AO.Company_Basic_Data_Window_API.Is_Active_Lu_Exist( {1} IN,{2} IN) ;",
   this.QualifiedVarBindName("sState"),
   this.QualifiedVarBindName("i_sCompany"),
   this.QualifiedVarBindName("sLu"));
   if (sState == "TRUE")
   {
      sType = "AUTOMATIC";
      cControls[0] = colsAttribute;
      cCopyToCompany.CopyToCompanies(Ifs.Fnd.ApplicationForms.Const.METHOD_Execute, this, sLu, "Accounting_Attribute_API", 
                                     cControls, i_sCompany, sType, ref this.lsAttr, ref sAllInfo, ref sWindow, ref nLogId);
      sParams[0] = sWindow;
   }
   return true;
   #endregion
}
...
...
private void tbwAttribute_OnPM_DataSourceSave(object sender, WindowActionsEventArgs e)
{
   #region Actions
   e.Handled = true;
   if (Sal.SendClassMessage(Ifs.Fnd.ApplicationForms.Const.PM_DataSourceSave, Sys.wParam, Sys.lParam))
   {
      e.Return = true;
      if (Sys.wParam == Ifs.Fnd.ApplicationForms.Const.METHOD_Execute)
      {
         if (cCopyToCompany.NavigateToCopyBasicDataLog(ref sAllInfo, sParams))
         {
            NavigateToCopyBasicDataLog();
         }
      }
      return;
   }
   else
   {
      lsAttr.Clear();
      e.Return = false;
      return;
   }
   #endregion
} 
...
...
private void menuTbwMethods_menuCopy_To_Companies____Execute(object sender, FndCommandExecuteEventArgs e)
{
   sType = "MANUAL";
   cControls[0] = colsAttribute;
   cCopyToCompany.CopyToCompanies(Ifs.Fnd.ApplicationForms.Const.METHOD_Execute, this, sLu, "Accounting_Attribute_API", 
                                  cControls, i_sCompany, sType, ref this.lsAttr, ref sAllInfo, ref sWindow, ref nLogId);
   sParams[0] = sWindow
   if (cCopyToCompany.NavigateToCopyBasicDataLog(ref sAllInfo, sParams))
   {
      NavigateToCopyBasicDataLog();
   }
}
...
...
private void menuTbwMethods_menuCopy_To_Companies____Inquire(object sender, FndCommandInquireEventArgs e)
{
   ((FndCommand)sender).Enabled = cCopyToCompany.CopyToCompanies(Ifs.Fnd.ApplicationForms.Const.METHOD_Inquire, this, sLu, "Accounting_Attribute_API", 
                                                                 cControls, i_sCompany, sType, ref this.lsAttr, ref sAllInfo, ref sWindow, ref nLogId);
}
...

Refer tbwAttribute.cs and frmPaymentTermDetails.cs for more details about these examples.