拡張可能フレックスフィールドの拡張
拡張可能フレックスフィールドを含むオーダー管理拡張を、デプロイメントをカスタマイズするための便利で強力な方法として使用します。
拡張可能フレックスフィールドへのアクセスおよび更新
任意の拡張ポイントを使用して、オーダー・ヘッダーまたはオーダー明細にある拡張可能フレックスフィールドにアクセスまたは更新できます。 フレックスフィールド・セグメントにアクセスするために、拡張によってフレックスフィールド・コンテキストの行が作成されます。 その後、getAttributeメソッドおよびsetAttributeメソッドを使用して、セグメントの読取りおよび書込みを行うことができます。詳細は、「Order Managementの拡張機能を使用した拡張可能フレックスフィールドからの値の取得」を参照してください。
拡張可能フレックスフィールドの値に従って処理を実行
import oracle.apps.scm.doo.common.extensions.ValidationException;
def poNumber = header.getAttribute("CustomerPONumber");
if(poNumber != null && poNumber.equals("test") ) {
def lines = header.getAttribute("Lines");
while( lines.hasNext() ) {
def line = lines.next();
def context = line.getContextRow("VS_Context");
def effVal = context != null ? context.getAttribute("eligibleforprime") : null;
if("Y".equals(effVal)) {
line.setAttribute("OrderedQuantity",0);
}
}
}
コンテキストが存在せず、作成する場合は、getContextRowのかわりにgetOrCreateContextRowを使用します。 getOrCreateContextRowを使用する場合は、setAttributeを使用して、getAttributeではなくコンテキストに属性の値を設定する必要があります。 たとえば:
import oracle.apps.scm.doo.common.extensions.ValidationException;
def poNumber = header.getAttribute("CustomerPONumber");
if(poNumber != null && poNumber.equals("test") ) {
def lines = header.getAttribute("Lines");
while( lines.hasNext() ) {
def line = lines.next();
def context = line.getOrCreateContextRow("VS_Context");
def effVal = context != null ? context.setAttribute("eligibleforprime") : null;
if("Y".equals(effVal)) {
line.setAttribute("OrderedQuantity",0);
}
}
}
拡張可能フレックスフィールド値をデータ値にコピー
import oracle.apps.scm.doo.common.extensions.ValidationException;
def poNumber = header.getAttribute("CustomerPONumber");
if(poNumber != null && poNumber.equals("TEST_CO2") ){
def docRefs = header.getAttribute("DocumentReferences");
if (!docRefs.hasNext()){
throw new ValidationException("We need more time to get the document reference.");
}
while(docRefs.hasNext()) {
def docRef = docRefs.next();
String docRefType = docRef.getAttribute("DocumentReferenceType");
if(!'COPY_REF_ORDER'.equals(docRefType))continue;
def cntxRow = header.getOrCreateContextRow("HeaderContext1");
cntxRow.setAttribute("_H1AttributeChar2",docRef.getAttribute("DocumentNumber"));
}
}
出荷先所在地の更新
この例では、出荷先住所を更新します。 顧客関係タイプが単一の場合は、拡張可能フレックスフィールドの値に従って出荷先住所の値を設定します。
import oracle.apps.scm.doo.common.extensions.ValidationException;
import oracle.apps.scm.doo.common.extensions.Message;
List < Message > messages = new ArrayList < Message > ();
def po = header.getAttribute("CustomerPONumber");
//Condition that specifies when to call the extension. You can can also use an extensible flexfield on the order header.
if (!"TEST_MDF".equals(po))
return;
def line2AddrMap = [: ];
def lines = header.getAttribute("Lines");
if (!lines.hasNext()) {
throw new ValidationException("Order Management hasn't saved the order line details. Save the sales order, then try again.");
}
while (lines.hasNext()) {
def line = lines.next();
def lineNo = line.getAttribute("DisplayLineNumber");
line2AddrMap.put(lineNo, line.getAttribute("ShipToPartySiteIdentifier"));
}
lines.reset();
while (lines.hasNext()) {
def line = lines.next();
def context = line.getContextRow("FulfillLineContext1"); //Add your own extensible flexfield context that identifies the address for the ship-to line that you must copy.
def copyFromLineNo = context != null ? context.getAttribute("_FL1AttributeChar1") : null; //Update this value with the display line number of the source line.
if (copyFromLineNo != null && !copyFromLineNo.isEmpty()) {
line.setAttribute("ShipToPartySiteIdentifier", line2AddrMap.get(copyFromLineNo));
}
}
if (!messages.isEmpty()) {
ValidationException ex = new ValidationException(messages);
throw ex;
}
その他
トピック | 説明 |
---|---|
拡張機能を使用したOracle Applicationsからのデータの取得 | コンテキスト・セグメントの値を設定します。 |
オーダーの発行日の更新 | 拡張可能フレックスフィールドを使用して、オーダー発行日を更新します。 |
拡張機能を使用したオーダー明細の取消 | 拡張可能フレックスフィールドを使用して、販売オーダーのオーダー明細を取り消します。 |
「返品オーダーの延長」の元の販売オーダーからの拡張可能フレックスフィールドの取得サブトピックを参照してください。 | 元のオーダーのオーダー明細から拡張可能フレックスフィールドを取得し、それを返品オーダー明細にコピー |
オーダー・ヘッダーの拡張 |
次のサブトピックを参照してください:
|
返品オーダーの延長 |
元のオーダーからRMAサブトピックへの拡張可能フレックスフィールドのコピーを参照してください。 元のオーダーから返品承認(RMA)を含む返品オーダーに拡張可能フレックスフィールド・データをコピーします。 |