Posts

Showing posts with the label abap

How to Create and Use an SAP Function Module for Order Details Retrieval in ABAP

Image
 Let’s take real life scenario to develop a function module. Requirement :- Create a function module that takes Single Order Number as input. Displays details of Order Number (Order Header + Order Item ). Suppose below is my header and item table. Header. Item Table Solution :- Step 1 :- Go to SE37. Step 2 :- Give a name and click on create button. Step 3 :- Provide the function group and short description and click on save button. Step 4 :- In import tab we will declare single input as a parameter. Step 5 :- Let’s create a type structure which contains fields from both header and item table which will be given in export section. Step 6 :- Create a table type for same structure. Step 6 :- Pass the type structure and table type in export section of function module to create a internal table and work area. Step 7 :- Open Source Code, Create a type structure for order header and order item table. Step 8 :- Write select query to fetch data

ABAP Event Magic: Navigating Interactive Classical Reports for Dynamic Displays

Image
 Welcome back everyone, We were discussing about Interactive Classical Report events, So, let’s continue it. System Variables in Interactive Classical Report Events :- SY-LISEL :- It is a system variable which returns the contents of the selected line. SY-LSIND :- It is a system variable which returns the index of the displayed list. Interactive Classical Report Events :- 1. At Line-Selection :- When user double clicks on the line or select a line and press F2 or select a line and click choose at that time at line-selection event triggers. Suppose, user double click on the below line :- Then the output should be showing the respective line items for the respective header items in a new page :- Note :- F2 is the shortcut key for double click. It is a reserve key by SAP used for double click purpose. Let’s take a requirement to understand the At Line Selection event. Requirement :- Let’s use our order header and order item table, which we have been using so bar.

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

ABAP Insights: Demystifying Internal Table Operations - Sorting Tricks, Smart Data Summation, and Table Types Unveiled

Image
 Welcome back everyone, So basically we were discussing about internal table operations in our last blog. So let’s continue it. Internal Table Operations - SORT :- It is to sort the internal table. If we are not specifying anything, then by default it sorts in the ascending order. If we want to sort in descending order, then we need to specify the keyword descending. Practical implementation :- ************************************************* *Start of Program SORT lt_header BY order_number. "here we have not specified "anything, then by default it " will sort in ascending order. *Printing data LOOP AT lt_header INTO ls_header. WRITE :/ ls_header-order_number, ls_header-payment_mode. ENDLOOP. *End or Program ******************************************************** Output :- Sorting in Descending Order :- ************************************************* *Start of Program SORT lt_header BY order_number DESCENDING. *Printing data LOOP AT lt_header INTO