ユーザーが入力したデータの検証
オーダー入力スペシャリストが購買オーダー属性に入力する購買オーダー番号に対して購買オーダーが存在するかどうかを決定する、オーダー管理拡張を作成します。
パブリック・ビュー・オブジェクトを呼び出して、Oracle Procurementからデータを取得します。
デモンストレーションを目的として、この例では、HW INTERNALなどの値をハード・コードしています。 実際の環境では、異なる変数値が必要になる場合があります。
このトピックではサンプル値を使用します。 ビジネス要件に応じて、異なる値が必要になる場合があります:
-
「Setup and Maintenance(設定および保守)」作業領域に移動し、「Manage Order Management Extensions(オーダー管理拡張の管理)」タスクに移動します。
-
「Manage Order Management Extensions(≪Order Management拡張の管理|Crm≫)」ページの「On Start of Submission Request(≪送信要求の開始時|Crm≫)」タブで、新しい拡張を作成します。
属性
値
名前
購買オーダーの存在の確認
説明
オーダー入力スペシャリストが購買オーダー属性に入力する購買オーダー番号に対して購買オーダーが存在するかどうかを決定します。
-
定義領域で、コードを追加します。
//Import classes for validation exceptions and messages from Oracle Trading Community Architecture. import oracle.apps.scm.doo.common.extensions.ValidationException; def orderType = header.getAttribute("TransactionTypeCode"); //Determine whether the sales order is internal. if(orderType != null && orderType.contains("HW INTERNAL")) { //Determine whether the purchase order exists. String poNumber = header.getAttribute("CustomerPONumber"); boolean poExists = false; if( poNumber != null ) { //Get the PVO you need to access purchase orders. def poPVO = context.getViewObject("oracle.apps.prc.po.publicView.PurchasingDocumentHeaderPVO"); //Create the view criteria. Use where clause predicates. def vc = poPVO.createViewCriteria(); def vcrow = vc.createViewCriteriaRow(); vcrow.setAttribute("Segment1", poNumber); //Query the view object to find a matching row. def rowset = poPVO.findByViewCriteriaWithBindVars(vc, 1, new String [0], new String [0]); //Determine whether a matching row exists. poExists = rowset.hasNext(); } //If a matching row does not exist, then the purchase order that you entered does not exist. Create a validation error and stop the sales order submit. if( !poExists ) { throw new ValidationException("ORA_MANAGE_EXTENSIONS", "DOO_EXT_HW_INTERNAL_PO_REQD", null); } }