Siebel Connector for SAP R/3 > Creating Integration Touch Points >

Sample Business Services


///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 1999, Siebel Systems, Inc., All rights reserved.
//
// $Revision: 4 $
// $Date: 12/10/99 10:29a $
// $Author: Achaudhr $ of last update
//
// CREATOR: P. Lim
//
// DESCRIPTION
// Javascript maps from Siebel Order to SAP entities
//
///////////////////////////////////////////////////////////////////////////////

#include "eaisiebel.js"
/* This function shared by "Simulate Order" and "Create Order" */

function GetSAPMaterialATP_BAPIToSiebel (inputMsg, outputMsg)
{
   /*
   * Set up EAI Input Message objects
   */
   var iGSProductObj; // BAPI Product instance
   var iGSExportComp; // BAPI Export Parameters

   // Store inputId to be denormalized to all RFC table rows
   var inputId = inputMsg.GetArgument ("Product Id");

   /*
   * Set up EAI Output Message objects
   */
   var oProductObj; // Siebel Productinstance
   var oProductComp; // Product

   var oGSOutputComp; // Create Output

   /*
   * Find and create top-level integration object
   */
   iGSProductObj = inputMsg.GetIntObj("BAPI_MATERIAL_AVAILABILITY (Output)");
   oProductObj = outputMsg.CreateIntObj ("Product - Get SAP Material (Siebel)");

   /*
   * Read int object instances from EAI message
   */

   while (iGSProductObj.NextInstance ())
   {
   /*
   * Create "Product" object in output message
   */
   oProductObj.NewInstance ();

   /*
   * Create "Product" component
   */
   oProductComp = oProductObj.CreatePrimaryIntComp ("Product");

   /*
   * Read "Export Parameters" component
   */
   iGSExportComp = iGSProductObj.GetPrimaryIntComp ("Export Parameters");

   /*
   * Create the output component.
   *
   */
   if (iGSExportComp.NextRecord())
      {
      /*
      * Write "Create Output" component
      */
      oProductComp.NewRecord ();
      oProductComp.SetCopySource (iGSExportComp);
      oProductComp.SetFieldValue ("Id", inputId);
      oProductComp.CopyFieldValue ("Stock Level", "AV_QTY_PLT");

      }

   }

}

Siebel Connector for SAP R/3