Category Archive Personal tips

Template ABAP for local classes

Local class template :
See also Template for ABAP local ALV event class


CLASS lcl_sample_class DEFINITION.
*------------------------------
* Public section
*------------------------------
  PUBLIC SECTION.

    TYPES : BEGIN OF ts_public_type,
              flag  TYPE abap_bool,
              value TYPE char20,
            END OF ts_public_type.

    DATA : gt_public_table TYPE STANDARD TABLE OF ts_public_type WITH DEFAULT KEY. "Global table inside the class (table must be fully typed to be used in return types)

    METHODS constructor IMPORTING iv_input TYPE char20.


    METHODS public_method IMPORTING iv_input         TYPE char20
                          RETURNING VALUE(rs_output) TYPE ts_public_type.

    CLASS-METHODS public_static_method IMPORTING iv_input         TYPE char20
                                       RETURNING VALUE(rv_output) TYPE char20.


*------------------------------
* Private section
*------------------------------
  PRIVATE SECTION.

    TYPES : BEGIN OF ts_private_type,
              flag  TYPE abap_bool,
              value TYPE char20,
            END OF ts_private_type,
            ti_private_type TYPE STANDARD TABLE OF ts_private_type WITH DEFAULT KEY. " (tables must be fully typed to be used in return types)

    DATA : gt_private_table TYPE ti_private_type. "Global table inside the class

    CLASS-DATA : gs_static_private_structure TYPE mara,
                 gv_static_private_var       TYPE matnr.

    METHODS _private_method IMPORTING iv_input         TYPE char20
                            RETURNING VALUE(rs_output) TYPE ts_public_type.

    CLASS-METHODS _private_static_method IMPORTING iv_input         TYPE char20
                                         RETURNING VALUE(rv_output) TYPE char20.

ENDCLASS. " End of lcl_sample_class DEFNITION



CLASS lcl_sample_class IMPLEMENTATION.

  METHOD constructor.
    " Init process for instanciated class
  ENDMETHOD.

  METHOD public_method.
    " Public (instanciated) method
    " Code...
  ENDMETHOD.

  METHOD public_static_method.
    " Code...
  ENDMETHOD.

  METHOD _private_method.
    " Private (instanciated) method
    " Code...
  ENDMETHOD.

  METHOD _private_static_method.
    " Code...
  ENDMETHOD.

ENDCLASS. " End of lcl_sample_class IMPLEMENTATION

Table type for VBELN field

This post just to save time, instead of doing where-used on VBELN field…

Type table of VBELN: 
TT_VBELN => TABLE_LINE
MDS_SALES_KEY_TAB => Champ VBELN (type VBELN_VA)

Type range of VBELN: WTYSC_VBELN_RANGES_TAB

Search tag : type de table

Table type for MATNR field

This post just to save time, instead of doing where-used on MATNR field…

Type table of MATNR : TABLE_MATNR => TABLE_LINE

Type range of MATNR : RANGE_T_MATNR

Search tag : type de table

Transport data from applicative table

Check the step by step process here : https://blogs.sap.com/2013/07/18/step-by-step-guide-to-transport-table-contents-from-one-environment-to-other-in-sap/ .

Key to put in Development/Correction TO task :

Short description Prog. Obj. Obj. name Fun
Table Contents R3TR TABU <Table name>
Icon to add tabke keys to transport

Click on this Icon to add lines to transport (precise the keys)

Search tags : OT, TO, order, donnée

My Selection-screen macros for reports

Macros that I’m using for formatting reports quicker.

Theses are declared in the TOP of report.

Read More