Thursday, February 3, 2011

BSP Application using Date Navigator Control

Scenario: Displaying the selected date in an Inputfield.

Go to transaction SE80. Select BSP application and input the name of the BSP application that you want to create. Press Enter or click on the display icon.

Save and activate the application.

Right click on the application name and click à create à page.

The resultant window appears as follows.

Enter the name of the page that you want to create.

In this case it is the ‘first.htm’ that is being created.

Enter the name, description of the page,

select the ‘Page with Flow Logic’ radio button and click on ‘continue’.

Now we are done with creating the pages.

Your screen should look as shown below.

We proceed with providing the layout, attributes and the Event handling

of the respective pages.

Go to first.htm and put the following code in the layout tab of the page

Code in layout tab

<%@page language="abap"%>

<%@extension name="htmlb" prefix="htmlb"%>




       ">

maxlength = "10"
type = "date"/>


     




In the ‘Page Attributes’ of first.htm, enter the attributes as shown below.

We need our application to take the date in input field when date is selected from DateNavigator control.

So we write the code in the ‘OnInputProcessing’ event.

Code in event handler tab for oninputprocessing event.

DATA: date_event TYPE REF TO CL_HTMLB_INPUTFIELD.

date_event ?= CL_HTMLB_MANAGER=>GET_DATA(
REQUEST = RUNTIME->SERVER->REQUEST
NAME = 'inputField'
ID = 'mydate' ).
DATA: event TYPE REF TO CL_HTMLB_EVENT.

event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).
DATA: dateNavigator_event TYPE REF TO CL_HTMLB_EVENT_DATENAVIGATOR.

dateNavigator_event ?= event.
 if date_event->value is initial.

date = dateNavigator_event->day.
 elseif date_event->value is not initial.

date = dateNavigator_event->day.
endif.

Save, Check and activate the first.htm. Save, check and activate the application

and after that execute it. The below screen would be displayed.

Enter the username and password and click on ‘OK’.

The BSP page appears as shown below.

Select the date from DateNavigator.

The date is displayed in input field as shown below.

Now we are done with displaying the date in the inputfield using the DateNavigator.

No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)

Userexits/BADIs

Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

Blog Archive

goodsites