How to programmatically associate a dimension with an output journal in C/AL

How do I programmatically associate a dimension with an output journal in C/AL ?

The Dimension is called OPERATOR and I want to associate this with an output journal record in a code unit.

Any ideas?

Thanks

Dave K

Hi ,

Output journal is basically an Item Journal Line . You can modify the trigger for insert or at the moment of population , depending on your process.

Do you know C/AL ?

G.

Is this dimension attached to any of the master ?

Is user selecting this dimension in Sales order?

when you are inserting the output journal insert them with validate command in the fields assignment and use insert(true) option in the code… dimensions are automatically created if they are assigned to your masters…

Anil.

Thanks, I am new to C/AL.

We have some software written in C#.net which uses the NAV API.
I have exposed Output Journal page along with some other pages and a code unit.

The software populates the output journal and then calls our code unit with the order number as a parameter to post the journals with the same order number.

Now, I want to associate our OPERATOR dimensions with each output journal line before posting it.

It is better or even possible to associate the dimension to the output journal in the software using exposed pages/code units ?
or should I pass the dimension value as a parameter to a function in our code unit and create the dimension value and associate it to the output journal line from within NAV using codeunit 408 - (and How do I do this please - can’t find any documentation for this) ?

Is there a best way to do this?

Hi ,

I would amend the triggers in the table , but it should be also ok to expose a Page function if - its callable. Depends on your process and scenario really.

g.

Hi,

in your code unit… you can use the below syntax.

DimMgt.InsertJnlLineDim( DATABASE::“Item Journal Line”, “Journal Template Name”,“Journal Batch Name”,“Line No.”,0, “Shortcut Dimension 1 Code”,“Shortcut Dimension 2 Code”);

DimMgt → Codeunit DimensionManagement

DATABASE::“Item Journal Line” → this should be your output journal

and then all the respective parameters are from your output journal fields only.

This will work.

good luck!!

Anil.

Please excuse my new-ness to C/AL, but I don’t fully understand the InsertJnlLineDim function.

Should I have said DIMENSION VALUE ? that’s what I meant. All of the Dimension Values will have already been set up using the Edit Dimension Values window.

For example, a third party .net app has created an output journal line and calls a our code unit passing the order number or perhaps some id for the output journal line and a string representing the ‘OPERATOR’ Dimension Value Code such as “123” as parameters

So, I want to post the output journal line with the dimension OPERATOR having the value code of “123” (or whatever is in the parameter)
I understand I will need to look up this DIMENSION VALUE to ensure it is valid and it exists.

This Standard Dimension value Code 123 could have a Name of “Joe Blogs” for example.

The end result is that we can know who the machine operator was (Note: not the person logged in to the terminal or into NAV)
using dimensions in the reports etc.

I think I had not set out my question properly [:$]

Thanks in advance and for your patience.

Dave K

Well,

Basically you are calling a codeunit right , that codeunit does the insert . Then This codeunit is to be extended with dimension value population…

I think we got what you mean :slight_smile: , you are just not a C/AL developer :slight_smile: . No offense.

g

None taken.

What would help though is “how to do it”.

Everyone has to start somewhere. There was probably a time when you needed help from these forums.

Can anyone tell me? Or are the previous posts the way to do this?

If so could someone tell me what each line is doing because I do t get it.

Thanks

Dave K

Basically, how do I tell the insert dim function that it is a OPERATOR

dimension and that it has the value of 137 for example.

I already know that I am a beginner and don’t need an expert to tell me that.

Isn’t this the beginners forum ?

Thanks.

Dave K

Anil has given you an example.

As a begineer you need to learn too :slight_smile: .

g.

Would I be correct in saying…

DimMgt.InsertJnlLineDim( DATABASE::“Item Journal Line”, “Journal Template Name”,“Journal Batch Name”,“Line No.”,0, “Shortcut Dimension 7 Code”,“Shortcut Dimension 8 Code”);

Since OPERATOR is short cut dimension 7

And I populate the shortcut fields of the output journal with the required values before posting ?

By the way, my output journal table has fields for shortcut dimension codes 7 and 8 already, so could I get away with simply populating those fields?

(8 is unused at the moment)

Thanks

It’s NAV 2013 and InsertJnlLineDim has been deleted from DimMgt. So, I need to add a combination of Dimension values and get the Dimension Set ID and assign this to the Item Journal Line before posting.

Now I just need to figure out how to do this :slight_smile:

Any further advice appreciated. Thanks.

It’s NAV 2013 and InsertJnlLineDim has been deleted from DimMgt.

http://msdn.microsoft.com/en-us/library/jj552487(v=nav.70).aspx

So, I need to add a combination of Dimension values and get the Dimension Set ID and assign this to the Item Journal Line before posting.

Now I just need to figure out how to do this :slight_smile:

Any further advice appreciated. Thanks.

http://msdn.microsoft.com/en-us/library/jj552487(v=nav.70).aspx

Well i can help you on this… i know there must be some other function for nav 2013 in the same dim mgmt…

let me help you online…

my skype ID is : anliinecta

Thanks,

Anil.

Solved !!

I read up some more on Dimensions and I had not realised that the Output Journal (and the other tables) already have the 8 shortcuts that I can assign the values to directly into the table before posting. This is really easy now :slight_smile:

So, If I want to attribute 3 dimensions to my output journal line:

  • STAGE (shortcut 6) = “FIRST OFF INSPECTION”
  • OPERATOR (shoutcut 7) = “160”
  • INSPECTOR (shortcut 8) = “240”

from a c# app, I just need to…

outp.ShortcutDimCode6 = “FIRST OFF INSPECTION”;
outp.ShortcutDimCode7 = “160”;
outp.ShortcutDimCode8 = “240”;

Then save the record. I then call my code unit function which posts all output journals where the order number, machine centre and op number matches the given parameters

Done.