首页 > 解决方案 > 12.1.3. OAF。如何加入以编程方式填充的 2 个视图对象?

问题描述

我有 2 个以编程方式填充的视图对象,即该对象在查询语句区域中没有 SQL 查询。有 HeaderVO 和 LinesVO。我的任务是在高级表中显示高级表。而这个基于 HeaderVO 和 LinesVO 的高级表格。如果我使用 View Link 而不是 HeaderVO 表显示数据,但 LinesVO 表仅显示“未进行搜索”。这是合乎逻辑的,我明白为什么会这样。

在此处输入图像描述

但是我怎样才能连接这 2 个表(视图对象)?

标签: oracleoracle-ebsoaf

解决方案


由于 VO 以编程方式填充,您可以尝试通过在这些 VO 之间创建 View Link 也以编程方式进行。您可以使用以下方法进行相同的操作:

假设 Master VO 为 deptVO,Detail VO 为 empVO。

  // Build an attribute array, consisting of deptVO.DeptNum for Master VO
  AttributeDef[] deptAttrs = new AttributeDef[1];
  deptAttrs[0] = deptVO.findAttributeDef("DeptNum");

  // Build an attribute array, consisting of empVO.DeptNum for Detail VO
  AttributeDef[] empAttrs = new Attributedef[1];
  empAttrs[0] = empVO.findAttributeDef("DeptNum");

  ViewLink vl = myAM.createViewLinkBetweenViewObjects("yourVLName",
  "VLAccessor", //accessor name
  deptVO, //master VO
  deptAttrs, //master VO attribute
  empVO, //detail VO
  empAttrs, //detail VO attribute
  null); //association clause

推荐阅读