Friday, May 16, 2008

ABAP Function Module for Displaying Clock

ABAP Function Module for Displaying Clock

If you wish to display time in a Pop-up window then use the following function module.

F4_CLOCK

The user can select the desired time and the result is exported in one of the parameters.

Please find the code below.

REPORT ZEX_TIME .


Data: d_time like sy-uzeit.

CALL FUNCTION 'F4_CLOCK'
 EXPORTING
   START_TIME          = SY-UZEIT
   DISPLAY             = ' '
 IMPORTING
   SELECTED_TIME       = d_time.


   Write:/ 'The selected time is ', d_time.



ABAP Function Module for Calculator

ABAP Function Module for Calculator

If you wish to present the users with a pop-up calculator you can do so by the following function module.

FITRV_CALCULATOR

Once this function module is executed a small calculator appears on the screen. The user can then perform the desired calculations and the resulted is obtained in the export parameter.

Please find the example below.

REPORT ZEX_CALCULATOR .


Parameters: p_ival(10).

Data: d_oval(200).

CALL FUNCTION 'FITRV_CALCULATOR'
 EXPORTING
   INPUT_VALUE                = p_ival
   CURRENCY                   = 'USD'
   START_COLUMN               = '10'
   START_ROW                  = '10'
 IMPORTING
   OUTPUT_VALUE               = d_oval
 EXCEPTIONS
   INVALID_INPUT              = 1
   CALCULATION_CANCELED       = 2
   OTHERS                     = 3
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Write:/ 'The Result is = ', d_oval.