Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Applymap missmatch ?

Dear Sirs,

I have coding in the script below.

mapKUND:Mapping LOAD %LIFNR,
    
text(replace(ltrim(replace(KNVP.KUNNR, '0', ' ')), ' ', 0)) as KNVP.KUNNR FROM
[..\..\..\..\Source Data\QVD\SAP\EMB\Marknad\SPEDITÖR_202_KNVP.QVD]
(
qvd);



Speditör:LOAD %LIFNR,
    
LFA1.Namn_SP,
    
applymap('mapKUND',%LIFNR) AS [KUNNR]
     FROM$(QVD_Path_SD_EMB)Speditör_202_LFA1.QVD
(
qvd);

The result in the table is:

%LIFNR          LFA1.Namn_SP     KUNNR

0001043199      Schenker          0001043199

The result I really want is that KUNNR should display value from KNVP.KUNNR = Customer number in order.

Could anyone please help me?

Regards Magnus

3 Replies
SunilChauhan
Champion
Champion

your code looks right to me.

please check result of below code

text(replace(ltrim(replace(KNVP.KUNNR, '0', ' ')), ' ', 0)) as KNVP.KUNNR

weither its calculating correct

the result depend on the above calculaton.

or you can share sample file

hope this help

Sunil Chauhan
clisboa_noesis
Partner - Creator
Partner - Creator

Hi Magnus,

It looks like that the %LIFNR don't have the same format or something.

I say this because the KUNNR get's the %LIFNR when there's no match and you don't have a default expression on the applymap.

You should always use a default expression (even null() is more usefull than nothing).

My advice is load the mapping table without the mapping to check what

text(replace(ltrim(replace(KNVP.KUNNR, '0', ' ')), ' ', 0))

is returning and if %LIFNR have the same format.

Regards,

Carlos

Not applicable
Author

Hi Carlos,

Sorry for the late reply. You where correct.  I needed to ad the same trim function as KUNNR in order to trim the leading zeros.

text

(replace(ltrim(replace(%LIFNR, '0', ' ')), ' ', 0)) as [%LIFNR]

Regards Magnus