Order Management

Get Involved. Join the Conversation.

Topic

    Anuj Mawadikar
    Default order type on Sales Order based on Customer DFF
    Topic posted August 30, 2019 by Anuj MawadikarRed Ribbon: 250+ Points, last edited September 18, 2019, tagged Order Management, Supply Chain Orchestration 
    79 Views, 2 Comments
    Title:
    Default order type on Sales Order based on Customer DFF
    Summary:
    How to default order type on a SO based on a DFF at customer level
    Content:

    Oracle Gurus,

     

    We have a particular order type associated with a particular customer.

    Opened a DFF on Customer to capture the order type to be associated.

    How can I default this order type at customer level to the Order Type field on a Sales Order?

     

    -The requirement is to default the order type on a Sales Order based on the customer selected. is

    How To: Default Legal Entity on Sales Order based on Order Type (Doc ID 2358545.1) is closely related but not exactly same as our requirement.

     

    Thanks,

    Anuj

    Comment

     

    • Shyam Singh Patel

      Hi Anuj,

      This is only possible through OM Extension. take the help of a groovy expert. EFF to EFF Works 100% but Seeded to Seeded not sure as it didn't work sometimes
      Public View Objects in Oracle Applications Cloud (Doc ID 2386411.1) 

      Regards
      Shyam 

    • Venkatesh Malapati

      Following is a sample extensions where it reads attributes from a customer acct site DFF's and updates various attributes on the order. Please note this code needs to be changed as per the specific DFF setups and it is a just sample code and it won't work exactly as the DFF setup may be different in your environment. Please also  refer to the Order Management Extensions White paper - Defining Extensions That Modify Order Management Cloud (Doc ID 2252683.1) for more details.

      Please note that the customer Master don't support EFF's and instead supports DFF's. Please also note the customer & ship to are party & party sites in TCA and bill to is a customer account & acct site.

      For the party PVO, you can use /oracle/apps/cdm/foundation/parties/publicView/analytics/CustomerPVO.xml or oracle/apps/cdm/foundation/parties/publicView/core/PartyPVO.xml.

      For party sites, you can use /oracle/apps/cdm/foundation/parties/publicView/core/PartySitePVO.xml.

      For the DFF's support for party layer, it looks like TCA has DFF's only on the party profile & party site. Please use setup tasks, Manage Trading Community Organization Descriptive Flexfields & Manage Trading Community Organization Site Descriptive Flexfields for those DFFs.

      For the various DFF VO names, you need to download the flexfield archive as shown in the attached document from the flexfield setup actions corresponding to whichever flexfield you want to use and then introspect the zip and look within the publicflex directory of zip to find out the name of the DFF VO's to use and replace in the below code.

      import oracle.apps.scm.doo.common.extensions.ValidationException;

      String customerPONumber = header.getAttribute("CustomerPONumber");

      if(customerPONumber != "AccountSiteDFFTest") return;

      // get the bill to site use id. from that we will get the bill to site id using TCA PVO
      Long billToCustomerSiteUseId = header.getAttribute("BillToCustomerSiteIdentifier");

      // use TCA PVO to get site id by querying by site use id
      def siteUsePVO = context.getViewObject("oracle.apps.cdm.foundation.parties.publicView.customerAccounts.CustomerAccountSiteUsePVO");
      String[] paramNames = ["BindSiteUseId"];
      Object[] paramValues = [billToCustomerSiteUseId];

      def siteUses = siteUsePVO.findByViewCriteriaWithBindVars("ValidateSiteUseId", 1, paramNames, paramValues);
      // we are assuming that we will have atleast one row. So we are skipping a hasNext check.
      def siteUse = siteUses.next();

      Long siteId = siteUse.getAttribute("CustAcctSiteId");

      // we are writing the site id in packing instructions attribute
      header.setAttribute("PackingInstructions", "SiteId: " + siteId);

      // now let's find the DFF for the site
      def itemPVO = context.getViewObject("oracle.apps.cdm.foundation.parties.publicFlex.custAccountSite.view.CustAcctSiteInformationVO");

      def vc = itemPVO.createViewCriteria();
      def vcrow = vc.createViewCriteriaRow();
      vcrow.setAttribute("CustAcctSiteId", siteId);
      vc.add(vcrow);

      def rowset = itemPVO.findByViewCriteriaWithBindVars(vc, -1, new String [0], new String [0]);
      def custDFF = rowset.first();

      if( custDFF != null ) {

      String SiteName = custDFF.getAttribute("sitename");

      String values = "SiteName: " + SiteName;

      String SiteNumber = custDFF.getAttribute("sitenumber");

      values = values + "\nSiteNumber: " + SiteNumber;

      String SiteDate = custDFF.getAttribute("sitedate");

      values = values + "\nSiteDate: " + SiteDate;

      String context = custDFF.getAttribute("__FLEX_Context");
      values = values + "\nContext: " + context;

      if( context == "SiteContext1") {
      attr = custDFF.getAttribute("scname");
      // attr2 =custDFF.getAttribute(""omnumber"");
      //attr3 =custDFF.getAttribute(""omdate"");
      values = values + "\nctxsentiveattr1: " + attr;
      // values = values + ""\nctxsentiveattr2:"" + attr2;
      // values = values + ""\nctxsentiveattr3:"" + attr3;
      }

      header.setAttribute("ShippingInstructions", values);

      def complianceDetails = header.getOrCreateContextRow("ComplianceDetails");
      complianceDetails.setAttribute("_ComplianceReason", SiteName);
      complianceDetails.setAttribute("_ComplianceValue", SiteNumber);
      complianceDetails.setAttribute("_ComplianceDate", SiteDate);

      // throw new ValidationException(""Reached end of extension checkDFF, updated values "" + values);
      // header.setAttribute(""Salesperson"", salesPerson);
      }
      else {
      header.setAttribute("ShippingInstructions", "No DFF found");
      }