JD Edwards

JD Edwards
Lokesh Reddy Blog

Monday, December 14, 2015

NER To Read the Work Center Error Messages

=======================================================================
     NAMED ER: - Get Batch Error Messages From Work Center
=======================================================================
     evt_szPPATBriefMassage_MSGP
     evt_szSubstitutionValues_TSV
     evt_szErrorID_TMPI
     evt_szFunctionName_FCTNM
     evt_idF01131MHandle_HF01131M
     evt_mnSecondKey_SERK
     evt_szErrorMessage_TSV
     evt_szSourceLineNumber_LNBR
     evt_cErrorFlag_ERR
     OPT: Using Defaults
0001 //
0002 VA evt_cErrorFlag_ERR = "Y"
0003 If BF mnParentKeyValue_PPSRK is equal to <Zero>
0004    Get PPAT Messages By Work Field
           BF idMessagePointer_GENLNG -> BF idPPATWorkField
           BF mnParentKeyValue_PPSRK <- BF mnKeyValueSerialNumber
0005 End If
0006 F01131M(VA evt_idF01131MHandle_HF01131).Select
        BF mnSerialNumber_SERK <  TK Key Value Serial Number
        BF mnParentKeyValue_PPSRK =  TK ParentKeyValueSerialNumberA
0007 F01131M(VA evt_idF01131MHandle_HF01131).Fetch Next
        BF mnSerialNumber_SERK <- TK Key Value Serial Number
0008 While SV File_IO_Status is equal to CO SUCCESS
0009    VA evt_idF01131MHandle_HF01131 = F01131M.Open Handle
0010    F01131M(VA evt_idF01131MHandle_HF01131).Select
           BF mnSerialNumber_SERK =  TK Key Value Serial Number
           BF mnMessageLevel_LV =  TK Level of Indention
0011    F01131M(VA evt_idF01131MHandle_HF01131).Fetch Next
           VA evt_mnSecondKey_SERK <- TK Key Value Serial Number
           VA evt_szPPATBriefMassage_MSGP <- TK PPAT - Brief Message
           VA evt_szSubstitutionValues_TSV <- TK Template Substitution Values
           VA evt_szErrorID_TMPI <- TK Template ID
           VA evt_szFunctionName_FCTNM <- TK Name - Function
           VA evt_szSourceLineNumber_LNBR <- TK Source Line Number
0012    While SV File_IO_Status is equal to CO SUCCESS
0013       If VA evt_szPPATBriefMassage_MSGP is equal to <Null> Or VA evt_szPPATBriefMassage_MSGP is equal to <Blank>
0014          VA evt_szErrorMessage_TSV = VA evt_szSubstitutionValues_TSV
0015       Else
0016          VA evt_szErrorMessage_TSV = VA evt_szPPATBriefMassage_MSGP
0017       End If
0018       // Insert into Custom Error Table
0019       F55WCMSG.Insert
              BF szEdiBatchNumber -> TK EDI - Batch Number
              BF mnLineNumberID -> TK Who's Who Line Number - ID
              BF mnSerialNumber_SERK -> TK Key Value Serial Number
              VA evt_mnSecondKey_SERK -> TK Key Value Serial Number
              VA evt_szErrorID_TMPI -> TK Data Item
              VA evt_szErrorMessage_TSV -> TK Template Substitution Values
              VA evt_szFunctionName_FCTNM -> TK Name - Function
              VA evt_szSourceLineNumber_LNBR -> TK Source Line Number
              BF mnEdiDocumentNumber -> TK EDI - Document Number
              VA evt_cErrorFlag_ERR -> TK Data Field Error Code
0020       F01131M(VA evt_idF01131MHandle_HF01131).Fetch Next
              VA evt_mnSecondKey_SERK <- TK Key Value Serial Number
              VA evt_szPPATBriefMassage_MSGP <- TK PPAT - Brief Message
              VA evt_szSubstitutionValues_TSV <- TK Template Substitution Values
              VA evt_szErrorID_TMPI <- TK Template ID
              VA evt_szFunctionName_FCTNM <- TK Name - Function
              VA evt_szSourceLineNumber_LNBR <- TK Source Line Number
0021    End While
0022    F01131M(VA evt_idF01131MHandle_HF01131).Close
0023    F01131M.Fetch Next
           BF mnSerialNumber_SERK <- TK Key Value Serial Number
0024 End While

Friday, May 15, 2015

Launch UBE For SynchronousAsynchronous

 Business Function : Launch R5942004 With Report Interconnects Header File
  This business function is used to run the specified UBE by either Synchronous or Asynchronous.
/*****************************************************************************
 *    Header File:  B5942004.h
 *
 *    Description:  Launch R5942004 With Report Interconnects Header File
 *
 *        History:
 *          Date        Programmer  SAR# - Description
 *          ----------  ----------  -------------------------------------------
 *   Author 2/2/2015      Lokesh      Unknown  - Created 
 *
 *
 * Copyright (c) J.D. Edwards World Source Company, 1996
 *
 * This unpublished material is proprietary to J.D. Edwards World Source 
 * 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 J.D. Edwards World Source Company.
 ****************************************************************************/

#ifndef __B5942004_H
#define __B5942004_H

/*****************************************************************************
 * Table Header Inclusions
 ****************************************************************************/
 #include <R5942004.h>
/*****************************************************************************
 * External Business Function Header Inclusions
 ****************************************************************************/

/*****************************************************************************
 * Global Definitions
 ****************************************************************************/

/*****************************************************************************
 * Structure Definitions
 ****************************************************************************/

/*****************************************************************************
 * DS Template Type Definitions
 ****************************************************************************/
 /*****************************************
 * TYPEDEF for Data Structure
 *    Template Name: Data Structure for B5942004                                
 *    Template ID:   D5942004A
 *    Generated:     Tue Feb 2 09:59:58 2015
 *
 * 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_D5942004A
#define DATASTRUCTURE_D5942004A

typedef struct tagDSD5942004A
{
  MATH_NUMERIC      mnLoadNumber_LDNM;                  
  JCHAR             szLoadDepot_VMCU[13];               
  JCHAR             szVersion[11];                      
  JCHAR             cSyncFlag01_EV01;                   
  JCHAR             cErrorCode_ERRC;                    
} DSD5942004A, *LPDSD5942004A;

#define IDERRmnLoadNumber_LDNM_1                  1L
#define IDERRszLoadDepot_VMCU_2                   2L
#define IDERRszVersion_3                          3L
#define IDERRcSyncFlag01_EV01_4                   4L
#define IDERRcErrorCode_ERRC_5                    5L

#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 LaunchR5942004WithReportIntercon (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD5942004A lpDS);


/*****************************************************************************
 * Internal Function Prototypes
 ****************************************************************************/

#endif    /* __B5942004_H */


#include <jde.h>

#define b5942004_c


/*****************************************************************************
 *    Source File:  b5942004
 *
 *    Description:  Launch R5942004 With Report Interconnects Source File
 *
 *        History:
 *          Date        Programmer  SAR# - Description
 *          ----------  ----------  -------------------------------------------
 *   Author 2/2/2015   Unkno       Unknown  - Created  
 *
 * Copyright (c) J.D. Edwards World Source Company, 1996
 *
 * This unpublished material is proprietary to J.D. Edwards World Source 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 J.D. Edwards World Source Company.
 ****************************************************************************/
/**************************************************************************
 * Notes:
 *
 **************************************************************************/

#include <b5942004.h>


/**************************************************************************
 *  Business Function:  LaunchR5942004WithReportIntercon
 *
 *        Description:  Launch R5942004 With Report Interconnects
 *
 *         Parameters:
 *           LPBHVRCOM           lpBhvrCom    Business Function Communications
 *           LPVOID              lpVoid       Void Parameter - DO NOT USE!
 *           LPDSD5842           lpDS         Parameter Data Structure Pointer  
 *
 *************************************************************************/

JDEBFRTN (ID) JDEBFWINAPI LaunchR5942004WithReportIntercon (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD5942004A lpDS) 

{
   /************************************************************************
    *  Variable declarations
    ************************************************************************/
      JCHAR                   szEnvironmentName[11];
    JCHAR                   szLocalComputerName[16];
    HUSER                    hUser                        = (HUSER)   NULL;
    PUBEVAR                    pUBEVar                       = (PUBEVAR) NULL;
    ID                        idJDBReturn                    = JDEDB_PASSED;
    BOOL                    bReportSuccess                = FALSE;
    ID                        idReturnValue                = ER_SUCCESS;
   /************************************************************************
    * Declare structures
    ************************************************************************/
     DSRIR5942004                ds5942004;  
   /************************************************************************
    * Declare pointers
    ************************************************************************/

   /************************************************************************
    * Check for NULL pointers
    ************************************************************************/
   if ((lpBhvrCom == (LPBHVRCOM) NULL) ||
       (lpVoid    == (LPVOID)    NULL) ||
       (lpDS      == (LPDSD5942004A)    NULL))
   {
     jdeErrorSet (lpBhvrCom, lpVoid, (ID) 0, _J("4363"), (LPVOID) NULL);
     return ER_ERROR;
   }
    
   idJDBReturn = JDB_InitBhvr(lpBhvrCom, &hUser, (JCHAR *)NULL,
                              JDEDB_COMMIT_AUTO);  

   if (idJDBReturn == JDEDB_FAILED)
   {
      jdeSetGBRError(lpBhvrCom, lpVoid, (ID)0, _J("3143"));
      return ER_ERROR;
   }

   /************************************************************************
    * Set pointers
    ************************************************************************/

   /************************************************************************
    * Main Processing
    ************************************************************************/

    /* Retrieve Computer Information */
    jdeGetHostName(szLocalComputerName, DIM(szLocalComputerName), (int) 0);
    GetLocalEnvironmentName(szEnvironmentName, sizeof(szEnvironmentName));
   
    /* Allocate memory */
    pUBEVar = jdeAlloc(COMMON_POOL, sizeof(struct tagUBEVAR),MEM_ZEROINIT);

    if (pUBEVar != (PUBEVAR)NULL)
    {
        memset((void *)pUBEVar, (int)_J('\0'), sizeof(pUBEVar));

        /* Load UBE Structure */

        pUBEVar->bPreview = TRUE;
        jdeNIDcpy((JCHAR *)pUBEVar->szReport,(const JCHAR *)_J("R5942004"));

        if (IsStringBlank(lpDS->szVersion))
        {
            memcpy((void *)(pUBEVar->szVersion), (const JCHAR *) _J("TEST0001"),
                    sizeof(pUBEVar->szVersion));
        }
        else
        {
            memcpy((void *)(&pUBEVar->szVersion), (const JCHAR *) &lpDS->szVersion,
                    sizeof(pUBEVar->szVersion));
        }

        memcpy((void *)(&pUBEVar->szMachineKey), (const JCHAR *) &szLocalComputerName,
                    sizeof(pUBEVar->szMachineKey));
        memcpy((void *)(&pUBEVar->szEnhv), (const JCHAR *) &szEnvironmentName,
                    sizeof(pUBEVar->szEnhv));
       

       
      /* If cXMLFlag is equal to 1, run Asynch, otherwise run Synch  */
          if (lpDS->cSyncFlag01_EV01 == _J('1'))
          {   
            /* Run the UBE Synchronously */
              pUBEVar->bSynchFlag    = TRUE;
          }
          else
          {
                /* Run the UBE Asynchronously */
                pUBEVar->bSynchFlag    = FALSE; 
          }   
        /* Run the UBE Asynchronously */
        //pUBEVar->bSynchFlag = FALSE;  

        /* Run the UBE in Batch Mode */
        pUBEVar->bBatchFlag = TRUE;

        /* Load R5942004 Structure */
        memset((void *)&ds5942004, (int)_J('\0'), sizeof(ds5942004));

        MathCopy(&ds5942004.mnLoadNumber1_LDNM, &lpDS->mnLoadNumber_LDNM);
        memcpy((void *)(&ds5942004.szCostCenterTrip1_VMCU), (const JCHAR *) &lpDS->szLoadDepot_VMCU,
                    sizeof(ds5942004.szCostCenterTrip1_VMCU));
       
        /* Launch the UBE */
        bReportSuccess = jdeLaunchUBEEx((HUSER)hUser, (PUBEVAR)pUBEVar, (LPVOID)&ds5942004, lpBhvrCom);

        if (!bReportSuccess)
        {
         jdeSetGBRError(lpBhvrCom, lpVoid, (ID)0, _J("017H"));
         idReturnValue = ER_ERROR;
         lpDS->cErrorCode_ERRC = _J('1');
        }
    }


   /************************************************************************
    * Function Clean Up
    ************************************************************************/
    if (pUBEVar != (PUBEVAR)NULL)
    {
        jdeFree((LPVOID)pUBEVar);
    }

    if (hUser)
    {
        JDB_FreeBhvr(hUser);
    }
    return (idReturnValue); 
}

/* Internal function comment block */
/**************************************************************************
 *   Function:  Ixxxxxxx_a   // Replace "xxxxxxx" with source file number
 *                           // and "a" with the function name
 *      Notes:
 *
 *    Returns:
 *
 * Parameters:
 **************************************************************************/

Saturday, May 9, 2015

Get Files From the Directory For EDI Inbound Process

Business Function : Get Files From Directory
 Description: This is used to read the files from the particular directory and read the each file having the number of records.After reading the files , it will store the the file names,record count,transaction id,audit fields in to the custom table F567101.That will use to read the Inbound files using the inbound EDI programs.


/************************* HEADER FILE ******************************************
 *    Header File:  B567101.h
 *
 *    Description:  Inbound Directory Monitoring BSFN Header File
 *
 *        History:
 *          Date        Programmer  SAR# - Description
 *          ----------  ----------  -------------------------------------------
 *   Author 1/2/2015   Lokesh Reddy    Unknown  - Created 
 *
 *
 * Copyright (c) J.D. Edwards World Source Company, 1996
 *
 * This unpublished material is proprietary to J.D. Edwards World Source 
 * 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 J.D. Edwards World Source Company.
 ****************************************************************************/

#ifndef __B567101_H
#define __B567101_H

/*****************************************************************************
 * Table Header Inclusions
 ****************************************************************************/

 #include <f567101.h>

/*****************************************************************************
 * External Business Function Header Inclusions
 ****************************************************************************/
  #include <b9800100.h>        /* For Audit Information */

/*****************************************************************************
 * Global Definitions
 ****************************************************************************/

/*****************************************************************************
 * Structure Definitions
 ****************************************************************************/

/*****************************************************************************
 * DS Template Type Definitions
 ****************************************************************************/
 /**
 * TYPEDEF for Data Structure
 * D567101 : DS For Inbound Directory Monitoring BSFN
 *
 * Copyright Oracle USA
 *
 * This is a JDEdwards EnterpriseOne generated file.
 * Do not modify this file.
 * Only re-generate with the appropriate tool.
 * Generation Date : 1/2/2015
 */

#ifndef DATASTRUCTURE_D567101
#define DATASTRUCTURE_D567101

typedef struct tagDSD567101
{
  JCHAR          szDirectoryPath_DRPT[255];
  JCHAR          cErrorCode_ERRC;
  JCHAR          szNameObject_OBNM[11];
  JCHAR          cInitialUploadFlag_EDSP;
  MATH_NUMERIC   mnUniqueKeyID_UKID;
} DSD5847101 , *LPDSD5847101;

#define IDERRszDirectoryPath_DRPT_1               1L
#define IDERRcErrorCode_ERRC_2                    2L
#define IDERRszNameObject_OBNM_3                  3L
#define IDERRcInitialUploadFlag_EDSP_4            4L
#define IDERRmnUniqueKeyID_UKID_5                 5L

#endif /* DATASTRUCTURE_D567101 */
/*****************************************************************************
 * 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 GetFileNamesInDirectoryN         (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD567101 lpDS);


/*****************************************************************************
 * Internal Function Prototypes
 ****************************************************************************/

#endif    /* __B567101_H */


 ****************SOURCE FILE********************************************

#include <jde.h>

#ifdef JDENV_PC
#include <windows.h>
#else
#include <dirent.h>
#include <sys/types.h>
#endif

#define b567101_c


/*****************************************************************************
*    Source File:  b567101
*
*    Description:  Inbound Directory Monitoring BSFN Source File
*
*        History:
*          Date        Programmer  SAR# - Description
*          ----------  ----------  -------------------------------------------
*   Author 1/2/2015   Lokesh Reddy       Unknown  - Created  
*
* Copyright (c) J.D. Edwards World Source Company, 1996
*
* This unpublished material is proprietary to J.D. Edwards World Source 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 J.D. Edwards World Source Company.
****************************************************************************/
/**************************************************************************
* Notes:
*
**************************************************************************/

#include <x00022.h>  /* BF: GetNextUniqueKeyID */
#include <b567101.h>


/**************************************************************************
*  Business Function:  GetFileNamesInDirectoryN
*
*        Description:  Get File Names In Directory
*
*         Parameters:
*           LPBHVRCOM           lpBhvrCom    Business Function Communications
*           LPVOID              lpVoid       Void Parameter - DO NOT USE!
*           LPDSD584            lpDS         Parameter Data Structure Pointer  
*
*************************************************************************/

JDEBFRTN (ID) JDEBFWINAPI GetFileNamesInDirectoryN (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD567101 lpDS) 

{
    /************************************************************************
    *  Variable declarations
    ************************************************************************/
#ifndef JDENV_PC

    int iRet = ER_SUCCESS;
    DIR *dir = NULL;
    struct dirent *de = NULL;       
    JCHAR    szd_name[255] = {0};

    ID  idJDEDBReturn;
    int     counter = 0;
    int nMathReturn=0;

    /************************************************************************
    * Declare structures
    ************************************************************************/
    DSD9800100     GetAuditParms     = {0};   
    F567101    dsF567101 = {0};
    DSDX00022A    dsX00022A = { 0 };
#define NUMMAP_1 1
    CALLMAP cmErrorMap_1[NUMMAP_1] = { { IDERRszNameObject_OBNM_3, IDERRszObjectName_1 } };
    /************************************************************************
    * Declare pointers
    ************************************************************************/
    HREQUEST                 hRequestF567101 =(HREQUEST)NULL;
    HREQUEST                 hRequestFetchSingle =(HREQUEST)NULL;
    HUSER                  hUser =(HUSER)NULL;
    KEY2_F567101          dsF567101Key2  =  {0} ;
    LPJDEAPP              lpObj = (LPJDEAPP)NULL;
    LPAPPVARIABLES        pAppVars = (LPAPPVARIABLES)NULL;

    /************************************************************************
    * Check for NULL pointers
    ************************************************************************/
    if ((lpBhvrCom == (LPBHVRCOM) NULL) ||
        (lpVoid    == (LPVOID)    NULL) ||
        (lpDS      == (LPDSD5847101)    NULL))
    {
        jdeErrorSet (lpBhvrCom, lpVoid, (ID) 0, _J("4363"), (LPVOID) NULL);
        return ER_ERROR;
    }
    idJDEDBReturn = JDB_InitBhvr((void *)lpBhvrCom, &hUser,(JCHAR *) NULL,
        JDEDB_COMMIT_AUTO);

    if (idJDEDBReturn == JDEDB_FAILED)
    {
        jdeWriteLog(_J("B567101"), 0,_J("hUser Failure"));
    }

    /************************************************************************
    * Set pointers
    ************************************************************************/
    lpObj = lpBhvrCom->lpObj;
    pAppVars = lpObj->lpzAppVars;
    /************************************************************************
    * Main Processing
    ************************************************************************/

    idJDEDBReturn =    JDB_OpenTable (hUser,
        NID_F567101,
        ID_F567101_UKID__FILENAME,
        (NULL),
        (ushort) 0,
        (JCHAR *) NULL,
        &hRequestF567101);

    if (idJDEDBReturn == JDEDB_FAILED)
    {
        jdeWriteLog(_J("B567101"), 0,_J("Table Open Failure"));
    }

    if ((lpDS->cInitialUploadFlag_EDSP == _J(' ')) ||
        (lpDS->cInitialUploadFlag_EDSP == _J('\0')))
    {
        lpDS->cInitialUploadFlag_EDSP = _J('I');
    }                                

    dir = jdeOpendir( lpDS->szDirectoryPath_DRPT );

    if (dir)
    {
        //Generate UKID
        jdeStrncpyTerminate( dsX00022A.szObjectName , lpDS->szNameObject_OBNM , DIM( dsX00022A.szObjectName ) );
        pAppVars->iBusFuncRetCode =
            jdeCallObject( _J("GetNextUniqueKeyID") ,
            (LPFNBHVR)NULL , lpBhvrCom , lpVoid ,
            &dsX00022A , cmErrorMap_1 , NUMMAP_1 ,
            (JCHAR*)NULL , (JCHAR*)NULL , 0 );
        MathCopy( &dsF567101.fiukid , &dsX00022A.mnUniqueKeyID );
        MathCopy( &lpDS->mnUniqueKeyID_UKID , &dsX00022A.mnUniqueKeyID );
        /*               End UKID Generation                                     */

        while( (de=readdir(dir)) != NULL )
        {
            jdeToUnicode (szd_name, (ZCHAR *) de->d_name, DIM(szd_name), NULL);   

            if ((jdeStrcmp(szd_name, _J(".")) == 0)  || (jdeStrcmp(szd_name, _J("..")) == 0))
            {
                // Keep Reading...
            }
            else
            {

                jdeStrncpy(dsF567101.fifilename,szd_name,DIM(dsF567101.fifilename)-1);

                // Before Inserting check whether the flat file information has already been written
                // Go to the table using the flat file name
                idJDEDBReturn =    JDB_OpenTable (hUser, NID_F567101, ID_F567101_FILENAME, (NULL), (ushort) 0, (JCHAR *) NULL, &hRequestFetchSingle);
                if (idJDEDBReturn == JDEDB_FAILED)
                {
                    return (ER_ERROR);
                }

                else
                {
                    // Build the Key
                    jdeStrncpy(dsF567101Key2.fifilename, (const JCHAR *)(dsF567101.fifilename), DIM(dsF567101Key2.fifilename));

                    /*Fetch the Database table values based on the Parameters(dsF567101Key2 ).*/

                    idJDEDBReturn = JDB_FetchKeyed(hRequestFetchSingle, ID_F567101_FILENAME,(void *)&dsF567101Key2, (short)1,(void *) &dsF567101,FALSE);

                    if (idJDEDBReturn != JDEDB_PASSED)
                    {

                        //Generate UKID

                        if (MathZeroTest(&lpDS->mnUniqueKeyID_UKID) == 0)
                        {
                            jdeStrncpyTerminate( dsX00022A.szObjectName , lpDS->szNameObject_OBNM , DIM( dsX00022A.szObjectName ) );
                            pAppVars->iBusFuncRetCode =
                                jdeCallObject( _J("GetNextUniqueKeyID") ,
                                (LPFNBHVR)NULL , lpBhvrCom , lpVoid ,
                                &dsX00022A , cmErrorMap_1 , NUMMAP_1 ,
                                (JCHAR*)NULL , (JCHAR*)NULL , 0 );
                            MathCopy( &dsF567101.fiukid , &dsX00022A.mnUniqueKeyID );
                            MathCopy( &lpDS->mnUniqueKeyID_UKID , &dsX00022A.mnUniqueKeyID );
                            /*               End UKID Generation                                     */
                        }
                        else
                        {
                            MathCopy( &dsF567101.fiukid , &lpDS->mnUniqueKeyID_UKID);
                        }

                        nMathReturn = IntToMathNumeric(counter, &dsF567101.ficount);
                        // Set File Path
                        jdeStrncpy((JCHAR *)(dsF567101.fidrpt), (const JCHAR *)(lpDS->szDirectoryPath_DRPT),
                            DIM(dsF567101.fidrpt));
                        // Set EDSP Flag for Initial Upload
                        dsF567101.fiedsp = lpDS->cInitialUploadFlag_EDSP;
                        // Set Audit fields
                        jdeCallObject(_J("GetAuditInfo"), (LPFNBHVR) NULL, lpBhvrCom, lpVoid,
                            (LPVOID) &GetAuditParms, (CALLMAP *) NULL,
                            (int) 0, (JCHAR *) NULL, (JCHAR *) NULL, (int) 0); 

                        jdeStrncpy((JCHAR *)(dsF567101.fijobn), (const JCHAR *)(GetAuditParms.szWorkstation_UserId),
                            DIM(dsF567101.fijobn));
                        jdeStrncpy((JCHAR *)(dsF567101.fipid), (const JCHAR *)(_J("B567101")),
                            DIM(dsF567101.fipid));
                        jdeStrncpy((JCHAR *)(dsF567101.fiuser), (const JCHAR *)(GetAuditParms.szUserName),
                            DIM(dsF567101.fiuser));      
                        memcpy((void *)(&dsF567101.fiupmj), (const void *)(&GetAuditParms.jdDate),
                            sizeof(JDEDATE));              
                        MathCopy(&dsF567101.fitday, &GetAuditParms.mnTime);
                        // Table Insert
                        idJDEDBReturn = JDB_InsertTable(hRequestF567101, NID_F567101, (ID) NULL,
                            (void *) &dsF567101);

                        if (idJDEDBReturn == JDEDB_FAILED)
                        {
                            jdeWriteLog(_J("B567101"), 0,_J("Table Insert Failure"));
                        }

                        jdeWriteLog(_J("B567101"), 0,szd_name);
                        //counter++;
                    }
                } /* Open Table success */
                JDB_CloseTable(hRequestFetchSingle);
            }
        } /* end while */

        jdeClosedir(dir);
        JDB_CloseTable(hRequestF567101);
    }
    else
    {   
        iRet = ER_ERROR;
    }

    return iRet;
#else
    /************************************************************************
    * Function Clean Up
    ************************************************************************/

    return (ER_SUCCESS);

#endif

}

/* Internal function comment block */
/**************************************************************************
*   Function:  Ixxxxxxx_a   // Replace "xxxxxxx" with source file number
*                           // and "a" with the function name
*      Notes:
*
*    Returns:
*
* Parameters:
***********************************