ABAP Development Tools (ADT) has totally replaced SE80 for me. On-premise or SAP BTP ABAP Environment, ADT increases productivity with several developer assisting features and short cuts. Below are some of the short cuts that I frequently refer to.
Short Cut | Function | Comments |
Ctrl + Shift + A | Open development object | |
Ctrl + 6 | Start GUI independently of development object | |
Alt + F8 | Run ABAP Development object as ABAP Application in GUI | Useful to open a transaction in GUI in one step. |
Short Cut | Function | Comments |
Shift + F1 | Indent | |
Ctrl + F2 | Syntax Check | |
Ctrl + F3 | Activate |
Short Cut | Function | Comments |
Ctrl + U | Unlock object |
Short Cut | Function | Comments |
Ctlr + < | Add comment | |
Ctlr + > | Remove comment | |
Ctrl + 7 | Comments/Uncomments selected lines |
Short Cut | Function | Comments |
Ctrl + D | Deletes the current line | No selection required |
Alt + Up/Down | Moves the current line up or down | No selection required |
Short Cut | Function | Comments |
Alt + U | Delete unused variables(All) | |
Alt + Shift + U | Delete unused variables(Selection) |
Short Cut | Function | Comments |
Alt + Shift + M | Extract Method | |
Alt + Shift + R | Rename |
Short Cut | Function | Comments |
Tab | To select the initial suggestion of the Keyword or code completion suggestion | |
Ctrl + Space | To get more suggestions from the Keyword or code completion suggestion(includes suggestions from the Static Code Templates) | |
Shift + Enter | To insert the full signature of the code completion suggestion | Useful for Function Modules, Class Methods. |
Enter | To insert only the name of the selected item from the code completion suggestion |
Short Cut | Function | Comments |
Ctrl + 1 | Quick fix suggestions | |
Ctrl + 2 | In file Quick fix |
Short Cut | Function | Comments |
Ctrl + O | Quick Outline | |
Ctrl + T | Quick Type Hierarchy | |
F2 | signature of a variable or method is displayed in the Code Element Information popup | |
F3 | Navigates between the declaration and implementation of the selected object. | |
Alt + Left/Right | Move forward or backward the navigation history |
Short Cut | Function | Comments |
Ctrl + H | ABAP Object search | |
Ctrl + Shift + G | Where used |
Short Cut | Function | Comments |
Ctrl + Alt + C | Compare with Revision History(Released transports) or across ABAP Projects. | The Local History does not come up with this shortcut. For compare with Local History use the context menu of the ABAP Object->Compare With->Local history. |
Short Cut | Function | Comments |
Ctrl + Shift + F10 | Execute ABAP unit tests |
Short Cut | Function | Comments |
Ctrl + Shift + F2 | ABAP Test Cockpit(ATC) |
Short Cut | Function | Comments |
F1 | ABAP Help |
Short Cut | Function | Comments |
Ctrl + E | Displays the list of all open editors | You can select the one that you are interested in and switch to it by pressing Enter key. |
Ctrl + F6 | Displays the list all open editors and allows to switch between them as well. No need to press Enter key. | |
Ctrl + W | Close single editor window | |
Ctrl + Shift + L | List of all commands |
Annotation | Function | Comments |
@EndUserText | End user text | @EndUserText.label |
@AbapCatalog | ABAP related, example enhancementCategory, foreignKey etc. | |
@Semantics | For quantity and currency fields | @Semantics.quantity.unitOfMeasure @Semantics.amount.currencyCode |
Variable | Description |
Cursor | Specifies the cursor position after leaving template edit mode. |
Date | Equates to the current date. |
Dollar | Equates to the dollar symbol ($). |
line_selection | Equates to the content of all currently selected lines. |
Time | Equates to the current time. |
word_selection | Equates to the content of the currently selected text. |
Year | Equates to the current year. |
Variable | Description |
enclosing_object | Equates to the name of the development object displayed in the current editor, such as the name of a class or include program. |
enclosing_package | Equates to the package, which the development object belongs to. |
system_id | Equates to the ABAP System ID. |
User | Equates to the name of the user that is currently logged in to the ABAP system. |
You got the option to change any of the short cuts to your preferred ones.
Window -> Preferences -> General -> Keys
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="ABAP" deleted="false" description="Assert 1 = 2. This should not happen" enabled="true" name="Ram_Assert_ThisShouldNotHappen">ASSERT 1 = 2."this should never happen</template><template autoinsert="true" context="ABAP" deleted="false" description="Data Providers Set" enabled="true" name="Ram_Class_DataProvider_Set">MO_${OBJECT} ?= COND #( WHEN IO_${OBJECT} IS BOUND THEN IO_${OBJECT} ELSE NEW ZCL_${OBJECT}( ) ).</template><template autoinsert="true" context="ABAP" deleted="false" description=""<PENDING> Comment" enabled="true" name="Ram_Comment_Pending">"<PENDING>${cursor}</template><template autoinsert="true" context="ABAP" deleted="false" description="CL_DEMO_OUTPUT" enabled="true" name="Ram_Demo_Output">CL_DEMO_OUTPUT=>BEGIN_SECTION( TITLE = ${Title} ).
CL_DEMO_OUTPUT=>WRITE_DATA( VALUE = ${FieldValue} NAME = ${FieldName} ).
CL_DEMO_OUTPUT=>WRITE_TEXT( TEXT = ${someText} ).
CL_DEMO_OUTPUT=>END_SECTION( ).
CL_DEMO_OUTPUT=>DISPLAY( ).</template><template autoinsert="true" context="ABAP" deleted="false" description="Documentation of a Method" enabled="true" name="Ram_Docu_Method">"! <p class="shorttext synchronized" lang="en">${MethodName}</p>
"! @parameter ${Parameter1}${cursor} | <p class="shorttext synchronized" lang="en">${ParameterDesc1}</p>
"! @parameter ${Parameter2} | <p class="shorttext synchronized" lang="en">${ParameterDesc2}</p>
"! @parameter ${Parameter3} | <p class="shorttext synchronized" lang="en">${ParameterDesc3}</p>
"! @raising ${Exception} | <p class="shorttext synchronized" lang="en">${ExceptionDesc}</p>
</template><template autoinsert="true" context="ABAP" deleted="false" description="Documentation of a variable" enabled="true" name="Ram_Docu_Variable">"! <p class="shorttext synchronized" lang="en">${VariableDesc}</p></template><template autoinsert="true" context="ABAP" deleted="false" description="Message Variables Set" enabled="true" name="Ram_Message_Variables_Set">if 1 = 2.
MESSAGE ${msgType} ${msgId} (${msgClass}) WITH ${msgVariable1} ${msgVariable2} ${msgVariable3} ${msgVariable4}.
endif.
MO_MSG->SET( IM_MSGNO = '${msgId}' IM_MSGID = '${msgClass}' IM_MSGTY = ZCL_CONSTANTS=>MC_${msgTypeConstant} IM_MSGV1 = CONV #( ${msgVariable1} ) IM_MSGV2 = CONV #( ${msgVariable2} ) IM_MSGV3 = CONV #( ${msgVariable3} ) IM_MSGV4 = CONV #( ${msgVariable4} ) ).</template><template autoinsert="true" context="ABAP" deleted="false" description="OData Create read input data" enabled="true" name="Ram_OData_Create_readInput">DATA: LS_${inputStructure} TYPE ZST_${inputStructure}.
DATA: LS_${outputStructure} TYPE ZST_${inputStructure}.
* Get the body
io_data_provider->read_entry_data( importing es_data = LS_${inputStructure} ).
"you class implementing the action action
IF MO_MSG->SUBRC IS NOT INITIAL.
ME->ZRAISE_BUSINESS_EXCEPTION( ).
ENDIF.
er_entity = LS_${outputStructure}.</template><template autoinsert="true" context="ABAP" deleted="false" description="oData Function Import convert parameters" enabled="true" name="Ram_oData_FunctionImport_ConvertParameters"> DATA: LS_${inputStructure} TYPE ZST_${inputStructure}.
IO_TECH_REQUEST_CONTEXT->GET_CONVERTED_PARAMETERS( IMPORTING ES_PARAMETER_VALUES = LS_${inputStructure} ).
"you class implementing the action action
IF MO_MSG->SUBRC IS NOT INITIAL.
ME->ZRAISE_BUSINESS_EXCEPTION( ).
ENDIF.
COPY_DATA_TO_REF(
EXPORTING
IS_DATA = LS_${inputStructure}
CHANGING
CR_DATA = ER_DATA ).</template><template autoinsert="true" context="ABAP" deleted="false" description="Ram oData raise business exception" enabled="true" name="Ram_oData_RaiseBusinessException"> IF MO_MSG->SUBRC IS NOT INITIAL.
ME->ZRAISE_BUSINESS_EXCEPTION( ).
ENDIF.</template><template autoinsert="true" context="ABAP" deleted="false" description="oData Read Class" enabled="true" name="Ram_oData_ReadClass">"! <p class="shorttext synchronized" lang="en">${description}</p>
CLASS ZCL_${className} DEFINITION
PUBLIC
INHERITING FROM ZCL_ODATA_GET_ENTITY_ABS
FINAL
CREATE PUBLIC .
PUBLIC SECTION.
METHODS CONSTRUCTOR
IMPORTING
!IS_PAGING TYPE /IWBEP/S_MGW_PAGING OPTIONAL
!IS_FILTERS TYPE ZST_${outputFilters} OPTIONAL
!IT_ORDER TYPE /IWBEP/T_MGW_TECH_ORDER OPTIONAL
RAISING
ZCX_VALIDATION_FAILED
Zcx_${exceptionClass} .
METHODS GET_DATA
EXPORTING
!ET_DATA TYPE ZTT_${outputTable}
!EV_COUNT TYPE RECCOUNT
!ES_SEGRIGATED_COUNT TYPE ZST_${outputCounts}
!ES_OPEN_SEARCH_COUNT_JSON TYPE STRING
RAISING
Zcx_${exceptionClass} .
PROTECTED SECTION.
"! <p class="shorttext synchronized" lang="en">Prepare open search filter</p>
METHODS PREPARE_OPEN_SEARCH_FILTER .
METHODS APPLY_OPEN_SEARCH
REDEFINITION .
METHODS VALIDATE
REDEFINITION .
PRIVATE SECTION.
TYPES:
BEGIN OF TY_SITES,
PLANT_NO TYPE WERKS_D,
END OF TY_SITES .
TYPES:
BEGIN OF TY_GRADES,
GRADE TYPE ZSTE_BIN_GRADE,
END OF TY_GRADES .
TYPES:
BEGIN OF TY_COMMODITIES,
COMMODITY TYPE MVGR2,
END OF TY_COMMODITIES .
TYPES:
BEGIN OF TY_SEASONS,
SEASON TYPE MVGR3,
END OF TY_SEASONS .
TYPES:
BEGIN OF TY_OPEN_SEARCH_COUNTS,
NAME(50) TYPE C,
VALUE TYPE ZDE_COUNT,
ODATA_FIELD TYPE /IWBEP/SBDM_ELEMENT_NAME,
END OF TY_OPEN_SEARCH_COUNTS .
TYPES:
TTY_OPEN_SEARCH_COUNTS TYPE TABLE OF TY_OPEN_SEARCH_COUNTS .
"! <p class="shorttext synchronized" lang="en">Filters</p>
DATA MS_FILTERS TYPE ZST_${outputFilters}.
"! <p class="shorttext synchronized" lang="en">Output Data</p>
DATA MT_DATA TYPE ZTT_${outputTable} .
DATA MS_output_COUNTs TYPE ZST_${outputCounts} .
DATA MS_OPEN_SEARCH_COUNTS_JSON TYPE STRING .
"! <p class="shorttext synchronized" lang="en">Get the open search counts</p>
METHODS GET_OPEN_SEARCH_COUNTS .
"! <p class="shorttext synchronized" lang="en">Calculate Counts</p>
METHODS CALCULATE_COUNTS .
METHODS CHECK_ACCOUNT_FILTER .
"! <p class="shorttext synchronized" lang="en">Add descriptions to the final structure</p>
METHODS ADD_DESCRIPTIONS .
METHODS READ_DATA.
ENDCLASS.
CLASS ZCL_${className} IMPLEMENTATION.
METHOD ADD_DESCRIPTIONS.
IF MO_MSG->SUBRC IS NOT INITIAL OR
MT_DATA IS INITIAL.
RETURN.
ENDIF.
DATA: LS_DATA LIKE LINE OF MT_DATA,
LT_MATERIAL_RANGE TYPE ZTT_MATERIAL_RANGE.
DATA IR_COMMODITY_CODE TYPE ZSTTY_COMMODITY_CODE_RA.
DATA IR_SEASON_YEAR TYPE ZTT_SEASON.
"we got only one season year for Croptimiser
IR_SEASON_YEAR = VALUE #( SIGN = ZCL_CONSTANTS=>MC_INCLUDE OPTION = ZCL_CONSTANTS=>MC_EQ
( LOW = MT_DATA[ 1 ]-SEASON_YEAR ) ).
"get the commodity and season year desc
"get all commodities
DATA(LT_COMMODITY) = ZCL_MATERIALS=>GET_COMMODITY_DESC( IR_COMMODITY_CODE = IR_COMMODITY_CODE ).
SORT LT_COMMODITY BY MVGR2.
DATA(LT_SEASON_YEAR) = ZCL_MATERIALS=>GET_SEASON_DESC( IR_SEASON_YEAR = IR_SEASON_YEAR ).
DATA(LV_SEASON_YEAR_DESC) = LT_SEASON_YEAR[ 1 ]-BEZEI.
LOOP AT MT_DATA ASSIGNING FIELD-SYMBOL(<LS_DATA>).
READ TABLE LT_COMMODITY INTO DATA(LS_COMM) WITH KEY MVGR2 = <LS_DATA>-COMMODITY BINARY SEARCH.
<LS_DATA>-COMMODITY_DESCRIPTION = LS_COMM-MVGR2_DESC.
<LS_DATA>-SEASON_YR_DESC = LV_SEASON_YEAR_DESC.
ENDLOOP.
ENDMETHOD.
METHOD APPLY_OPEN_SEARCH.
IF MO_MSG->SUBRC IS NOT INITIAL.
RETURN.
ENDIF.
* apply open search filter
IF MS_COMMON_FILTERS-OPEN_SEARCH IS NOT INITIAL.
DELETE MT_DATA WHERE RECEIVAL_ID NOT IN MS_COMMON_FILTERS-OPEN_SEARCH.
ENDIF.
ENDMETHOD.
METHOD CALCULATE_COUNTS.
IF MO_MSG->SUBRC IS NOT INITIAL.
RETURN.
ENDIF.
DATA:
LT_SITES TYPE HASHED TABLE OF TY_SITES WITH UNIQUE KEY PLANT_NO,
LT_COMMODITY TYPE HASHED TABLE OF TY_COMMODITIES WITH UNIQUE KEY COMMODITY,
LT_GRADES TYPE HASHED TABLE OF TY_GRADES WITH UNIQUE KEY GRADE,
LT_SEASONS TYPE HASHED TABLE OF TY_SEASONS WITH UNIQUE KEY SEASON,
LV_ALERTS TYPE ZDE_COUNT.
DATA: LS_SITES TYPE TY_SITES,
LS_GRADES TYPE TY_GRADES,
LV_GRADE TYPE STRING,
LS_COMMODITY TYPE TY_COMMODITIES,
LS_SEASONS TYPE TY_SEASONS.
IF MT_DATA IS NOT INITIAL.
LOOP AT MT_DATA ASSIGNING FIELD-SYMBOL(<LS_DATA>).
"COLLECT SITES
CLEAR LS_SITES.
LS_SITES-PLANT_NO = <LS_DATA>-PLANT_NO.
COLLECT LS_SITES INTO LT_SITES.
* "COLLECT COMMODITIES
* CLEAR LS_COMMODITY.
* LS_COMMODITY-COMMODITY = <LS_DATA>-COMMODITY.
* COLLECT LS_COMMODITY INTO LT_COMMODITY.
"COLLECT GRADES
CLEAR LS_GRADES.
LS_GRADES-GRADE = <LS_DATA>-GRADE.
COLLECT LS_GRADES INTO LT_GRADES.
"UPGRADABLE
IF <LS_DATA>-SITE_AVG_CHECK = ABAP_TRUE.
MS_output_COUNTs-UPGRADABLE = MS_output_COUNTs-UPGRADABLE + 1.
ENDIF.
ENDLOOP.
* MS_output_COUNTs-UPGRADABLE = LINES( VALUE ZTT_CC_CROPT_EXT( FOR LS_DATA IN MT_DATA WHERE ( SITE_AVG_CHECK = ABAP_TRUE ) ( LS_DATA ) ) ).
MS_output_COUNTs-GRADES = LINES( LT_GRADES ).
MS_output_COUNTs-SITES = LINES( LT_SITES ).
MS_output_COUNTs-SEASONS = 1."Only one season can be active for the croptimiser
ENDIF.
ENDMETHOD.
METHOD CHECK_ACCOUNT_FILTER.
IF MO_MSG->SUBRC IS NOT INITIAL.
RETURN.
ENDIF.
IF MS_FILTERS-NGR IS INITIAL OR
LINES( MS_FILTERS-NGR ) GT 1 OR
( MS_FILTERS-NGR[ 1 ]-SIGN <> ZCL_CONSTANTS=>MC_INCLUDE OR
MS_FILTERS-NGR[ 1 ]-OPTION <> ZCL_CONSTANTS=>MC_EQ ).
IF 1 = 2.
MESSAGE S381(ZST2) WITH MV_MSGV1.
ENDIF.
MO_MSG->SET( IM_MSGID = ‘ZST1’ IM_MSGNO = ‘381’ IM_MSGTY = ZCL_CONSTANTS=>MC_ERROR ).
ENDIF.
ENDMETHOD.
METHOD CONSTRUCTOR.
* call the super class constructor
CALL METHOD SUPER->CONSTRUCTOR
EXPORTING
IS_PAGING = IS_PAGING
IS_FILTERS = IS_FILTERS
IT_ORDER = IT_ORDER.
IF MO_MSG->SUBRC IS NOT INITIAL.
RETURN.
ENDIF.
* add filters
CLEAR: MS_FILTERS.
MS_FILTERS = IS_FILTERS.
* validate
VALIDATE( ).
** prepare PZone filter
* PREPARE_PZONE_FILTER( ).
** Get materials ased on filter content
* GET_MATERIAL_FROM_FILTERS( ).
** prepare material range
* PREPARE_MATERIAL_FILTER( ).
* incase of any issues raise exception
IF MO_MSG->SUBRC IS NOT INITIAL.
RAISE EXCEPTION TYPE Zcx_${exceptionClass}.
ENDIF.
ENDMETHOD.
METHOD READ_DATA.
"the core read logic
ENDMETHOD.
METHOD GET_DATA.
IF MO_MSG->SUBRC IS NOT INITIAL.
RETURN.
ENDIF.
DATA: LO_CX TYPE REF TO Zcx_${exceptionClass},
LO_CX_ROOT TYPE REF TO CX_ROOT.
* check if already called
TRY .
CHECK_ALREADY_CALLED( ).
CATCH Zcx_${exceptionClass} INTO LO_CX.
RAISE EXCEPTION TYPE Zcx_${exceptionClass}.
CATCH CX_ROOT INTO LO_CX_ROOT.
RAISE EXCEPTION TYPE Zcx_${exceptionClass}.
ENDTRY.
* get data
READ_DATA( ).
* Apply open search
APPLY_OPEN_SEARCH( ).
* calculate counts
CALCULATE_COUNTS( ).
* add the descriptions
ADD_DESCRIPTIONS( ).
* Sort as requested
SORT( CHANGING CT_DATA = MT_DATA ).
* Get total records for OData
GET_TOTAL_RECORDS( EXPORTING IT_DATA = MT_DATA ).
* apply skip and top
APPLY_SKIP_TOP( CHANGING CT_DATA = MT_DATA ).
* Return the data
ET_DATA = MT_DATA.
EV_COUNT = MV_TOTAL_RECORDS_COUNT.
ES_SEGRIGATED_COUNT = MS_output_COUNTs .
ES_OPEN_SEARCH_COUNT_JSON = MS_OPEN_SEARCH_COUNTS_JSON.
ENDMETHOD.
METHOD GET_OPEN_SEARCH_COUNTS.
CHECK MS_FILTERS-OPEN_SEARCH_COUNTS IS NOT INITIAL. " We need to do this only if this is a open search count request
CHECK MS_FILTERS-OPEN_SEARCH IS NOT INITIAL.
DATA: LT_OPEN_SEARCH_COUNTS TYPE TTY_OPEN_SEARCH_COUNTS.
* LOOP AT MT_DATA INTO DATA(LS_DATA).
** collect tickets
* IF LS_DATA-RECEIVAL_ID1 IN MS_FILTERS-OPEN_SEARCH.
* LV_TICKETS_COUNT = LV_TICKETS_COUNT + 1.
* ENDIF.
** truck rego
* IF LS_DATA-TRUCK_REGO IN MS_FILTERS-OPEN_SEARCH.
* LV_TRUCK_REGO_COUNT = LV_TRUCK_REGO_COUNT + 1.
* ENDIF.
* ENDLOOP.
** collect the counts
* LS_OPEN_SEARCH_COUNTS-VALUE = LV_TICKETS_COUNT.
* LS_OPEN_SEARCH_COUNTS-NAME = ZCL_TICKETS=>MC_TICKET_COUNT_DESC.
* LS_OPEN_SEARCH_COUNTS-ODATA_FIELD = ZCL_TICKETS=>MC_TICKET_COUNT_FIELD.
* APPEND LS_OPEN_SEARCH_COUNTS TO LT_OPEN_SEARCH_COUNTS.
*
* LS_OPEN_SEARCH_COUNTS-VALUE = LV_TRUCK_REGO_COUNT.
* LS_OPEN_SEARCH_COUNTS-NAME = ZCL_TICKETS=>MC_TRUCK_REGO_COUNT_DESC.
* LS_OPEN_SEARCH_COUNTS-ODATA_FIELD = ZCL_TICKETS=>MC_TRUCK_REGO_COUNT_FIELD.
* APPEND LS_OPEN_SEARCH_COUNTS TO LT_OPEN_SEARCH_COUNTS.
*
* NEW ZCL_GENERIC_VALIDATIONS( )->CONVERT_TO_JSON_STRING( EXPORTING I_DATA = LT_OPEN_SEARCH_COUNTS
* IMPORTING EV_JSON_STRING = MS_OPEN_SEARCH_COUNTS_JSON ).
ENDMETHOD.
METHOD PREPARE_OPEN_SEARCH_FILTER.
** If open search passed in check search field value is valid otherwise clear search field value
* IF MS_FILTERS-OPEN_SEARCH IS INITIAL.
** if FE did not pass the open search parameter we have to clear the open search field.
* CLEAR: MS_FILTERS-OPEN_SEARCH_FIELD.
* ELSEIF MS_FILTERS-OPEN_SEARCH_FIELD IS NOT INITIAL.
** user is asking to perform the open search on a particular field lets check if this field is in our list of fields
* IF MS_FILTERS-OPEN_SEARCH_FIELD NOT IN ZCL_TICKETS=>GET_OPEN_SEARCH_FIELD_RANGE( ).
** this is a open search field which we are not aware of so lets clear this so that we can query as a normal open search
* CLEAR: MS_FILTERS-OPEN_SEARCH_FIELD.
* ENDIF.
* ENDIF.
ENDMETHOD.
METHOD VALIDATE.
IF MO_MSG->SUBRC IS NOT INITIAL.
RETURN.
ENDIF.
* validate ACCOUNT FILTER
CHECK_ACCOUNT_FILTER( ).
* validate sort
VALIDATE_SORT( EXPORTING IO_DATA_REF = ZCL_ODATA_UTILITY=>CREATE_DATA_REFERENCE( EXPORTING I_DATA = MT_DATA ) ).
ENDMETHOD.
ENDCLASS.</template><template autoinsert="true" context="ABAP" deleted="false" description="OData Update read input parameters" enabled="true" name="Ram_OData_Update_readInput">
DATA: LS_${inputStructure} TYPE ZST_${inputStructure}.
DATA: LS_${keyStructure} TYPE ZST_${inputStructure}.
* Get the body
io_data_provider->read_entry_data( importing es_data = LS_${inputStructure} ).
* Get key table information
IO_TECH_REQUEST_CONTEXT->GET_CONVERTED_KEYS( IMPORTING ES_KEY_VALUES = LS_${keyStructure} ).
"you class implementing the action action
IF MO_MSG->SUBRC IS NOT INITIAL.
ME->ZRAISE_BUSINESS_EXCEPTION( ).
ENDIF.
</template><template autoinsert="true" context="ABAP" deleted="false" description="Reduce operator" enabled="true" name="Ram_Reduce">LV_${value} = REDUCE #( INIT LV_${para1} TYPE I FOR LS_${line} IN LT_${table} NEXT LV_${para1} = LS_${line}-${field} + LV_${para1} ).</template><template autoinsert="true" context="ABAP" deleted="false" description="" enabled="true" name="Ram_Table_Maintenance_Event_01_BeforeSavingTheDataInDatabase">*&---------------------------------------------------------------------*
*& Form ${formName_01_BeforeSavingInDB}
*&---------------------------------------------------------------------*
*& Called from event '01 Before saving the data in the database'
*& Input on end_date field is not possible.
*& On adding a new row the end_date is auto populated by 31.12.9999 by the 05 event
*& Below code validates if there are overlaps on new entries and throws an error.
*& If there are no overlaps the old row(if exists) is end dated with current row's
*& start_date - 1.
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM ${formName_01_BeforeSavingInDB}.
TYPES BEGIN OF L_ROW.
INCLUDE STRUCTURE ${table_name}.
INCLUDE STRUCTURE VIMTBFLAGS.
TYPES END OF L_ROW.
DATA: LV_EXTRACT_CURRENT_INDEX LIKE SY-TABIX.
DATA: LV_EXTRACT_PREVIOUS_INDEX LIKE SY-TABIX.
DATA: LV_TOTAL_CURRENT_INDEX LIKE SY-TABIX.
DATA: LV_TOTAL_PREVIOUS_INDEX LIKE SY-TABIX.
DATA EV_ERROR TYPE BOOLE_D.
DATA LS_PREVIOUS_ROW TYPE L_ROW.
DATA LS_CURRENT_ROW TYPE L_ROW.
*The TOTAL[] is sorted in ASCENDING order already.
LOOP AT TOTAL.
LV_TOTAL_PREVIOUS_INDEX = LV_TOTAL_CURRENT_INDEX.
LV_TOTAL_CURRENT_INDEX = SY-TABIX.
LV_EXTRACT_PREVIOUS_INDEX = LV_EXTRACT_CURRENT_INDEX.
READ TABLE EXTRACT WITH KEY <VIM_XTOTAL_KEY>.
IF SY-SUBRC EQ 0.
LV_EXTRACT_CURRENT_INDEX = SY-TABIX.
ELSE.
CLEAR LV_EXTRACT_CURRENT_INDEX.
ENDIF.
CLEAR LS_CURRENT_ROW.
LS_CURRENT_ROW = TOTAL."<VIM_TOTAL_STRUC>.
IF LS_PREVIOUS_ROW-FUNDING_SOURCE = LS_CURRENT_ROW-FUNDING_SOURCE.
* We are dealing with the same BCQ.
"check overlaps
IF ( LS_PREVIOUS_ROW-VIM_ACTION <> NEUER_GELOESCHT AND LS_PREVIOUS_ROW-VIM_ACTION <> UPDATE_GELOESCHT AND LS_PREVIOUS_ROW-VIM_ACTION <> GELOESCHT ) AND "previous row is not deleted
( LS_CURRENT_ROW-VIM_ACTION <> NEUER_GELOESCHT AND LS_CURRENT_ROW-VIM_ACTION <> UPDATE_GELOESCHT AND LS_CURRENT_ROW-VIM_ACTION <> GELOESCHT ) AND "current row is not deleted
( LS_PREVIOUS_ROW-START_DATE >= LS_CURRENT_ROW-START_DATE OR
( LS_PREVIOUS_ROW-END_DATE <> ZCL_DRAWDN_FUND_ORG_UD8_DATES=>MC_END_DATE AND LS_CURRENT_ROW-START_DATE <= LS_PREVIOUS_ROW-END_DATE ) OR
( LS_PREVIOUS_ROW-VIM_ACTION = NEUER_EINTRAG AND LS_PREVIOUS_ROW-START_DATE <= LS_CURRENT_ROW-START_DATE )
).
MESSAGE S003(ZMC_DRAWDN) DISPLAY LIKE 'E' WITH LS_CURRENT_ROW-FUNDING_SOURCE.
EV_ERROR = ABAP_TRUE.
EXIT.
ELSE.
IF <ACTION> = NEUER_EINTRAG."WE CAN USE THE LS_CURRENT_ROW-VIM_ACTION AS WELL
LS_PREVIOUS_ROW-END_DATE = LS_CURRENT_ROW-START_DATE - 1.
LS_PREVIOUS_ROW-VIM_ACTION = AENDERN.
MODIFY TOTAL FROM LS_PREVIOUS_ROW INDEX LV_TOTAL_CURRENT_INDEX - 1.
IF LV_EXTRACT_PREVIOUS_INDEX IS NOT INITIAL.
MODIFY EXTRACT FROM LS_PREVIOUS_ROW INDEX LV_EXTRACT_PREVIOUS_INDEX.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
CLEAR LS_PREVIOUS_ROW.
LS_PREVIOUS_ROW = LS_CURRENT_ROW.
ENDLOOP.
IF EV_ERROR IS INITIAL.
SY-SUBRC = 0.
VIM_ABORT_SAVING = SPACE.
ELSE.
VIM_ABORT_SAVING = ABAP_TRUE.
SY-SUBRC = 4.
ENDIF.
ENDFORM.
*&---------------------------------------------------------------------*
*& Form FETCH_VALUE
*&---------------------------------------------------------------------*
*& Called from event '05 Creating a new entry'
*& On adding a new row the end_date is auto populated by 31.12.9999 by the 05 event
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM FETCH_VALUE .
${table_name}-END_DATE = ZCL_DRAWDN_FUND_ORG_UD8_DATES=>MC_END_DATE.
ENDFORM.</template><template autoinsert="true" context="ABAP" deleted="false" description="" enabled="true" name="Ram_Table_Maintenance_Event_05_CreatingNewEntry">*&---------------------------------------------------------------------*
*& Form FETCH_VALUE
*&---------------------------------------------------------------------*
*& Called from event '05 Creating a new entry'
*& On adding a new row the end_date is auto populated by 31.12.9999 by the 05 event
*&---------------------------------------------------------------------*
*& --> p1 text
*& <-- p2 text
*&---------------------------------------------------------------------*
FORM FETCH_VALUE .
${table_name}-END_DATE = ZCL_DRAWDN_FUND_ORG_UD8_DATES=>MC_END_DATE.
ENDFORM.</template><template autoinsert="true" context="ABAP" deleted="false" description="Test class (ABAP Unit)" enabled="true" name="Ram_testClass">class ${ltcl_} definition final for testing
duration ${short}
risk level ${harmless}.
private section.
DATA: M_CUT TYPE REF TO ${CUT}.
DATA MTD_${testDouble} TYPE REF TO ZIF_${testDouble}.
methods:
${first_test} for testing raising cx_static_check,
SETUP,
TEARDOWN,
CR8_TEST_DOUBLES,
VERIFY_EXPECTATIONS.
endclass.
class ${ltcl_} implementation.
method ${first_test}.
${cursor}cl_abap_unit_assert=>fail( 'Implement your first test here' ).
endmethod.
METHOD SETUP.
"given
CR8_TEST_DOUBLES( ).
M_CUT = NEW #( IO_${testDouble} = MTD_${testDouble} ).
ENDMETHOD.
METHOD TEARDOWN.
VERIFY_EXPECTATIONS( ).
ENDMETHOD.
METHOD CR8_TEST_DOUBLES.
"cr8 test doubles
MTD_${testDouble} ?= CL_ABAP_TESTDOUBLE=>CREATE( 'zif_${testDouble}' ).
ENDMETHOD.
METHOD VERIFY_EXPECTATIONS.
"verify expectations
CL_ABAP_TESTDOUBLE=>VERIFY_EXPECTATIONS( DOUBLE = MTD_${testDouble} ).
ENDMETHOD.
endclass.</template><template autoinsert="true" context="ABAP" deleted="false" description="TestDouble create" enabled="true" name="Ram_TestDouble_Create">data Ltd_${objectName} type ref to zif_${objectName}.
Ltd_${objectName} ?= CL_ABAP_TESTDOUBLE=>CREATE( 'zif_${objectName}' ).
CL_ABAP_TESTDOUBLE=>CONFIGURE_CALL( Ltd_${objectName}
).</template><template autoinsert="true" context="ABAP" deleted="false" description="Test Double with Interface implementation" enabled="true" name="Ram_TestDouble_InterfaceImplementation">*"* use this source file for your ABAP unit test classes
CLASS LTD_${testDoubleName} DEFINITION
FOR TESTING.
PUBLIC SECTION.
INTERFACES ZIF_${testDoubleName} PARTIALLY IMPLEMENTED.
ENDCLASS.
CLASS ltd_${testDoubleName} IMPLEMENTATION.
ENDCLASS.
</template><template autoinsert="true" context="ABAP" deleted="false" description="Test Double custom Matcher implementation example for Message class exception comparision" enabled="true" name="Ram_testDouble_MatcherExample">CLASS LCL_MSG_MATCHER DEFINITION.
PUBLIC SECTION.
INTERFACES IF_ABAP_TESTDOUBLE_MATCHER.
ENDCLASS.
CLASS LCL_MSG_MATCHER IMPLEMENTATION.
METHOD IF_ABAP_TESTDOUBLE_MATCHER~MATCHES.
RESULT = ABAP_FALSE.
FIELD-SYMBOLS <LOX_EXP_UNIT_PROCES> TYPE ANY.
FIELD-SYMBOLS <LOX_ACT_UNIT_PROCES> TYPE ANY.
DATA LOX_ACT TYPE REF TO ZCX_CUSTOM_EXCEPTIONS.
DATA LOX_EXP TYPE REF TO ZCX_CUSTOM_EXCEPTIONS.
IF METHOD_NAME = 'SET'.
IF ACTUAL_ARGUMENTS->IS_IMPORTING_PARAM_SUPPLIED( NAME = 'IO_CX' ).
DATA(LOX_EXP_ANY) = CONFIGURED_ARGUMENTS->GET_PARAM_IMPORTING( 'IO_CX' ).
DATA(LOX_ACTUAL_ANY) = ACTUAL_ARGUMENTS->GET_PARAM_IMPORTING( 'IO_CX' ).
ASSIGN LOX_EXP_ANY->* TO <LOX_EXP_UNIT_PROCES>.
ASSIGN LOX_ACTUAL_ANY->* TO <LOX_ACT_UNIT_PROCES>.
IF <LOX_EXP_UNIT_PROCES> IS ASSIGNED AND <LOX_ACT_UNIT_PROCES> IS ASSIGNED.
LOX_EXP ?= <LOX_EXP_UNIT_PROCES>.
LOX_ACT ?= <LOX_ACT_UNIT_PROCES>.
IF LOX_EXP->IF_T100_MESSAGE~T100KEY = LOX_ACT->IF_T100_MESSAGE~T100KEY.
RESULT = ABAP_TRUE.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
ENDCLASS.
“message setup
DATA(LO_MSG_MATCHER) = NEW LCL_MSG_MATCHER( ).
TRY.
RAISE EXCEPTION TYPE ZCX_CC_CROPT_BGRFC_UNIT_LOST
EXPORTING
MV_RECEIVAL_ID = LTC_CONSTANTS=>MV_TICK_NEW
MV_UNIT_ID = LTC_CONSTANTS=>MC_UNIT_ID.
CATCH ZCX_CC_CROPT_BGRFC_UNIT_LOST INTO DATA(LOX_CC_CROPT_BGRFC_UNIT_LOST).
ENDTRY.
CL_ABAP_TESTDOUBLE=>CONFIGURE_CALL( MTD_MESSAGE
)->SET_MATCHER( LO_MSG_MATCHER
* )->IGNORE_PARAMETER( NAME = 'IO_CX'
)->AND_EXPECT(
)->IS_CALLED_ONCE(
).
MTD_MESSAGE->SET( IO_CX = LOX_CC_CROPT_BGRFC_UNIT_LOST ).</template><template autoinsert="true" context="ABAP" deleted="false" description="Test double generic configuration method example" enabled="true" name="Ram_testDoubleGenericConfigurationExample">method BGRFC_DB_CALL " definition
IMPORTING
IT_CROPT_BGRFC_DB TYPE ZTT_CROPT_BGRFC_DB OPTIONAL
IV_CALLED_TIMES TYPE I OPTIONAL
IV_TIMES TYPE I OPTIONAL
IV_IGNORE_ALL_PARAMETERS TYPE BOOLE_D OPTIONAL
IV_RECEIVAL_ID TYPE ZSTE_RECEIVAL_ID OPTIONAL.
METHOD BGRFC_DB_CALL.
DATA(LO_ABAP_TESTDOUBLE_CONFIG) = CL_ABAP_TESTDOUBLE=>CONFIGURE_CALL( MTD_CC_CROPT_BGRFC_QUEUE_DB ).
IF IV_IGNORE_ALL_PARAMETERS IS SUPPLIED.
IF IV_IGNORE_ALL_PARAMETERS IS NOT INITIAL.
LO_ABAP_TESTDOUBLE_CONFIG = LO_ABAP_TESTDOUBLE_CONFIG->IGNORE_ALL_PARAMETERS( ).
ENDIF.
ENDIF.
IF IT_CROPT_BGRFC_DB IS SUPPLIED.
IF IT_CROPT_BGRFC_DB IS INITIAL.
LO_ABAP_TESTDOUBLE_CONFIG = LO_ABAP_TESTDOUBLE_CONFIG->RAISE_EXCEPTION( NEW ZCX_NO_DATA_FOUND( ) ).
ELSE.
LO_ABAP_TESTDOUBLE_CONFIG = LO_ABAP_TESTDOUBLE_CONFIG->RETURNING( IT_CROPT_BGRFC_DB ).
ENDIF.
ENDIF.
IF IV_TIMES IS SUPPLIED.
LO_ABAP_TESTDOUBLE_CONFIG = LO_ABAP_TESTDOUBLE_CONFIG->TIMES( NUMBER = IV_TIMES ).
ENDIF.
IF IV_CALLED_TIMES IS SUPPLIED.
DATA(LO_ABAP_TESTDOUBLE_VERIFY) = LO_ABAP_TESTDOUBLE_CONFIG->AND_EXPECT( ).
IF IV_CALLED_TIMES IS NOT INITIAL.
LO_ABAP_TESTDOUBLE_VERIFY->IS_CALLED_TIMES( TIMES = IV_CALLED_TIMES ).
ELSE.
LO_ABAP_TESTDOUBLE_VERIFY->IS_NEVER_CALLED( ).
ENDIF.
ENDIF.
TRY.
MTD_CC_CROPT_BGRFC_QUEUE_DB->GET_BGRFC_TICKETS(
EXPORTING
IR_RECEIVAL_ID = VALUE #( SIGN = ZCL_CONSTANTS=>MC_INCLUDE OPTION = ZCL_CONSTANTS=>MC_EQ ( LOW = IV_RECEIVAL_ID ) )"IT_CROPT_BGRFC_DB[ 1 ]-RECEIVAL_ID ) )
IR_UNIT_ID = VALUE #( SIGN = ZCL_CONSTANTS=>MC_INCLUDE OPTION = ZCL_CONSTANTS=>MC_EQ ( LOW = MTD_CC_CROPT_BGRFC_UNIT_HELPER->GET_UNIT_ID( ) ) )
* IR_STATUS = VALUE #( SIGN = ZCL_CONSTANTS=>MC_INCLUDE OPTION = ZCL_CONSTANTS=>MC_EQ ( LOW = ZIF_CC_CROPT_BGRFC_QUEUE_DB=>MC_STATUS_NEW ) )
).
CATCH ZCX_NO_DATA_FOUND.
“handle exception
ENDTRY.
ENDMETHOD. </template><template autoinsert="true" context="ABAP" deleted="false" description="Types with structure included" enabled="true" name="Ram_Types_Structure"> TYPES:
BEGIN OF TY_${typeName},
${field1} TYPE ${field1Types},
${field2} TYPE ${field2Types}.
INCLUDE TYPE ${structure}.
TYPES: END OF TY_${typeName}.
TYPES TTY_${typeName} TYPE TABLE OF TY_${typeName}.</template><template autoinsert="true" context="ABAP" deleted="false" description="Range insert on ‘Value’ constructor" enabled="true" name="Ram_ValueConstr_Range">DATA(${LR_VARIABLE}${cursor}) = VALUE #( FOR ${STRUCTURE} IN ${word_selection} SIGN = ZCL_CONSTANTS=>MC_INCLUDE OPTION = ZCL_CONSTANTS=>MC_EQ ( LOW = ${STRUCTURE} ) ).</template></templates>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
12 | |
7 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |