Hi Josh
[ QUOTE ]
Hi Carlos,
Really informative post. Even I faced the problem many times.Could you share the code of your new business function if possible?
Regards,
Josh
[/ QUOTE ]
Sure
here is
******************** B5648001.C source Code *******************
#include <jde.h>
#define b5648001_c
/*****************************************************************************
* Source File: B5648001
*
* Description: Lee Opciones de Proceso de P48013
*
* History:
* Date Programmer SAR# - Description
* ---------- ---------- -------------------------------------------
* 20/05/2010 C. Lorenzo TRID-1732 Codigos de Categoria en Ordenes de Trabajo
*
* Copyright (c) SUMTEC, S.L. 2010
*
* This unpublished material is proprietary to SUMTEC, S.L.
* All rights reserved. The methods and techniques described herein are
* considered trade secrets and/or confidential. Reproduction or
* distribution, in whole or in part, is forbidden except by express
* written permission of SUMTEC, S.L.
****************************************************************************/
/**************************************************************************
* Notes:
* Esta función devuelve todas las opciones de proceso de la version suministrada
* de la Pantalla P48013, incluyendo las nuevas modificaciones segun TRID-1732
*
**************************************************************************/
#include <b5648001.h>
/**************************************************************************
* Business Function: LeeOpcionesProcesoP48013
*
* Description: Lee Opciones de Proceso de P48013
*
* Parameters:
* LPBHVRCOM lpBhvrCom Business Function Communications
* LPVOID lpVoid Void Parameter - DO NOT USE!
* LPDSD5648001 lpDS Parameter Data Structure Pointer
*
*************************************************************************/
JDEBFRTN (ID) JDEBFWINAPI LeeOpcionesProcesoP48013 (
LPBHVRCOM lpBhvrCom,
LPVOID lpVoid,
LPDSD5648001 lpDS
)
{
/************************************************************************
* Variable declarations
************************************************************************/
ID idReturnValue = ER_SUCCESS; /* Return Code */
ID idJDEDBReturn = JDEDB_PASSED; /* DB API Return Code */
HUSER hUser = (HUSER)NULL;
/************************************************************************
* Declare structures
************************************************************************/
/************************************************************************
* Declare pointers
************************************************************************/
LPDST48013 lpdsProcOptions = (LPDST48013)NULL;
/************************************************************************
* Check for NULL pointers
************************************************************************/
if ((lpBhvrCom == (LPBHVRCOM) NULL) ||
(lpVoid == (LPVOID) NULL) ||
(lpDS == (LPDSD5648001) NULL))
{
jdeErrorSet (lpBhvrCom, lpVoid, (ID) 0, "4363", (LPVOID) NULL);
return ER_ERROR;
}
/************************************************************************
* Set pointers
************************************************************************/
/************************************************************************
* Initialize Behavior Routine
************************************************************************/
idJDEDBReturn = JDB_InitBhvr(
(void *)lpBhvrCom,
&hUser,
(char *) NULL,
JDEDB_COMMIT_AUTO
);
if (idJDEDBReturn != JDEDB_PASSED)
{
jdeSetGBRError(lpBhvrCom, lpVoid, (ID) 0, "3143");
return ER_ERROR;
}
/************************************************************************
* Main Processing
************************************************************************/
if (IsStringBlank(lpDS->Version_VERS))
{
strcpy((char *)lpDS->Version_VERS, (const char *)"ZJDE0001");
}
lpdsProcOptions = (LPDST48013)AllocatePOVersionData(hUser,"P48013",
lpDS->Version_VERS,
sizeof(DST48013));
if (lpdsProcOptions != (LPDST48013)NULL)
{
/* Copy lpdsProcOptions values to lpDS */
strcpy((char *)lpDS->TipoOrden_DCTO,
(const char *)lpdsProcOptions->szOrdertype);
strcpy((char *)lpDS->UnidadMedida_UM,
(const char *)lpdsProcOptions->szUnitofmeasure);
lpDS->TipoWO_TYPS = lpdsProcOptions->cTypewo;
lpDS->PrioridadWO_PRTS = lpdsProcOptions->cPrioritywo;
strcpy((char *)lpDS->EstadoWO_SRST,
(const char *)lpdsProcOptions->szStatuscodewo);
strcpy((char *)lpDS->CategoriaWO01_WR01,
(const char *)lpdsProcOptions->szCategoriesworkorder001);
strcpy((char *)lpDS->CategoriaWO02_WR02,
(const char *)lpdsProcOptions->szCategoriesworkorder002);
strcpy((char *)lpDS->CategoriaWO03_WR03,
(const char *)lpdsProcOptions->szCategoriesworkorder003);
strcpy((char *)lpDS->CodigoBloqueoSO_HCOD,
(const char *)lpdsProcOptions->szSOHoldCode);
strcpy((char *)lpDS->CodigoBloqueoPO_HOLD,
(const char *)lpdsProcOptions->szPOHoldcode);
strcpy((char *)lpDS->DisponibilidadLista_VERS,
(const char *)lpdsProcOptions->szBillAvailVersion);
lpDS->CoproductosSubproductos_EV01 = lpdsProcOptions->cCreateCoByflag;
strcpy((char *)lpDS->ActualizaCat01_UPCD,
(const char *)lpdsProcOptions->szF4102CategoryCode1);
strcpy((char *)lpDS->ActualizaCat02_UPCD,
(const char *)lpdsProcOptions->szF4102CategoryCode2);
strcpy((char *)lpDS->ActualizaCat03_UPCD,
(const char *)lpdsProcOptions->szF4102CategoryCode3);
strcpy((char *)lpDS->ActualizaCat04_UPCD,
(const char *)lpdsProcOptions->Cat04WO_UPCD);
strcpy((char *)lpDS->ActualizaCat05_UPCD,
(const char *)lpdsProcOptions->Cat05WO_UPCD);
strcpy((char *)lpDS->TipoReferenciaCruzada_XRT,
(const char *)lpdsProcOptions->szCrossReferenceTypeCode);
strcpy((char *)lpDS->CreacionECOWO_V001,
(const char *)lpdsProcOptions->szECOWOEntryVersion);
strcpy((char *)lpDS->AsignacionNumeroSerie_V002,
(const char *)lpdsProcOptions->szAssignSerialNosVersion);
strcpy((char *)lpDS->EstadoBloqueado_SRST,
(const char *)lpdsProcOptions->szHeldStatus);
strcpy((char *)lpDS->EstadoCambio_SRST,
(const char *)lpdsProcOptions->szChangeStatus);
strcpy((char *)lpDS->EstadoCancelado_SRST,
(const char *)lpdsProcOptions->szCancelledStatus);
strcpy((char *)lpDS->TipoTransaccionEDI_TYTN,
(const char *)lpdsProcOptions->szTypeTransaction);
strcpy((char *)lpDS->EstadoCorte_SRST,
(const char *)lpdsProcOptions->szCutoffStatus);
lpDS->FlagTipoLista_EV05 = lpdsProcOptions->cBillTypeflag;
lpDS->FlagTipoRuta_EV06 = lpdsProcOptions->cRoutingTypeflag;
lpDS->FlagCentroCoste_EV06 = lpdsProcOptions->cCostCenterFlag;
lpDS->FlagRecalculo_EV02 = lpdsProcOptions->cRecalculationFlag;
lpDS->FlagValidacionArticulo_EV08 = lpdsProcOptions->cItemBranchFlag;
strcpy((char *)lpDS->Rutas_V003,
(const char *)lpdsProcOptions->szRoutingVersion);
strcpy((char *)lpDS->ListasPiezas_V004,
(const char *)lpdsProcOptions->szPartsListVersion);
lpDS->ColaBackscheduling_EV01 = lpdsProcOptions->cBackschedulingQueueHrsFlag;
strcpy((char *)lpDS->Surtidos_V005,
(const char *)lpdsProcOptions->szMaterialIssuesVersion);
FreePODataStructure(lpdsProcOptions);
}
else
{
idReturnValue = ER_ERROR;
}
/************************************************************************
* Function Clean Up
************************************************************************/
return (idReturnValue);
}
/* Internal function comment block */
/**************************************************************************
* Function: Ixxxxxxx_a // Replace "xxxxxxx" with source file number
* // and "a" with the function name
* Notes:
*
* Returns:
*
* Parameters:
**************************************************************************/
********************* B5648001.H Include File *******************
/*****************************************************************************
* Header File: B5648001.h
*
* Description: Lee Opciones de Proceso de P48013
*
* History:
* Date Programmer SAR# - Description
* ---------- ---------- -------------------------------------------
* 20/05/2010 C. Lorenzo TRID-1732 - Codigos de Categoria en Ordenes de Trabajo
*
*
* Copyright (c) SUMTEC, S.L. 2010
*
* This unpublished material is proprietary to SUMTEC, S.L.
* Company. All rights reserved. The methods and techniques described
* herein are considered trade secrets and/or confidential. Reproduction
* or distribution, in whole or in part, is forbidden except by express
* written permission of SUMTEC, S.L.
****************************************************************************/
#ifndef __B5648001_H
#define __B5648001_H
/*****************************************
* TYPEDEF for Data Structure
* Template Name: Lee Opciones de Proceso de P48013
* Template ID: D5648001
* Generated: Thu May 20 13:46:01 2010
*
* DO NOT EDIT THE FOLLOWING TYPEDEF
* To make modifications, use the OneWorld Data Structure
* Tool to Generate a revised version, and paste from
* the clipboard.
*
**************************************/
#ifndef DATASTRUCTURE_D5648001
#define DATASTRUCTURE_D5648001
typedef struct tagDSD5648001
{
char Version_VERS[11];
char TipoOrden_DCTO[3];
char UnidadMedida_UM[3];
char ColaBackscheduling_EV01;
char TipoWO_TYPS;
char PrioridadWO_PRTS;
char EstadoWO_SRST[3];
char FlagCentroCoste_EV06;
char TipoReferenciaCruzada_XRT[3];
char EstadoBloqueado_SRST[3];
char EstadoCambio_SRST[3];
char EstadoCancelado_SRST[3];
char EstadoCorte_SRST[3];
char CategoriaWO01_WR01[5];
char CategoriaWO02_WR02[4];
char CategoriaWO03_WR03[4];
char ActualizaCat01_UPCD[5];
char ActualizaCat02_UPCD[5];
char ActualizaCat03_UPCD[5];
char ActualizaCat04_UPCD[5];
char ActualizaCat05_UPCD[5];
char FlagRecalculo_EV02;
char FlagValidacionArticulo_EV08;
char CodigoBloqueoSO_HCOD[3];
char CodigoBloqueoPO_HOLD[3];
char FlagTipoLista_EV05;
char FlagTipoRuta_EV06;
char DisponibilidadLista_VERS[11];
char CreacionECOWO_V001[11];
char AsignacionNumeroSerie_V002[11];
char Rutas_V003[11];
char ListasPiezas_V004[11];
char Surtidos_V005[11];
char CoproductosSubproductos_EV01;
char TipoTransaccionEDI_TYTN[9];
} DSD5648001, *LPDSD5648001;
#define IDERRVersion_VERS_34 34L
#define IDERRTipoOrden_DCTO_35 35L
#define IDERRUnidadMedida_UM_36 36L
#define IDERRColaBackscheduling_EV01_37 37L
#define IDERRTipoWO_TYPS_38 38L
#define IDERRPrioridadWO_PRTS_39 39L
#define IDERREstadoWO_SRST_40 40L
#define IDERRFlagCentroCoste_EV06_41 41L
#define IDERRTipoReferenciaCruzada_XRT_42 42L
#define IDERREstadoBloqueado_SRST_43 43L
#define IDERREstadoCambio_SRST_44 44L
#define IDERREstadoCancelado_SRST_47 47L
#define IDERREstadoCorte_SRST_48 48L
#define IDERRCategoriaWO01_WR01_49 49L
#define IDERRCategoriaWO02_WR02_50 50L
#define IDERRCategoriaWO03_WR03_51 51L
#define IDERRActualizaCat01_UPCD_52 52L
#define IDERRActualizaCat02_UPCD_53 53L
#define IDERRActualizaCat03_UPCD_54 54L
#define IDERRActualizaCat04_UPCD_55 55L
#define IDERRActualizaCat05_UPCD_56 56L
#define IDERRFlagRecalculo_EV02_57 57L
#define IDERRFlagValidacionArticulo_EV08_58 58L
#define IDERRCodigoBloqueoSO_HCOD_59 59L
#define IDERRCodigoBloqueoPO_HOLD_60 60L
#define IDERRFlagTipoLista_EV05_61 61L
#define IDERRFlagTipoRuta_EV06_62 62L
#define IDERRDisponibilidadLista_VERS_63 63L
#define IDERRCreacionECOWO_V001_64 64L
#define IDERRAsignacionNumeroSerie_V002_65 65L
#define IDERRRutas_V003_66 66L
#define IDERRListasPiezas_V004_67 67L
#define IDERRSurtidos_V005_68 68L
#define IDERRCoproductosSubproductos_EV01_69 69L
#define IDERRTipoTransaccionEDI_TYTN_70 70L
#endif
/*****************************************
* TYPEDEF for Data Structure
* Template Name: Manufacturing Work Order Processing
* Template ID: T48013
* Generated: Thu May 20 13:53:29 2010
*
* DO NOT EDIT THE FOLLOWING TYPEDEF
* To make modifications, use the OneWorld Data Structure
* Tool to Generate a revised version, and paste from
* the clipboard.
*
**************************************/
#ifndef DATASTRUCTURE_T48013
#define DATASTRUCTURE_T48013
typedef struct tagDST48013
{
char szOrdertype[3];
char szUnitofmeasure[3];
char cTypewo;
char cPrioritywo;
char szStatuscodewo[3];
char szCategoriesworkorder001[5];
char szCategoriesworkorder002[4];
char szCategoriesworkorder003[4];
char szSOHoldCode[3];
char szPOHoldcode[3];
char szBillAvailVersion[11];
char cCreateCoByflag;
char szF4102CategoryCode1[5];
char szCrossReferenceTypeCode[3];
char szECOWOEntryVersion[11];
char szAssignSerialNosVersion[11];
char szHeldStatus[3];
char szChangeStatus[3];
char szCancelledStatus[3];
char szTypeTransaction[9];
char szCutoffStatus[3];
char cBillTypeflag;
char cRoutingTypeflag;
char cCostCenterFlag;
char cRecalculationFlag;
char cItemBranchFlag;
char szRoutingVersion[11];
char szPartsListVersion[11];
char szF4102CategoryCode2[5];
char szF4102CategoryCode3[5];
char cBackschedulingQueueHrsFlag;
char szMaterialIssuesVersion[11];
char Cat04WO_UPCD[5];
char Cat05WO_UPCD[5];
} DST48013, *LPDST48013;
#define IDERRszOrdertype_1 1L
#define IDERRszUnitofmeasure_2 2L
#define IDERRcTypewo_3 3L
#define IDERRcPrioritywo_4 4L
#define IDERRszStatuscodewo_5 5L
#define IDERRszCategoriesworkorder001_6 6L
#define IDERRszCategoriesworkorder002_7 7L
#define IDERRszCategoriesworkorder003_8 8L
#define IDERRszSOHoldCode_12 12L
#define IDERRszPOHoldcode_13 13L
#define IDERRszBillAvailVersion_16 16L
#define IDERRcCreateCoByflag_17 17L
#define IDERRszF4102CategoryCode1_23 23L
#define IDERRszCrossReferenceTypeCode_26 26L
#define IDERRszECOWOEntryVersion_27 27L
#define IDERRszAssignSerialNosVersion_28 28L
#define IDERRszHeldStatus_34 34L
#define IDERRszChangeStatus_35 35L
#define IDERRszCancelledStatus_36 36L
#define IDERRszTypeTransaction_37 37L
#define IDERRszCutoffStatus_38 38L
#define IDERRcBillTypeflag_39 39L
#define IDERRcRoutingTypeflag_40 40L
#define IDERRcCostCenterFlag_41 41L
#define IDERRcRecalculationFlag_42 42L
#define IDERRcItemBranchFlag_44 44L
#define IDERRszRoutingVersion_45 45L
#define IDERRszPartsListVersion_46 46L
#define IDERRszF4102CategoryCode2_47 47L
#define IDERRszF4102CategoryCode3_48 48L
#define IDERRcBackschedulingQueueHrsFlag_49 49L
#define IDERRszMaterialIssuesVersion_50 50L
#define IDERRCat04WO_UPCD_51 51L
#define IDERRCat05WO_UPCD_52 52L
#endif
/*****************************************************************************
* Source Preprocessor Definitions
****************************************************************************/
#if defined (JDEBFRTN)
#undef JDEBFRTN
#endif
#if defined (WIN32)
#if defined (WIN32)
#define JDEBFRTN(r) __declspec(dllexport) r
#else
#define JDEBFRTN(r) __declspec(dllimport) r
#endif
#else
#define JDEBFRTN(r) r
#endif
/*****************************************************************************
* Business Function Prototypes
****************************************************************************/
JDEBFRTN (ID) JDEBFWINAPI PORetrievalWOProcessin (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD5648001 lpDS);
/*****************************************************************************
* Internal Function Prototypes
****************************************************************************/
#endif /* __B5648001_H */
********************************************
Look that at the end of T48013 there are my 2 new Processing Options.
I duplicated the DLink original Bussines function, but when duplicating the data structure, I prefered to delete all the parameters andcreated my own ones with translated names (I'm spanish), to keep some order on them.
Hope this helps