How do I join STOJOU to GACCCODE?

SOLVED

I am looking to join the two above tables, According to the data models, the join is supposed to happen like this: 1;ACCCOD. How is that supposed to work if STOJOU doesn't have any accounting code? Also what does the 1 mean in the data model? Any and all help is appreciated, Thank you!

  • +1
    verified answer

    The data model links based on table keys. In this case, the link is GACCCODE key GAC0 which consists of TYP_0, ACCCOD_0 and COA_0. The a value of TYP_0 in your example is based on local menu 602, and 1 means products, to get the accounting code, link to the ITMMASTER, then to the GACCCODE. (I did not include the COA, if you have multiple chart of accounts, it is required as third part of the link). Your link to the tables would look like this, assuming you are looking for the product GL accounting code.

    select * from STOJOU S
    inner join ITMMASTER I on I.ITMREF_0 = S.ITMREF_0
    inner join GACCCODE G on G.TYP_0 = 1 and G.ACCCOD_0 = I.ACCCOD_0