Posts

Exploring ABAP Classical Report Events: Start Of Selection, End Of Selection, Top of Page, and End of Page

Image
 Welcome back everyone, We have started Classical report events in the last blog. so, Let’s continue it. 3. Start Of Selection This event calls when user clicks execute button on the selection screen. The selection logic is the part of this event. Let’s create a type structure for our header table in our program, which we have seen in the last blog. Implementation :- Note :- Please go to the debug mode and check which events are triggering at what time, It will help everyone to understand the entire concept. Code :- *********************************************** *Start of Program *********************************************** *Declaring type strcuture TYPES: BEGIN OF ty_header, order_number TYPE zar_order_number, order_date TYPE zar_order_date, payment_mode TYPE zar_payment_mode, currency TYPE zar_curency, END OF ty_header. **************** *Internal Table and Work Area DATA : lt_header type table of ty_header, ls_h

Exploring Classical Report Events in ABAP: Initialization and At Selection-Screen

Image
 Welcome back everyone, So basically We were discussing about some best programming practices in our previous blog. Let’s discuss Classical Report Events. Events :- Classical Reports are the most basic ABAP reports, in which we display the output using WRITE statement. Event is always triggered by a specific action or a specific occurrence ( when a particular time has been reached ). The example of specific actions are mouse click, pressing a key etc. The example of specific occurrence is running out of memory etc. Classical Report Events :- The same concept of events is applicable to classical reports. Some events trigger by specific user action and some events trigger at specific occurrence in classical reports. The various classical report event are as follows :- Initialization At selection-screen Start of Selection End of Selection Top of page End of page At selection screen output At selection screen on value request for <field> At selection screen o

Optimizing ABAP Performance: Best Practices and Parallel Cursors

Image
 We have discussed the Message class and how to create a transaction code for a Executable program in our last blog. Let’s discuss some best programming practices. Best Performance Practices/Guidelines :- Never use * in the query. Fetch the data of only those columns which are required. Columns fetching sequence needs to be same as that of data dictionary column sequence. Where condition column sequence needs to be same as that of data dictionary column sequence. Never use corresponding in the query. For traditional databases avoid using JOIN, use FOR ALL ENTRIES IN. For fetching data from foreign key tables/dependent tables, Check for sy-subrc or internal table not initial condition. Use binary search in read table. Use parallel cursor in nested loops. For multiple conditions, use case conditional statement rather than if conditional statement. Depends upon the requirement, create secondary indexes to improve the performance. Never write a select query inside the loop.

Harnessing the Power of Message Class for Effective Program Communication

Image
 Welcome back everyone to our Complete SAP ABAP Master Series, We have started Message Class in our last blog, So let’s continue it. Message Class :- Suppose, I want to open a program in ABAP Editor which does not exist, then the SAP System will automatically generate a message that the Program does not exist. Messages play a very crucial and vital role in SAP. Types of Messages :- A(Abort) E(error) I(Information) S(success/status) W(warning) X(exit) Note :- We should always use Message class for writing Messages, Never hard code messages inside the program. Requirement :- Let’s understand the importance of Messages through a requirement. Suppose, I have the below program, I hope you remember the below code, Since we had discussed this program in our previous blogs. Now, Once we are trying to execute the program and we provide a wrong input number, then Suppose the Customer wants us to display a message that Order Number does not exist. Solution :- Step

Mastering SAP ABAP: Enhancing Reports with Left Outer Join, Column Labels, and Formatting Techniques

Image
 Welcome back everyone, We have implemented inner join in our last blog, So let’s continue it. Requirement :- Suppose, there are 7 elements in header table and for only 5 elements of header table, we have elements in item table. Now, the Customer wants that the matching data between should be displayed, also rest elements of header table should be displayed in the output. Solution :- In that scenario, we will use left outer join. Code :- *********************************************************** *Start of Program *Declaring the final type structure TYPES: BEGIN OF ty_final, order_number TYPE zar_order_number, order_date TYPE zar_order_date, payment_mode TYPE zar_payment_mode, total_amount TYPE zar_total_amount, currency TYPE zar_curency, order_item_number TYPE zar_order_item_number, item_cost TYPE zar_total_amount, END OF ty_final. ********************************