How to Create Sales Order and Post the Order automatically??

kishi_gkishi_g Member Posts: 162
Hi,
I had one doubt in Navision. we create Sales Order by using code. But my doubt is first we will open the salesorder form by using form.run code.

after that i assign no.series and assign one customer in Sellto Cutomer field and assign some items to SalesLine tabel. All these data shall i see in SalesOrder form???

all this data comes from coding only. no manual interaction...

first i want to open the form and after that selltocutomer filed data will show and after items will show and finally it will post automatically.


Is it possible?????

Share ur ideas....

Thanks & Regards,
kishore..

Comments

  • rajpatelbcarajpatelbca Member Posts: 178
    kishi_g wrote:

    after that i assign no.series and assign one customer in Sellto Cutomer field and assign some items to SalesLine tabel. All these data shall i see in SalesOrder form???

    all this data comes from coding only. no manual interaction...

    yes you can see that order in a sale order form.
    kishi_g wrote:
    first i want to open the form and after that selltocutomer filed data will show and after items will show and finally it will post automatically.


    Is it possible?????

    do u mean to say that you want to crate an order with coding then open it in sales order form then post it automatically ?
    Experience Makes Man Perfect....
    Rajesh Patel
  • kishi_gkishi_g Member Posts: 162
    Hi Raj,
    I didnt open sales order form manually. I wrote the code in Codeunit and i run the codeunit. Then after shall i see all these process in Sales order form dynamically. Suppose in the codeunit i assigned sell to Cust is 10000, then will it show automatically in Sales Order form????




    Thanks & Regards,
    kishore...
  • rajpatelbcarajpatelbca Member Posts: 178
    you can open sale order from by using this syntax
    but commit that insertion of an oder in both sales order and line.
    then create another variable type of record eg.
    saleshdr record sales header.

    get that record by using setrange.

    saleshder.setrange(saleshder."No.",your orderno);
    if saleshdr.findfirst then begin

    Form.RUNMODAL(form::Sales order form , saleshdr)

    syntax :
    Form.RUNMODAL(Number [, Record] [, Field])

    hope it is clear.
    Experience Makes Man Perfect....
    Rajesh Patel
  • kishi_gkishi_g Member Posts: 162
    Hi Raj,
    Thanks for ur reply. I want to see the data dynamically. In the Codeunit i use this code for open the Sales Order form.

    Form.RUNMODAL(form::Sales order form , saleshdr)

    then the form will appear. then after that line i assigned
    Salesheader.No. := '1234';
    Salesheader.selltocustomerNo := 'xxxx';

    Is this data will appear in that Sales Order form dynamically.


    Thanks & Regards,
    kishore...
  • rajpatelbcarajpatelbca Member Posts: 178
    hi kishore,

    yes you will see your record on sales order form.

    by the way, if your problem has solved then change the subject as [Solved] prefix with your title.
    Experience Makes Man Perfect....
    Rajesh Patel
Sign In or Register to comment.