Changing the Item Code field size

kamranshehzadkamranshehzad Member Posts: 165
Is it possible to change the field size of Item.No field. I want to change it from 20 to 50.

I know its related to other fields so I was just wondering if there is a safe way to do so.

please advise.

regards,
KS

Answers

  • DenSterDenSter Member Posts: 8,304
    It's possible, but personally I would not do it. You will also need to change it everywhere else that the field is used. The Item is used throughout the entire system, it is linked to in just about every functional area in NAV. You're gong to find yourself fixing issues for years to come.

    I would figure out an alternative, such as a new field with the length you're looking for, and keeping the primary key intact. Assign a meaningless numbering serie to the Item number, just let it run and assign the meaning you are seeking to this new field.

    Why do you want to increase the length anyway? The only reason I've seen so far to do this was to be able to build 'smart' numbers, where it is built up of other attribute values. If that's the case, you're better off using separate fields anyway, much easier to work with.
  • kamranshehzadkamranshehzad Member Posts: 165
    Issue is we are getting data from outside like sales orders, purchase orders, items , customers , vendors etc from a different system. we are using navision as financial system at this moment. I can't change the flow at this stage while almost all interfaces are in place.

    the structure of interface is that we are importing data through code units / xml ports and its on regular basis not one off. it will be a challenge to use a second field to store item no's and use navision generated item numbers and the pick the navision numbers based on newitemno field.
    furthermore, this will slow down the interface speed. we will be getting about 1000 invoices / day and 100 pos.

    the lenght of field is 20 in navision but we are getting upto 45 chars as item no's.

    I can't think of anything other than changing field size in navision...

    stuck...

    any advice...
    regards,
    KS
  • DenSterDenSter Member Posts: 8,304
    Like I said, create a new field that's 50 characters long, make sure that unique values are entered into it, and let the numbering series take care of primary key values. All you need to do is make sure to look up Items using that new field, which is a slightly different approach than using GET on the primary key, but still, if you make sure that only unique values are entered into that field, should still give you the results that you're looking for.
  • kamranshehzadkamranshehzad Member Posts: 165
    fine but when i import the sales / purchase order through xmlport how would i get nav itemno... any idea.. dats the only point of concern..

    regards,
    KS
  • DenSterDenSter Member Posts: 8,304
    Item.SETRANGE(NewItemNo,IncomingItemNumber);
    Item.FINDFIRST;
    THEItemNo := Item."No.";
    
  • kamranshehzadkamranshehzad Member Posts: 165
    I believe I can write this code in xmlport to handle the item no? Am i right?

    regards,
    KS
  • DenSterDenSter Member Posts: 8,304
    I don't know exactly what your process is, and what your XMLPort does, so it's difficult for me to say what will and will not work. Apparently you are using an XMLPort to import orders, so if you want to use an item number substitute you're going to have to make the XMLPort smart enough to substitute said item number. If this process happens elsewhere in the system as well, you could consider creating a codeunit and calling this codeunit from your XMLPort.
  • kamranshehzadkamranshehzad Member Posts: 165
    DenSter wrote:
    don't know exactly what your process is, and what your XMLPort does, so it's difficult for me to say what will and will not work. Apparently you are using an XMLPort to import orders, so if you want to use an item number substitute you're going to have to make the XMLPort smart enough to substitute said item number. If this process happens elsewhere in the system as well, you could consider creating a codeunit and calling this codeunit from your XMLPort.

    Yes I am using xmlport to import the orders. My xmlport imports the orders passed to it though webservice.

    So now i have 2 options now..
    1- Code in XMLPort to handle the swap of incomingitemno with navitemno by inputing itemno.
    2- Write codeunit routine to get the navitemno by passing it incomingitemno.

    ill try both and see if I can handle it some how.

    regards,
    KS
  • kamranshehzadkamranshehzad Member Posts: 165
    Can you advise me on this bit of code?

    RecItem gets the right record no. when i try to assign it to line item... it throws the exception.


    ItemNumber - Import::OnAfterAssignField()
    RecItem.SETRANGE(RecItem.EEItemNo);
    RecItem.FINDFIRST;
    "<Sales Line>"."No." := RecItem."No.";


    Microsoft Dynamics NAV Classic
    The Data conflict with the LinkTable and LinkFields setup of Table <Sales Line>.

    OK


    Kind regards,
    KS
  • DenSterDenSter Member Posts: 8,304
    I don't think that gets the right Item at all, because you're not specifying the value in your SETRANGE. I also don't think you actually copied that from the C/AL, because that code would not compile with the < and the > inside the quotation marks.

    First make sure that your XMLPort is not pointed at the field itself but at a Text type element. Then in the Import::OnAfterAssignVariable trigger, try this:
    ItemNumber - Import::OnAfterAssignVariable()
       RecItem.SETRANGE(EEItemNo,ItemNumber); // you have to specify the value to set a filter
       RecItem.FINDFIRST;
       "Sales Line".Type := "Sales Line".Type::Item;
       "Sales Line".VALIDATE("No.",RecItem."No.");
    

    Don't you have a senior there that can help you with this code?
  • kamranshehzadkamranshehzad Member Posts: 165
    thank you very much. we will also try to limit the incoming item nos and will use replacement item no as you suggested.

    Thanks for your help.

    No I dont have any senior nav developer, we just started work on navision last month and I am also reading training guides. hopefully will be soon able to sort out small issues byself:)

    kind regards,
    KS
  • SavatageSavatage Member Posts: 7,142
    for a second I was thinking about using the Cross-reference table to store all the outside numbers and assign them to your nav item number - but the field length is the same issue - but used in much less places that the item."no".

    I haven't tested to see how many places the cross-reference is used.
  • kamranshehzadkamranshehzad Member Posts: 165
    I did look into that this evening as well. I thought i should use it. but now i am thinking to have mapping in other system to handle this issue. i think that will be a better way to sort this out. in other sytsem, we will remove the unneccssary charactors like / etc from item codes and will copy them inanother field. from there we will get the data and get other system item no into an extra field in items table just for reference.

    i think thats one of the good solutions ..if i want to handling it outside nav.
    KS
Sign In or Register to comment.