Print Sales Order form last line

Hi Guys,

I have to get the last line of the Sales Order Form through another form by clicking a button. For example If there is 10 items selected in the Sales Line The form have to show the last line. Normally the form shows the first line. But I have to display last line.

Any experts provide me a solution for this.

Welcome to DUG.

Need more information on this…

What is the source table of new Form?

Check the code in OnPush trigger of the form.

Thanx for Your wish and reply Mohana.

New Form is Blanket Sales Order.

Source Table :- Sales Header.

I created a button in Blanket Sales Order form and when click the button it goes to Sales Order Form.

But Im confused with the coding of getting the last line of Sales Order from Blanket Sales Order.

Can someone help on this?

So you have created a button in Sales Blanket Order form and when you press that button it should open Sales Order form with Last line of Sales Blanket Order…am I right?

Can you show the code in Onpush trigger of the button?

No

When the button got clicked it need to show the last line of the Sales Order Form. Not the Blan.Sal.Order Form.

I just wrote in OnpushTrigger

FORM.RUN(FORM::“Sales Order”);

RVSalesLine.GET;

IF RVSalesLine.FINDLAST THEN

MESSAGE(‘Successfully Displayed the Last Line’);

This is not working. What can do now?

Any Solutions Mr. Mohana Kishna?

No .

When the button got clicked it need to show the last line of the Sales Order Form. Not the Blan.Sal.Order Form.

I just wrote in OnpushTrigger

FORM.RUN(FORM::“Sales Order”);

RVSalesLine.GET;

IF RVSalesLine.FINDLAST THEN

MESSAGE(‘Successfully Displayed the Last Line’);

This is not working. What can do now?

Any Solutions Mr. Mohana Kishna?

May I know the Purpose of this customization…

Why do you want to show only last line? what about remaining lines?

Do you want to show total Sales Order form or Sales Order subform with last line?

No.

I have to show whole Sales Order form. But If we select 10 lines the Scroll bar need to show the last line values means that the scrollbar need to scroll down and show the last value.

Note :- Not only the last value

Show all values but the selector need to highlight the last line.

Thats my Point.

OK Got it.

Coming to your code…where did you mention that which order should be open?

in the ONPUSH trigger.

where in this code? I cannot find that?

FORM.RUN(FORM::“Sales Order”);

RVSalesLine.GET;

IF RVSalesLine.FINDLAST THEN

MESSAGE(‘Successfully Displayed the Last Line’);

Here:-

FORM.RUN(FORM::“Sales Order”);

This will run Sales Order form but which Order? first Order??? Last Order??

Task as i understand it:

You have a blanket order and you want to show one of the sales orders created from the blanket orders but when you show it you want the last order line to be the active one.

Now the following is only a suggestion from the top of my head. I have not verified it my self.

  1. In subform for order lines add function “SelectLastLine” that does findlast on the subdforms rec thus selection the last line as active

  2. In Form Sales Order add function “SelectLastLine” that call the function in the subform

  3. In your button OnPush create variable SalesOrder of type form. Get the form to show correct order and then call “SelectLastLine” and last call SalesOrder.Run to actually show the form to user. (Might have to do it in other order but you’ll have to try around)

It’s not a full solution and y’ll have to fill in some blanks your self and probably you have to do a little trial and error But i hope you understand the idea of the solution.

/Jinnis