Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
maternmi
Creator II
Creator II

Apply map - where is the bug

Hi everybody,

I've tried the first time to use apply map instead of join statement but it is not working as I thought.  The reload works but I don't see in the VBEP table the REQ_Delivery_Date. Do you know where the mistake is?

Here the code

MappingEDDtoVBEP:

 

Mapping Load %VKANRHD%POSHD as %VBELN%UEPOS,

                        ZGS_SCM_MONITOR.EARLIEST_DELIV       

From

  ...Pickup_Reliability\QVDs\ZGS_SCM_MONITOR_01.qvd (qvd)

;     

VBEP:

Load *,

ApplyMap('MappingEDDtoVBEP',%VBELN%UEPOS) as REQ_Delivery_Date

;

Thank you in advance

BR

Michael

 

23 Replies
martinpohl
Partner - Master
Partner - Master

If the applymap always returns "not found" the camparing values seems to to be the same.

load the mappinf table from your first topic with renaming so the tables are in relationship.

Create a listbox with the %VBELN%UEPOS-field

Then you can check if the values are equal or by using one field from the VBEP and the other from your mapping-tables, what are the difference.

Maybe figure of the fields?

SAP is using for example 10 figures for the VBELN

Regards

Colin-Albert

I would suggest adding a table name to your mapping table rather than relying on the default table name.

Also there is no need to alias fields in the mapping table, the field names are irrelevant. The apply map function just scans for a match on column1 returning column2 and does not use column names.

To held find the error, add the mapping data to a qualified test table this will allow you to see if your mapping data is correct.

// test table

qualify * ;

     MappingEDDtoVBEP:

     Load      %VKANRHD%POSHD ,

                        ZGS_SCM_MONITOR.EARLIEST_DELIV       

      From

       ...Pickup_Reliability\QVDs\ZGS_SCM_MONITOR_01.qvd (qvd)

     ;

unqualify * ;

MappingEDDtoVBEP:

Mapping Load %VKANRHD%POSHD ,

                        ZGS_SCM_MONITOR.EARLIEST_DELIV       

From

  ...Pickup_Reliability\QVDs\ZGS_SCM_MONITOR_01.qvd (qvd)

;     

VBEP:

Load *,

ApplyMap('MappingEDDtoVBEP',%VBELN%UEPOS) as REQ_Delivery_Date

...

;

maternmi
Creator II
Creator II
Author

Hi Colin,

that means even the column name of the id is not relevant. Only relevant is that the values of id are in both tables in the first column and are equal... right?

Colin-Albert

Yes, the column names are not used by ApplyMap, a mapping table can only have 2 columns.

Also ApplyMap will only return the first matching value.

So if you mapping table has multiple values for a single ID, only the first match is returned.

If the id value is missing from the mapping table, then you can add a third value as a default

     ApplyMap('mapping_table_name', ID, 'No Match')

maternmi
Creator II
Creator II
Author

mytables.bmp
The values of the id in both columns are equal but you see there are lot of other columns in both tables. So does it mean that apply map is not working here?

BR

salto
Specialist II
Specialist II

Hi,


MappingEDDtoVBEP:

Mapping Load %VKANRHD%POSHD as %VBELN%UEPOS,

                        ZGS_SCM_MONITOR.EARLIEST_DELIV      

From

  ...Pickup_Reliability\QVDs\ZGS_SCM_MONITOR_01.qvd (qvd)

;    

VBEP:

Load *,

ApplyMap('MappingEDDtoVBEP',%VBELN%UEPOS, 'No match') as REQ_Delivery_Date

From [YOUR VBEP TABLE]

;


Hth.

Colin-Albert

When you load the data from ZGS_SCM_MONITOR_01.qvd into your mapping table you are only loading two columns into the mapping table.  (%VKANRHD%POSHD and ZGS_SCM_MONITOR.EARLIEST_DELIV) The other columns in the QVD are not part of the mapping table.

The apply map function will search the MappingEDDtoVBEP table and return the first value of ZGS_SCM_MONITOR.EARLIEST_DELIV (Column2) where %VBELN%UEPOS in VBEP matches %VKANRHD%POSHD (Column1) in the mapping table.

salto
Specialist II
Specialist II

No, the number of columns in both tables is not relevant.

Tha mapping table has always two columns (and is automatically deleted when the script finishes, so you do not need to drop it at the end of the script).

maternmi
Creator II
Creator II
Author

Hi,

I still doesn't works. Anyway, Thanks to all for the support!

BR

Michael

Peter_Cammaert
Partner - Champion III
Partner - Champion III

%VKANRHD%POSHD and %VBELN%UEPOS look like home-grown ID fields. Can you post a screenshot of those two fields presented as listboxes? Mapping Tables are rather picky when it comes to matching values...