JD Edwards

JD Edwards
Lokesh Reddy Blog

Thursday, October 20, 2016

C Business Function For Subsystem Job.



Header File:
/*****************************************************************************
 *    Header File:  B5642pic.h
 *
 *    Description:  Sub System C BSFN Source File
 *
 *        History:
 *          Date        Programmer  SAR# - Description
 *          ----------  ----------  -------------------------------------------
 *   Author 29/09/16    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.
 ****************************************************************************/

#ifndef __B5642PIC_H
#define __B5642PIC_H

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

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

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

/*****************************************************************************
 * DS Template Type Definitions
 ****************************************************************************/
/*****************************************
* TYPEDEF for Data Structure
*    Template Name: Sub System C BSFN
*    Template ID:   D5642PIC
*    Generated:     Mon Oct 10 13:33:09 2016
*
* 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_D5642PIC
#define DATASTRUCTURE_D5642PIC

typedef struct tagDSD5642PIC
{
    MATH_NUMERIC      mnUserReservedAmount;
    MATH_NUMERIC      mnUserReservedNumber;
    JDEDATE           jdUserReservedDate;
    JCHAR             szVersionR5642PIL[11];
    JCHAR             cSubsystemQue;
    JCHAR             cSuppressErrorMessage;
    JCHAR             szErrorMessage[57];
    MATH_NUMERIC      mnWaveID;
    JCHAR             cRegularorSpecialWaveType;
    MATH_NUMERIC      mnNumberOfCases;
    JCHAR             cAutoOrOnDemand;
    JDEDATE           jdDateUpdated;
    MATH_NUMERIC      mnTimeLastUpdated;
} DSD5642PIC, *LPDSD5642PIC;

#define IDERRmnUserReservedAmount_2               2L
#define IDERRmnUserReservedNumber_3               3L
#define IDERRjdUserReservedDate_5                 5L
#define IDERRszVersionR5642PIL_6                  6L
#define IDERRcSubsystemQue_7                      7L
#define IDERRcSuppressErrorMessage_8              8L
#define IDERRszErrorMessage_9                     9L
#define IDERRmnWaveID_12                          12L
#define IDERRcRegularorSpecialWaveType_13         13L
#define IDERRmnNumberOfCases_14                   14L
#define IDERRcAutoOrOnDemand_15                   15L
#define IDERRjdDateUpdated_16                     16L
#define IDERRmnTimeLastUpdated_17                 17L

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

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

#endif    /* __B5642PIC_H */

Source File:
#include <jde.h>

#define b5642pic_c


/*****************************************************************************
 *    Source File:  b5642pic
 *
 *    Description:  Sub System C BSFN Source File
 *
 *        History:
 *          Date        Programmer  SAR# - Description
 *          ----------  ----------  -------------------------------------------
 *   Author 05/10/16    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 <b5642pic.h>


/**************************************************************************
 *  Business Function:  SubSytemJobsCustom
 *
 *        Description:  Sub System Jobs Custom
 *
 *         Parameters:
 *           LPBHVRCOM           lpBhvrCom    Business Function Communications
 *           LPVOID              lpVoid       Void Parameter - DO NOT USE!
 *           LPDSD564            lpDS         Parameter Data Structure Pointer  
 *
 *************************************************************************/

JDEBFRTN (ID) JDEBFWINAPI SubSytemJobsCustom (LPBHVRCOM lpBhvrCom, LPVOID lpVoid, LPDSD5642PIC lpDS) 

{
   /************************************************************************
    *  Variable declarations
    ************************************************************************/
    ID          idReturnValue      = ER_SUCCESS;     /* Return Code  */
    ID          idJDEDBReturn      = JDEDB_PASSED;   /* DB API Return Code */
    ID            idReturnValue2       = ER_SUCCESS;     /* Return Code  */
    HUSER       hUser              = (HUSER) NULL;  
    JCHAR       szErrorID[11]      = _J(" ");                 /* Error Message ID */
   /************************************************************************
    * Declare structures
    ************************************************************************/
    DSRIR5642PIL ds5642pil = {0};  /* Location Selection DS */
   /************************************************************************
    * Declare pointers
    ************************************************************************/

   /************************************************************************
    * Check for NULL pointers
    ************************************************************************/
   if ((lpBhvrCom == (LPBHVRCOM) NULL) ||
       (lpVoid    == (LPVOID)    NULL) ||
       (lpDS      == (LPDSD5642PIC)    NULL))
   {
     jdeErrorSet (lpBhvrCom, lpVoid, (ID) 0, _J("4363"), (LPVOID) NULL);
     return ER_ERROR;
   }
    /************************************************************************
    *Intitialize Behavior Routine
    ************************************************************************/

   idJDEDBReturn = JDB_InitBhvr((void *)lpBhvrCom, &hUser, (JCHAR *) NULL, JDEDB_COMMIT_AUTO);

   if (idJDEDBReturn != JDEDB_PASSED)
   {
       jdeErrorSet(lpBhvrCom, lpVoid, (ID) 0, _J("3143"), (LPVOID) NULL);
       return ER_ERROR;
   }

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

   /************************************************************************
    * Main Processing
    ************************************************************************/
    /* Initialize Error ID to blank */

   jdeStrcpy((JCHAR *)(szErrorID), (const JCHAR *)(_J("    ")));

   if ( lpDS->cSubsystemQue  == _J('2') )
   {
      
      memset((void *)(&ds5642pil),(int)(_J('\0')), sizeof(DSRIR5642PIL));
      MathCopy (&ds5642pil.mnWaveID, &lpDS->mnWaveID);
      MathCopy (&ds5642pil.mnNumberOfCases, &lpDS->mnNumberOfCases);
      ds5642pil.cRegularorSpecialWaveType = lpDS->cRegularorSpecialWaveType;
      ds5642pil.cAutoOrOnDemand = lpDS->cAutoOrOnDemand;
      if ((MathZeroTest(&ds5642pil.mnUserReservedNumber)))
      {
        MathCopy (&ds5642pil.mnUserReservedNumber, &lpDS->mnUserReservedNumber);
      }
      if ((MathZeroTest(&ds5642pil.mnUserReservedAmount)))
      {
        MathCopy (&ds5642pil.mnUserReservedAmount, &lpDS->mnUserReservedAmount);
      }
      MathCopy (&ds5642pil.mnTimeLastUpdated, &lpDS->mnTimeLastUpdated);
      memcpy((void *)(&ds5642pil.jdUserReservedDate),
                (const void *)(&lpDS->jdUserReservedDate),
                sizeof(JDEDATE));
       memcpy((void *)(&ds5642pil.jdDateUpdated),
                (const void *)(&lpDS->jdDateUpdated),
                sizeof(JDEDATE));
       
   
       if (IsStringBlank(lpDS->szVersionR5642PIL))
       {
           jdeStrcpy((JCHAR *) (lpDS->szVersionR5642PIL), (const JCHAR *)(_J("PARSO00001")));
       }

       idReturnValue2 = ubeReport_AddSubsystemRecord (hUser,        /*User Handle*/
                       _J("R5642PIL"),                            /*Name of Subsyste*/
                       lpDS->szVersionR5642PIL,                     /*Subsystem Version (modified 4/17/98)*/
                       NULL,                                /*Name of the Override Envir.  Not used */
                       NULL,                                /*Name of the Server*/
                       &ds5642pil);                            /*Subsystem Connect DS*/
                      
   }

   if(idReturnValue2 == 0)
   {
       idReturnValue = ER_ERROR;
       if (lpDS->cSuppressErrorMessage != _J('1'))
       {
         
           jdeErrorSet(lpBhvrCom, lpVoid, (ID) 0, _J("099R"), (LPVOID) NULL);
           jdeStrcpy((JCHAR *)(lpDS->szErrorMessage), (const JCHAR *)(_J("099R")));
       }
   }

  

   /************************************************************************
    * Function Clean Up
    ************************************************************************/

   return (ER_SUCCESS);
}

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


No comments:

Post a Comment