0% found this document useful (0 votes)
141 views

ABAP Object Oriented Approach For Reports - Redesign

This document discusses redesigning ABAP reports using an object-oriented approach. It provides an example of creating a selection class and exception class for a report. The selection class defines methods for getting a default value and validating a message class. The exception class defines an attribute to store an error message that is raised if validation fails.

Uploaded by

machnik1486624
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
141 views

ABAP Object Oriented Approach For Reports - Redesign

This document discusses redesigning ABAP reports using an object-oriented approach. It provides an example of creating a selection class and exception class for a report. The selection class defines methods for getting a default value and validating a message class. The exception class defines an attribute to store an error message that is raised if validation fails.

Uploaded by

machnik1486624
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Link:

http://zevolving.com/2013/03/abap-object-oriented-approach-for-reports-redesign/

Create the selection class first


class ZCL_REPORT_T100_SEL definition
public
final
create public .

public section.

types TT_MSGNR_RANGE type T100-MSGNR .

data V_ARBGB type T100-ARBGB .


data T_MSGNR_RANGE type TT_MSGNR_RANGE .

methods GET_DEFAULT
returning
value(RV_ARBGB) type T100-ARBGB .
methods VALIDATE_MESSAGE_CLASS
importing
value(IV_ARBGB) type T100-ARBGB .
protected section.
private section.
ENDCLASS.

CLASS ZCL_REPORT_T100_SEL IMPLEMENTATION.


* <SIGNATURE>----------------------------------------------------------------
-----------------------+
* | Instance Public Method ZCL_REPORT_T100_SEL->GET_DEFAULT
* +--------------------------------------------------------------------------
-----------------------+
* | [<-()] RV_ARBGB TYPE T100-ARBGB
* +--------------------------------------------------------------------------
------------</SIGNATURE>
METHOD GET_DEFAULT.
" returning value(RV_ARBGB) type T100-ARBGB .
rv_arbgb = '00'.
ENDMETHOD.

* <SIGNATURE>----------------------------------------------------------------
-----------------------+
* | Instance Public Method ZCL_REPORT_T100_SEL->VALIDATE_MESSAGE_CLASS
* +--------------------------------------------------------------------------
-----------------------+
* | [--->] IV_ARBGB TYPE T100-ARBGB
* +--------------------------------------------------------------------------
------------</SIGNATURE>
METHOD validate_message_class.
" importing !IV_ARBGB type T100-ARBGB
" raising ZCX_MSG .
DATA: ls_msg TYPE symsg.
SELECT SINGLE arbgb
INTO v_arbgb
FROM t100
WHERE arbgb = iv_arbgb.
IF sy-subrc NE 0.
ls_msg-msgty ='E'.
ls_msg-msgid ='00'.
ls_msg-msgno = '398'.
ls_msg-msgv1 = 'No Message class found'.
RAISE EXCEPTION TYPE zcx_msg
EXPORTING
msg = ls_msg.
ENDIF.
ENDMETHOD.
ENDCLASS.

Create an exception class with attribute MSG

You might also like