events in abap report


ABAP programs are executed based on events. Following is the list of events which get triggered in a sequence, while program execution.



·         Load-of-program

·         Initialization

·         At Selection-Screen output

·         At Selection-Screen on field

·         At Selection-Screen on value request

·         At Selection-Screen on help request

·         At Selection-Screen

·         Start-of-Selection

·         End-of-Selection

·         Top-of-Page

·         End-of-Page

 

·         Load-of-program:

Load of program is the very first event which gets triggered in program. This event loads the programs into memory for execution. All the type and data declaration will get executed in this part.This event is written as   ‘LOAD-OF-PROGRAM’   (not case sensitive)

·         Initialization

This event get triggered after the load of program, this is generally use to set default values of screen fields or the value of variables in the program. This block is executed after system done the processing of selection screen. but before displaying the screen to the users.

 

·         At Selection-Screen output

This events act as PBO i.e process before output, this event is use to manipulate dynamic selection screen changes, and this block gets executed just before displaying the screen in the output.

  • At Selection-Screen on <field>

This event is use for the validation of selection screen values.

 ·         At Selection-Screen on value request

This event is use to provide a value help (F4 help or field help) for a input field.

 ·         At Selection-Screen on help request

This event is use to provide the F1 help , generally documentation about the field.

·         At Selection-Screen

When user press enter or executed the report, first this event gets triggered,  this event is generally use for the selection screen data validations.

 ·         Start-of-Selection & End-of-Selection

Start of selection event is use, to begin the writing of business logic, and after finishing the business logic this event is end with End-of-selection.

 ·         Top-of-Page & End-of-page

Top of page event is use to printing the page headings on all the pages, and end of page to print the footer value on all the pages.  For end of we have to mention line count at the top, if we have not mentioned it is not get executed.

report ZUD_REPORT_EVENTS1 NO STANDARD PAGE HEADING LINE-COUNT 35(1).

tables ekkoekpo.

types begin of tp_ernam,
        ernam type ekko-ERNAM,
        end of tp_ernam.


data gt_ernam type STANDARD TABLE OF tp_ernam,
       gs_ernam type tp_ernam.

DATAit_return LIKE ddshretval OCCURS WITH HEADER LINE.

SELECTION-SCREEN begin of BLOCK b1 WITH FRAME TITLE text-001.
  select-OPTIONS  s_ebeln for ekko-ebeln,
                    s_ebelp for ekpo-ebelp,
                    s_aedat for ekko-aedat,
                    s_ernam for ekko-ernam MODIF ID HID,
                    s_bsart for ekko-bsart MODIF ID DIS.
 SELECTION-SCREEN SKIP.
   PARAMETERS R_ALL RADIOBUTTON GROUP GRP USER-COMMAND CMD,
                R_WO RADIOBUTTON GROUP GRP,
                R_SO RADIOBUTTON GROUP GRP.
SELECTION-SCREEN end of BLOCK b1.

 INITIALIZATION.
     S_AEDAT-SIGN   'I'.
     S_AEDAT-OPTION 'BT'.
     S_AEDAT-LOW    SY-DATUM 365.
     S_AEDAT-HIGH   SY-DATUM.
     APPEND S_AEDAT.

  IF R_ALL IS INITIAL AND R_WO IS INITIAL AND R_SO IS INITIAL.
     R_ALL 'X'.
  ENDIF.

at SELECTION-SCREEN OUTPUT.  "PBO

  IF R_ALL 'X'.
     CLEAR S_BSART[].
  ELSEIF R_WO 'X'.

   CLEAR S_BSART[].
   S_BSART-SIGN    'I'.
   S_BSART-OPTION  'EQ'.
   S_BSART-LOW     'XSWO'.
   append s_bsart.

  ELSEIF R_SO 'X'.
   CLEAR S_BSART[].
   S_BSART-SIGN    'I'.
   S_BSART-OPTION  'EQ'.
   S_BSART-LOW     'ZLOC'.
   append s_bsart.
  ENDIF.

  LOOP AT SCREEN.
  IF R_ALL IS INITIAL AND SCREEN-GROUP1 'DIS'.
     SCREEN-INPUT 0.
     MODIFY SCREEN.
  ENDIF.

  IF R_ALL IS INITIAL AND SCREEN-GROUP1 'HID'.
     SCREEN-ACTIVE 0.
     MODIFY SCREEN.
  ENDIF.

  ENDLOOP.

AT SELECTION-SCREEN"validation

   IF S_ERNAM-LOW IS INITIAL.
      message 'Enter the created by' TYPE 'I'.
   ENDIF.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_ERNAM-LOW.

   clear gt_ernam[].
   gs_ernam-ERNAM  'DEVELOPER1'.
   append gs_ernam to gt_ernam.
   gs_ernam-ERNAM  'TECHNICAL'.
   append gs_ernam to gt_ernam.
      gs_ernam-ERNAM  'FUNCTIONAL'.
   append gs_ernam to gt_ernam.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
  EXPORTING
*   DDIC_STRUCTURE         = ' '
    RETFIELD               'ERNAM'
*   PVALKEY                = ' '
*   DYNPPROG               = ' '
*   DYNPNR                 = ' '
*   DYNPROFIELD            = ' '
*   STEPL                  = 0
*   WINDOW_TITLE           =
*   VALUE                  = ' '
   VALUE_ORG              'S'
*   MULTIPLE_CHOICE        = ' '
*   DISPLAY                = ' '
*   CALLBACK_PROGRAM       = ' '
*   CALLBACK_FORM          = ' '
*   CALLBACK_METHOD        =
*   MARK_TAB               =
* IMPORTING
*   USER_RESET             =
  TABLES
    VALUE_TAB              gt_ernam
*   FIELD_TAB              =
   RETURN_TAB             IT_RETURN
*   DYNPFLD_MAPPING        =
 EXCEPTIONS
   PARAMETER_ERROR        1
   NO_VALUES_FOUND        2
   OTHERS                 3
          .
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.

  WRITE it_return-fieldval TO S_ERNAM-LOW.
  REFRESH gt_ernam.


START-OF-SELECTION.
      "business logic

end-of-SELECTION.
      "print data

Post a Comment

1 Comments

Total Pageviews