@omi4u. Your post in this discussion wrote "please guide with codes". You asked for code in your other posts.
Now that you are asking for codes, you need to try again but share your code, what issue you had and the errors. Also, if I take your question in the title and google that, examples are found for you to read and try to understand.
Maybe some will write code for you but how that will fit into your ERP system would be up to you to pound into place.