Dataport for Amazon orders delivered via AMTU

bberkleybberkley Member Posts: 11
We sell our products on amazon in addition to using EDI for major retail chains, and the volume is such that we need to make the process of entering the amazon orders by the batch, rather than keying them in one at a time.

amazon has a open source order delivery system that is called AMTU, and it delivers batches of orders in a tab-delimited text file.

Has anyone used this combination before to create sales orders?

We would also need to be able to output a tab-delimited text file that confirms orders to upload back to amazon.

Thanks,

Brian

I looked at this thread: http://www.mibuso.com/forum/viewtopic.php?t=16024 and think that will help, but I'm not a developer, and don't know that I can do this on my own.

Comments

  • ara3nara3n Member Posts: 9,256
    I suggest to contact your NSC and ask them to give you a quote.
    You could also paste a couple of lines of the text file in here and somebody could give you a dataport. But you won't be able to import the txt file.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • bberkleybberkley Member Posts: 11
    order-id	order-item-id	purchase-date	payments-date	buyer-email	buyer-name	buyer-phone-number	sku	product-name	quantity-purchased	item-price	item-tax	shipping-price	shipping-tax	ship-service-level	recepient-name	ship-address-1	ship-address-2	ship-address-3	ship-city	ship-state	ship-postal-code	ship-country	item-promotion-discount	item-promotion-id	ship-promotion-discount	ship-promotion-id
    

    These are the fields in the header of the text file.

    I would paste more, but that is private data containing real names, numbers, addresses, etc. If someone orders more than 1 product in an order (i.e. two different SKUs, it is separate lines.
  • ara3nara3n Member Posts: 9,256
    Do you create a new customer for each order? or do you use a generic Customer "Amazon"?

    If you create a new customer, what do you search for first name or buyer-email?
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • ara3nara3n Member Posts: 9,256
    Here is an example dataport.
    OBJECT Dataport 50100 Load Order
    {
      OBJECT-PROPERTIES
      {
        Date=11/05/07;
        Time=[ 8:14:15 PM];
        Modified=Yes;
        Version List=Ara3n;
      }
      PROPERTIES
      {
        Import=Yes;
        FieldStartDelimiter=<None>;
        FieldEndDelimiter=<None>;
        FieldSeparator=<TAB>;
      }
      DATAITEMS
      {
        { PROPERTIES
          {
            DataItemTable=Table2000000026;
            AutoSave=No;
            AutoUpdate=No;
            AutoReplace=No;
            DataItemTableView=SORTING(Number);
            OnPreDataItem=BEGIN
                            Window.OPEN('Going through #1#############',DataItem[1]);
                          END;
    
            OnBeforeImportRecord=BEGIN
                                   CLEAR(DataItem);
                                 END;
    
            OnAfterImportRecord=BEGIN
                                  Window.UPDATE();
                                  IF DataItem[1] = 'order-id' THEN
                                    CurrDataport.SKIP;
                                  IF DataItem[4] = '' THEN
                                    CurrDataport.SKIP;
    
                                  IF NOT TempSalesHeader.GET(TempSalesHeader."Document Type"::Order,DataItem[1]) THEN
                                    CreateHeader
                                  ELSE BEGIN
                                    SalesHeader.GET(TempSalesHeader."Document Type",TempSalesHeader."No.");
                                  END;
    
    
                                  CLEAR(SalesLine);
                                  SalesLine."Document Type" := SalesLine."Document Type"::Order;
                                  SalesLine."Document No."  := SalesHeader."No.";
                                  EVALUATE(SalesLine."Line No.",DataItem[2]);
                                  SalesLine.INSERT(TRUE);
    
                                  SalesLine.VALIDATE(Type,SalesLine.Type::Item);
                                  SalesLine.VALIDATE("No.",DataItem[8]);
                                  EVALUATE(SalesLine."Unit Price",DataItem[11]);
                                  SalesLine.VALIDATE("Unit Price");
                                  SalesLine.MODIFY(TRUE);
    
                                  //Add code here to insert gl lines for
                                  //item-tax shipping-price   shipping-tax  ship-service-level
                                  //item-promotion-discount ship-promotion-discount
                                END;
    
          }
          FIELDS
          {
            {      ;     ;DataItem[1]          }
            {      ;     ;DataItem[2]          }
            {      ;     ;DataItem[3]          }
            {      ;     ;DataItem[4]          }
            {      ;     ;DataItem[5]          }
            {      ;     ;DataItem[6]          }
            {      ;     ;DataItem[7]          }
            {      ;     ;DataItem[8]          }
            {      ;     ;DataItem[9]          }
            {      ;     ;DataItem[10]         }
            {      ;     ;DataItem[11]         }
            {      ;     ;DataItem[12]         }
            {      ;     ;DataItem[13]         }
            {      ;     ;DataItem[14]         }
            {      ;     ;DataItem[15]         }
            {      ;     ;DataItem[16]         }
            {      ;     ;DataItem[17]         }
            {      ;     ;DataItem[18]         }
            {      ;     ;DataItem[19]         }
            {      ;     ;DataItem[20]         }
            {      ;     ;DataItem[21]         }
            {      ;     ;DataItem[22]         }
            {      ;     ;DataItem[23]         }
            {      ;     ;DataItem[24]         }
            {      ;     ;DataItem[25]         }
            {      ;     ;DataItem[26]         }
            {      ;     ;DataItem[27]         }
            {      ;     ;DataItem[28]         }
            {      ;     ;DataItem[29]         }
            {      ;     ;DataItem[30]         }
            {      ;     ;DataItem[31]         }
            {      ;     ;DataItem[32]         }
            {      ;     ;DataItem[33]         }
            {      ;     ;DataItem[34]         }
          }
           }
      }
      REQUESTFORM
      {
        PROPERTIES
        {
          Width=9020;
          Height=3410;
        }
        CONTROLS
        {
        }
      }
      CODE
      {
        VAR
          DataItem@1000000000 : ARRAY [100] OF Text[100];
          SalesHeader@1000000001 : Record 36;
          TempSalesHeader@1000000004 : TEMPORARY Record 36;
          SalesLine@1000000002 : Record 37;
          Window@1000000003 : Dialog;
          Customer@1000000005 : Record 18;
    
        PROCEDURE CreateHeader@1000000000();
        BEGIN
          CLEAR(SalesHeader);
          SalesHeader."Document Type" := SalesHeader."Document Type"::Order;
          SalesHeader.VALIDATE("No.",DataItem[1]);
          SalesHeader.INSERT(TRUE);
          SalesHeader.SetHideValidationDialog(TRUE);
          IF NOT Customer.GET(DataItem[5]) THEN
            CreateCustomer;
          SalesHeader.VALIDATE("Sell-to Customer No.",DataItem[5]);
          SalesHeader.VALIDATE("Ship-to Address",DataItem[17]);
          SalesHeader.VALIDATE("Ship-to Address 2",DataItem[18]);
          SalesHeader.VALIDATE("Ship-to City",DataItem[20]);
          SalesHeader.VALIDATE("Ship-to County",DataItem[21]);
          SalesHeader.VALIDATE("Ship-to Post Code",DataItem[22]);
          SalesHeader.VALIDATE("Ship-to Country Code",DataItem[23]);
          //add additional fields needed
          SalesHeader.MODIFY(TRUE);
        END;
    
        PROCEDURE CreateCustomer@1000000001();
        BEGIN
          CLEAR(Customer);
          Customer.VALIDATE("No.",DataItem[5]);
          Customer.VALIDATE(Name,DataItem[7]);
          Customer.VALIDATE(Contact,DataItem[16]);
          Customer.VALIDATE(Address,DataItem[17]);
          Customer.VALIDATE("Address 2",DataItem[18]);
          Customer.VALIDATE("E-Mail",DataItem[6]);
          Customer.VALIDATE("Phone No.",DataItem[7]);
          //Add theh additional fields you need here
    
          Customer.INSERT(TRUE);
        END;
    
        BEGIN
        {
          1order-id   2order-item-id   3purchase-date   4payments-date   5buyer-email   6buyer-name   7buyer-phone-number  8sku  9product-name
          10quantity-purchased   11item-price  12item-tax   13shipping-price   14shipping-tax  15ship-service-level   16recepient-name
          17ship-address-1 18ship-address-2   19ship-address-3   20ship-city   21ship-state  22ship-postal-code   23ship-country
          24item-promotion-discount 25item-promotion-id   26ship-promotion-discount   27ship-promotion-id
        }
        END.
      }
    }
    
    
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • bberkleybberkley Member Posts: 11
    ara3n wrote:
    Do you create a new customer for each order? or do you use a generic Customer "Amazon"?

    If you create a new customer, what do you search for first name or buyer-email?

    We use the singular customer Amazon, and each order is a different ship-to. We don't store the ship-to addresses in the customer card, address list. We treat each one like a drop-shipment.
  • SavatageSavatage Member Posts: 7,142
    I think the key here is getting your datafile in place.

    We too receive amazon orders.
    As stated in the link you made above.

    We pre-format the data into just the fields we actually use..
    All the HEADERS
    then All the Lines.


    We also use just 1 Customer # and the dataport imports the customers info into the Ship-To fields else you will have thousands & thousands of customers at the blink of an eye.

    And use a Dataport to import all the orders. Then you can customized it as you need. Here's how we import internet orders

    http://savatage99.googlepages.com/Datap ... erswAd.txt
  • bberkleybberkley Member Posts: 11
    Thanks Harry and ara3n.

    So, the code for the dataport is compiled as a codeunit? Then you create a dataport to hit the sales header?
  • SavatageSavatage Member Posts: 7,142
    My dataport brings the info directly into the Sales Header & Sales Line Table.

    The application Designers Guide that comes on the product CD has a whole chapter about dataports. If you don't have it I can send you the link to download it.

    PS: That orig post you linked to has many good tips.
    Play around with some test data in a test environment.

    If you get stuck somewhere lets us know.
  • bberkleybberkley Member Posts: 11
    I tried importing both dataports in my test environment. Ara3n's imports, but tries to manually create Numbers for the Sales Order number series, and its automatic for us.

    Harry, your dataport won't import, I get errors on Line 37 in your comment:
    //This Imports all the sales header info!!!!
    
    and if I remove that, I get errors on line 92:
          }
          FIELDS
          {
            {      ;     ;"Document Type"      }
            {      ;     ;"No."                }
            {      ;     ;CustNo               }
            {      ;     ;"Customer PO Number" }
            {      ;     ;"Order Date"         }
            {      ;     ;"Shipping Agent Code" }
            {      ;     ;"E-Ship Agent Service" }
            {      ;     ;Internet_Cust_Residential }
            {      ;     ;Internet_Cust_Name   }
            {      ;     ;Internet_Cust_Address1 }
            {      ;     ;Internet_Cust_Address2 }
            {      ;     ;Internet_Cust_City   }
            {      ;     ;Internet_Cust_State  }
            {      ;     ;Internet_Cust_Zip    }
            {      ;     ;Internet_Cust_Country }
            {      ;     ;Internet_Cust_Email  }
            {      ;     ;Internet_Order_Type  }
            {      ;     ;Internet_Gift_Wrap   }
            {      ;     ;Internet_Gift_Message }
            {      ;     ;Internet_Cust_Phone  }
          }
           }
    

    The error I get is: The AL code is not indented as much as the first line.
  • SavatageSavatage Member Posts: 7,142
    edited 2007-11-06
    Here's the fob. Note you will probably not find an exact fob from us that will import and work right off the bat. You will need to adjust/change some parts to work with your system & data.

    It will pay to review the text about dataports.

    For example I have added custom fields to our sales header table that WE need to process our orders you may not need them..such as:

    50011 Internet Order Boolean
    50012 Internet Backorder Boolean
    50013 Internet Gift Wrap Boolean
    50014 Internet 3rd Party BO Boolean
    50015 Internet Gift Message1 Text 84
    50016 Internet Gift Message2 Text 83
    50017 Internet Gift Message3 Text 83
    50018 Internet Order Type Option
    50019 Internet Phone No. Text 30
    50025 E-Mail Text 80

    *Note - Customer PO Number is field 100 (External Doc Number)

    http://savatage99.googlepages.com/Datap ... erswAd.fob

    *PS When you add New fields to the Sales Header or Sales Line - If you add the Same Fields to the Sales Invoice Header & Sales Invoice Line using the same Numbers (ie.50011) the data will transfer over and be saved in the sales invoice. If you don't the Data will be lost when you post.

    I don't think with a reg license you can make changes to the Sales Invoice header table - you will have to then ask your nSC.
  • bberkleybberkley Member Posts: 11
    Thanks Harry, its more for my own learning. We'll have our VAR do the work, I just like to learn more about the system and how this all works, especially if I have to troubleshoot it in order to tell someone why/what isn't working.
  • SavatageSavatage Member Posts: 7,142
    that's why in
    http://savatage99.googlepages.com/Datap ... erswAd.txt
    I added alot of //Comments to help you see how & where things were happening.
    I've found it very useful to become as aware as I can about the system and how it works. 8)
Sign In or Register to comment.