删除源中不存在的行;逐行选择

主页 » SAP文库 » DS

作者 Rajan Burad 2017-09-20    641

 

  大家好,  

 

  如果客户要求在一天内删除所有目标记录但不存在的记录,或者客户要求从目标中删除至少一条记录并保留剩余记录,会怎样?所以为了实现这个BODS提供了一个称为表比较及其特征的转换            从比较表中检测已删除的行          在实现这一任务方面很方便。  

 

  让我们看看如何!  

 

  考虑我的下面的来源,目标和映射来实现数据加载。  

 

  资源:  

 

    

 

  制图:  

 

    

 

    

 

    

 

  目标:  

 

    

 

  从现在开始,目标表具有存在于源中的所有记录,这意味着存在同步。  

 

      现在如果记录存在目标但不存在于来源中呢?     

 

  看看新的来源,映射和目标:  

 

  资源:  

 

    

 

  制图:  

 

    

 

  目标:  

 

    

 

  EMP_ID 1010存在于目标中,但不在源中。 L现在我的第一个要求是放弃最新的记录,但保留其余部分。所以我运行这个工作。  

 

      注意:请在试验期间忽略更新部分,更新标志可能会创建烟雾和镜像。     

 

  正如你可以看到EMP_ID = 1010的最新记录和S_No = 5变换生成一个删除。  

 

  对于1010,生成的键列的最大值为5.因此,应删除此行并保留所有记录。  

 

  所以我的最终目标是:  

 

    

 

  现在如果我想保持源和目标之间的同步,该怎么办?由于emp_id 1010的记录在源文件中不存在,但是存在于目标文件中,因此我想从目标文件中删除这些标识。  

 

  资源:  

 

    

 

  映射:检查检测所有行选项。  

 

    

 

 

 

  执行前的目标:  

 

    

 

  现在我执行这项工作。对于目标中存在但源中不存在的所有副本,转换会生成Delete'D'标志。  

 

    

 

  因此,我的最终表格记录是:  

 

    

 

  目标记录现在完全与源同步。  


 英文原文


Hello All,

What if on one fine day client asks to remove all the records which are present in target but not present in source or may be clients asks to remove at least one record from target and preserve the remaining? So to achieve this BODS provides a transform called Table Comparison and its feature     Detect Deleted Rows from comparison table      comes handy in achieving this task.

Let’s see how!

Consider my below source, targets and mapping to achieve the data load.

Source:

Mapping:

Target:

As of now Target table has all the records which are present in source which means synchronization is there.

  Now what if the records are present in target but not present in source?  

Have a look at the new source, mapping and target:

Source:

Mapping:

Target:

EMP_ID 1010 exists in target but isn’t in source. L Now my first requirement is to discard the latest record but keep the rest. So I run the job.

  NOTE: Kindly ignore the update part as during experimenting the Update flags might create smoke and mirrors.  

As you can see for the latest record with EMP_ID = 1010 and S_No = 5 transform generates a delete.

For 1010 the generated key column has highest value as 5. So this row should be deleted and rest all records should be preserved.

So my final target becomes:

Now what if I want to maintain sync between source and target. Since record with emp_id 1010 is absent in source but present in target so I want to remove those id’s from target as well.

Source:

Mapping: Checking Detect all rows option.


Target before execution:

Now I execute the job. For all the duplicates present in target but not present in source the transform generates Delete ‘D’ flag.

Hence my final table records are:

Target records are now completely in sync with source.

Hope it helps!

Please let me know if I’ve missed anything.

Thanks. 🙂


本文原始地址:http://sapdoc.cn/sap/theme/939.html

转载请注明出处来自 SAP文库

上一篇

AA固定资产|概述

下一篇

查找您的SAP PI/PO系统中发生了哪些变化