RE: Customised Error Message

SJavadia

Active Member
RE: Customised Error Message

HowTo Data Classification: Confidential

Anand,
I had this JDE document which explains the whole process in detail.
I hope it helps.

Shahroz.



Title: Creating a Text Substitution Error Message
Abstract: This document gives details on the steps involved in creating a
Text Substitution Error Message in OneWorld.
Product OneWorld
Suite Technical
Release B732, B733
Document ID ott-99-0067
Date Created 4/20/1999
Date Reviewed 4/20/1999
Date Revised 4/20/1999

What You Need To Know
Creating a text substitution error message is a complex process. The
instructions in the Development Tools manual are only the first step. In
order to create a text substitution error message, you must understand the
following processes:
1. How to create a OneWorld data structure.
2. How to create an interactive message data item.
3. How to link a data structure to an interactive message data item.
4. How to create a business function.
5. How to get OneWorld data structure definitions into a business
function.
6. How to program in C.
Creating a text substitution error message is not a simple process and
should only be undertaken by a person who has the necessary skills. This
document will not provide enough information for people without the skills
listed above to be successful.
In order to perform the steps, you must be in a OneWorld Development
environment and have Visual C++ loaded on the workstation.
How A Text Substitution Error Message Works.
To make error text substitution work a Glossary Data Item must be created.
The description and glossary can have &s followed by a number to mark the
places that the substitutions are to occur. Example " The Address Number &1
is not correct for &2". &1 is the first text substitution and &2 is the
second substitution. The data for these substitutions will be stored in a
data structure, which is attached to the Glossary Data Item. The first data
item in the data structure replaces &1. The second data item in the data
structure replaces &2.
The actual work of error text substitution is done in a business function.
In the business function the JDE API jdeSetGBRErrorSubText is called. This
API writes the error message with the text substitution. The API
jdeSetGBRErrorSubText must be called from a C Business function and must be
passed specific arguments. One of those arguments is the text substitution
data structure that contains the data to be placed in the error message.
Another of those arguments is the Data Dictionary Alias for a Glossary Data
Item. The data placed in the text substitution structure must be passed to
the business function when it is called. The Alias for the Glossary Data
Item is hard coded in the business function.
Once all of the parts are created then the business function can be called
from any application. Many of the JDE business functions that use error text
substitution do more than just write the error message. They very often
validate some fields and do the error text substitution only if the
validation fails.
Steps for Creating Error Text Substitution
There are six steps in creating an error text substitution.
1. Create a OneWorld data structure for the substitution data.
2. Create a OneWorld Glossary Data Item and attach the data structure.
3. Create a data structure to pass data into the business function.
4. Create the business function.
5. Write the business function.
6. Build the business function.
Step 1: Create Substitution Data Structure
Before the error text substitution data structure is created the messages
for the Glossary Data Item description and glossary must be designed. The
substitutions in the description and the glossary can be the same or
different. The messages can contain any number of &1s, and they will all be
replaced with the same data. The important thing to remember is that each
unique substituted data item must have its own number.
Once the messages are designed then the data structure can be created.
1. Go into OneWorld Object Librarian set the object type to DSTR then
press the ADD button in the toolbar.
2. Enter the Object Name, Description, System Code 55 - 59, Object Use
Code, and Data Structure Type of '1' (Function Data Structure). Then press
the OK button.
3. Select the Design tool bar button.
4. In the design tool, the data dictionary items to hold the error text
substitution data must be added to the data structure. It is important to
understand that the first data item added to the structure will hold the
data to be substituted for &1 in the message. The second will hold the data
to be substituted for &2 and so on. It is also important to remember that
the data dictionary types must match the data types for the data to be
substituted in the message.
5. In the Dictionary Items Tab enter the Alias for the Data Dictionary
item in the Short Name field and press the Enter key. Drag the Data
Dictionary item into the Structure Members Tab. Do this for each data item
to be substituted into the message.
6. When all the Data Dictionary items have been selected press the OK
button.
Step 2: Create a Glossary Data Item And Attach Data Structure
This step will define the Glossary Data Item. The glossary data item will
contain the description and glossary messages that will contain the text
substitution. Once the Glossary Data item is created then the text
substitution structure will be attached.
1. Go to the Data Dictionary Design Menu (GH951). Fast path DD.
2. Enter the Error Messages Application
3. Press the Add button.
4. Enter a Data Item Name. Names for error messages are usually
numbers. Enter the System Code from 55 - 59. Enter the description message.
Make sure that the &1 ... are included in the correct places.
5. If you want a Glossary Message then select Glossary from the Form
Menu. Enter the Glossary Message. Make sure that the &1... are included in
the correct places. Press the OK button when the message has been entered.
6. Set the error message level.
7. Press the Data Structure button to attach the error text
substitution data structure created in step 1. Set the Text Substitution
Data Structure radio button. Press the Browse button to select the data
structure. In the Object Name QBE line enter the name of the structure
created in step 1 above. Press the Find button. Highlight the data structure
in the grid and select OK. Select OK again to set the Text Substitution Data
Structure.
8. Once everything is set, press OK to create the new Glossary Data
Item.
Step 3: Create a Business Function Data Structure
The business function data structure will be used to pass all data from the
OneWorld application to the business function. At the very least it must
include the same data items that are in the error text substitution data
structure. If these items are not passed then the error text substitution
cannot be executed correctly.
If the text substitution is the only process that the business function will
do then the business function can use the same data structure that was
created for the error text substitution. (Created in Step 1 above.)
It can also include other data items. These items may include data to do
validation. They may contain the data item to be validated. They may contain
a data return value, an error return value, or both.
1. Go into OneWorld Object Librarian, set the object type to DSTR, then
press the ADD Button in the tool bar.
2. Enter the Object Name, Description, System code 55- 59, Object Use
Code, and data Structure Type of "1" (Function Data Structure). Then press
the OK button.
3. Highlight the location line in the grid and select the Design tool
bar button.
4. In the design tool, the data dictionary items to hold the error text
substitution data must added to the data structure. Any other data items
that are to be used by the business function or returned from the business
function must also be added.
5. In the Dictionary Items Tab enter the Alias for the Data Dictionary
item in the Short Name field and press the Enter key. Drag the Data
Dictionary item into the Structure Members Tab. Do this for each data item
need for the business function.
6. When all the Data Dictionary items have been selected press the OK
button (check mark).
Step 4: Create the Business Function
There are a number of steps in building a business function. All of these
steps are documented in the OneWorld Design Tools Manual. The important
thing to remember is that these steps are designed to create the Header File
(.h) and the source file (.c). The header file will contain the definitions
of all the data items and data structures that will be needed by the source
file. The source file will contain the C code that makes the function run.
The business function must be created correctly or there will be a problem
with the data structure definitions. The source code created will only be an
outline of the program. In step five the rest of the code will have to be
added.
1. Go into Object Librarian. Set the Object Type to BSFN. Press the Add
button.
2. Enter the name of the business function file. The convention is to
start this name with the letter B. Enter a description of the business
function. Enter a system code of 55-59. Enter a reporting system code. Enter
a function location. It is usually best to enter 2 for Both Client and
Server. The Source Language must be C.
3. Press the OK button when all the information is filled out.
4. Highlight the Location grid row. Select the Design button in the
tool bar or select design in the form menu.
5. In business function design in the first grid row under function
name, enter the name of the new business function. This name needs to be
exactly the same as the one used in the .c source file. Enter the
description. The Function Category can be left blank for General. The
Function use can be left blank for General. The F3 code should be set to 3
for Minor Business Rule.
6. Highlight the row and select the Parameter row exit or row menu
item. In the QBE line over the Name column enter the name of the Business
function data structure. Press the Find button. Make sure the Business
function data structure is highlighted and press the Select button.
7. If the business function needs access to other tables or business
functions enter these using the Table or function buttons in the row exits.
If all you are doing is error text substitution, there should be no need for
other tables or business functions.
8. Select the Create row exit or row menu item. When the window comes
up and says the function is not found, press the YES button. When the window
comes up and says the prototype is not found, press the YES button. When the
last window comes up press OK.
9. Without exiting the business function design program, go to the
Windows Start Button and start Windows Explorer. In Windows Explorer go to
the B7/Pathcode/Include directory. In the Include look for the business
function header file. It should have the business function name.h. Example:
B000001.h. Double click on the file and it should come up in the Visual C++
editor. Now go back to the OneWorld business function design application.
Highlight the business function in the grid, then select Typedef in the row
exit or row menu. This will cause a copy of the business function data
structure to be built in the clipboard. Go back to Visual C++ editor and
place the cursor under the comment that says DS Template Type Definition.
Press the CTRL V button to paste the data structure definition from the
clipboard.
10. Exit the business function design application.
11. If the text substitution structure is different than the business
function structure, the text substitution structure must be placed in the
business function header file. In Object Librarian select the text
substitution structure. Highlight the grid entry for the location on the
workstation. Press the Typedef key. This will place a copy of the text
substitution structure in the clipboard. Go into the Visual C++ editor that
has the business function header active. Place the cursor after the business
function structure created in step 9. Press the CTRL V keys to paste the
text substitution data structure into the header file. Save the header file.

Step 5: Write the business function.
The outline of the business function was created in step 4. In this step the
outline must be filled in. This section will only cover the steps for
writing the error text substitution message. The first set of steps is used
if the error text substitution structure is different from the business
function structure. The second set of steps is used if the error text
substitution structure is the same as the business function structure.
1. In the Visual C++ editor, open the business function source (.c)
file which will be in the directory \B7\Pathcode\source. Open the business
function include (.h) file which will be in the directory
\B7\Pathcode\include.
2. Place the cursor after the Declare Structure comment in source file.
Declare an error text substitution structure.
3. Place the cursor after the Main Processing comment. Data from the
business function structure must be copied into each entry in the error text
substitution structure.
4. Call the API jdeSetGBRErrorSubText function. The first argument
should be the pointer to the behavior structure (lpBhvrCom) which is the
first argument of the business function. The second argument is not used and
should be a void pointer. The third argument is the handle of the field that
is in error. This field should have been one of the data items in the
business function structure. The handles for each item in the business
function structure are defined in the header file just below the business
function data structure. The fourth argument should be the Data Dictionary
Alias for the error text substitution data dictionary item. This should be
hard coded. The last argument should be a pointer to the error text
substitution data structure.
5. Save the source file and exit.
Use these steps if the error text substitution structure is the same as the
business function structure.
1. Call the jdeSetGBRErrorSubText function. The first argument should
be the pointer to the behavior structure (lpBhvrCom) which is the first
argument of the business function. The second argument is not used and
should be a void pointer. The third argument is the handle of the field that
is in error. This field should have been one of the data items in the
business function structure. The handles for each item in the business
function structure are defined in the header file just below the business
function data structure. The fourth argument should be the Data Dictionary
Alias for the error text substitution data dictionary item. This should be
hard coded. The last argument should be a pointer to business function data
structure.
2. Save the source file and exit.
Step 6: Build the business function.
Once the business function code has been written the business function can
be built.
1. Go into Object Librarian. Find the business function that was just
written. Highlight the business function. Press the Select button.
2. Highlight the version of the business function on the local
workstation. Then press the Build button.
The business function will be placed in the parent DLL that was specified
when creating the new business function.
 
RE: Customised Error Message

Thanx Javadia...will try it out

Regards

=====
Regards,

K.J.ANAND KUMAR
---------------
SYSTIME COMPUTER SYSTEMS LTD
CHENNAI,INDIA.

__________________________________________________
 
Back
Top