Error during Sales Line insert

TOMTEFARTOMTEFAR Member Posts: 8
Hello!

I'm trying to insert a new entry in the Sales Line table. I keep getting the following error message.

Navision communication exception: 1011 21:
You must specify Document No. in Sales Line Document Type='Quote',Document No.='',Line No.='0'.

The thing is that I set the Document No. = Sales Header No.
I also set Line No. to 10000 ( I only have 1 item).
I also set No. to the product number.

Besides those I set a number of other properties that I don't think are as important.

I don't understand the error message because I do set Document No. befor I try to save the entry? Do you have any Ideas?

Comments

  • SavatageSavatage Member Posts: 7,142
    Apparently whatever you are trying to do it is NOT getting the Sales Header No. How are you calling it? with a GET or FIND?

    PS don't forget to set the TYPE too if you need that
    ie/
    ITEM
    G/L ACCOUNT
    FIXED ASSET
    etc.

    How are you doing this insert - thru a dataport?
  • kinekine Member Posts: 12,562
    Best will be to post the code you are using for that. It seems that there will be some wrong steps...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • TOMTEFARTOMTEFAR Member Posts: 8
    Is there a certain order I need to do things.

    For instance do I need to create the sales line first and once it's added hook it up to the sales header?

    Are there any key constraints that I might be doing something with.

    Posting the code would not really be helpful since we use a middleware called Celenia.
  • kinekine Member Posts: 12,562
    Of course, the header must be created first.

    After that, you have the document no. which you need to use when inserting the lines.

    May be you can describe the process you are using. It seems for me that you are inserting the records from external application using some tool from Celenia. But how you are passing the data to NAV? If we do not know the background, we cannot help you effectively...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • TOMTEFARTOMTEFAR Member Posts: 8
    The header is created first. I then get the No. from the newly created header and use as a parameter to the lines.

    I only code against the Celenia framework. Celenia takes care of the communication to NAV.

    What I'm trying to find out is if there are some rules that I need to follow such as:

    The order in which I supply the data to NAV matters.
    I need to set the following fields or it wont work.
    etc...
  • kinekine Member Posts: 12,562
    Because we do not know how the Celenia framework works, I cannot help. I do not know if you are sending field by field, or some whole record etc. In Nav, it depends on the order of validation of the fields. Some validation of some fields can clear another field etc. and thus the order must be correct. For me it seems like question for Celenia.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • TOMTEFARTOMTEFAR Member Posts: 8
    I send the whole transaction in one record. It might be that since I don't supply all fields the validation you talk about will fail. I will also look into the ordering of the fields.

    Thanks, you gave me a possible solution to my problem.
Sign In or Register to comment.