Report Assignment In Sap Query Documentation

I’m sure that some of you have used the functionality called report assignment when creating queries.  For those that have not, this is a function that allows you to assign additional reports that you can jump to within the query’s results.  As an example, you have a query of material master data.  You can assign a jump to the material master itself.  I found some issues with making this work properly, so I found a trick to make it do what I wanted.  Let me explain:

This report assignment function allows you to assign a transaction or another query (among other things) so that the transaction or query is called within the results.  I’ll show you where and how below.

My complaint about using a transaction is I often found that the field value that I expected to see populated was not.  This is particularly true with the material master.  I found using a query produces better results.  The key is the InfoSet.  I have to admit that I’m not 100% confident in my explanation of the code below, but I think I’m close.

Let’s use the example of the material master.  Create a simple InfoSet with a direct read of the table MARA and include only the key fields in the field group defaults.  I named my InfoSet “REPORT_ASSIGNMENT_MM03” because I’ll use it to execute the transaction MM03.  Name yours as you see fit.  You should have an InfoSet that looks like so:

Click on the “Extras” button and pick the “Code” tab and the “DATA” code section.  You could also go directly there by choosing the menu path Goto | Code | DATA.

Enter the following code:

Here is the code snippet:


The PARAMETERS command defines a variable for the selection screen.  To define the variable, I used a structure variable that is linked with that screen field (RMMG1-MATNR).  You can find it by looking at the technical information in the help for that field.

I found that using the exact screen field is crucial when you want the query to populate the value into the screen.

Next, the SET PARAMETER command pushes the value from the query results into the parameter ID ‘MAT’ using the screen field variable defined above.

Looking again at the technical information, you can see the parameter ID for the field Material shown here.  You may note that this is the same ID that you would use in your user profile.

Next, you have the CALL TRANSACTION statement with the modifier SKIP FIRST SCREEN.  I think the effect here is pretty clear – run MM03 and skip the selection screen where you see the field for material.

Finally, you have an EXIT command to end the processing in the InfoSet after the user finishes with the MM03 transaction.  It effectively pushes the user back to the original results.

Save and generate the InfoSet.  Don’t forget to assign to the proper user group and provide any authorizations that you might use in your environment.  Now you’ll need to create a very basic query that incorporates the newly created InfoSet.

This query should be very basic – much like the InfoSet.  Give it a title and assign the one field to the basic list.

After saving, you’re ready to use this query in another query’s report assignment.  Go to your original query’s Title, Format screen and select the menu path Goto | Report Assignment.

This brings up the list of all reports that are assigned to this query.  Obviously, you can add more than one.  For example, you can add one entry for changing a material and another for displaying a material.

Click on the button indicated (label “Insert Row”).  Enter the user group and query name created previously.

Now the new “report” query is assigned.

If only one report is defined, the result of a double click within the results of the original query will take you straight into the material master skipping the initial screen.  Depending on your settings, you may be required to select the views and organizational levels.  If, as in my example above, you assign two queries, then you’ll see a popup window asking you to choose which option you want.

Although I haven’t tried it, you could conceivably build in a check for authority in the code of the new InfoSet.  If you have authority to change, the CALL TRANSACTION would take you to MM02, otherwise to MM03.

I have also created the similar InfoSet & query combinations for purchase orders and sales orders.

The screenshot above is for display of purchase orders.  In this case, the PARAMETERS definition follows the same approach that I used for the material master where the field you see when the transaction starts is not linked with the underlying table EKKO, but with a structure called RM06E.

The screenshot above is for display of sales orders.  In this case, the PARAMETERS definition is slightly different.  It does not reference the screen field.

For the transaction VA03, you can see that the screen field is linked with the transparent table VBAK and not a structure like RMMG1.  In this case, I used the Data Element, but could easily have used LIKE vbak-vbeln.

If you are familiar with SAP Query already, you know that you can generate some very robust results with a little extra effort in the InfoSet and query.  This trick is particularly helpful, in my opinion, because it turns a simple set of records into a interactive report.  I’d like to hear your comments on how you are using it!

Like this:




The first usual improvisation requirement in self-made Infoset Queries by beginners, is often the requirement of calling other reports from ALV output, just the same way we do in Standard reports.  In ABAP-coded Z Report Programs, there are several techniques of achieving this by syntax like Call Transaction,Submit etc.

The very objective of this documentation is to achieve the same. This topic was briefly discussed in the document 10 Useful Tips on Infoset Queries. But, when the author experienced few exceptions in the technique suggested there and found a solution subsequently, he got the idea of having an exclusive document on this topic.

This document has assumption that readers have working knowledge in developing Infoset Queries.

Here we Start

We have seen earlier, that for enabling Report Calling from the ALV output of an Infoset Query, we need to do these steps in SQ01.

Note: If your Report Assignment option is found disabled, then the reason and setting to restore is here: How to make ‘Report assignment‘ available in ‘SQ01’

Click here on   then on then select  TR (Transaction Code) or RT (Report Program),

  1. When we select TR we need to put only the Transition code.



IE03 if our ALV lines are having Equipment field and we want Equipment Master display upon clicking on the ALV row.

If we have a Maintenance Order Number in the ALV, and we want to have Display Order Screen upon clicking on this row, then we give the Tcode IW33 here.

     2.  In the other case, when we want to call List Reports like IW37 , then we need to select RT in the Report type, where we need to give the

          Program  name (in this case RIAFVC20) in the Report field  and the variant name.


So far, it looked very much OK, until I found recently that few field names like EQUNR, MATNR, DOKNR etc, do not exhibit the desired behaviour.

Few cases  where this call report was not working are discussed here.

In one of my Queries, I have Material number (MATNR) in the ALV output, for which I used Report Type TR with Tcode MM03, for the purpose of  Material Master Display. What happened here, was no Material number was passing to the MM03 initial screen, so the display interrupted, In another case, the first attempt display was coming, but the next attempt on different material line in the ALV, the material master display of the first attempt was repeating. Broadly there is a technical problem in passing the Material number.

Another such case was with the Tcode CV03N  (Display of DMS Document) , where the DOKNR, DOKAR field values were not passing to the CV03N initial screen.

Here is the solution I worked-out, using the QUReport Type of Report Assignment

We are taking the MM03 case

As mentioned above, the report Type QU (Query), in the Report Assignment came to rescue.

This option has 3 fields.

First field (User Group):  You know, your User Group.

Second field (Query): We need to develop a simple query for this field.

Third field (Variant): Optional.

So, what required was that a simple Infoset query using MARA table (Material Master) to be created.

And this Query name, was given in the field 2 above.

Let’s see the steps of creating the simple Query for Report Assignment purpose.


We are Creating an Infoset (I named it MM03) with Direct read of table option.

This is because, we use only one table.

Select this default option, and Continue.

With this the Key field MATNR is added to the Field Group folder in the Infoset.

And in the Infoset Code Section, give the following code

  Generate Infoset and do not forget to assign it to your User Group.


Create a Query (Say MM03) using the above Infoset.


This query name is going to be used in the Report Assignment.

Go to Basic list screen and Tick the MATNR field in the List fields column.

Save the Query.


Here we are examining, the behaviour of 3 cases of Report Assignment)  in the ALV output of an Infoset Query.

We know that when multiple Call report assignments are there in the query, then the options appear as a menu as shown above, upon clicking on a row.

  • Here the first option in the menu namely Display PM Order, is that where I used report type TR and given Tcode IW33,
  • Second one, namely Report Assignment MM03 is through Report Type QU with Query field value MM03 (created as explained above)
  • Third one was the option which was malfunctioning i.e., Report Type TR and Tcode MM03

Now when tested, the first option with TR report-typeworks satisfactorily, without any problem, passing the Order number (AUFNR) correctly everytime.

The third option, again with report type TR works erratically, unable to pass material number (MATNR) correctly.

The second option is our solution to the erratic behaviour of MM03 through TR report type. i.e., through QU report type. This works very correctly like the first case.

In the case of Display Equipment (IE03) , the above method would work, with the following code in SQ02.



So that is about the Problems and the Solutions

As referred in the beginning, another parameter which gave trouble in calling reports through report-type TR was, DOKNR (DMS document number).

I have solved this issue too in a similar manner.  The transaction called was CV03N. The code used in the Infoset is given below.


See the Syntax used  PARAMETER ID  in the syntax used in both the cases above.

The Parameter Id used in MM03 case was, MAT,  and in the CV03N case was CV1  and CV2.

MAT is the Parameter Id for field MATNR, CV1 is for DOKNR and CV2 is for DOKAR.

This parameter-id is the key factor for any Call report to function properly.

Where do we get this?

For example for MATNR, place cursor in MATNR field of any screen, and press F1 on key-board. The pop-up has this value.

Similarly for any other field.

That’s everything I think, about this document.

The author hopes that this document also will be useful to the members, the way the  other documents by the author, in the series of Infoset-queries.

Thank you

Jogeswara Rao K


A tip in this context of Report Assignment.

Recently I made 3 ALV reports using Query for Equipment, Functional Location and Material BOMs . And then I was trying to use Report Assignment in the SQ01 of Equipment BOM. i.e., I was trying to call ALV report of Material BOM, when we click on the Component material field of Equipment BOM ALV. My issue was it was not taking to that report. I analyzed the reason to be:The BOM Component field (IDNRK) does not have a ParameterId on which the Report Assignment function depends.

What I did:

I created a user field MATNR in the Infoset Query by giving data type MARA-MATNR which has a Parameter Id MAT, and then equated that to BOM component (IDNRK) field. Means I gave code in the Code area of this user-field MATNR as: MATNR = STPO-IDNRK.

Then I took this user-field to SQ01 and then to List fields (ALV). Now I thought that the ALV has PID, and the Report Assignment would work. But it was not working. Then  I realized the reason to be that as long as IDNRK field is there in ALV it would not work. I removed the IDNRK field from ALV. I already have the values of BOM component material values in my user-field MATNR. But then I had to remove the text field also associated with IDNRK field from the ALV. Now it worked. Now it is taking me to the Material BOM report assigned in the Report assignment when I click on any ALV line of the Equipment BOM, when that material has got a BOM of it own.

But I lost the Component Description field which I had to remove alongwith IDNRK field from the ALV. So what I did was I created another user-field MAKTX in SQ02 and in its code retrieved the Description field from MAKT table. ( Select single maktx from makt into maktx where matnr = stpo-idnrk.). Now I took this MAKTX field also to SQ01 and then to List. So I got back the lost fields also and finally made the Report assignment to work.

Again with a view not to lose this information by memory erosion and for the benefit oft he forum I’m preserving here.



One thought on “Report Assignment In Sap Query Documentation

Leave a Reply

Your email address will not be published. Required fields are marked *