V10 ResourcesReference
ResourcesReference
Reference
Back | List of Articles

How to correctly perform drilldowns?

Last changed in 02/12/2020

The extensibility projects can contain code to drilldown in most of the ERP entities or in some documents and explorations.

In order to do so, it is necessary to know the internal codes used by the ERP to instance the screen and load the desired information. These codes are made of several elements, the module the screen belongs, the maintenance itself, the document identifier, etc.

The method to execute a drilldown is the DrilDownLista, available in the public interface of the platform (StdPlatBS100.StdBSInterfPub). This interface is available in any CustomClass, CustomForm or when subscribing the interface events: PSO.DrillDownLista.

The following list represents the most important and most used codes, associated to the module.

NameApplication /ModuleEventAudit (ex: maintenance)Parameters
ItemsBASGCP_MOSTRAMANUTENCAOmnuTabArtigoItem code
ClientsBASGCP_MOSTRAMANUTENCAOmnuTabClientesClient code
Sales cycleCRMCRM_MOSTRAMANUTENCAOmnuTabCabecCicloVendaCycle code
ActivitiesCRMCRM_MOSTRAMANUTENCAOmnuTabActividadesActivity identifier
Work logsGPRGPR_MOSTRAMANUTENCAODiariosTrabalhoLog code
Accounts planCBLCBL_PlanoContasn/aFiscal year; Account (*)
STP processesSTPevtDD_STP_Processosn/aProcess key (*)
Sales documentVNDGCP_EditarDocumenton/aDocument key (*)
Purchase documentCMPGCP_EditarDocumenton/aDocument key (*)
Accounting documentCBLCBL_EditaDocumentoIDn/aDocument key (*)
CC statementsCCTGCP_MOSTRAEXPLORACAOmnuExpCCExtractoEntity type; Entity
CC open itemsCCTGCP_MOSTRAEXPLORACAOmnuExpCCPendentesGrelhaEntity type; Entity
Bank statementTESGCP_MOSTRAEXPLORACAOmnuExpExtractoBancarioAccount; Start Dt; End Dt

(*) More information below.

Simply reference the Assembly ConstantesPrimavera100 in your project to easily find in constants all the codes Audit. The following table shows a few examples.

AuditConstant
mnuTabArtigoConstantesPrimavera100.Audit.TAB_ARTIGOS
mnuTabClientesConstantesPrimavera100.Audit.TAB_CLIENTES
mnuTabCabecCicloVendaConstantesPrimavera100.Audit.TAB_CICLO_VENDAS
mnuTabActividadesConstantesPrimavera100.Audit.TAB_ACTIVIDADES
mnuExpCCExtractoConstantesPrimavera100.Audit.EXP_CC_EXTRACTO
mnuExpCCPendentesGrelhaConstantesPrimavera100.Audit.EXP_CC_PENDENTES_GRELHA
mnuExpExtractoBancarioConstantesPrimavera100.Audit.DOC_EXTRACTO

Next, we shoe some examples of how to use the codes to open maintenances, documents and explorations in the different modules.

Maintenances

void ExecutaDrillDown(string Aplicacao, string Evento, string Param1, string Param2 = ", string Param3 = ", string Param4 = ", string Param5 = ")
{
	StdBESqlCampoDrillDown campoDrillDown = new StdBESqlCampoDrillDown
	{
		ModuloNotificado = Aplicacao,
		Tipo = StdBESqlTipos.EnumTipoDrillDownListas.tddlEventoAplicacao,
		Evento = Evento
	};

	StdBEValoresStr param = new StdBEValoresStr();
	param.InsereNovo("Param1", Param1);

	if (!string.IsNullOrWhiteSpace(Param2))
		param.InsereNovo("Param2", Param2);

	if (!string.IsNullOrWhiteSpace(Param3))
		param.InsereNovo("Param3", Param3);

	if (!string.IsNullOrWhiteSpace(Param4))
		param.InsereNovo("Param4", Param4);

	if (!string.IsNullOrWhiteSpace(Param5))
		param.InsereNovo("Param5", Param5);

	PSO.DrillDownLista(campoDrillDown, param);
}

This method can be placed in a shared class to show any ERP maintenance, and it is only necessary to specify the previously mentioned codes.

Knowing the maintenance codes, the event code and the module/application they belong to, we can invoke the method. In the following example, the Param1 receives the maintenance code and the Param2 receives the key for the record to be loaded.

NOTE: In the maintenances, the first parameter must always be the first maintenance code.

Clients (BAS)

ExecutaDrillDown("BAS", "GCP_MOSTRAMANUTENCAO", "mnuTabClientes", "SOFRIO");

Suppliers(BAS)

ExecutaDrillDown("BAS", "GCP_MOSTRAMANUTENCAO", "mnuTabFornecedores", "F0001");

Items (BAS)

ExecutaDrillDown("BAS", "GCP_MOSTRAMANUTENCAO", "mnuTabArtigo", "A0001");

Contacts (CRM)

ExecutaDrillDown("CRM", "CRM_MOSTRAMANUTENCAO", "mnuTabCabecCicloVenda", "CV_HW");

Activities (CRM)

ExecutaDrillDown("CRM", "CRM_MOSTRAMANUTENCAO", "mnuTabPlanoActividades", "A29DF423-4D63-4A29-B42C-6DB70546CB7A");

Work logs (GPR)

ExecutaDrillDown("GPR", "GPR_MOSTRAMANUTENCAO", "DiariosTrabalho", "20");

(*) In the following examples, the maintenance code is not specified, considering that the event code already specifies the maintenance to be shown. In this case, the parameters only refer to the record key that can, in some cases, be composed.

Charts of accounts (CBL)

ExecutaDrillDown("CBL", "CBL_PlanoContas", 2019, "21111001");

Processes (STP)

ExecutaDrillDown("STP", "evtDD_STP_Processos", "PRC/000/2018/1");

Logistic documents

The previously shown method can be used to present these documents, and it is only necessary to specify the correct parameters.

To edit a logistic document, such as the Sales (VND), Purchases (CMP), Internal (INT), Inventory (INV), Current Account (CCT) and Treasury (TES) document, besides being necessary to specify the event code that executes the drilldown (GCP_EditarDocumento) it is also necessary to specify all the key parameters to edit a document of this type, respecting this order: Module, Branch, Document Type, Series and Document Number.

The following example shows how to edit the FA 2019/1 document of the Sales module.

ExecutaDrillDown("VND", "GCP_EditarDocumento", "V", "000", "FA", "2019", "1");

There is, however, another way to edit these documents without specifying all the parameters, using only the document identifier (field Id of the corresponding document header table). With this option, the event to specify is the GCP_EditarDocumentoId and the only parameters that you should move are the Module and the Identifier.

ExecutaDrillDown("VND", "GCP_EditarDocumentoId", "V", "BCB54D22-739A-40C0-878F-ECFBE6EDC369");

Accounting documents

The following example shows how to edit an accounting document in which the only parameter to specify is the document identifier (field Id of the table CabecMovCBL) using drilldown.

Accounting Document (CBL)

ExecutaDrillDown("CBL", "CBL_EditaDocumentoID", "47F38B48-9201-11DC-B190-0020E024149C");

Explorations

It is also possible to drilldown for ERP explorations. However, due to the screens' specificities, it is necessary to handle them individually, depending on the case. The main feature, common to all exploration drilldowns, is the name of the first parameter that must be "Exploracao". As to the remaining parameters, a few explorations require specific parameters (name and value) to load the information.

The following examples show how to drilldown in some explorations.

public void ExecutaDrillDownExploracaoCCT(string Exploracao, string TipoEntidade, string Entidade)
{
	StdBESql100.StdBESqlCampoDrillDown objCampoDrillDown = new StdBESql100.StdBESqlCampoDrillDown
	{
		ModuloNotificado = "CCT",
		Tipo = StdBESql100.StdBESqlTipos.EnumTipoDrillDownListas.tddlEventoAplicacao,
		Evento = "GCP_MOSTRAEXPLORACAO"
	};

	StdBE100.StdBEValoresStr objParam = new StdBE100.StdBEValoresStr();
	objParam.InsereNovo("Exploracao", Exploracao);
	objParam.InsereNovo("TipoEntidade", TipoEntidade);
	objParam.InsereNovo("Entidade", Entidade);

	PSO.DrillDownLista(objCampoDrillDown, objParam);

	objCampoDrillDown = null;
	objParam = null;
}

Current account statements (CCT)

ExecutaDrillDownExploracaoCCT("mnuExpCCExtracto", "C", "SOFRIO");

This exploration requires the parameters Entity Type and Entity.

Open Items (CCT)

ExecutaDrillDownExploracaoCCT("mnuExpCCPendentesGrelha", "C", "SOFRIO");

This exploration also requires the parameters Entity Type and Entity.

Bank statements (TES)

public void ExecutaDrillDownExploracaoTES(string Exploracao, string Conta, string DataInicial, string DataFinal)
{
	StdBESql100.StdBESqlCampoDrillDown objCampoDrillDown = new StdBESql100.StdBESqlCampoDrillDown
	{
		ModuloNotificado = "TES",
		Tipo = StdBESql100.StdBESqlTipos.EnumTipoDrillDownListas.tddlEventoAplicacao,
		Evento = "GCP_MOSTRAEXPLORACAO"
	};

	StdBE100.StdBEValoresStr objParam = new StdBE100.StdBEValoresStr();
	objParam.InsereNovo("Exploracao", Exploracao);
	objParam.InsereNovo("Conta", Conta);
	objParam.InsereNovo("DataInicial", DataInicial);
	objParam.InsereNovo("DataFinal", DataFinal);

	PSO.DrillDownLista(objCampoDrillDown, objParam);

	objCampoDrillDown = null;
	objParam = null;
}
ExecutaDrillDownExploracaoTES("mnuExpExtractoBancario", "CXREC", "1/1/2018", "31/12/2018");

This exploration uses the parameters Account, Start and Final Date, and the "Dates" (the last two) are not mandatory.

You can see more drilldown examples in this GitHub repository.

Bookmark or share this article
Esta página foi útil?
Obrigado pelo seu voto.

login para deixar a sua opinião.

Obrigado pelo seu feedback. Iremos analisá-lo para continuarmos a melhorar!
Artigos Relacionados
Características das entidades e serviços Conceito de integração Conceito de extensibilidade Como registar projetos de extensibilidade? Boas práticas de organização de projetos de integração