Mapping to edifact

78 views
Skip to first unread message

Len Finley

unread,
Jan 17, 2022, 3:53:59 PM1/17/22
to Bots Open Source EDI Translator
In the process of migrating all of our EDI messaging to BOTS.  Definitely a BOTS newbie.  Can someone give me some pointers about mapping to edifact through BOTS?  I found a huge list of grammars on sourceforge that I'm assuming I should just copy to my grammars\edifact directory.  Do i also need to install some sort of plugin or is it just a matter of creating a map?  Also does anyone have any examples of edifact maps?

Regards,
Len

Eppye Bots

unread,
Jan 17, 2022, 4:19:50 PM1/17/22
to 'Chuck Turco' via Bots Open Source EDI Translator
pointers:
- mappings: for examples see plugins (plugins are jsut zipfiels so you can open those)
- grammars can be downloaded from bots site. use only the messages/versions you actually use.


kind regards, Henk-Jan Ebbers


--
You received this message because you are subscribed to the Google Groups "Bots Open Source EDI Translator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to botsmail+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/botsmail/9b4d84d2-e309-4b41-a1fb-95e331c8e8fan%40googlegroups.com.

Len Finley

unread,
Jan 17, 2022, 5:04:45 PM1/17/22
to Bots Open Source EDI Translator
Thanks was hoping to get review some sample edifact maps.

regards,
Len

Len Finley

unread,
Jan 17, 2022, 5:56:58 PM1/17/22
to Bots Open Source EDI Translator
Disregard.  I found some examples on sourceforge.

Regards,
Len

Henk-Jan Ebbers

unread,
Jan 17, 2022, 6:14:43 PM1/17/22
to bots...@googlegroups.com
and in the plugins....

kind regards,
Henk-Jan Ebbers


Len Finley

unread,
Jan 17, 2022, 11:30:02 PM1/17/22
to Bots Open Source EDI Translator
I did that.  Here's my map.  It fails on this line.  

out.put({'BOTSID':'UNS','0081','S'})

Can you tell me what I'm doing wrong?

#mapping-script
#~ from x12lib import get_art_num          #import x12 specifc helper function
import bots.transform as transform      #import div bots helper functions
import isbnlib
import datetime
from datetime import date

def main(inn,out):
    docnum = inn.get({'BOTSID':'OutboundPurchaseOrderDto','PurchaseOrderName':None})
    inn.ta_info['botskey']=docnum
    out.ta_info['botskey']=docnum
   
    docdtm = inn.get({'BOTSID':'OutboundPurchaseOrderDto','PurchaseOrderDate':None})
    docdtm = transform.datemask(docdtm,'CCYY-MM-DD','CCYYMMDD')

    out.put({'BOTSID':'UNH','0062':docnum})
    out.put({'BOTSID':'UNH','S009.0065':'ORDERS'})
    out.put({'BOTSID':'UNH','S009.0052':'D'})
    out.put({'BOTSID':'UNH','S009.0054':'96A'})
    out.put({'BOTSID':'UNH','S009.0051':'UN'})
    out.put({'BOTSID':'UNH','S009.0057':'EAN008'})
   
    out.put({'BOTSID':'UNH'},{'BOTSID':'BGM','C002.1001':docnum})
    out.put({'BOTSID':'UNH'},{'BOTSID':'BGM','C002.1131':'9'})
    out.put({'BOTSID':'UNH'},{'BOTSID':'BGM','C002.3055':'AC'})
    out.put({'BOTSID':'UNH'},{'BOTSID':'BGM','C002.1000':docnum})

    out.put({'BOTSID':'UNH'},{'BOTSID':'DTM','C507.2005':'137'})
    out.put({'BOTSID':'UNH'},{'BOTSID':'DTM','C507.2380':docdtm})
    out.put({'BOTSID':'UNH'},{'BOTSID':'DTM','C507.2379':'102'})

    out.put({'BOTSID':'UNH'},{'BOTSID':'RFF','C506.1153':'API'})
    out.put({'BOTSID':'UNH'},{'BOTSID':'RFF','C506.1154':docnum})
   
    out.put({'BOTSID':'UNH'},{'BOTSID':'NAD','3035':'SU'})
    out.put({'BOTSID':'UNH'},{'BOTSID':'NAD','C082.3039':inn.get({'BOTSID':'OutboundPurchaseOrderDto','ReceivingPartner':None})})
    out.put({'BOTSID':'UNH'},{'BOTSID':'NAD','C082.3055':'9'})
   
    out.put({'BOTSID':'UNH'},{'BOTSID':'NAD','3035':'BY'})
    out.put({'BOTSID':'UNH'},{'BOTSID':'NAD','C082.3039':inn.get({'BOTSID':'OutboundPurchaseOrderDto','SendingPartner':None})})
    out.put({'BOTSID':'UNH'},{'BOTSID':'NAD','C082.3055':'9'})

    out.put({'BOTSID':'UNH'},{'BOTSID':'CUX','C504#2.6347':'2'})
    out.put({'BOTSID':'UNH'},{'BOTSID':'CUX','C504#2.6345':'EUR'})
    out.put({'BOTSID':'UNH'},{'BOTSID':'CUX','C504#2.6343':'10'})
         
    addpolines(inn,out,docnum)
   
#FAILS HERE  
    out.put({'BOTSID':'UNS','0081','S'}) #bots counts line items
   
    out.put({'BOTSID':'CNT','C270.6069':2})
    out.put({'BOTSID':'CNT','C270.6066':out.getcountoccurrences({'BOTSID':'UNH'},{'BOTSID':'LIN'})})
   
    out.put({'BOTSID':'UNT','0074':out.getcount()})
    out.put({'BOTSID':'UNT','0062':docnum})
       
def addpolines(inn,out,docnum):
    line = 0
    #loop over lines
    for po1 in inn.getloop({'BOTSID':'OutboundPurchaseOrderDto'},{'BOTSID':'OutboundPurchaseOrderLines'},{'BOTSID':'OutboundPurchaseOrderLineDto'}):
        lou = out.putloop({'BOTSID':'UNH'},{'BOTSID':'LIN'})
        lou.put({'BOTSID':'LIN','1082':line})
        lou.put({'BOTSID':'LIN','C212.7140':po1.get({'BOTSID':'OutboundPurchaseOrderLineDto','Sku':None})})
        lou.put({'BOTSID':'LIN','C212.7143':'EAN'})

        anotherNewLoop = lou.putloop({'BOTSID':'LIN'},{'BOTSID':'QTY'})
        anotherNewLoop.put({'BOTSID':'QTY','C186.6063':'21'})        
        anotherNewLoop.put({'BOTSID':'QTY','C186.6060':po1.get({'BOTSID':'OutboundPurchaseOrderLineDto','Quantity':None})})        
       
        anotherNewLoop2 = lou.putloop({'BOTSID':'LIN'},{'BOTSID':'PRI'})
        anotherNewLoop2.put({'BOTSID':'PRI','C509.5125':'GRP'})        
        anotherNewLoop2.put({'BOTSID':'PRI','C509.5387':'LBL'})                

        anotherNewLoop3 = lou.putloop({'BOTSID':'LIN'},{'BOTSID':'RFF'})
        anotherNewLoop3.put({'BOTSID':'RFF','C506.1153':'ON'})        
        anotherNewLoop3.put({'BOTSID':'RFF','C506.1154':docnum})  
       
        anotherNewLoop4 = lou.putloop({'BOTSID':'LIN'},{'BOTSID':'RFF'})
        anotherNewLoop4.put({'BOTSID':'RFF','C506.1153':'CR'})        
        anotherNewLoop4.put({'BOTSID':'RFF','C506.1154':po1.get({'BOTSID':'OutboundPurchaseOrderLineDto','LineNumber':None})})
       
        line += 1

Henk-Jan Ebbers

unread,
Jan 18, 2022, 3:02:46 AM1/18/22
to bots...@googlegroups.com
please use examples provided in plugins.



kind regards
Henk-Jan Ebbers

Reply all
Reply to author
Forward
0 new messages