Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Field not connecting properly

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 (qvd)
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 (qvd);

This is what the second table QVD looks like:

VendorTableQVD.PNG

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.

Details Section.PNG

I am also attaching the script if that is relevant for anyone.

1 Solution

Accepted Solutions
jfkinspari
Partner - Specialist
Partner - Specialist

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.

View solution in original post

12 Replies
sasiparupudi1
Master III
Master III

try

LOAD LAND1,
    
LIFNR,
    trim(
LIFNR2) as LIFNR2,,
    
NAME1
FROM (qvd);

jfkinspari
Partner - Specialist
Partner - Specialist

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

Not applicable
Author

Hi,

No that still looked the same. And what I really need is a Name2 field that is filled in for all lines.

Not applicable
Author

Will check if that works now.

Not applicable
Author

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?

sasiparupudi1
Master III
Master III

use trim on the both the keys

Left Join
Load
%DocKey,
Trim(LIFNR) as LIFNR2
Resident TempHeaderItemSAP
Where Len(Trim(LIFNR)) >0;

jfkinspari
Partner - Specialist
Partner - Specialist

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.

jfkinspari
Partner - Specialist
Partner - Specialist

The load should be at the end after the first Vendor dimension is loaded.

Not applicable
Author

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 (qvd);