Transaction

I need help on the following:-

Actually, i would like to run a transaction which consists of few processes.(I would like to automate the following processes by using Codeunit) Following are the processes:-
1)Create customer
2)Create Sales Order
3)Posting partial shipments
4)Combine Shipment
5)...........

For instance, during the transaction, if there are any errors occured in the 4th process, i would like to roll back to the initial stage. Undo the processes have been performance.

Are there any C/AL code allows me to set the begin and end of the transaction. Thus, all processes within the transaction can be only updated upon reaching to the transaction's commit point. (Base on what i know, Dataport act as a transaction, if there is any error occured in the process of import/Export, it will roll back the whole thing! However, beside using Dataport, what can i do on this??

Thank you very much !!!

  • Hi
    I guess you can write a process to Automate the Processes you have mentioned but, I would like to know how are you going to get the Data for
    1. Creating a Customer
    2. Creating a Sales Order - well for the Header maybe you could use the customer you created but what about the Lines ??
    3. Posting Partials Shipmenets - How are you going to update the Quantities.

    is the data going to be in the form of Text files or CSV files or some other formats.

    Regards
    Vishal



    NGP/NCSD
  • Hi, Vishal, Thanks for your reply!!
    Actually, i am getting the data from other company within a same database. If i simply write a process to perform those
    sub-pocesses above mentioned, during the process, if any error occured in one of the sub-process, the whole process won't be able to complete. Thus, it will cause data inconsistent in between these two companies.

    Thanks!

  • Define two variables:


    Customer Record Customer
    Cusromer2 Record Customer


    db.changecompany(Customer,CopyFromCompanyName);
    <find the customer you need from the other company>

    Customer2 := Customer;
    dbinsrec(Customer2);


    Uhm - The good old blue - It's been a while since I did any development in there :)


    //Henrik Helgesen
    -: KISS::Keep it Simple, Stupid :-
  • I think the roll back issues boil back to the COMMIT function again. i am not too sure what you people will say out there but i say to automate everything and keep the roll back feature is quite impossible or difficult. my suggestion is to keep all the processes in segments. create several buttons for the user to click, and not to click one button and automate everything. in case if the procedure fails, the user would know where it is stuck and do something about it.

    but does anyone has a better way at doing these automations? cause i have not found that out yet...

Related