Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics SL (Archived)

Transaction import - error importing Inventory Item using CTL

Posted on by Microsoft Employee

Hello All,

Trying to use transaction import with a .CSV and .CTL to setup new Inventory Item in SL 2011...  but I get an error and i believe my issue in the Macro dealing with Level1 (the button "Site Details..." that is clicked to set the site details..)

Sample of the Log
'System Message 8026: Insertion of new records on this level are NOT allowed
'System Message 2: Data must be entered in this field
'System Message 8002: Error In Field: cdfltsiteid Value:
'System Message 8004: Data File Record/Line Number: 24 Column: 0

sample of my CSV:
Level0,BB100001,4 HOLE DOCK BUMPER,BUMPER,F,P,F,NN,EXEMPT,AC,1,N,EA,EA,EA,4.95,1300,000000,5200,000000,4200,000000,000000,000000
Level1,GHCWHS,,,,

Below is my .CTL:

'$include: "bsl.dh"
'10250 Control Macro
Sub ProcessImportLine( LevelNumber%, Retval% )
  select Case LevelNumber
    case TI_Start

      call AliasConstant( "Level0", "InventoryItem" )

      call AliasConstant( "Level1", "CompanyDefaults" )

    case 0 ' 0 of 1

    'Level 0 if of Type N
      ' cinvtid is a key field for level 0
      ' Field mask is UUUUUUUUUUUUUUUUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cinvtid", ImportField(1) )

      ' Field mask is XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      serr = SetObjectValue( "cdescr", ImportField(2) )

      ' Field mask is UUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cclassid", ImportField(3) )

'Currently Disabled cMfgClassID

      ' cinvttype is an Combo Box
      ' Values are C;Component Part,L;Labor,F;Finished Good,M;Machine Overhead,D;Other Direct Costs,O;Other type of Item,R;Raw Material,S;Subassembly
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cinvttype", ImportField(4) )

      ' csource is an Combo Box
      ' Values are M;Manufactured,O;Outsourced,P;Purchased
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "csource", ImportField(5) )

      ' cvalmthd is an Combo Box
      ' Values are F;FIFO ,L;LIFO ,A;Average Cost ,S;Specific Identification ,T;Standard Cost ,U;User-Specified Cost
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cvalmthd", ImportField(6) )

      ' clotsertrack is an Combo Box
      ' Values are NN;None,LI;Lot Numbered,SI;Serial Numbered
      serr = SetObjectValue( "clotsertrack", ImportField(7) )

      ' Field mask is UUUUUUUUUU
      serr = SetObjectValue( "cslstaxcat", ImportField(8) )

      ' ctransstatus is an Combo Box
      ' Values are AC;Active,NP;No Purchase,NU;No Usage,OH;On Hold,IN;Inactive,DE;Delete
      serr = SetObjectValue( "ctransstatus", ImportField(9) )

'Currently Disabled cKitType

      ' cstkitem is an Check Box
      ' Values are 1 for ON and 0 for OFF
      ' Values are CHECKED for ON and UNCHECKED for OFF
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cstkitem", ImportField(10) )

      ' cchkordqty is an Check Box
      ' Values are Y for ON and N for OFF
      ' Values are CHECKED for ON and UNCHECKED for OFF
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cchkordqty", ImportField(11) )

      ' Field mask is UUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cstkunit", ImportField(12) )

      ' Field mask is UUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cpounit", ImportField(13) )

      ' Field mask is UUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "csounit", ImportField(14) )

      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cstkbaseprc", ImportField(15) )

'Currently Disabled cpstdcost04

      ' Field mask is UUUUUUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cinvtacct", ImportField(16) )

      ' Field mask is UUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cinvtsub", ImportField(17) )

      ' Field mask is UUUUUUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "ccogsacct", ImportField(18) )

      ' Field mask is UUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "ccogssub", ImportField(19) )

      ' Field mask is UUUUUUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cDfltSalesAcct", ImportField(20) )

      ' Field mask is UUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cDfltSalesSub", ImportField(21) )

      ' Field mask is UUUUUUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cPPVAcct", ImportField(22) )

      ' Field mask is UUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cPPVSub", ImportField(23) )

    case 1 ' 1 of 1

    'Level 1 if of Type C
      ' cDfltInvtID is a key field for level 1
      ' cDfltCpnyID is a key field for level 1
      ' Field mask is UUUUUUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cdfltsiteid", ImportField(1) )

      ' Field mask is UUUUUUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cdfltPickBin", ImportField(2) )

      ' Field mask is UUUUUUUUUU
      ' NOTE  -- This field is a required field
      serr = SetObjectValue( "cdfltputawaybin", ImportField(3) )

      ' Field mask is 9999-9999
      serr = SetObjectValue( "cpjt_entity", ImportField(4) )


    case TI_Finish

  End Select
End Sub
' The following shows the correct syntax to
'  PRESS a button
' These object names are specific to this screen.
'      Button object name Button05OK, Caption &OK
'      serr = SetObjectValue( "Button05OK", "PRESS" )

'      Button object name ButtonXRef, Caption Item &XRef...
'      serr = SetObjectValue( "ButtonXRef", "PRESS" )

'      Button object name ButtonHistory, Caption Item &History...
'      serr = SetObjectValue( "ButtonHistory", "PRESS" )

'      Button object name ButtonSiteDetail, Caption &Site Detail...
'      serr = SetObjectValue( "ButtonSiteDetail", "PRESS" )

'      Button object name cmdFindItem, Caption
'      serr = SetObjectValue( "cmdFindItem", "PRESS" )

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Transaction import - error importing Inventory Item using CTL

    We import into this screen frequently and the site details are included

    Control macro has Level0 and Level1.  The Level1 is treated as a change to an existing record of the Level0 line. 

    Our data file is similar to this:

    Level0,invit,.....

    "Level1,change",invtid,site details,....

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Transaction import - error importing Inventory Item using CTL

    Eben, first thing you need to do is figure out what is required. On my system I can enter just an invtid and hit save, everything defaults. Everyone's system can be customized and maybe you have more requirement or need to set the default site bin and location then you will need level1.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Transaction import - error importing Inventory Item using CTL

    The previously posted CTL file was an intelligent control file and the data list is for an intelligent control file but the error message "'System Message 8031: The object names in the simple control file are not sorted correctly." suggests that you are using a simple control file. Try it with the CTL file you had previously posted.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Transaction import - error importing Inventory Item using CTL

    'System Message 8042: Transaction Import Processing Combine Edit and Update mode

    'System Message 8040: Database Name TESTLAN              

    'System Message 8031: The object names in the simple control file are not sorted correctly.

    'System Message 8031: The object names in the simple control file are not sorted correctly.

    'System Message 8031: The object names in the simple control file are not sorted correctly.

    'System Message 8001: Completed Processing 16:40:07

    Level0,BB100001,4 HOLE DOCK BUMPER,BUMPER,F,P,F,NN,EXEMPT,AC,1,N,EA,EA,EA,4.95,1300,000000,5200,000000,4200,000000,000000,000000

    Level0,BB100002,2 HOLE DOCK BUMPER ,BUMPER,F,P,F,NN,EXEMPT,AC,1,N,EA,EA,EA,3.58,1300,000000,5200,000000,4200,000000,000000,000000

    Level0,FL100005,T-FLOOR STABILIZER END CAP PROTECTOR,FLOOR,F,P,F,NN,EXEMPT,AC,1,N,EA,EA,EA,15,1300,000000,5200,000000,4200,000000,000000,000000

    Level0,DO100066,St Hinge, Maersk MCIQ type, br insert bushing 1 2 pin,DOOR,F,P,F,NN,EXEMPT,AC,1,N,EA,EA,EA,20.39,1300,000000,5200,000000,4200,000000,000000,000000

    Level0,DE100001,2 LETTER NUMBER VINYL DECAl,DECALS,F,P,F,NN,EXEMPT,AC,1,N,EA,EA,EA,0.23,1300,000000,5200,000000,4200,000000,000000,000000

    Level0,BB100012,MUD FLAP RETAINING STRAP SLOTTED,BUMPER,F,P,F,NN,EXEMPT,AC,1,N,EA,EA,EA,2.95,1300,000000,5200,000000,4200,000000,000000,000000

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Transaction import - error importing Inventory Item using CTL


    'Below is the new error after i took level1 out

    System Message 8042: Transaction Import Processing Combine Edit and Update mode

    'System Message 8040: Database Name TESTLAN              

    'System Message 8031: The object names in the simple control file are not sorted correctly.

    'System Message 8031: The object names in the simple control file are not sorted correctly.

    'System Message 8031: The object names in the simple control file are not sorted correctly.

    'System Message 8001: Completed Processing 16:40:07


    Level0,BB100001,4 HOLE DOCK BUMPER,BUMPER,F,P,F,NN,EXEMPT,AC,1,N,EA,EA,EA,4.95,1300,000000,5200,000000,4200,000000,000000,000000
    Level0,BB100002,2 HOLE DOCK BUMPER ,BUMPER,F,P,F,NN,EXEMPT,AC,1,N,EA,EA,EA,3.58,1300,000000,5200,000000,4200,000000,000000,000000
    Level0,FL100005,T-FLOOR STABILIZER END CAP PROTECTOR,FLOOR,F,P,F,NN,EXEMPT,AC,1,N,EA,EA,EA,15,1300,000000,5200,000000,4200,000000,000000,000000
    Level0,DO100066,St Hinge, Maersk MCIQ type, br insert bushing 1 2 pin,DOOR,F,P,F,NN,EXEMPT,AC,1,N,EA,EA,EA,20.39,1300,000000,5200,000000,4200,000000,000000,000000
    Level0,DE100001,2 LETTER NUMBER VINYL DECAl,DECALS,F,P,F,NN,EXEMPT,AC,1,N,EA,EA,EA,0.23,1300,000000,5200,000000,4200,000000,000000,000000
    Level0,BB100012,MUD FLAP RETAINING STRAP SLOTTED,BUMPER,F,P,F,NN,EXEMPT,AC,1,N,EA,EA,EA,2.95,1300,000000,5200,000000,4200,000000,000000,000000

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Transaction import - error importing Inventory Item using CTL

    You don't need to modify the control file. If your inventory screen already takes default site and bins then just leave the Level1 lines out of your data file.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Transaction import - error importing Inventory Item using CTL

    Thanks for your response Erich. I will try what you recommended for the Site Details

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Transaction import - error importing Inventory Item using CTL

    Thanks for your response Rob.... So, how should the new macro look like excluding Level1 ?

  • Erich Strelow F Profile Picture
    Erich Strelow F 1,642 on at
    RE: Transaction import - error importing Inventory Item using CTL

    Actually Level1 refers to the "Item Defaults" tab, not the "Site Details".

    You should provide a default Warehouse and default bins for the article. For some reason, this data is mandatory, but it's used only as default in the inventory screens.

    If GHCWHS is your warehouse code, and let's say you have a "00 initial bin for all articles" created, then you should include the following line for each new item:

    Level1,GHCWHS,00,00,,


    If you do need to populate the Site Details screen, you must create a second TI file for the 01255 screen.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Transaction import - error importing Inventory Item using CTL

    On my screen I just let these default and don't set them. These are the item defaults tab. The error message "Error In Field: cdfltsiteid Value:" suggests you are trying to set a blank warehouse or an invalid warehouse on your level 1 import at line 24.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans