Convert Eif invoice to outgoing 880, quick Altova Mapforce Tutorial

Started working on converting an .eif file into an X12 880 using mapforce. One thing I learned was that when using the TransformTool.jar you can just specify a * (asterisk) for the new file name and it will use the original file name with .xml for the transformed file. Very Useful.

So my work flow goes something like this. Create a 880 svn repository. Get an .eif invoice and convert it to .xml using the TransformTool.jar (Manually for now)

Transform Explanation Doc is here http://mellerbeck.googlepages.com/sv_diary_5305664_ERPTEEBarcodingInst.doc

If you are curious the transform definition is

<?xml version=”1.0″?>
<!DOCTYPE InputFile SYSTEM “C:\XML\InputFile.dtd”>
<InputFile>
<Directory>
<DirName>c:\XML\810_Outbound</DirName>
<DirType>.eif</DirType>
<DocTypes>
<DocType>
<DocName>Invoice</DocName>
<DocTransform>c:\XML\Invoice_Outbound.xsl</DocTransform>
<NewFile>
<NewFileType>.xml</NewFileType>
<NewFileName>*</NewFileName>
<NewFileDir>c:\XML\810_Outbound\Processed</NewFileDir>
</NewFile>
<SaveOption>
<SaveOptionType>Save</SaveOptionType>
<SaveOptionDir>c:\XML\Archive</SaveOptionDir>
</SaveOption>
</DocType>
</DocTypes>
</Directory>
</InputFile>

Open up Mapforce and use the provided .dtd from Adage (Invoice_Outbound.dtd) and then provide it the converted .xml file (from above) to use as a reference for the mapping. (clicking the add schema/xml)

Then click the EDI button and add the 880 (under x12 tab)

Next I start studying the vendors EDI specs. I first start with ISA line, and set mapforce to match the requested Data Element Separator, Composite Separator, Repetition Separator, and Segment Terminator. I get to this by right clicking the EDI portion and then select properties. I also click the Extended button to change the Interchange Control Version Number (If needed).

Next I started creating constants and connecting them to the appropriate parts of the ISA. I just learned that Segment Terminator 85 (hex 85) equals a newline. I connect the ID qualifier and the sender/receiver ID.

Next work down to the GS. Connect a constant of GP.

Next I create my lame’o Control number generator. Basically read in two numbers, add one to it, and write out the new numbers to the same file. This is for the GS and ST segment.

I add a ‘now’ from the datetime functions and connect it to the invoice date, and then connect the document number to the invoice number (F76).

Then connect the CustomerPurchaseOrderNumber to the Purchase Order Number and PurhcaseOrderSalesOrderNumber connect to Vendor Order Number.

I connected constants for the Terms of Sale.

I met kindof a nasty snag with the date format of the InvoiceDueDate. From Adage it is output like

26-jun-2008 00:00:00

This isn’t a format that Mapforce Recognizes as a date 😦 so I had to parse out the day, month, year using a substring-before and replace combo, and then value map the jun into a 6 then connect it all to a datetime-from-parts. There might be an easier way so I posted the question on the Mapforce forum.

Next, started working on the N segments. This was interesting because I had never looked up a bill to name before in Adage. It is stored in the en_bill_tbl so did a select en_bill_name where en_bill_key = ‘whatever’

On further review all that was needed was to send the Remit to which made everything much easier. I connected a RE to the F98_1 and the rest of the name, address info etc…

Next I wanted to get looping information So I connect the Detail01 of my xml to the Loop0300 of the edi spec. Then I connected the price, quantity etc.. to the G17 etc…

To get the total invoice quantity use a sum and connect the InvoiceLineQuantity to it inside of a looping area of code.

I ran into the most annoying problem of not being able to import the generated EDI into TrustedLink. After a lot of work, thinking that it was a problem with the segment it turned out to be a slight bug in Mapforce. Inside of mapforce when I connected a now to the F337 it would truncate the time to 6 chars, but the code it was generating was truncating at 12 chars. Since that is invalid for the F337 the import was not happening successfully. To fix it you connect the now to a time-from-datetime and then to the F337 Time and the generated code truncates correctly.

Terminal Server Stickyness

One thing that has really frustrated me and my users is when their default printer does not stick inside of terminal server. (Well that and when the spooler crashes 🙂 So this time around I’m turning off the automagic that maps their local printer and instead hard coding all the printers with all supported printer drivers. I hope this solves the printer stickyness problem as well as greatly reducing spooler crashes.

Mapforce Woes

I love Altova mapforce. But every so often I run into minor blemishes. I used to be able to read in a file, modify it, and then save out to the same file. With with version 2008 rel. 2 this appears broken 😦 this is my post about it on the forum. http://www.altova.com/forum/default.aspx?g=posts&t=1000001196

Now I have to map some XML to EDI and it needs a segment terminator of <CR><LF> and so far I haven’t figured out how to do it, bummer. http://www.altova.com/forum/default.aspx?g=posts&t=1000001197 Luckily, Altova tech support is excellent and very responsive. So I’m not very worried.

One of those dumb default settings in Internet Explorer

Find this post interesting? Do you like interesting things? Maybe you would like my invention, a connectible candle called a WickBrick!

Get one here http://wickbrick.etsy.com/

WickBrick

Have you ever had Internet Explorer open and then click on a link from an email message and have it take over the window… isn’t that annoying. Well, there is a simple checkbox that disables that if you open up Tools, Internet Options, Advanced, and uncheck the Reuse windows for launching shortcuts. But what if you want to push that out to your entire Active Directory?

This post from dmarelia at http://x220.minasi.com/forum/post.asp?method=ReplyQuote&REPLY_ID=42635&TOPIC_ID=10529&FORUM_ID=34

Has an .adm that you can create to push out this setting

I created a custom ADM to do this. Just copy and paste the following text into an .adm file and load it into your GPO:

Class USER

CATEGORY !!IE
POLICY !!IEAdvanced
EXPLAIN !!IEAdvanced_Help
KEYNAME “Software\Microsoft\Internet Explorer\Main”
VALUENAME “AllowWindowReuse”
VALUEON NUMERIC 1
VALUEOFF NUMERIC 0
END POLICY
END CATEGORY
[strings]
IE=”Internet Explorer”
IEAdvanced=”Re-use Windows for Launching Shortcuts”
IEAdvanced_Help=”Enabling this policy means that new sites visited in IE will open in existing windows rather than launching new ones. Disabling this policy prevents window re-use”

For more help on how to import an .adm and to be able to view it (hint click to un-mark the “Only show policy settings that can be fully managed” option. Then click Ok.) go to this helpful site

http://www.petri.co.il/adding_new_administrative_templates_to_gpo.htm

Outlook Kungfu

You ever want to edit that AutoComplete list that outlook uses (this is stored in [Your Profile]\Application Data\Microsoft\Outlook , and it always saved as the profile name of Outlook with .NK2 extension btw)

Then look no farther than the freeware http://www.nirsoft.net/utils/outlook_nk2_autocomplete.html

What about removing duplicate messages or contacts in outlook. Grab yourself a copy of http://www.vaita.com/ODIR.asp