Sales Packing slip Code

Dear Friends,

I have 3 sales lines for a sales order. The packing slip for 3 lines are completed.

Now i need to invoice only one particular line through script. If know please tell me.



Based on what condition you need to post the invoice for the particularline.Ideally system will post the for all lines.Wee need to skip some lines based on the condition.

Hi Ali,

I don’t know technically how we need to right a code but as par functionality, out of 3 lines … 1 line needs to be invoiced means we can do it by doing partial delivery method. Where in the SO line > Quantity (TAB) > Deliver now field… we will be mentioning the 1 line quantity and post the Packing slip. even after posting the packing slip or invoice, status of SO will be in “Open order” only.

Ex: SO Line 1 : Quantity 5

SO Line 2 : Quantity 5

SO Line 3 : Quantity 5

Now as par your requirement we will be selecting the line 2 and Go to Quantity (tab)> in the Deliver now field we will mention Quantity as 5. and leave rest of the 2 lines as usual and we will do packing slip posting. now status will remains same as OPEN ORDER, because still 2 more lines are yet to do packing slip & invoice.

I hope my post might give you how this partial delivery functionality runs and gives you some idea how to write a code now.


Hai sarathy ans saju,

thanks for ur replies. We have 3 sales lines which are delivered.

Here we integrated Ax with .net.

The .net script will send some parameter as Line Number 2 Invoice first.

But i have some script which is invoicing all lines.

But i need to invoice only 2nd line. (They will give only one 2 parameters for Ax: One is SalesId and other is line number. So need to invoice only one line.)

Can u please help me



Will check it.


I dont have enough knowledge in .net.I mentioned below how AX system works when we post the order.


Above method is creating the parmlines in salesparmLine table.
System will select the lines from the parmlinetable and post the order.

If you are skipping the below line based on your condition system will not create the record in parmline table.

sourceLineTable = this.chooseLinesGetSourceLine();

This is just a workarround.But the problem is if one sales order has 100 lines, I need to post the oneline from the order

system will loop 100 times.It seems to be not good practice.But we can achieve the result.Even I am also looking for

optimization.If i find any good logic let you know.From your side also check it and post it.

Better to filter it in chooseLines query level.I checked it in the voucher level also.Posting is perfect.

formletterParmData is common class which is called from PO and SO.Your order type must be Sales order.

If you want to invoice after packingslip posted then you need to move your customization to Salesformletterparmdatainvoice


Here is the sample code:

SalesTable salestable = SalesTable::find(‘SO-000038’);
SalesFormLetter sales = SalesFormLetter::construct(DocumentStatus::Invoice);

Put debugger in below path debug how code is executed.
\Classes\formletterParmData\doChooseLines (sales.update(salestable,today(),Salesupdate::All):wink:
Salesformletterparmdatainvoice\Choselinespackingslip (sales.update(salestable,today(),Salesupdate::PackingSlip):wink:

I welcome if any expert has very good solution.

Thanks a lot for ur valuable time.