How to embed ABAP progam in SAP Query
As far as we known, there are many magical functions in SAP system, today let’s talk about one from SAP query.
The application SAP Query is used to create lists not already contained in the SAP standard. It has been designed for users with little or no knowledge of the SAP programming language ABAP. SAP Query offers users a broad range of ways to define reporting programs and create different types of reports such as basic lists, statistics, and ranked lists. SAP Query’s range of functions correspond to the classical reporting functions available in the system. Needs in this area like list, statistic, or ranked list creation can be met using queries. All necessary data can be selected from various R/3 tables. To define a report, you first have to enter individual texts, such as titles, and select the fields and options which determine the report layout. Then you can edit list display in the WYS/WYG mode whenever you want using drag and drop and the other toolbox functions available.
The SAP Query comprises five components as follows:
- User Groups
Today my blog will focus on the magical function of InfoSets, how to embed ABAP progam in SAP query. Go straight to my point, if we want to embed ABAP program, we should create an “Extras” in InfoSets at first, it can be an additional table, additional field, additional structure, or add the ABAP codes directly, then we can embed simple ABAP program in it. Herein I took the ‘additional field’ as the example.
Please see the following steps:
- I created one additional field “Week”, defined the relevant format as I want,
- Embedded the ABAP program codes, it called a function which is used to get the calendar week base on the posting date in table MKPF, because my end users want to make the statistic report in accordance with calendar weeks.
- After that I created a Query using the InfoSets with additional field Week, I don’t itemize the detailed steps how to create a Query here, just post the screen snapshot of report result, you can find the field ‘Week’ in the report alreay, now my end users can freely use it to do the statistical analysis from SAP Query!
That’s the magical function in SAP Query, Hope my blog can help you to get more useful Query report in SAP system. Every success!