Field-from Purchase to Sales

Hi…

I have a field in Purchase header(i hv created this for some requirement) and now i want it to have it on sales line.

How should i go with it?

Any help???

Some questions:

  • Purchase Header to Sales Line? Or should it be PH to Sales Header? Or PH to Purchase Line?
  • Should the content of that field be automatically synchronized?

Thank you for your time…

The value of the field has to flow from Purchase Header to Sales Line.The value has to be synchronized and should be displayed on the Sales Line.

We need more information, what will be the relationship between the two tables?

If you are creating a Purchase Order document for a specific Sales Line, then on the Sales Line you will need to add a lookup field ‘My New Field’ and code a lookup / drilldown to the the Purchase Header table, and the user will have to select the correct Purchase Header record to fill the new field.

The syncronisation will have to be a manual process, and a one to one relationship Sales Line to Purchase Header, if you need more help we would need a better scenario of the process, and the field relationships.

Example:

Create your new field on the Sales Line, “My New Field”, create a C/AL Global PurchHeader - Record - ‘Purchase Header’ then add code in the OnLookup trigger

My New Field OnLookup

PurchHeader.RESET;

PurchHeader.SETRANGE(“Document Type”,PurchHeader.“Document Type”::Order);

IF FORM.RUNMODAL(0, PurchHeader) = ACTION::LookupOK THEN

VALIDATE(“My New Field”,PurchHeader.“My New Field”);

David

Thank you…But i dont want it to be in the form of lookup.I want to show the value on the sales line which i have inserted while making a purchse order.

Actual Requirement: While purchasing an item,i am going to assign a code for that item. and when ever i am going to sell that item to a customer that code has to be fetched on to the sales line.

Hi Aravind,

From actual requirement, it is clear that you do NOT need data from Purchase Header to Sales Line, rather it will be from either Purchase Line to Sales Line or may be something like Item Tracking.

This code is entered on the purchase header while making purchase order.That is why i have mentioned like that.

Any solution for me?

Aravind,

it is not clear how you expect the system to syncronize, you are not giving a workable scenario, your options if you do not want a lookup is to add a value to the item table, or if you saying that everytime you purchase an item you want to give this a specific ID then that would be Item Tracking lot or serial number.

If ‘Item A’ is on two or more Purchase Orders how does the system know which value to use for the Sales Line?

David

i am sorry if my explanation is not clear…But replying to the last point,the item is unique and it can be purchased once and sold once.The reason being is,it is some customized product and for these items only we will enter that code and for others the value will be left as blank.

The requirement you mentioned will not be fulfilled by only entered the code on the Purchase header and trying to fetch the same on sales line. Since if you create the Sales Order after the Purchase order is posted, then the Purchase order will not be available on the Purchase header table. This requirement looks like as suggested by Dhan Raj Bansal needs something like Item Tracking.
Look if the requirement needs Item Tracking to be used, otherwise customization needs to be done so that the code that is entered on the Purchase header will have to flow to the Item Ledger entry, and on the sales line the user will have to select “Appl.-from Item Entry” and the the correspondig code on that particular Item Ledger entry needs to be fetched to the sales line.

Aravind,

The best place then would be to add the new field to the Item table and card, then you can add a flowfield to the Sales Line with a relationship to the Item record to display this value, or fill the value into a Normal field when you validate the Sales Line ‘No.’ field

You could also use a Dimension on the Item and set this to default, but as the Item No. is unique what is the value you want to carry over to the Sales Line?

You can do it with ‘no code’ as well, use “Description 2” add this to the Item card and enter a value, this will copy to Purchase and Sales Lines if it exists on the Item card at the time the order is created, and all the History Tables “Description 2” fields will be populated for you on posting, then just add the field to any forms or reports where it is required.

David