APO interactive transactions for multiple products don’t usually have all the options for selection that the business may need. This article explains how to use ABAP Query functionality to extend and customize the selection for these transactions.
The article shows - as an example - how the receipts view can be selected by the ABC indicator of the products; a field not present in the standard selection screen. The technical details are explained so it should be easy to adjust the query for other fields and more complex selection requirements.
ABAP query is a powerful functionality that allows complex reporting. It can include ABAP code without the need for a developer key. In this example we combine the query selection with a transaction screen called directly from within the query.
Queries can be exported and shared easily. You can download a file with the definition of the query in this article in the original post in my professional blog (see my profile). You will also find instructions on how to load it into your system.
These are APO transactions that use the same selection screen. As you can see below the selection options are limited, even if we consider the additional tabs.
Selection screen of /SAPAPO/RRP4
“Other” tab in /SAPAPO/RRP4 selection screen
This is enough in most cases but the user may need a different selection field or approach.
Using the product-location free attributes fields in this way can be particularly useful as these fields can be populated with specific parameters from ECC not available in standard APO.
In the example presented the selection screen will look as follows and includes the ABC indicator as a selection option. The output result will depend on the interactive transaction extended. In this example it will be the receipts list for those product-locations matching the query selection.
The transactions indicated in the previous chapter all have a similar internal structure. The transaction calls a program include that does the following:
The following table shows for the 4 transactions the program include where the functions are called and the function used to run the main transaction.
Report | Transaction | Program Include | Function to run/display |
Receipt view | /SAPAPO/RRP4 | /SAPAPO/SAPRRP_RECEIPTS_ENTRY | /SAPAPO/RRP_SHOW_RECEIPTS |
Requirement view | /SAPAPO/RRP1 | /SAPAPO/SAPRRP_REQMTS_ENTRY | /SAPAPO/RRP_SHOW_REQMTS |
Product planning Table | /SAPAPO/PPT1 | /SAPAPO/SAPRRP_PT_ENTRY | /SAPAPO/RRP_PLANNING_TABLE |
Product overview | /SAPAPO/POV1 | /SAPAPO/POV_ENTRY | /SAPAPO/RRP_POV_SHOW |
The query selection substitutes the first function call with a customized extraction of the pegging areas that is then feed to the function that runs the transaction. In this way, we can make the selection much more complex, adding any field available in the product-location master data tables and filtering the combinations before calling the transaction.
For this article we are going to use a simplified selection of product, location and ABC indicator.
First of all we create an infoset by joining the tables indicated below.
Then select the fields to be used in the query.
The “from” and “to” dates are important parameters to reduce processing time. These transactions are usually slow even for a small set of materials and any additional restriction will help performance. Create them as parameters in the query infoset.
Additional selection parameters in query
Definitions for date and time fields
ABAP code is required to call the transaction function with the parameters determined by the query.
The following is an explanation of the code logic by sections in the query code tab.
In this section the data variables and structures are defined.
DATA: |
This is the code that is executed for each of the records returned by the query select of the data.
The query returns a list of pegging areas in table /SAPAPO/PEGKEY for those product-locations included in the selection. Each pegging area ID is copied and appended to the temporary tablelt_pegarea.
* |
After the query has collected the pegging areas for the product-locations in the selection, the function that runs the transaction is called.
In addition to the pegging areas, the FROM and TO date timestamps and the active version (000) are passed to the function.
* |
The query itself (SQ01) is straightforward. The selection screen shows the parameters defined in the infoset. Add the others parameters as selection. This query will not have any list displayed as the transaction will be called first. Include the fields in the display anyway to make sure the code is executed.
It is also important that the query is set as ABAP List to make sure the code in the END-OF-SELECTION section is included and used in the query.
This basic query can be extended in different ways, for example:
Have fun.
(This post was first published on the author's professional blog, see profile)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |