Declaring Variables to Relevant Datatypes

For all Developers,

I just thought of sharing this very simple (some, with their experience, may even think that this is silly) piece of advise.

Recently I was working on a Customization (debugging an issue reported). An Inventory Variance Transaction was not getting posted. Trx Lines were perfect, the lots were properly assigned and everything looked perfect. This Variance Trx was created at runtime based on the Customization. Still, this batch was not getting posted. The client had suppressed the Edit List functionality on the Trx Entry and the Posting Journal Report on the Batch Entry screen. Ideally, there is no other way to get informed on what went wrong.

I first enabled the Edit List report on Batch Entry and ran the Edit List. Which displayed this error message: Lot number does exist for this item and site in Lot Number file.

I checked the IV Lot Master table and IV TRX Serial Lot Work table. Records were properly linked. After hours of troubleshooting, I finally found one difference.

The Date Seq Number in Lot Master table and IV Trx Serial Lot Work table did not match for the erroneous record. The value of DTSEQNUM in IV00300 table was 32768 and the value in IV10002 was 32767. I got the source code of that Customization and checked the place where this Trx is created. This developer had declared an “integer” variable and had passed it to the script INVEN_LotNumberAutoAssign script, which returns a “long” value for this parameter. Ideally this should have been 32768 and since the “integer” does not hold more than 32767, wherever the value was 32768, it had stored as 32767.

Well, the moral of this frustrating story: Please be very alert in declaring variables and always keep it to relevant Data Type, as this may take your (worse someone else’ life) life sometime down the lane.



One thought on “Declaring Variables to Relevant Datatypes

  1. Well done for working that one out. A very valid warning.They should have received a warning from Dexterity due to the possible data loss. Don’t ignore the warnings.David


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s