How can I post one conpany journal from another.

nxlkarnxlkar Member Posts: 4
edited 2003-01-17 in Navision Attain
I have one problem when i try to make similar transaction in two different company (in one database). I can greate the same journal line using CHANGECOMPANY function but I can't post this journal from othe company. My be some one knows how I can do this. I will be very pleased.

Comments

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    With CHANGECOMPANY, you can only change the company for tables. This is not possible when running codeunits. Therefore, you can't post something in another company.

    If you have an Application Server, you can start that server with the right company and do the posting.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • DenSterDenSter Member Posts: 8,307
    Actually, you CAN post in other companies, but it involves extremely tedious programming, and debugging it would probably be hell, since you'd have to be switching companies a lot to verify results.

    You'd have to recreate all the posting logic, but add the CHANGECOMPANY method to each record variable and a way to pass the company name through the whole posting routine.

    It doesn't matter from which company you perform logic, as long as you make sure that ALL record type variables write to the correct company, which in the posting routine's case is a LOTTA variables. As you probably won't find a customer who'd be willing to pay for such a job, it probably won't happen.
  • NickNick Member Posts: 8
    You could try changing companies, creating the same journal in the other company (a temp table would probably do the job) and then calling the post codeunit with that journal (if you're using Attain you'll have to handle the dimension also).
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Nick,

    The main problem is you can't call a codeunit in company Y from company X. The codeunit will be executed in company X.

    Only solution is to use Navision Application Server.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • DenSterDenSter Member Posts: 8,307
    You can't call a codeunit from another company, but you CAN read and write data to another company, so you can do anything you want from any company you want. It just takes a VERY big amount of programming, since you have to maintain the company name of all your record variables.
Sign In or Register to comment.