When I create orders in a dataport import, I use this to create sales headers:
SalesHeader.INIT;
SalesHeader."No.":='';
SalesHeader.VALIDATE("No.");
SalesHeader.VALIDATE("Document Type",SalesHeader."Document Type"::Order);
SalesHeader.VALIDATE("Sell-to Customer No.",impNo);
SalesHeader.VALIDATE("External Document No.",impExternalDocumentNumber);
SalesHeader.VALIDATE("Shortcut Dimension 1 Code",'SOMECODE');
SalesHeader.INSERT(TRUE);
impNo and impExternalDocumentNumber are set to the right values, but the Shortcut Dimension 1 Code is not inserted. I also don't get any error. The VALIDATE just silently fails. Everything else seems to work just fine. The sales header is created with the required information except for the Dimension code (which does exist).
I am obviously missing something, but what? :-)
0
Answers
When the dimensions are processed, the header must be inserted into DB already, because the dimension entries must be created and connected to this record.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
My thoughts would be to check the OnValidate trigger for the Dimension Code in the Sales Header. Maybe there was a modification to it that you have forgotten or don't know about.
Check the document dimension table. I usually see it the other way around, where the dimension is displayed on the header and is not in the document dimension table, but I suppose it could be this way.
Try putting a CONFIRM after the VALIDATE, CONFIRM('%1', TRUE, SalesHeader."Shortcut Dimension 1 Code"); See if it is coming back set correctly from the validate trigger.
Then put one after the insert. Maybe something in the insert trigger is changing the value.
Hope those help. Good luck.
My Blog - nav.education
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.