Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am working on an invoicing issue and cannot figure out why a field isn't connecting properly.
Each invoice has a certain number of lines and the vendor number of that vendor appears on only 1 line of that invoice. In order to get the name of the vendor I have to connect this to another table where I have the same vendor number along with the vendor name. So far so good.
For another operation I needed the vendor number (and name) not to only appear on one line, but on all invoice lines. I managed to write the script (with a left join) in such a way that I now have an original field with the vendor number on the lines where they originally appeared, and a second field where the vendor number is filled in for all lines. I also duplicated the vendor number field in the second table and gave it the same name as the field that is filled in for all lines. However, in QlikView the connection is still not made and the vendor name only appears on the lines of the original field. If I could create a new field that with vendor name that connects on all lines that would be great. Below are a few images to illustrate:
Script from my original table:
TempHeaderItemSAP:
LOAD
BELNR & BUKRS & GJAHR as %DocKey,
BELNR,
BUKRS,
BUZEI,
DMBTR,
GJAHR,
KOSTL,
KSTAR,
LIFNR,
MANDT,
MWSTS,
POSID,
Left(POSID,6) as project_code,
PRCTR,
SGTXT,
SHKZG
FROM
WHERE GJAHR > 2010 AND MANDT = 101;
Left Join
Load
%DocKey,
LIFNR as LIFNR2
Resident TempHeaderItemSAP
Where Len(Trim(LIFNR)) >0;
Script second table:
VendorTableSAP:
LOAD LAND1,
LIFNR,
LIFNR2,
NAME1
FROM
This is what the second table QVD looks like:
But as you can see from my details section, the connections are still not made between LIFNR2 and NAME1. What I really would like is a second name field (the first NAME1 to remain with only those lines, and the second to be filled in for all lines). Is this something someone can explain to me? I am not really sure what is going on.
I am also attaching the script if that is relevant for anyone.
Okay, if you just needs the name on all lines, you should just make the connection from the FACT to Vendor Dimension is made using only field LIFNR2.
You can do that easily by commenting/removing the field LIFNR from the fact table.
try
LOAD LAND1,
LIFNR,
trim(LIFNR2) as LIFNR2,,
NAME1
FROM
Hi Espen,
In order to differentiate between when displaying Name on 1 or all lines, you'll need two Vendor dimensions.
1. Vendor dimension displays name on all lines. Key field is LIFNR2. Use current dimension
2. Vendor dimensions displays name on only 1 line. Key field should be LIFNR. Load that dimension by
LOAD LAND1 AS LAND2,
LIFNR,
NAME1 AS NAME2
Resident VendorTableSAP;
The problem is that the key between FACT and Vendordimension is currently combination of LIFNR and LIFNR2
Hi,
No that still looked the same. And what I really need is a Name2 field that is filled in for all lines.
Will check if that works now.
Hi Jens,
Where do I put that Load Statement? Do mean in my Fact table? And then I would need my VendorTableSAP to be earlier in the code than the Fact table, right?
use trim on the both the keys
Left Join
Load
%DocKey,
Trim(LIFNR) as LIFNR2
Resident TempHeaderItemSAP
Where Len(Trim(LIFNR)) >0;
Okay, if you just needs the name on all lines, you should just make the connection from the FACT to Vendor Dimension is made using only field LIFNR2.
You can do that easily by commenting/removing the field LIFNR from the fact table.
The load should be at the end after the first Vendor dimension is loaded.
Hi Jens,
That was really helpful!
I have now managed it by loading the table again, this time just including LIFNR2 and renaming NAME1 as NAME2. That way I have both LIFNR, LIFNR2, NAME1, NAME2.
LOAD LIFNR2,
NAME1 as NAME2
FROM