Override DD System Function

Pon

Well Known Member
I'm using a variable to store a UDC System Code & User Define Code (i.e., System Code = 56, User Define Code = DP). I would like to use this variable to override the UDC for another form control. I decided to use the system function 'Set Data Dictionary Overrides' to override the DD item (form control) and make it use the UDC system code & user define code that are in my variable. Unfortunately, the system function does not accept variables and, I had to input (hard code) the values. In other words, I had to check to see what was in the variable and then call the system function using the values obtained. Does anyone know if there is another system or business function that will allow me to override the UDC associated with a form control and, pass it a variable that would contain the UDC system/user define code I'd like to use? I'd like to avoid any hard coding.

Any help would be greatly appreciated. Thanks.

P.S. If I've confused anyone than just try playing with the Set Data Dictionary Overrides system function. Pick a form control to override and click on the UDC button. It will prompt you to enter the UDC code you'd like to use for this form.

OW Xe, Update 6, SP 20, AS/400.
 
Pon,

Here is one solution, if I understand what you are trying to do. In the 'Visual Assist Button Clicked' event, do the following:

system function: Suppress Default Visual Assist
form interconnect: P0005 using form W0005SB

You should be able to pass your variables and return your selected value. Hope I'm on the right track. Good luck.
 
Jeremy,

You do understand correctly and, you are right on the money! That works perfectly. Thanks a bunch!

Pon

P.S. One small note: The application you call using the form interconnect is actually P0005S. I found it doing a search on P0005*. Thanks again.
 
Jeremy,

I did find one problem with this method. The field is still validated against the UDC associated with it in the Data Dictionary. Anyway around this?

Thanks,
Pon
 
Pon,

You can disable 'Editing' for the control (in the control's properties\overrides). However, I suspect you want to validate against your new UDC, am I correct? If so, you may have to find a business function to do this. I'll let you search for it. You will probably want to call it in the following places:

On OK button pressed
On Exited and changed event of control

Careful when passing UDC parms as they are stored in F0005 right justified. For example, a defined UDC of length 3 will be stored in DRKY beginning in position 8.
 
Yeah, that's kind of what I figured I'd have to do to have the value validated against my new UDC.

Thanks for the info. This will be very helpful.

Pon
 
Pon,

OK, since I anticipate having to do this myself sometime, I did a little research on the bsfn's to use. I found the following:

RetrieveCodeTypeInfo (B9800088)
send in: system code, table
return: length, numericYN

RightAdjustUDValue (B9800088)
send in: length, numericYN, value
returns: value

F0004ValidateUDCValue (B0000204)
send in: system code, table, value
returns: 1 if valid, 0 if not valid

I didn't find one that encapsulates all 3, but if anyone knows of one, please let us know.
 
Jeremy,

Thanks for the valuable information. I have used those business functions in the past and they do work perfectly in this scenario.

Thanks again.
 
Back
Top