Steps to call NER from a C Master Business Function:

Author: Zaki Ahmed

Recently, we have discovered an issue with Sales Order Entry Application where when users cancel a Sales Order, the related Work Order doesn’t get cancelled with it all the time.

After further investigation, I’ve found that the logic that was supposed to go out and update the Work Order table sometimes completes before the Sales Order Master Business Function calls complete. Since JDE uses Cache almost all the time, any physical calls to update/delete/add data to a file gets over overwritten with cache data.

To avoid such issues, anytime there’s a need to change data in physical file after a transaction, where there is an End Doc Master Business Function Call which is running Asynchronously, developer should always create a custom NER and do all the required logic in that. Then make a slight modification to standard JDE C BSFN to call that custom NER.

This approach has following advantages:

  1. All the code will be maintained in a custom NER which is easy to maintain/change
  2. No changes will be applied to standard JDE applications or UBEs
  3. There won’t be any data integrity issues
  4. It’ll make upgrade easier, as there won’t be a need to rewrite all the logic in Standard JDE applications. Rather a simple change to C function to call custom NER call will do the trick.

Example:

In this example, I am passing Sales Order Key (DOCO, DCTO, KCOO) from Sales Order Master Business Function End Doc B4200310 to a custom NER N55test1

This custom NER basically calls MDDEBUG BSFN to show the values passed from C function on the screen.

Source C Function Details:

Source C Function: B4200310

Source C Function Name: Sales Order Master BSFN

Source C Function DS: DS4200310

Target NER Details:

Custom NER: N55test1

Custom NER Name: DeleteMeSOKey

Custom NER Data Structure: D55TEST2

Step 1:

Create Target NER

Step 2:

Modify C Function as follows to call custom NER:

  1. Include the .h file reference to Source NER .h File. In this case it was B554200310.h file
  2. Example:
  1. Under Variable Declaration Section, Declare Variable to return the BSFN Value:

A good practice is to start variable name with PLXS so that it can be easily identified as custom variable created by Plexus developer.

  1. Example:

  1. Declare Data Structure of Target NER in Source C BSFN under Declare Structures Section
  2. Example:

  1. At the end of “Main Processing” Section, right before “Function Cleanup” Section of Source C BSFN, do the logic as follows:
  2. Set Size of Data Structure Parameter

In this case, the data structure is D55TEST2. The left section of this statement creates memory allocation of data structure whereas the right section of this statement gets the size of the datastructure.

  1. Example:
  1. Copy Math Numeric Value from C Function to Data Structure of NER
  2. Example:
  1. Copy String Value from C Function to Data Structure of NER
  2. Example:
  1. Call NER through JDE Call Object API
  2. Example:

  1. Return Value of API
  2. Example:
  1. Build BSFN - hopefully no errors will show up.

After making above changes and building BSFN, I did a simple test to verify that the MDDebug screen shows values passed in through to C function to the NER or not. So, to do that, I went into Sales Order Application and cancelled a Sales Order Line to see what happens. After I cancelled the line, MDDebug Screen popped up with the values I passed in from C Function as shown below: