Report Assignment In Sap Query

Introduction

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.

     

Example:

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.

SQ02

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.

SQ01

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

Note:

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.

Testing.

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.

PARAMETERS:

EQUNR LIKE EQUI-EQUNR.
SET PARAMETER ID ‘EQN’ FIELD EQUNR.
CALL TRANSACTION ‘IE03’ AND SKIP FIRST SCREEN.
EXIT.

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.

Note

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

05/11/2015:

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.

Regards

KJogeswaraRao

You have a PO report and wants to drill in to each PO in enjoy transaction code ME23N. This is usually not possible, and most of you will just use ME23 to display.

I will explain how to do this with ME23N.

Step 1: SQ02

a) Create a infoset e.g. MM_DISPLAY_PO, and name your infoset.

b) You select Direct Read of table EKPO.

c) You should have PO and Item in your field group.

d) Under “Extras” tab, create a code.

e) Put in below codes:

SET PARAMETER ID ‘BSP’ FIELD EKPO–ebelp.
SET PARAMETER ID ‘BES’ FIELD EKPO–ebeln.
CALL FUNCTION ‘ME_DISPLAY_PURCHASE_DOCUMENT’
          EXPORTING
            i_ebeln = EKPO–ebeln
            i_ebelp = EKPO–ebelp
            i_enjoy = ‘X’
          EXCEPTIONS
            OTHERS  = 1.
EXIT.

f) Save code, infoset and generate.

e) Assign this infoset to a dummy user group. E.g. IT_DUMMY

Step 2: SQ01

a) Go to your dummy group.

b) Create a query e.g. MM_DISPLAY_PO and reference to your new infoset above.

c) Have the 2 available fields Purchase Order and Item in your selection screen and list field under Basic list.

d) Save your query and try it out with some PO number in your selection screen. You should be able to go to the respective PO.

Step3: SQ01

a) For your PO report in your main query group, do a report assignment to the dummy query group and query you have created above. This is found in change mode –> menu –> Goto –> Report assignment. Fill in the dummy group and query you have from above and save in the pop up box.

b) Save your main PO report query.

c) Run your main report and execute it. when you double click on the respective PO line, you should now be able to see ME23N with the respective PO!!!

0 Thoughts to “Report Assignment In Sap Query

Leave a comment

L'indirizzo email non verrà pubblicato. I campi obbligatori sono contrassegnati *