Group Discounts available for 3+ students and Corporate Clients

How to display User Name, User Id and Responsibility id

In this lesson, we are going to learn how to display Oracle Applications User Name, User Id, Responsibility Name and Responsibility Id.

We will see little bit java programming too in this chapter.

Steps to follow:

  1. Create a page first, see the chapter Welcome Page Creation to see how to create a page.
  2. Create the region and four items in the region, we can see the creation process of Regions and Items in the Previous Chapter.
  3. Create the controller and write the Java Code.

Here I am taking the page which is already created and adding a region with region style as ” message Component Layout “.

After adding Region under region here, we are creating four items and Item style of all the four items is “ message Text Input ”.

After adding Region and Items, the page structure will look like:

82

Now change the prompt values for each item as follows:

(if you want to know how to change the prompt values in the Property Inspector see the Previous Chapter which shows how to change the prompt value)

Prompt 

item1  -> User ID

item2  -> User Name

item3  -> Responsibility ID

item4  -> Responsibility Name

The below picture shows how the output structure looks like after running the page, just have a look into it

83

Now we need to create a Controller, let us see how to create a controller in JDeveloper (OAF).

Best practice is to create the controller Globally so that it should be applicable to all the child regions.

Right Click on the Main Region and then select Set New Controller…

84

After choosing Set New Controller, one dialog box window opens, and it shows some default package and also some default name, in Package name at last we will find  ”.webui.webui” change it to single webui i.e, nothing but remove one WebUI from the default package name, for example, assume the default package is as follows:

newtonapples.oracle.apps.po.welcomeprj.webui.webui

change it to

newtonapples.oracle.apps.po.welcomeprj.webui

If you want to know why webui is there at the end means you can see the BC4J file Structure lesson which displays the file structures.

give the class name, and we know that every controller ends with CO. For example, give the controller name as WelcomeCO as shown below:

85

Click on OK button after giving Class Name and also after deleting one WebUI from the package. Now if you observe Applications Navigator structure controller is created under webui. Select the controller (WelcomeCO.java) and see the java program how it looks.

In the java program, WelcomeCO class is created which is extending OAControllerImpl which contains the main method.

We can also see two methods namely

1) public void processRequest(OAPageContext pageContext, OAWebBean webBean)

The above method is used whenever we want any logic to be implemented before the page gets loaded. It means while loading a page if we want to display (or) perform any business logic then we go for processRequest.

2) public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)

This method is used if we want any changes to be made once after the page gets loaded, i.e, After the page is loaded suppose after clicking on a particular button if we want to display the result into another item or after clicking on the button if we want to go to another page.

As of now, our requirement is to display the User ID, User Name, Responsibility ID, Responsibility Name whenever page gets loaded all the fields automatically to be displayed in the respective items. So, therefore, we need to write our program logic in the processRequest.

86

Look at the below figure we declared four variables of type String, and if you observe for number/id values, we are just converting those values into the string. In the OAPageContext, we will be having some defined values which we can access as shown in the below figure using notation dot (.) we will get all the available values and then we need to choose the required one.

87

“pageContext” is nothing but the variable name of the OAPageContext (OracleApps page Context), if you observe to declared four variables we assigned values respectively.

Now after declaring variables and assigning values to the variables, we need to search for items on our page, if you observe we created four items item1, item2, item3, and item4. So, therefore, to find the items on the page we need to use the bean as follows:

Here in this lesson, we are not providing access to copy and paste the code of java because whenever we are typing code JDeveloper prompts us to import the packages automatically. For example look at the below figure whenever we start typing, JDeveloper prompts us to click on Alt-Enter so that we can import the required package. It just saves our typing time of importing a package.

88

After clicking on Alt-Enter, it displays the packages list then choose the required import package. Here we are typing OAMessageTextInput it is a bean if you observe we used item style as “MessagetextInput” we are just adding OA (OracleApps) at the beginning and Bean at last which gives our Bean name. Now look at the below figure which shows the imported package name:89

90

If you observe first, we initialized a bean, and at the time of initialization, we also need to import the respective package and hence now we know that how to import the required package automatically. After that declare a variable and we used Java typecasting process here.

Every item has its id, so we used id value of the item to find the required item in the page.

Similarly, write the code to find all the items on the page which we created.

Now after finding the items on the page we need to assign values which we got using pageContext into the respective items. It means we need to set a value for each item in the page and for that, we use the line code as follows:

91

Similarly set values to all the items and after that, the code looks like:

92

Rebuild the program after finishing the code, just Right click on the code area and then select Rebuild option or we can also use a short cut code Alt+Shift+f9. The same scenario is shown in the below figure:

93

After successfully rebuilding the java program Run the page and see the output. The output of the page which we created is as follows:

94

Check out our Popular Trainings 

Oracle Fusion Financials Training in Bangalore

Structure of OAF

Advantages and Dis-Advantages of OAF

Creating First OAF Page in Project

“At TekSlate, we are trying to create high quality tutorials and articles, if you think any information is incorrect or want to add anything to the article, please feel free to get in touch with us at info@tekslate.com, we will update the article in 24 hours.”

1 Responses on How to display User Name, User Id and Responsibility id OAF"

  1. Afaf Aboutabit says:

    Thank you so much, these tutorials are really helpful. Compared to the copy&paste code tutorials, these are much better because they give deep and clear explanation of the coding logic. Thank you so much.

Leave a Message

Your email address will not be published. Required fields are marked *

Support


Please Enter Your Details and Query.
Three + 6