SAP AMDP Statement Performance Trace

1. Objective

Explain Step by step guide to trace the SAP AMDP method to analyze the performance and most expensive performance bottlenecks.

2. Steps to trace AMDP method

2.1 Run Transaction AMDP_UTILS

AMDP_UTILS provides a list of AMDP utilities present in your system.

AMDP_UTILS


2.2 RS_AMDP_STMT_TRACE Report

Double Click on the RS_AMDP_STMT_TRACE

AMDP Trace
  • Click on the button "Activate Trace".
  • Now you can RUN your transaction.
  • Once your transaction is finished click on the ‘Deactivate Trace’ button.

2.3 Display the Trace Entries 

Click on the ‘Display Trace Entries’ button. It will navigate into the below screen.

It will list down all the AMDP method executions within the transaction and also displays execution time against each AMDP method.

SAP AMDP Trace

Click the 'Display' icon and check execution time against each AMDP method.
 
SAP AMDP Trace

Identify the performance pain points with execution time and improve. 

Enjoy.


OOP ALV Set Filter Criteria

Introduction:

If you use OO ALV based on the class CL_GUI_ALV_GRID, then you can hide rows using the built-in filter functionality and manipulate the filter criteria from the program with modify the main Itab. 


in the above example based on the button selection set filter Criteria for Status fields.

Steps:

  • Add value to ALV filter Criteria 
IF GV_filter IS INITIAL. "filter set condition
   gs_filter-fieldname = 'STATUS'. "Field Name
   gs_filter-sign = 'I'.
   gs_filter-option = 'EQ'.
   gs_filter-low = '@0A@'. "Filter Value
   APPEND gs_filter TO gt_filter.

 ELSE. "Appned Green items to main ALV
   CLEAR :gt_filter[],
ENDIF.

  • Set ALV filter Criteria to ALV object 
CALL METHOD go_alvgrid->set_filter_criteria
EXPORTING
it_filter = gt_filter. 
 
  • Refresh ALV grid to apply filter;
 PERFORM alv_refresh. 

SAP Move Cursor to next Row automatically after Pressing Enter in OOP ALV

SAP Move Cursor to next Row automatically after Pressing Enter in OOP ALV


Introduction:

Do you think.. if is it possible to have the same functionality of the Excel: Press Enter and cursor will move to next row in ALV ??

Steps

  • Register the ALV Edit event (mc_evt_enter) for enter
This will enable ALV event trigger option when press enter.
CALL METHOD g_grid->register_edit_event
  EXPORTING    i_event_id cl_gui_alv_grid=>mc_evt_enter
  • Event listener method for Edit Event
Event Handler create object g_event_receiver.
SET HANDLER g_event_receiver-handle_data_changed FOR g_grid.
  • In Side the ''handle_data_changed" put in following code
DATA: lv_row TYPE i,
lv_value TYPE c,
lv_col TYPE i,
lv_row_id TYPE lvc_s_row,
lv_col_id TYPE lvc_s_col,
lv_row_no TYPE lvc_s_roid.

//Getting Current Cell
CALL METHOD g_grid->get_current_cell
IMPORTING
e_row = lv_row
e_value = lv_value
e_col = lv_col
es_row_id = lv_row_id
es_col_id = lv_col_id
es_row_no = lv_row_no.

//Total number of tables
DESCRIBE TABLE gt_outtab LINES sy-index.

//Getting next row
lv_row_id-index = lv_row_id-index + 1.
lv_row_no-row_id = lv_row_no-row_id + 1.

//Set the Next row
IF lv_row_id-index LE sy-index.
CALL METHOD g_grid->set_current_cell_via_id
EXPORTING
is_row_id = lv_row_id
is_column_id = lv_col_id
is_row_no = lv_row_no.
ENDIF.

SAP ABAP Enable or Disable / Hide Function Keys on the application tool bar and menu painter

Introduction:

Enable or display/hide the function keys or push buttons on the application toolbar on the screen.


Steps

  • Create a PF STATUS by double-clicking on the name “PF_STATUS”.

  • Set the mode of Options of the display icon. 
    • Enable or display (displayed in gray) 
      • The advantage of this method is that functions in the application toolbar remain in the same place (location constant) especially by dynamic deactivation.
    • Hide (disappear).


    • In MODULE status_0100 should maintain the following Code.
      • To do this, modify the Form SET_STATUS.
    *(beasd on the GI_RETURN, buttion will do the action)
    IF gi_return IS INITIAL. "Condition of display or Hide 
      SET PF-STATUS 'STATUS_100' EXCLUDING fcode.
    ELSE.
      SET PF-STATUS 'STATUS_100'.
    ENDIF.
    • Execute the program once again,
      • Now the output will be displayed with one function key or button on the application toolbar.
    Please send us your feedback/suggestions at biitsumudu@gmail.com

    Best Wishes.. :)