Posts

Showing posts with the label sap

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 ...

Mastering ABAP: A Step-by-Step Guide to Function Modules and Groups for Modularized Programming

Image
  Function Modules :- It is a modularization technique. The transaction code to create a function module is SE37. To create a function module, we need to create a function group. Function Group :- Function group is a container for the function modules. The transaction code to create a function group is SE80. A function group can store up to 99 function modules. Requirement :- let’s create a function module for sum of two numbers. 1. Creation of function group :- Step 1 :- Go to SE80 transaction code → Object Navigator. Step 2 :- From the drop down select function group. Step 3 :- Give a name of function group. Step 4 :- press enter. Step 5 :- Click on yes a popup screen will appear. Step 6 :- Give short description → press enter → Assign package and transaction request and press enter. Step 7 :- Right click on function group and click on activate to activate the function group. Step 8 :- You will see two includes, will be added afte...

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 ...