Professional Documents
Culture Documents
K Jogeswara Rao
October 24, 2013 5 minute read
1.Introduction
We know that Infoset Query is a report development tool given to Functional people by SAP. Using this, a
Functional person can be independent of ABAP to a large extent in the area of Report programs. Infoset query
is cross-functional application. Though this document demos in Plant Maintenance environment, it is believed to
be useful for other Functional people also.
This document is based on the assumption that the readers have basic working knowledge in the area of Infoset
Queries which involve Tcodes SQ03, SQ02 and SQ01. Points discussed here, take an Infoset query closer to
an ABAP report program.
Most of us, especially beginners, usually work on standard fields available in the tables we work on, in the
Infoset (SQ02). But, sooner almost everyone gets the desire to have his/her own defined fields in the report as a
function of standard fields. Such fields are also referred to as Derived fields, Local fields or Additional fields.
A client has a requirement to compute the duration of fields Required Start Date & Time and Required End
Date & Time in a Notification (VIQMEL table). The same is taken for demo here. Hereon we will be referring to
this field as ‘ mnthr ‘ .
(The above is an example of how requirements arise for derived fields. In IW28 standard report, we have
computed duration for Malfunction Dates, but not for the fields referred above.)
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 1/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
1.To define and compute this ‘mnthr’ field in the Infoset (SQ02)
Define:
In the pop-up, select Additional Field option and give the Additional field name as say MNTHR.
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 2/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
After this step we see a node created for Additional fields in the left side.
Now, place the cursor on the field name and click on ‘ CodingForAddition’ icon.
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 3/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
Note:
We have used a function module to easily calculate the duration between two Dates and Times.
This might look complex initially for beginners, but if you try it is simple application to understand.
One data type ‘duration’ (type i) declared here for temporary use in this code, because we import the duration
from FM in this form (seconds).
So, we got the value here for the additional field, we defined (in the form of seconds). To convert the same into
Hrs the last line of coding used.
(In other situations, the additional-field value calculation might be much simpler like some arithmetic expression
of few standard fields. The coding will be done accordingly)
All done. Now, you can drag this mnthr into desired Field Group on the right, to have this field in SQ01 for
reports.
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 4/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
Then,
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 5/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
Now go to the fields which are the components of the formula to calculate your duration (mnthr)
We know they are Required Start Date & Time and Required End Date & Time.
(I need not mention that these fields have come from the VIQMEL table fields selected in Infoset, SQ02)
And identify them with some Short names like shown below.
Now let us create our Local field (Additional field) mnthr, as under.
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 6/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
Now we need to give our code in the Calculation formula seen at the bottom.
If our code is simple we can give it in this screen itself. If it contains more if s then we need to click on Complex
Calculation button and to give the full code. (Our present case needs to go here)
So now, are giving the following code in the complex calculation screen.
(Note that what we mention against ‘Condition’ fields here, are nothing but ‘IF’ in ABAP coding.)
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 7/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
You may try to understand the logic (Condition vs Formula) given above, so that the formula giving would be
easier for your other requirements.
Select this field by ticking the Check-box in the Field selection screen to have it in the Basic List Fields.
Alert Moderator
(Also we need to select this field in Basic List screen too as we always do.)
Assigned tags
Now this field will appear in the Local Fields node of the Basic list screen of SQ01.
PLM Enterprise Asset Management (EAM)/Plant Maintenance (PM)
All done.
Infoset Queries:
In an InfosetCollection
query, we of important
can have posts
user fields derived from both SQ02 and SQ01.
By K Jogeswara Rao , May 02, 2014
A user field created in SQ02 would appear in ‘Additional Fields’ node and a user field created in SQ01
About Custom Field-Names and Text-Fields in Infoset Queries
would appear in ‘Local Fields’ node in the Basic List screen (SQ01).
By K Jogeswara Rao , Mar 02, 2014
The above narration mainly illustrates the procedure to have user defined fields. A little complex example has
Making of Boxed Reports for BOMs (using LDBs in Infoset Query)
been demonstrated here, so that simple requirements can be easily met.
By K Jogeswara Rao , Jul 21, 2014
The author wishes to compile some more useful points in the area of Infoset queries, into another document.
Related Questions
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 8/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
Related Questions
Thank you
PM Module (IW31,2,3) User Exit to validate Start constraints and End constraints fields.
By ASHISH PARWE , Jan 10, 2018
PS: The link given here will be of use to Infoset Query lovers: Infoset Queries: Collection of important posts
43 Comments
Akhilesh Singh
Former Member
Nice Document.
Regards,
Bhanu.
Srinu S
Ravi Prakash
Ravi Prakash
Former Member
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 10/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
Former Member
Ivan
Former Member
Would you mind to explain how we can concatenate 2 fields in a given table and check that value against
another table field so that only the matched records are displayed in the report output.
Thanks,
vamsi
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 11/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
I hope you know about selecting right data type while creating Additional field, depending upon the fields you
are concatenating and checking. (Concatenate only works for Character data types)
Hi Vamsi,
Jogeswara Rao K
Former Member
I have a question that I haven’t seen answered completely before regarding the use of the standard date
selection field when using HR ad-hoc queries.
The problem we are trying to solve concerns employee service years and months.
We have 2 dates held in IT0041. Datetype=01 holds the current start date and 02 holds the continuous service
date which is always less than or equal to the 01 date.
What we need to code is the difference, in years and months, between the continuous service date in
datetype=02 and the date entered using the standard HR Ad-hoc query selection.
What we are struggling with is how to reference the date, or dates, entered when running the query.
Normally ad-hoc HR queries are run as of Today but can be run as of a key date in the past or future. In this
case the contonuous service years and months will vary depending upon the date entered. Although a date
range selection could be entered, this would not normally be done with the length of service query, only a sing
date.
So, any idea how the standard date selection field(s) can be referenced in the code behind an additional field
(this would most probably be done in the Infoset) ?
Thanks
Alan
Lik (0) Al t M d t
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 12/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
Like (0) Alert Moderator
Though not conversant with HR area, I tried to understand the issue. Broadly it is about taking a date field
value from the selection screen into the code for duration calculation. If it is so this will be possible if the date
fields are from tables you are using in the infoset.
Now take both the date fields (DATE1 and DATE2) into the selection screen in SQ02 (not from SQ01).
If you have doubts about this please refer Tip4 the other document for this.
Use the following code in the code for this additional field :
If any of the date fields is not from the tables, then it might be difficult to address.
Jogeswara Rao K
Former Member
I checked the Infoset Selections and found 62 entries, with a mix of SelCrit and Parameters, and chose one
called PNPDISBD to test with.
Created an additional field and set this field to PNPDISBD using additional code.
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 13/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
Ran my test query with the standard HR selection option of Today and the correct date was populated in my
field.
Re-ran with the standard HR selection option of current month and the correct start of month date was
populated.
Re-ran with the standard HR selection option of Key Date of 31.03.2014 and this was the date that was
populated.
So many thanks for your help and your link to the 10 Useful Tips document, that is also very good.
Regards
Alan
Regards
Jogeswara Rao K
Former Member
Former Member
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 14/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
Former Member
Former Member
I have faced a issue that some of duration calculation reqired selection date in selcetion screen.
cf-
How can I get or add the date in infoset and Is it possible to use your documentation ?
Thanks
-In infoset, Additional fields can not be taken into selections (obviously)
-So I created an additional field, seldate (date format) and taken into field group.
Then, in SQ01, I created a local field say dtdiff. (char8 ) and gave formula to it as
seldate – budat
(you know that these two names are shortnames given to the original fields)
I have taken seldate into both selection screen and List screens
But I doubt this works, due to one obvious constraint that how the value will pass to the sledate selection field
Regards
Jogeswara Rao K
Former Member
I had a similar issue (see reply on 20-Nov-2013) where I was able to use the standard selection fields.
These are accessed from within SQ02 of your Infoset. Goto > Selections.
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 16/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
I was then able to use these fields, once I found the correct one, as part of a calculation and as a parameter to
a FM.
Alan
Good News, I got the solution. Though this is a confined space to answer. I’ll try.
SQ02
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 17/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
2. In the Extras – Selections, create a parameter PDATE as under: (sel No. 10)
(Do not get confused, I gave same descriptions for seldate and pdate)
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 18/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
SQ01
Give Short names for fields BUDAT and SELDATE as shown here.
Create a Local field DATEDIFF as shown below.(see the Calculation formula given)
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 19/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 20/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
Jogeswara Rao K
Former Member
As a result , It is extracted and dislplayed well even though Selction date was not key in selection screen(This
field was dispressed in layout).
Former Member
I have created the User Group , Infoset and Query in standard area then copied to global area as per the
requirement.Now I had created the varinat for the query and trying to assign the same Variant for T.code in
se93 but it is showing erro messgae as” there are no variants for screen 1000″.
Regards,
San.
Because, your query is not related to the document topic, request you to open a discussion thread (preferably
in ABAP space).
As far the query is concerned it is difficult to make-out the untold parts. Whether the screen number inside the
variant is different? (Check it). Also cross check with a direct case to ascertain that the trouble is related to cop
from one space to other.
Former Member
How to control multiple records in the query.We have created the query for Bank details and It0009 is having
only one valid record. In this query we have added It000, It0001,it0041 and it0006.when we run the report for
other period it is displaying more than one record but It0009 is having only one record.
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 22/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
Regards,
santhosh
This needs usage of syntax Delete Adjacent Duplicates’ which needs the specification of Internal table and tha
is the root problem. Accessing the internal table in Queries is not straight forward. You’ll find several threads in
SCN on this topic, but I didn’t find any with a solution.
Former Member
yes even I could not find the solution for it from long time.
A. Pillai
– Archana
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 23/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
Former Member
-Kiran
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 24/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
Former Member
Wonder full.. Thanks a lot, for sharing such a detailed and valuable info !!
I am looking for a way to get the report with ‘Company code+ customer+ year => Total of Open Items (single
field with sum of all open items per customer; single row per customer)’
Can you please guide me in this… have tried my best, but I was not successful
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 25/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
Goo luck
Former Member
Thanks
2. When it is working in other clients and not working in PRD means, some reason like domain/data element o
one or more of these Z-fields was not transported to PRD.
3.This place is not a convenient OR right place for such discussions because of several constraints like
difficulty in attaching images.
4. Also, because of point no.2 this query does not relate to the subject of the present document.
So it is advised to start a discussion with more details like error screen etc, preferably in ABAP space (or in the
function space SD/PP).
Former Member
I have a problem about additional field. Could you please help to solve the below issue?!
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 26/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
I have added a new additional fields in ME80FN and set this additional fields as a selection field as well. When
I try to execute the report with “Max. no. of hits” and selection of the additional fields, the number of result
records is incorrect.
Case 1:
Result:-
Case 2:
Result:-
Case 3:
Result:-
Seems the report extracted the first 100 records first, and then filter this first 100 records with the additional records
How can I extract the first 100 records with the “additional field” and “max no. of hits”?!
Thanks a lot!
Best Regards,
Eva
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 27/28
16/9/2019 Infoset Query: User Defined Fields | SAP Blogs
https://blogs.sap.com/2013/10/24/infoset-query-user-defined-fields/ 28/28