機械翻訳について

属性間の関係の検証

販売オーダーに販売先顧客と出荷先顧客との間の関係、および販売先顧客と請求先顧客との間の関係が含まれるようにするオーダー管理拡張を作成します。

販売オーダーの送信時にこれらの関係のいずれかが存在しない場合は、拡張によって販売オーダーの続行が停止され、エラー・メッセージが表示されます。

このトピックではサンプル値を使用します。 ビジネス要件によっては、別の値が必要になる場合があります。

  1. 「設定および保守」作業領域で、タスクに移動します。

    • オファリング: オーダー管理

    • 機能領域: オーダー

    • タスク: オーダー管理拡張の管理

  2. 「オーダー管理拡張の管理」ページの「発行リクエスト」の開始時タブで、新しい拡張を作成します。

    属性

    名前

    属性間の関係の検証

    説明

    販売先顧客と出荷先顧客、および販売先顧客と請求先顧客との間に関係が存在することを確認してください。 これらの関係のいずれかが存在しない場合は、エラーを作成し、販売オーダーの続行を停止します。

  3. 定義領域で、コードを追加します。

    //import classes for validation exceptions and messages from Oracle Trading Community Architecture.
    import oracle.apps.scm.doo.common.extensions.ValidationException;
    import oracle.apps.scom.doo.comm.extensions.Message;
    
    // Make sure the extension runs only for your test sales order. If more than one developer uses your test environment, then this condition makes sure the code updates only your sales order. You must remove this condition in a production environment.
    def poNumber = header.getAttribute("CustomerPONumber" );
    if(poNumber == null) return;
    if( !poNumber.startsWith("MatchRelationship") ) return;
    boolean relationExists=false;
    
    //define the variables you will use to store the identifiers.
    def soldTo = header.getAttribute("BuyingPartyIdentifier")
    def billTo = header.getAttribute("BillToCustomerIdentifier")
    
    //if the relationship exists, then further validation is not necessary, so save the sales order, and then exit.
    if (header.getAttribute("BuyingPartyName")==header.getAttribute("BillToCustomerName"))
      relationExists=true;
    
    //determine what relationship currently exists between the bill-to customer and the sold-to customer.
    //reference the view object that stores the relationship. In this example, the CustomerAccountRelationship view object stores this relationship.
    def CustPVO = context.getViewObject("oracle.apps.cdm.foundation.parties.publicView.customerAccounts.CustomerAccountRelationshipPVO");
    
    //create the view criteria. 
    def vc = CustPVO.createViewCriteria();
    def vcrow = vc.createViewCriteriaRow();
    //RelatedCustAccountId is an attribute that stores the sold-to relationship, so you set vcrow to reference RelatedCustAccountId. You will examine it to determine whether the sold-to customer is related to the bill-to customer.
    vcrow.setAttribute("RelatedCustAccountId", soldTo);
    //Query the view object according to the criteria that you set in the previous line of code.
    def rowSet = CustPVO.findByViewCriteria(vc, -1);
    
    //Read through the row set. If a row exists that contains a relationship, then you have determined that a relationship exists between sold-to and bill-to, so save the sales order, and then exit.
    while (rowSet.hasNext()) {
      def row = rowSet.next();
      def billtorelation=row.getAttribute("CustAccountId")
      if (billtorelation == billTo)
      {
        relationExists=true;
      }
    }
    //Create an exception when a relationship does not exist and display an error message.
    //header.setAttribute("ShippingInstructions", header.getAttribute("ShippingInstructions") + ", " relationExists)
    
    if( !relationExists) {
    throw new ValidationException("The order submit failed because the bill-to customer is not related to the sold-to customer.");
    }
    

    この例は、開発環境でのデモンストレーションのみを目的としています。 英語のオーダー管理作業領域に表示するメッセージをThe order submit failed because the bill-to customer is not related to the sold-to customerとしてハード・コーディングします。 他の言語への翻訳の問題を回避するために、メッセージを本番環境でコーディングしないでください。

    かわりに、メッセージング・フレームワークからのメッセージを参照するために使用できるコードを次に示します。

    throw new ValidationException("lookup_code", "message name", token_values);

    説明

    • lookup_codeは、オーダー管理作業領域でメッセージを表示する場所と方法を決定します。 たとえば、参照コードに従って、複数の参照コードを参照して、オーダー管理作業領域のインフォレットの異なる円スライスにメッセージを表示できます。

    • 「メッセージ名」は、メッセージング・フレームワークに存在するメッセージの名前を識別します。

    • token_valuesは、メッセージに含まれるトークンで使用する値のリストを指定します。 メッセージにトークンが含まれていない場合は、nullを使用します。

    たとえば、FOM_CMN_INV_BILL_TOメッセージの内容を表示するコードを次に示します。

    throw new ValidationException("ORA_MANAGE_EXTENSIONS", "FOM_CMN_INV_BILL_TO", null);

    ValidationExceptionメソッドでlookup_codeを使用する方法について学習します。 詳細は、「Order Managementの拡張機能で使用できるメソッド」を参照してください。

設定のテスト

  1. オーダー管理作業領域にナビゲートし、新しい販売オーダーを作成し、「送信」をクリックします。

    属性

    Customer

    Computer Service and Rentals

    請求先顧客

    株式会社ビジネス・ワールド。

    購買オーダー

    ValidateRelationshipsBetweenAttributes _run_extension

  2. エラー・ダイアログにコーディングしたメッセージが表示されることを確認します。

    Computer Service and Rentalsは販売先顧客で、Business World Incは請求先顧客で、一致しないため、オーダー管理はエラーを表示します。

  3. 値を設定し、「送信」をクリックします。

    属性

    請求先顧客

    Computer Service and Rentals

  4. オーダー管理によって販売オーダーが発行され、ステータスが処理中に設定されていることを確認します。

    Computer Service and Rentalsは、販売先顧客と請求先顧客が一致するため、オーダー管理によって販売オーダーが処理されます。