Skip to content
Home / Apps / Oracle MSCA/ MWA – Create Custom Page

Oracle MSCA/ MWA – Create Custom Page

Oracle Mobile Supply Chain Applications (MSCA) enables automated mobile user operations. You can receive PO, RMAs, internal requisitions, and in-transit shipments. order picking, labeling, and shipping support for Orders created in Oracle Order Management using hand-held radio frequency (RF) devices and lift truck-mounted RF scanners.

There are already standard oracle MSCA/MWA pages for these operations. What if you want to design a new custom MSCA/MWA page? How to do it?

Let’s see how to create a custom MSCA/MWA summation application.

Basic structure of MSCA Page

An Oracle MSCA application consists of Function, Function class, Page Class, and Listener Class.  A function is basically an AOL in Oracle Apps to point to the respective java page. Function, page, and listener classes are basically java classes that together make the application Work.

In brief,

  • Function  – points to function class which is an entry to the MWA screen.
  • Page class – has all necessary page elements like text bean, lovbean, button, etc.
  • Listener class – hold the entire event logic.

So remember when you want to design a custom MSCA page, you need to create a function class, Page class, and Listener class.

Let’s see that in action.

Create custom application in Oracle MSCA/MWA

Example – Let’s create a sample page that shows two input text boxes and one output text box with sum, clear and cancel buttons. A user enters a value in each text box and the output box should show the result.

As discussed above, you need to create 3 java files function class – BasicMathOperationsFunction.java, page class – BasicMathOperationsPage.java, listener class – BasicMathOperationsListener

1. Creation Function Class

A functions class is a file on which we define functions(AOL setup) in Oracle Apps. It extends OrgFunction class. Set the first page using setFirstPageName method in BasicMathOperationsFunction public method. When the user clicks on a function, the respective page opens.

You can also add appEntered and appExited methods to initialize or clear session information.

package xxc;

import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.inv.utilities.server.OrgFunction;
import oracle.apps.mwa.container.Session;
import oracle.apps.mwa.eventmodel.*;
import oracle.apps.inv.utilities.server.UtilFns;
import java.sql.Connection;
import java.sql.SQLException;

public class BasicMathOperationsFunction extends OrgFunction{

	private boolean mCurAutoCommit;
	Session session;

	public BasicMathOperationsFunction(){
	setFirstPageName("xxc.BasicMathOperationsPage");
	 		addListener(this);
 	}

        public void appEntered(MWAEvent mwaevent)
		 throws AbortHandlerException, InterruptedHandlerException, DefaultOnlyHandlerException
		{
			UtilFns.log("Inside BasicMathOperationsFunction appEntered");
			session = mwaevent.getSession();
			Connection connection = session.getConnection();
			super.appEntered(mwaevent);
			try{
				mCurAutoCommit = connection.getAutoCommit();
				connection.setAutoCommit(false);
				return;

			}catch(SQLException _ex){
				UtilFns.trace(".. Ex.. in BasicMathOperationsFunction.appEntered:" + _ex);
				throw new AbortHandlerException("BasicMathOperationsFunction: AppEntered - cannot set AutoCommit");
			}
	}

	public void appExited(MWAEvent mwaevent)
		throws AbortHandlerException, InterruptedHandlerException, DefaultOnlyHandlerException
		{
			UtilFns.log("Inside BasicMathOperationsFunction appExited");

		}

}

2. Page Class

Page class basically has the GUI/Layout of the mobile form. You can add different elements like text, button using available NumberFieldBean , ButtonFieldBean and supporting method.

package xxc;

import com.sun.java.util.collections.HashMap;
import java.sql.*;
import java.util.Hashtable;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.inv.lov.server.*;
import oracle.apps.inv.utilities.server.UtilFns;
import oracle.apps.inv.utilities.server.NumberFieldBean;
import oracle.apps.mwa.beans.*;
import oracle.apps.mwa.container.MWALib;
import oracle.apps.mwa.container.Session;
import oracle.apps.mwa.eventmodel.*;
import oracle.apps.mwa.presentation.telnet.TelnetSession;
import java.sql.ResultSet;
import java.util.*;

public class BasicMathOperationsPage extends PageBean implements MWAPageListener
{

NumberFieldBean input1;
NumberFieldBean input2;
NumberFieldBean result;

ButtonFieldBean sumBtn;
ButtonFieldBean CancelBtn;
ButtonFieldBean ClearBtn;

Session ses;

public BasicMathOperationsPage(Session session)
           {
			   ses = session;
		UtilFns.trace("Inside BasicMathOperationsPage Constructor");

		initLayout(session);
		addListener(this);
	   }
private void initLayout(Session session)
	{
		UtilFns.trace("Inside BasicMathOperationsPage initLayout");
  		BasicMathOperationsListener BasicMathOperationsPageLstr = new BasicMathOperationsListener(session);

		input1 = new NumberFieldBean(session);
		input1.setName("input1");
		input1.setPrompt("Input 1");
		//input1.setEditable(false);
		input1.addListener(BasicMathOperationsPageLstr);

		input2 = new NumberFieldBean(session);
		input2.setName("input2");
		input2.setPrompt("Input 2");
		//input2.setEditable(false);
		input2.addListener(BasicMathOperationsPageLstr);
		
		result = new NumberFieldBean(session);
		result.setName("result");
		result.setPrompt("Result");
		//result.setEditable(false);
		result.addListener(BasicMathOperationsPageLstr);

		sumBtn = new ButtonFieldBean();
		sumBtn.setName("sumBtn");
		sumBtn.setPrompt("Sum");
		sumBtn.setEnableAcceleratorKey(false);
		sumBtn.addListener(BasicMathOperationsPageLstr);
		
		ClearBtn = new ButtonFieldBean();
		ClearBtn.setName("clear");
		ClearBtn.setPrompt("Clear");
		ClearBtn.setEnableAcceleratorKey(true);
		ClearBtn.addListener(BasicMathOperationsPageLstr);
		
		CancelBtn = new ButtonFieldBean();
		CancelBtn.setName("INV.CANCEL");
		CancelBtn.setEnableAcceleratorKey(true);
		CancelBtn.addListener(BasicMathOperationsPageLstr);

         //below arranging the Layouts
	    addFieldBean(input1);
	    addFieldBean(input2);
		addFieldBean(result);
		addFieldBean(sumBtn);
		addFieldBean(ClearBtn);
	    addFieldBean(CancelBtn);
	        try{
				CancelBtn.setPrompt(MWALib.getAKPrompt(session, "oracle.apps.inv.utilities.InvResourceTable", "INV_CANCEL_PROMPT"));
				CancelBtn.retrieveAttributes("INV_CANCEL_PROMPT");
				}catch(Exception e){
									session.getLogger().println("Exception "+e);
		  						 }
	           }

               public void pageExited(MWAEvent mwaevent)
               throws AbortHandlerException, InterruptedHandlerException, DefaultOnlyHandlerException
	       			{
	   	   				UtilFns.log("Inside BasicMathOperationsPage pageExited");
	       			}
                //for example CTRL-G
	       	   public void specialKeyPressed(MWAEvent mwaevent)
		       throws AbortHandlerException
		    		{
		       			Session session = mwaevent.getSession();
		       			UtilFns.log("** Special Functions : Action :" + mwaevent.getAction());
              	   }
                      
	       public void pageEntered(MWAEvent mwaevent)
	       throws AbortHandlerException, InterruptedHandlerException, DefaultOnlyHandlerException
	       {
	       UtilFns.log("Inside BasicMathOperationsPage Entered");
	       Session session = mwaevent.getSession();
	       session.getConnection();
	      // String s2 = (String)session.getObject("ORGCODE");
	       setPrompt("Basic Math");//to show the heading of page
	       return;
	       }

            public NumberFieldBean getinput1(){
				return input1;
            }

            public NumberFieldBean getinput2(){
		   		return input2;
		    }
			public NumberFieldBean getresult(){
		   		return result;
		    }
		    
	        public ButtonFieldBean getsumBtn(){
					    	return sumBtn;
		    } 
		   public ButtonFieldBean getCancelBtn(){
		   		return CancelBtn;
		    }

}

3. Listener class

The listener class has a method that listens for respective events. It has fieldEntered and fieldExited methods, Here you need to implement the logic for each event and field.

package xxc;
import java.sql.SQLException;
import oracle.apps.fnd.common.VersionInfo;
import java.sql.ResultSet;
import oracle.apps.inv.utilities.server.*;
import oracle.apps.inv.utilities.TrxTypes;
import oracle.apps.mwa.beans.*;
import oracle.apps.mwa.container.*;
import oracle.apps.mwa.eventmodel.*;
import java.sql.*;
import java.util.*;
import oracle.apps.mwa.presentation.telnet.TelnetSession;
import java.text.*;

import java.util.Date;
import java.text.NumberFormat;

public class BasicMathOperationsListener implements MWAFieldListener{
	Session ses;
	private xxc.BasicMathOperationsPage mCurrPg;

	Connection mConn;
	Vector vector = new Vector();
    Vector iterator;

	public BasicMathOperationsListener(Session session){
		session.getLogger().println("Listener------------->Step 3.2");
		ses = session;
		mConn = ses.getConnection();
	
	}

	public void fieldEntered(MWAEvent mwaevent){
		UtilFns.trace("Inside BasicMathOperationsListener fieldEntered");
		try{
				ses = mwaevent.getSession();
				String s = UtilFns.fieldEnterSource(ses);
				UtilFns.trace("GnrcLst: FieldEntered :" + s);

				if(mCurrPg == null)
					mCurrPg = (BasicMathOperationsPage)ses.getCurrentPage();

				UtilFns.trace(s+" @@@@@ BasicMathOperationsListener @@@@@ "+mwaevent.getAction());
			
			}catch(Exception e){
				}
	}

	public void fieldExited(MWAEvent mwaevent)
		throws AbortHandlerException,InterruptedHandlerException, DefaultOnlyHandlerException{

			try{

					if(UtilFns.isTraceOn)
						UtilFns.trace("BasicMathOperationsListener - fieldExited");
					if(mCurrPg == null)
						mCurrPg = (BasicMathOperationsPage)ses.getCurrentPage();
					String s = ((FieldBean)mwaevent.getSource()).getName();
					UtilFns.trace("event s= " + s);
					
					if(mwaevent.getAction().equals("MWA_SUBMIT")){
					if(s.equals("sumBtn")){
				        sumBtnExited(mwaevent);
				         return;
				     }
					 if(s.equals("clear")){
				        ClearBtnExited(mwaevent);
				         return;
				     } 
				
					if(s.equals("INV.CANCEL")){
				        cancelBaseExited(mwaevent);
				         return;
				     }
					}

			}catch(Exception exception){
				UtilFns.trace("Error in BasicMathOperationsListener: fieldExited" + exception);
			}
}

    protected void sumBtnExited(MWAEvent mwaevent)
	throws AbortHandlerException, InterruptedHandlerException, DefaultOnlyHandlerException{
       UtilFns.trace("Entered BasicMathOperationsListener: sumBtnExited");
		
		long N1 = 0;
		long N2 = 0;
		 N1 = Long.valueOf(mCurrPg.getinput1().getValue()).longValue();
		 N2 = Long.valueOf(mCurrPg.getinput2().getValue()).longValue();
		UtilFns.trace("N1"+N1);
		UtilFns.trace("N2"+N2);
		long SumQty = N1+N2;
		mCurrPg.getresult().setValue(String.valueOf(SumQty));
		UtilFns.trace("SumQty"+SumQty);
		}
			
		protected void ClearBtnExited(MWAEvent mwaevent)
	    throws AbortHandlerException, InterruptedHandlerException, DefaultOnlyHandlerException{
        UtilFns.trace("Entered BasicMathOperationsListener: clearBtnExited");
		mCurrPg.getinput1().setValue("");
		mCurrPg.getinput2().setValue("");
		mCurrPg.getresult().setValue("");
		
		}

	protected void cancelBaseExited(MWAEvent mwaevent)
	throws AbortHandlerException, InterruptedHandlerException, DefaultOnlyHandlerException{

		mCurrPg.getCancelBtn().setNextPageName("|END_OF_TRANSACTION|");

		}
}

4. FTP and compile the java files

Copy this .java files to respective custom top and compile using javac to generate respective java class file.

javac BasicMathOperationsFunction.java

javac BasicMathOperationsPage.java

javac BasicMathOperationsListener.java

 

5. Define function (AOL setup) in Oracle Apps

Next, you have to do AOL setup.

Login to Oracle Application and define the function pointing to the function class as shown below.

Form Function Description

Define forms function for MSCA page

 

Form Function Properties

Define MSCA for function properties

 

Form

define MSCA for in Oracle Apps

 

Web HTML

Define MSCA web html

And add that function to the respective responsibility.

Just log in to the mobile server using telnet, zoc to check to work.

My Video

Summary

Creating a custom MSCA/MWA page may sound difficult in the first place, but it is actually very easy. You just need to understand the basic application flow. You can always refer oracle standard java classes for any methods