Tag Archives: SQL Server

How to search JDE EnterpriseOne Data Dictionary from SQL

The Issue

The JD Edwards EnterpriseOne database does not contain any table or field name aliases with meaningful English descriptions. This lack of descriptions creates an issue for application and software developers in accessing the Table File Definitions and Field Descriptions contained in the JDE Data Dictionary. Without access to the table descriptions and the field descriptions, developers are not able to easily navigate the data needed for developing applications or reports.

Normally there are only two ways to get this information; both native methods of accessing table and field description information are inside the JD Edwards application. This requires that developers be trained in JDE to access the information they need. The first native method of access is to log into the JDE Fat Client and search through the Data Dictionary for the specific field aliases and/or table names. The second method is to pull up the Table Browser inside the EnterpriseOne Web Application, or Fat Client, and browse the data table, toggling between the field names and the field descriptions.

Most developers prefer to stay inside of SQL, or their chosen Integrated Development Environment (IDE), while maintaining access to all the information necessary to identify JDE fields and tables.  Additionally, the ability to see field lengths and data, to search for specific field aliases throughout JDE, and to to perform wild card searches for field descriptions, aliases, data types, and other information in the Data Dictionary, from the development environment, is a huge time saver.

The Solution

I have developed a simple table function, called TFD (Table File Descriptions), which allows developers to search and display table file descriptions and JDE Data Dictionary information with a SQL command inside of a query window of your chosen IDE. How it works is simple. You just type a select statement and use the TFD() function in the “From Clause”. The TFD() function will return a table result based on the table name passed in, and any additional “Where Clause” constraints.


A basic query using the TFD() function will result in a standard Table File Description result set as follows:

The statement:

select * from tfd('F4211')

Produce the following results:


A more complex SQL Statement such as this:

distinct [JDE Table], [Table Name], [JDE Field], [Item Description] 
from TFD('%')
where alias = 'UOM4'
order by [JDE Table]

Will yield the following results:


Notice that I used the wildcard character ‘%’ (percent) to show all tables where the Pricing Unit of Measure (UOM4) is used.

You can use any combination of wild cards and select statements with the TFD() function. You can also search on any field in the result set. If, for example you wanted to find all the fields in the JDE EDI tables (‘F47%’) containing the word ‘%Partner%’ in it, you could write a query as follows:

select [JDE Table], [Table Name], [JDE Field], [Item Description] 
from tfd('F47%')
where [Item Description] like '%Partner%'

The result would be:


As you can see from these few examples, the TFD() function can save time in development by making JDE object names and descriptions visible to the SQL, VB, C#, or Java integrated development environments. Developers can save time finding which fields or tables contain the data they need, and begin making sense of the cryptic JDE alias names.

The code

Simply copy the following code and execute it in the IDE of your choice. I used SQL Management Studio to develop and create the function. Once the function has been created in the JDE database, it’ll be ready to use.

Note: you’ll have to change the schema names and database names to match your JDE EnterpriseOne environment.

GOCREATE FUNCTION [dbo].[tfd] (@tbl varchar(99))
-- =============================================
-- Written by Bryant Avey, InterNuntius, Inc.
-- Provided free "As Is" with no warranties or guarantees
-- I just ask that you keep these comments in the function, if you use it.
-- The complete article describing this function can be found at: 

-- Description: Retrieve Table and Field Descriptions for any JD Edwards Table
-- Use: execute this function by passing in the table name as a parameter:
-- select * from tfd('F47012')
-- you can also use it to find where fields are used:
-- select * from tfd('%') where alias = 'UOM4'
-- =============================================
RETURN (       
-- Get the table field definition data
        select "JDE Schema", "JDE Table", simd "Table Name",
        colorder "Field Sequence", "JDE Field",
        f9210.frdtai Alias,
        frclas "Data Class",
        frdtat "Data Type",
        frdtas Size,
        frdtad "Decimals Stored",
        frcdec "Decimals Displayed",
        frowdi "Item Description",
      --frdsca "Dictionary Description",
        length SQLlength,
        prec SQLprecision,
        isnullable SQLnull
        from sysobjects
        join syscolumns on =
        join jde812.dd812.f9210 on substring(,3,99)
                                 = f9210.frdtai
        join jde812.ol812.f9860 on = siobnm
        join sys.schemas on sysobjects.uid = sys.schemas.schema_id
        where like @tbl and sysobjects.xtype = 'U'

Let me know if this function proves useful to you. I welcome the feedback.


Posted by on August 17, 2009 in TechKnowledgy Articles


Tags: , , , , , , ,

How to convert EnterpriseOne (JDE) Julian Dates


If you’ve ever worked with Oracle/PeopleSoft’s EnterpriseOne ERP system (also known as JD Edwards or simply JDE) you’ll quickly find that dealing with dates from the database is a bit challenging.  EnterpriseOne stores all dates in the system in Julian Date format.  EnterpriseOne has a lot of dates in every table.

The Julian Date in EnterpriseOne goes back to the days before EnterpriseOne was called EnterpriseOne; back when it was just JD Edwards and it ran on an AS/400 (now called an iSeries or Series i).  Back then, disk space (DASD) was a premium.  By storing all the dates in 6-digit Julian format, the numbers could be packed (compressed) to save table or database space.  Additionally, since Julian Dates are in a fairly simple numerical form, it was easy to develop routines and functions to add, subtract, and otherwise calculate dates.

Over the years, disk space has turned into a commodity.  Modern computer languages and SQL  can easily deal with date calculation.  But EnterpriseOne data is still in this Julian Date format.   So how do we deal with it, and how do we get it converted into a normal datetime data type?

This article will cover how to create and use two SQL functions to convert Julian dates to Gregorian dates and then to convert Gregorian dates to EnterpriseOne Julian format.  Many of my clients use these two functions for SQL Server Reporting Services (SSRS) Reports, and various EDI interfaces, and XML feeds.  These two functions are valid on any version of JD Edwards including World, OneWorld, XE, or the latest version of EnterpriseOne.  If you want to use the functions on World, or directly on an IBM Series i, you’ll need to do a bit of syntax tweaking.  If you’re accessing the Series i (AS/400) from SQL Server, then this function will work perfectly for you.

EnterpriseOne Julian format

All versions of JDE use a Julian Date format as follows: CYYDDD where C = Century; YY = a 2 digit year; and DD = the 3 digit number representing the day of the year (1 through 365 or 366 days on a leap year).  The Century is either a 1 or 0 depending on whether you’re using year 2000 + or if you’re using dates in the 1900′s.

For example, the Gregorian Date 01/01/2009 would be Julian Date 109001 where 1 = century 2000, 09 = the last 2 digits of the year 2009; and 001 = the first day in 2009. Similarly 12/31/2009 would be represented as 109365 where the only change is the day number being 365 to represent the last day in 2009.

Note: A value of zero(0) in JDE Julian date format represents 12/31/1899 and 01/01/1900 is the numerical value 1 in Julian format.

Converting Julian Dates to Gregorian – Date J2G( )

The first function we’re going to write is one called DateJ2G() meaning “Date Julian to Gregorian”. This function has two parameters, one parm for the Julian date you wish to convert, and one parm for the format style code, which represents the format you want your Gregorian date.  The DateJ2G() function will convert the date to any standard SQL Server formatted date style.  A complete list of format styles can be found at

Here’s the code to create the function:


RETURNS varchar(20) AS  
--Written by Bryant Avey, InterNuntius, Inc.
--Provided free "As Is" with no warranties or guarantees
--I just ask that you keep these comments in the function, if you use it.
--The complete article describing this function can be found at:

--This function takes a JDE Julian Date and returns
--a varchar date in the format style you specify
--To us simply pass in the JDE date and the style code
--Style codes can be found at 

--For Example: select dbo.DateJ2G(sddgj,101) from f4211
--would return the JDE date in the format of 02/29/2008.
--Select dbo.DateJ2G(108060, 1) = 02/29/08
--Select dbo.DateJ2G(109060, 107) = Mar 01, 2009

--Format codes are standard SQL 2005 Date Convert codes.
--Conversion codes can be found here:
DECLARE @sqldate datetime
set @sqldate =
 dateadd(day,cast((1900000 + @JDEDATE)%1000 as int)-1,(cast((
 cast((1900000 + @JDEDATE)/1000 as varchar(4)) + '-01-01')
 as datetime)))

RETURN (convert(varchar(20),@sqldate,@FORMAT))

To use the DateJ2G function, just pass in a date and style format as described in the comments contained in the above code.

Converting Gregorian Dates to Julian – DateG2J( )

The next function will convert any standard formatted Gregorian date string to a JDE EnterpriseOne Julian date.

Here’s the code to create the DateG2J function:

CREATE FUNCTION [dbo].[DateG2J] (@Geogian_in datetime)
--Written by Bryant Avey, InterNuntius, Inc.
--Provided free "As Is" with no warranties or guarantees
--I just ask that you keep these comments in the function, if you use it.
--The complete article describing this function can be found at:

--This function takes a varchar gregorian date and returns
--a Julian JDE Date
--To use simply pass in the string date

--For Example: select dbo.DateG2J('02/29/2008')
--would return the JDE integer date of 108060.

--Date input formats are standard SQL 2005 DateTime values.
--Any validly formated date string will work such as 'feb 29,2008' to get 108060.

declare @JulianDate_out INT
declare @Century INT
declare @YY INT
declare @DayofYear INT

 Select @Century = case when datepart(yyyy,@Geogian_in) > 2000
 then 100000 else 0 end

 AS VARCHAR(4)), 3, 2)) AS INT)

 select @DayOfYear = datepart(dayofyear, @Geogian_in)

 SELECT @JulianDate_out = @Century + @YY * 1000 + @DayofYear


To use the DateG2J function just follow the examples outlined in the code above.


As you can see, there are only a few lines of SQL code needed to convert between Julian and Gregorian dates in JDE EnterpriseOne.  I used February 29, 2008 (leap year) dates in the examples to show that the functions correctly handle leap years.

Let me know how this has worked for you.


Posted by on August 16, 2009 in TechKnowledgy Articles


Tags: , , , , , , , , , , , , , ,


a blog by Bryant Avey

Bamboo Innovator

R.E.S.-ilience in Value Creation 《竹经:经商经世离不得立根创新》

On Purpose Magazine

Inspiring, Educational, Enlightening and Entertaining Content of Value


The real-time, continuous word tournament!

Ricky's Bing Maps Blog

A blog focused on developing applications with Bing Maps

a blog by Bryant Avey

JJ's Blog

Microsoft Business Intelligence and SharePoint in Action

SQL Server Rider

Database, SSIS, SSAS, SSRS, PowerPivot, Spatial

Nishant Rana's Weblog

Everything related to Microsoft .NET technology


SharePoint, ProjectServer and Microsoft Platform

Connection Agent

What do you need? Ask Steve!

Choiceology Blog

Just another weblog

Tales from the IT Side

Understanding SharePoint and how it interacts with your organization

Reckless Abandon

...with all your heart, soul, mind, and strength


Serving up the hottest dishes on

Fortune Tech: Technology blogs, news and analysis from Fortune Magazine

Fortune's tech team offers analysis and perspective on the world's most important developments.


Get every new post delivered to your Inbox.

Join 1,771 other followers

%d bloggers like this: