Calling Reports from an Infoset Query
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’
- 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 QU Report 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-type works 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.
EQUNR LIKE EQUI-EQUNR.
SET PARAMETER ID ‘EQN’ FIELD EQUNR.
CALL TRANSACTION ‘IE03’ AND SKIP FIRST SCREEN.
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.
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.