Purpose of WITH DO statement

Hii All,

In code unit 80 I have observed that

WITH salesHeader DO BEGIN

what is the purpose of with??

Can any one explain me

Hi Govardhini,

If you want to work with many field in a record, we are using like
Customer.“No.”:=‘1234’;
Customer.Name:=‘XXXXXX’;
Customer.“PhNo.”:=‘XXXXXXXXX’;
Customer.INSERT;

Here we are using Customer Rec variable every time.

But Using WITH - DO Statement no need to use rec variable every time like,

WITH Customer Do BEGIN
“No.”:=‘1234’;
Name:=‘XXXXXX’;
“PhNo.”:=‘XXXXXXXXX’;
INSERT;
END;

For more Information Check :
msdn.microsoft.com/…/dd338911(v=nav.90).aspx

Thank You

Hi Sreekanth,

I have created a field carrier charges in sales line and in sales order sub form I added this field, when I am posting the item in sales order the carrier charges should come as item charges, the new line of item charges should be post in background while posting the item and I have written the code for adding the new line of item charges automatically for example

Now I have the first Line as ->Item in sales order before ship
After ship now I have the second Line as ->Charge (item) Then I want to invoice the item with item charges but it throw me the error like U must assign item charges if u want to invoice it

But I don’t want to use the item charge assignment feature ,without using that feature it should get invoice

for that I have written the code like inserting the required fields in item charge assignment(Sales) table and by not using that feature the item get invoiced with item charges

But my problem is it didn’t get updated in value entries and in posted sales invoice, G/L entry, tax entry I can able to see the second line of item charges

Please help me to post the item with item charges in value entries.

Hi Gowardhini,
Please post new questions as new questions, unless they are directly related to the original question.
But in you case, then I know that you have already asked this or similar question in another thread.
Please continue the discussion about automatically creating and posting item charges there. Thank you for your understanding.