Error in Root Put

Problem:

ScriptError: Userscript "C:\Python27\lib\site-packages\bots\usersys\mappings\edifact\DESADVD96A2DELVRY03": "MappingRootError: Error in root put "{'BELNR': u'demo', 'BOTSID': u'E2EDL43000', 'QUALF': u'C', 'BOTSIDnr': u'1'}".".

This writes to the root of the outgoing message, which is EDI_DC40.  Normally there would be loops, getloop() and putloop().

Solution:

    for lin in inn.getloop({'BOTSID':'UNH'},{'BOTSID':'CPS'},{'BOTSID':'LIN'}):
        lou = out.putloop({'BOTSID':'EDI_DC40'},{'BOTSID':'E2EDL20002'},{'BOTSID':'E2EDL24006'})
        xou = out.putloop({'BOTSID':'EDI_DC40'},{'BOTSID':'E2EDL20002'},{'BOTSID':'E2EDL24006'})
        lou.put({'BOTSID':'E2EDL24006','POSNR':lin.get({'BOTSID':'LIN'},{'BOTSID':'PIA','C212#2.7140':None})})
        lou.put({'BOTSID':'E2EDL24006','MATNR':lin.get({'BOTSID':'LIN'},{'BOTSID':'PIA','C212#1.7140':None})})       #get SKU
        lou.put({'BOTSID':'E2EDL24006','WERKS':nadgg})
        lou.put({'BOTSID':'E2EDL24006','LFIMG':lin.get({'BOTSID':'LIN'},{'BOTSID':'QTY','C186.6063':'128','C186.6060':None})})       #get qty
        lou.put({'BOTSID':'E2EDL24006','VRKME':lin.get({'BOTSID':'LIN'},{'BOTSID':'QTY','C186.6063':'128','C186.6411':None})})       #get uom
        sku = lin.get({'BOTSID':'LIN'},{'BOTSID':'PIA','C212#1.7140':None})
        xou.put({'BOTSID':'E2EDL24006'},{'BOTSID':'E2EDL43000','QUALF':'9','BELNR':rfflo})
        xou.put({'BOTSID':'E2EDL24006'},{'BOTSID':'E2EDL43000','QUALF':'C','BELNR':nadgg})

The putloop sets the level and looping at line item level (E2EDL24006), the xou.put rules need to mention the E2EDL24006 as well as the child record E2EDL43000.  What we have here is a double output of record E2EDL43000 per line item, which is exactly what we are after.

Leave a Reply

Your email address will not be published. Required fields are marked *

*