Programming

Get Last Date of Month in ABAP/4


*&---------------------------------------------------------------------*
*&     Form get_last_date_of_month
*&---------------------------------------------------------------------*
*      get last date of month
*----------------------------------------------------------------------*
*     -->P_BEGDA is the date in month that you want to know last date
*     <--P_ENDDA last date of month that system will return to you
*----------------------------------------------------------------------*
form get_last_date_of_month using   p_begda
                           changing p_endda.
CALL FUNCTION ’LAST_DAY_OF_MONTHS’

How to Call Shell Script from ABAP/4


*---------------------------------------------------------------------*
*      FORM CALL_SHELL_SCRIPT                                       *
*---------------------------------------------------------------------*
*      ........                                                     *
*---------------------------------------------------------------------*
* --> PAR_FILENAME                                                 *
*---------------------------------------------------------------------*
FORM call_shell_script USING par_filename.

How to count page number of report in ABAP/4

In the first session we can define TOP-OF-PAGE event as normally and we will insert the special wording replace the page count.

In the second session we will place this code at the last of program. This session will replace back the no. of last page to special wording that you define in the first session. 

*** Note: If the special wording is not in the first line of report, you can change the sentence ’READ LINE 1 OF PAGE SY-INDEX.’ to ’READ LINE X OF PAGE SY-INDEX.’ by X is the no. of line that you want to modify.

How to get windows filename in ABAP/4

Method 1

CALL FUNCTION ’KD_GET_FILENAME_ON_F4’
EXPORTING
MASK = ’,*.txt,*.*’
STATIC = ’X’
CHANGING
FILE_NAME = LV_FILE.

Method 2 


CALL FUNCTION ’F4_FILENAME’
EXPORTING
         program_name = syst-cprog
         dynpro_number = syst-dynnr
         field_name  

Optical Mouse Cam

e1Wow! What’s a funny thing? Do you ever think how a optical mouse works? Yes! You can turn your mouse into some kind of scanner or camera because it must have a optical sensor (mostly CCD).

People get bored sometimes, and when I get bored I sometimes open up stuff to find out what makes it tick. One time, I did this with an old optical mouse. Well, a mouse only has 2 chips inside: the optical sensor and a chip for the usb/ps2-interfacing. I looked up the datasheet of the optical sensor (which is an ADNS2610) and it told me the sensor has a tiny 18x18 CCD, which can be read out using the serial port (the one which normally interfaces to the PS2/USB-chip).
Optical Mouse cam

Event of Report in ABAP/4

In ABAP/4, the event immidiately begins when the program is running. In general, these events is normally used in the report:

  • INITIALIZATION
    This is the first event when the report generated. We can modify default value of selection screen.
  • AT SELECTION-SCREEN
    If we want to verify input data before executing program, we will use this event. This event is triggered when user press Enter.
  • START-OF-SELECTION
    This event is activated at the main process when the program is executed.
  • END-OF-SELECTION
    This event is activated follow on START-OF-SELECTION event.