How to Implement User Reserved Columns in P4312

Title: How to Implement User Reserved columns in P4312 – Purchase Order Receipt

Abstract: This document is to explain how User Reserved Columns can be implemented into F43121  – Purchase Order Receiver File through P4312 – Purchase Order Receipt

This is just example of code so actual implementation can be vary.

Caution: This document may contain information, software, products or services which are not supported by Oracle Support Services and are being provided ‘as is’ without warranty. Please refer to the following site for My Oracle Support Terms of Use: https://support.oracle.com/CSP/ui/TermsOfUse.html

Before implement any additional columns make it sure back-up all the object to be modified


Table of Contents

Introduction
User Interface

Action Plan

Example of Implementation

 


Introduction

Only when implementing User Reserved Columns are crucial for your daily business you may consider implementing it. Before you take any action make it sure all the information is fully understood including consequences of this change to be made.

 

Note: This process involves change of Data Structure and Business Function. Unless you fully understood consequences of modification, do not continue this document. And it include change of Table Structure of F43121Z – Receiver Work File, so if there is any workaround (unused columns in P4312) try to implement Work Around. In real life the usage of User Reserved Columns in F43121 will be minimum. Rather this document is to explain how it handles data from Grid to F43121

 

Before starts note that P4312 – Purchase Order Receipt,

 

 

This document will focus on XT4312Z1 – F4312EditLine and XT4312Z2 – F4312EditLineInternalFunctions to implement User Reserved Columns through Grid Controls

 

Object affected

n  Change of Table F43121Z

n  Change of Data Structure of DF4312Z1B and DXF43121A

n  Change of BSFN XT4312Z2, XT43121Z1 and XF43121

n  Change of Business View

n  Change of Header Files XT43121Z1.h and XF43121.h

n  Change of Event Rule of P4312

 

 

 

n  In compiling master BSFN of XT4312Z2 which may create binary file as below,

-       XT4312Z1.h

-       XF43121.h

-       XT43121Z1.c

-       XT4312Z2.c

-       But for this case XT4312Z2 is dependent on XT4312Z1.c, that is, XT4312Z2 is just internal Business Function of XT4312Z1 though it is created into a separate file

 

 

Before Start

 

 

  1. Check business View in Grid of W4312A – [Purchase Order Receipts]. Currently V4311C – Purchase Order Detail – Receipt Entry – Joined w/F4311T. This implementation shows that it gets data from F4311 and going to insert/update F43121 – Purchase Order Receipt File. So User Reserved Columns will be implemented through Data Dictionary Item as we are not to override User Reserved Columns in F4311 – Purchase Order Detail File
  2. Add additional Columns in W4312A form
  3. In calling F4312EditLine assign GC Value to Data Structure assigned (DF4312Z1B)
  4. Write Cache in F43121Z through XT4312Z2
  5. Return to calling BSFN XT43121Z1 to proceed F4312EndDoc
  6. Call XF43121 -  POReceiptF43121Shell to write cache into F43121
  7. Let P43214 - Purchase Receipts Inquiry show User Reserved Columns if needed

 

IMPORTANT NOTE:

Unlike other Master BSFN, the way it handles data through P4312 is very much different. Simplified steps will be,

  1. DF43121Z1B stored GC User Reserved Columns
  2. Through XT43121Z2 stores data into F43121Z (or data structure)
  3. Through XT43121Z1 map data from F43121Z to F43121

 

Data Structure of flow,

n  F43121EditLine: DF43121ZB

n  F43121Z

n  DXF43121A

 

So user input value has to be handled as blow,

 

Note: This document contains huge number of change in table, Data Structure and BSFN so unless this is really necessary for your daily business DO NOT implement this!!!

 

Back to Top

User Interface

User may enter (type) User Reserved Columns in Grid of W4321A then the information has to be delivered to F4312EditLine to create Purchase Order Receipt Cache (F43121Z). So this document will cover how User Entered Values are to be handled in P4312 application.

Note: R43121Z table can be implement in Batch Process or this file can be used only for Data Structure. For this example, we are not writing physical file so to implement this file, refer ‘How to Implement User Reserved Columns in R47071’

 

 

Possible Implementation

  1. Add additional members into data structure (DF4312Z1B) of F4312EditLine

 

  1. Typedef D4312Z1B

 

/*****************************************

 * TYPEDEF for Data Structure

 *    Template Name: XT4312Z1 Edit Object - Edit Line                           

 *    Template ID:   DF4312Z1B

 *    Generated:     Tue Feb 23 17:32:09 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_DF4312Z1B

#define DATASTRUCTURE_DF4312Z1B

 

typedef struct tagDSDF4312Z1B

{

  MATH_NUMERIC      mnJobNumber;                        

  JCHAR             szComputerID[16];                   

  JCHAR             cActionCode;                        

  JCHAR             cProcessEdits;                      

  JCHAR             szProgramID[11];                    

  JCHAR             cCurrencyProcessingFlag;            

  MATH_NUMERIC      mnOrderNumber;                      

  JCHAR             szOrderType[3];                     

  JCHAR             szOrderKeyCompany[6];               

  JCHAR             szOrderSuffix[4];                    

  MATH_NUMERIC      mnLineNumber;                       

…

  JCHAR             szJobCategory[7];                   

  JCHAR             szUserReservedCode[3];              

  JDEDATE           jdUserReservedDate;                 

  MATH_NUMERIC      mnUserReservedAmount;               

  MATH_NUMERIC      mnUserReservedNumber;               

  JCHAR             szUserReservedReference[16];        

} DSDF4312Z1B, *LPDSDF4312Z1B;

 

#define IDERRmnJobNumber_1                        1L

#define IDERRszComputerID_2                       2L

#define IDERRcActionCode_3                        3L

#define IDERRcProcessEdits_4                      4L

#define IDERRszProgramID_5                        5L

#define IDERRcCurrencyProcessingFlag_6            6L

#define IDERRmnOrderNumber_7                      7L

#define IDERRszOrderType_8                        8L

#define IDERRszOrderKeyCompany_9                  9L

#define IDERRszOrderSuffix_10                     10L

#define IDERRmnLineNumber_11                      11L

…

#define IDERRszJobCategory_198                    198L

#define IDERRszUserReservedCode_199               199L

#define IDERRjdUserReservedDate_200               200L

#define IDERRmnUserReservedAmount_201             201L

#define IDERRmnUserReservedNumber_202             202L

#define IDERRszUserReservedReference_203          203L

 

#endif

 

 

θ Now XT4312Z1.h file will appears as above

 

 

 

 

  1. Add additional members to Data Structure DXF43121A

 

 

 

 

 

 

  1. Copy typedef and paste it into XT4312Z1.h file

θ The block of TYPEDEF is to be replaced by typedef created through steps 2

 

  1. Typedef of DXF43121A

 

/*****************************************

 * TYPEDEF for Data Structure

 *    Template Name: PO Reciept                                                 

 *    Template ID:   DXF43121A

 *    Generated:     Tue Feb 23 23:44:36 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_DXF43121A

#define DATASTRUCTURE_DXF43121A

 

typedef struct tagDSDXF43121A

{

  MATH_NUMERIC      mnOrderNumber;                      

  JCHAR             szOrderType[3];                     

  JCHAR             szOrderKeyCompany[6];               

  JCHAR             szOrderSuffix[4];                   

  MATH_NUMERIC      mnLineNumber;                       

  MATH_NUMERIC      mnDocumentNumber;                   

  JCHAR             szDocumentType[3];                  

  JCHAR             szKeyCompany[6];                    

…

  JCHAR             szUserReservedCode[3];              

  JDEDATE           jdUserReservedDate;                 

  MATH_NUMERIC      mnUserReservedAmount;               

  MATH_NUMERIC      mnUserReservedNumber;               

  JCHAR             szUserReservedReference[16];        

} DSDXF43121A, *LPDSDXF43121A;

 

#define IDERRmnOrderNumber_1                      1L

#define IDERRszOrderType_2                        2L

#define IDERRszOrderKeyCompany_3                  3L

#define IDERRszOrderSuffix_4                      4L

#define IDERRmnLineNumber_5                       5L

…

#define IDERRszUserReservedCode_123               123L

#define IDERRjdUserReservedDate_124               124L

#define IDERRmnUserReservedAmount_125             125L

#define IDERRmnUserReservedNumber_126             126L

#define IDERRszUserReservedReference_127          127L

 

#endif

 

 

  1. Update XF43121.h

θ Copy & Paste it into XF43121.h

 

 

 

 

 

 

  1. Update XT43121Z1.c file (Note that the flow of P4312 is different from other master files)

: Below code is Internal BSFN which write cache

 

int Ixt4312z1_ED_WritePOReceiverRecord (LPBHVRCOM          lpBhvrCom,

                           LPVOID             lpVoid,

                           HUSER              hUser,

                           LPDSDF4312Z1C         lpDS,

                           dsInt_ED_F4311Orig   *lpdsInt_ED_F4311,

                           dsInt_F43121ZOrig   *lpdsInt_F43121Z,

                           dsInt_ED_MiscOrig   *lpdsInt_ED_Misc,

                           dsInt_ED_PrOptOrig   *lpdsInt_ED_PrOpt)

{

…

}

 

 

: data Structure name dsInt_F43121Orig with *lpdsInt_F43121Z (pointer)

 

 

 

 

θ Note that the Data Structure appears here is different from F43121Z.h file so this file is purely to store data

 

 

 

 

   JCHAR              sz_urcd[3]; /*oracle test urcd*/

     JDEDATE        jd_urdt;

        MATH_NUMERIC mn_urat;

        MATH_NUMERIC mn_urab;

        JCHAR        sz_urrf[16];

} dsInt_F43121ZOrig;

 

: Note that dsInt_F43121Orig is data structure to store F43121Z

 

 

 

 

  1. Modify XT43121Z2.c file to hold lpDS (Data Structure from calling BSFN F43121EditLine) to F43121Z table

 

*** Break In code ***

int Ixt4312z1_EL_WritePOReceiverWorkFileRecord (

                                          LPBHVRCOM              lpBhvrCom,

                                          LPVOID                 lpVoid,       

                                          LPDSDF4312Z1B          lpDS,

                                          dsInt_EL_F4311Orig     *lpdsInt_EL_F4311,

                                          dsInt_EL_MiscOrig      *lpdsInt_EL_Misc,

                                          HCACHE                 hF43121ZCache,

                                          LPF43121Z              lpdsTable,

                                          dsInt_EL_NewPOLineOrig *lpdsInt_EL_NewPOLine,

                                                                                    dsInt_EL_PrOptOrig        *lpdsInt_EL_PrOpt,

                                          HUSER                  hUser)

{

…

 

   /* Oracle Test - User Reserved Columns into F43121Z */

      memcpy   ((void *)(&lpdsTable->pwurdt),

             (const void *)(&lpDS->jdUserReservedDate), sizeof(JDEDATE));

   jdeStrncpy(lpdsTable->pwurrf, lpDS->szUserReservedReference,

              DIM(lpdsTable->pwurrf)-1);

   /* Oracle Test End - User Reserved Columns */

 

 

…

      jdeCacheResult = jdeCacheOpenCursor((HCACHE) hF43121ZCache,

                                         &hCursor);

 

      if (jdeCacheResult != JDECM_PASSED)

      {

         memset((void *) (&dsDE0022), (int)(_J('\0')), sizeof(dsDE0022));

         jdeStrncpy(dsDE0022.szDescription,

                 (const JCHAR *) (_J("CF43121Z")),

                 DIM(dsDE0022.szDescription) - 1);

         jdeSetGBRErrorSubText (lpBhvrCom,

                                lpVoid,

                                (ID) 0,

                                _J("078M"),

                                &dsDE0022);

      }

…

}

*** Break In code ***

 

 

 

: Now cache CF43121Z is written based on user input value

 

 

  1. Go to XT43121Z1.c file to map above cache (physical value) before it calls XF43121

 

*** Break In code ***

int Ixt4312z1_ED_WritePOReceiverRecord (LPBHVRCOM          lpBhvrCom,

                           LPVOID             lpVoid,

                           HUSER              hUser,

                           LPDSDF4312Z1C         lpDS,

                           dsInt_ED_F4311Orig   *lpdsInt_ED_F4311,

                           dsInt_F43121ZOrig   *lpdsInt_F43121Z,

                           dsInt_ED_MiscOrig   *lpdsInt_ED_Misc,

                           dsInt_ED_PrOptOrig   *lpdsInt_ED_PrOpt)

{

 

…

   /* Oracle Test - User Reserved Columns Implementation */

  /*

   jdeStrncpyTerminate(dsDXF43121A.szUserReservedCode,lpdsInt_F43121Z->sz_urcd,DIM(dsDXF43121A.szUserReservedCode));

   MathCopy (&dsDXF43121A.mnUserReservedAmount,&lpdsInt_F43121Z->mn_urat);

   MathCopy (&dsDXF43121A.mnUserReservedNumber,&lpdsInt_F43121Z->mn_urab);

   */

    memcpy   ((void *)(&dsDXF43121A.jdUserReservedDate),(const void *)(&lpdsInt_F43121Z->jd_urdt),

            sizeof(JDEDATE));

   jdeStrncpyTerminate(dsDXF43121A.szUserReservedReference,lpdsInt_F43121Z->sz_urrf,DIM(dsDXF43121A.szUserReservedReference));

 

   /* Oracle Test End - User Reserved Columns */

 

…

   idJDEDBReturn = jdeCallObject (_J("POReceiptF43121Shell"),

                                 NULL, lpBhvrCom, lpVoid,

                                 (LPVOID)&dsDXF43121A, (CALLMAP*)NULL, (int)0,

                                 (JCHAR*)NULL, (JCHAR*)NULL, (int)0);

 

   if (idJDEDBReturn == ER_ERROR)

   {

      iReturnValue = 0;

   }

}

*** Break In Code ***

 

: Now value stored at CF43121Z is mapped to dsDXF43121A which is data structure for POReceiptF43121Shell which is actual BSFN to commit cache to F43121 – PO Receipt File

 

 

 

  1. Now write routine in XF43121 to commit cache to DB

 

*** Break In Code ***

JDEBFRTN(ID) JDEBFWINAPI POReceiptF43121Shell(LPBHVRCOM lpBhvrCom,

                                                 LPVOID lpVoid,

                                          LPDSDXF43121A lpDS)

{

 

…

   /* Oracle TEst - User Reserved Columns */

 

    memcpy( (void *) &dsF43121.prurdt, (void *) &lpDS->jdUserReservedDate, sizeof(JDEDATE) );

   jdeStrcpy((JCHAR*)dsF43121.prurrf,

          (const JCHAR *)(lpDS->szUserReservedReference));

 

   /* Oracle TEst End */

 

…

   lpdsF43121 = (LPF43121)jdeRetrieveDataPtr(hUser, lpDS->idPointerToF43121);

 

   if(lpdsF43121 != (LPF43121)NULL)

   {

      idJDBResult = JDB_InsertTable( hRequest, szTableID, (ID) 0L, (void *)(lpdsF43121) );

   }

…

}

 

*** Break In Code ***

 

 

 

 

 

 

  1. Add additional column with DD items

 

  1. When exit from row assign GC Value in calling F43121EditLine

 

  1. Add additional columns into F43121Z

θ Generate it and verify that F43121Z.h file has been updated accordingly

 

 

 

 

  1. Compile XT42121Z1, XT43121Z2 and XF43121

 

Note: If needed, compile it whereas you change any object as this will be easy for you to debug any syntax error

 

 

  1. Test it out

 

 

 

 

 

IMPORTANT NOTE:

If any of object is not handled properly, you will hit Memory Violation which crash ActiveConsole.exe or grid gets collapsed

 

 

 

 

 

 

 

Note: Above code is standard code so do not modify any of above codes

Note: Above code is based on Unicode

Note: This code does imply another other application other than P4312

 

 

 

Back to Top

 

E1: FDA: Object Modification Recommendations: Interactive Applications (Doc ID 626586.1) 

E1: FDA: Object Modification Recommendations: Event Rules (Doc ID 626585.1) 

E1: TDA: Object Modification Recommendations: Business Views (Doc ID 626582.1) 

E1: BSFN: Object Modification Recommendations: Business Functions (Doc ID 626581.1)

E1: TDA: Object Modification Recommendations: Tables (Doc ID 626588.1)

E1: FDA: Object Modification Recommendations: Data Structures (Doc ID 626584.1)

Back to Top