Intercompany RDD

Looking to modify our customized RMA Form to include information for a Intercompany RMA. The user is wanting to be able to see SoldTo/ShipTo Information from a different company within our Epicor instance. So the data is there, I’m just having trouble thinking of how to accomplish this inside a RDD.

I can think of a few ways to do this outside of a RDD with a Straight SQL connection, and a few other hacks. But I’m trying to do this as cleanly as possible. Any ideas?

Can you just remove the table relationship criteria of company=company on the desired tables?

You may have to recreate the RDD’s functionality in a BAQ.

I did not think of that, I guess I just assumed since the RDD’s were independent for each company, that they were inherently single company.

In this RDD however I am already using the OrderHed Table one that I need to link to for specific information in the main company. So I didn’t even think of getting burned by no table aliases.

In the spirit of learning/testing, I’m going to create another and see if leaving out a company link would do the trick.

The best idea I could think of was to create a customization on the RMA Print Screen that would have some c# code that would call a BAQ to retrieve the data I need on the other companies side, and throw it into one of the CallContext tables. However i have never done that so we will see how it goes.

This solution would keep things environment & Epicor specific come Epicor 11 Upgrade time.

2 Likes

Circling back to this finally. I was able to successfully pull this off.

  1. Create a customization on the RMA Print Screen. As well as BAQ that contains the appropriate links to get from the RMANum to the information you need. In this case I wanted to pull in the original customers address information from the intercompany links.
  2. Add a Custom Assembly Reference to the Ice.Contracts.BO.DynamicQuery.dll into your customization. This will be required to call your BAQ in the customization
  3. Open up your Custom Code and copy this
// **************************************************
// Custom code for RMAFormForm
// Created: 10/14/2020 9:07:15 PM
// **************************************************
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Windows.Forms;
using Erp.Adapters;
using Erp.UI;
using Ice.Lib;
using Ice.Adapters;
using Ice.Lib.Customization;
using Ice.Lib.ExtendedProps;
using Ice.Lib.Framework;
using Ice.Lib.Searches;
using Ice.UI.FormFunctions;

using Ice.BO;

public partial class Script
{
	// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
	// Begin Wizard Added Module Level Variables **

	private EpiDataView edvReportParam;
	private EpiDataView edvCallContextBpmData;
	// End Wizard Added Module Level Variables **

	// Add Custom Module Level Variables Here **

	public void InitializeCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
		// Begin Wizard Added Variable Initialization

		//This dataview contains the RMANum you need to pass to your BAQ
		this.edvReportParam = ((EpiDataView)(this.oTrans.EpiDataViews["ReportParam"]));
		//this dataview is where you will write your values to so you can pull them into your report
		this.edvCallContextBpmData = (EpiDataView)this.oTrans.EpiDataViews["CallContextBpmData"];

		// End Wizard Added Variable Initialization

		// Begin Wizard Added Custom Method Calls

		// End Wizard Added Custom Method Calls

		this.baseToolbarsManager.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.baseToolbarsManager_ToolClick);

	}

	public void DestroyCustomCode()
	{
		// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
		// Begin Wizard Added Object Disposal

		//act like you are a good developer
		this.edvReportParam = null;
		this.edvCallContextBpmData = null;

		// End Wizard Added Object Disposal

		// Begin Custom Code Disposal

		// End Custom Code Disposal

		//Need to override the ToolClicks so when you print the report in the 9000 different ways that you can, that your code still gets called
		this.baseToolbarsManager.ToolClick -= new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.baseToolbarsManager_ToolClick);

	}

	private void baseToolbarsManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs args)
	{
		String sToolKey = args.Tool.Key;
		//MessageBox.Show(sToolKey);
		if (sToolKey == "PrintPreviewTool" || sToolKey == "PrintServerTool" || sToolKey == "PrintClientTool" || sToolKey == "EmailTool" || sToolKey == "GenerateTool" || sToolKey == "ReportDesignModeTool")
		{
			string rmaNum = edvReportParam.dataView[0]["RMANum"].ToString();
			DataTable dt = new DataTable();
			try
			{
				//BAQ Name
				string QueryID = "TPC_InterCompAddresses";
				//BO Used for BAQ calls
				Ice.Proxy.BO.DynamicQueryImpl DynamicQuery = Ice.Lib.Framework.WCFServiceSupport.CreateImpl<Ice.Proxy.BO.DynamicQueryImpl>(Ice.Lib.Framework.FormFunctions.getILaunchSession(oTrans), Ice.Proxy.BO.DynamicQueryImpl.UriPath);

				//Parameters Object
				Ice.BO.QueryExecutionDataSet dsParams = new QueryExecutionDataSet();

				// Add Parameter to dataset
				dsParams.ExecutionParameter.AddExecutionParameterRow("rmaNum", rmaNum, "int", false, new Guid(), "A");

				//Execute the BAQ and its parameters
				DataSet ds = DynamicQuery.ExecuteByID(QueryID, dsParams);

				//Take the results from the BAQ and put it into a datatable
				dt = ds.Tables["Results"];
				ds.Tables.Remove(dt);
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message, "Error occurred-GetDataTableMain()", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
			foreach (DataRow dr in dt.Rows)
			{
				//Add the values returned from the BAQ into the callContextBPMData view so its passed to the SSRS report.
				edvCallContextBpmData.dataView[0]["Character01"] = "";
				edvCallContextBpmData.dataView[0]["Character02"] = "";
				edvCallContextBpmData.dataView[0]["Character01"] += dr["ShipTo_Name"].ToString() + "~";
				edvCallContextBpmData.dataView[0]["Character01"] += dr["ShipTo_Address1"].ToString() + "~";
				edvCallContextBpmData.dataView[0]["Character01"] += dr["ShipTo_Address2"].ToString() + "~";
				edvCallContextBpmData.dataView[0]["Character01"] += dr["ShipTo_Address3"].ToString() + "~";
				edvCallContextBpmData.dataView[0]["Character01"] += dr["ShipTo_City"].ToString() + " " + dr["ShipTo_State"].ToString() + ", " + dr["ShipTo_Zip"].ToString() + "~";
				edvCallContextBpmData.dataView[0]["Character01"] += dr["ShipTo_Country"].ToString() + "~";

				edvCallContextBpmData.dataView[0]["Character02"] += dr["Customer_BTName"].ToString() + "~";
				edvCallContextBpmData.dataView[0]["Character02"] += dr["Customer_BTAddress1"].ToString() + "~";
				edvCallContextBpmData.dataView[0]["Character02"] += dr["Customer_BTAddress2"].ToString() + "~";
				edvCallContextBpmData.dataView[0]["Character02"] += dr["Customer_BTAddress3"].ToString() + "~";
				edvCallContextBpmData.dataView[0]["Character02"] += dr["Customer_BTCity"].ToString() + " " + dr["Customer_BTState"].ToString() + ", " + dr["Customer_BTZip"].ToString() + "~";
				edvCallContextBpmData.dataView[0]["Character02"] += dr["Customer_BTCountry"].ToString() + "~";
			}

		}
	}
}
  1. After you save your customization assign it to the process in menu maintenance
  2. Open up your SSRS report and add a Dataset called “callContextBPMData”
  3. Copy the below or write your own SQL Query
="SELECT T1.Character01, T1.Character02 FROM CallContextBpmData_" + Parameters!TableGuid.Value + " T1"
  1. Create the fields inside the dataset
  2. Reference the new fields inside the report, then bobs your uncle.