38
Create transaction for SAP-Query By Aswani Bharath. Dell Services 1) Open transaction SE93 2) Put object name ,sort text for your transaction 3) Choose radio button 5. Transaction with parameter.

SAP T Code or Quaries

Embed Size (px)

DESCRIPTION

SAP T Code or Quaries

Citation preview

Page 1: SAP T Code or Quaries

Create transaction for SAP-Query

By Aswani Bharath. Dell Services  

1)     Open transaction SE93  

2)     Put object name  ,sort text for your transaction

3)     Choose radio button 5. Transaction with parameter.  

Page 2: SAP T Code or Quaries

4)     Default value for transaction ‘START_REPORT’

5)     In bellow default value section insert default value

           SREPOVARI-REPORTTYPE      = AQ      "Parameter indicating Abap Query           D_SREPOVARI-REPORT           = ZY_CS_ALLSLS   "Query User group           D_SREPOVARI-EXTDREPORT= ZY_SLS_MST_001   "Query name  

  

  

6)     Save the transaction.  

Page 3: SAP T Code or Quaries

8) Execute the transaction.  

Page 4: SAP T Code or Quaries

Developing SAP Query for Task List Data Extraction

By Shoyeb Ahamad, Wipro Infotech

Purpose: To create an SAP query to extract task list data from system.

Scope: All task lists pertaining to Production and Planning; Routing (N), Master Recipe (2), Rate Routing (R)

Procedure:  

Follow the procedure step by step:  

Transaction Code SQVIMenu path Tools>Utilities>SQVI - QuickViewer

Create new Quick view  

Write the appropriate name of query

Page 5: SAP T Code or Quaries

 

After you click on create button, system will populate the following window, complete the details with right information

Once you have done with above steps you will get “Choose Data Source” screen. Here in the following step you need to connect different tables properly in order to get task list data.

Page 6: SAP T Code or Quaries

We are starting with MAPL (Assignment of Task Lists to Materials) table. Similarly, we need to take following tables in order to get the appropriate information.

PLKO (Task list – header)

PLPO (Task list - operation/activity)

PLAS (Task list - selection of operations/activities)

Page 7: SAP T Code or Quaries

CRHD (Work Center Header)

CRTX (Text for the Work Center or Production Resource/Tool)

MARA (General Material Data)

MAKT (Material Descriptions)  

Between PLPO and CRHD, the default link is with field OBJTY. You need to delete this link and create with PLPO-ARBID and CRHD-OBJID. For this click on ARBID in PLPO table and drag the cursor towards OBJID in CRHD table. Afterwards it should like

Page 8: SAP T Code or Quaries

After you finish with above activities the screen will look like

Following tables explain the link details between different tables used above:

Table 1MAPL

Table2PLKO

Table 3MARA

Page 9: SAP T Code or Quaries

PLNTY PLNTY  PLNNR PLNNR  PLNAL PLNAL  MATNR   MATNR

PLKO PLAS  PLNTY PLNTY  PLNNR PLNNR  PLNAL PLNAL  

PLAS PLPO  PLNTY PLNTY  PLNNR PLNNR  PLNKN PLNKN  

PLPO CRHD  ARBID OBJID  

CRHD CRTX  OBJID OBJID  

MARA MAKT  MATNR MATNR  

In the following steps, mainly you need to select which fields you want to see in selection screen and which one in output.

Page 10: SAP T Code or Quaries

Similarly select all those fields from table enlisted which you want to see in Selection and Display screen.

For example, you want to see following fields in Selection Screen

o Materialo Planto Task List Type

And following fields in output

Page 11: SAP T Code or Quaries

o Materialo Material Descriptiono Planto Groupo Group Countero Task List Descriptiono Usageo Statuso From Lot Sizeo UoMo To Lot Sizeo UoMo Operation/Activityo Work centero Work center descriptiono Operation short Texto Operation Base Quantityo UoMo Standard value1o UoM for Std value1o Standard value2o UoM for Std value2o Standard value3o UoM for Std value3o Setup Group Keyo Setup Group Category  

Note: As per your requirement, you can select/deselect additional fields in Quick viewer: Initial screen

It’s better to arrange Sort Sequence in order to get proper operation number in output for a combination of Group, Group Counter, Material, and Plant.

Page 12: SAP T Code or Quaries

Check and Save the Query.

Now it’s the time to see the result of efforts that you have put in to develop this query.

So execute the transaction.  

Page 13: SAP T Code or Quaries

and the Result of your efforts is  

Page 14: SAP T Code or Quaries

SAP Query

Step-by-step procedure in configuring SAP Query

SAP R/3 Query tools (SAP Query) are based on the following four main components:

Query Areas Query Groups InfoSets Administrative Decisions (Company-specific)

Configuration of the Query tools is done in the following manner:

Create Query Groups Assign Users to Query Groups Create InfoSets Assign each InfoSet to a Query Group.

Create Query Groups

Go to Transaction SQ03.

Ensure that you are in the correct SAP Query area by navigating to Environment Query Areas

Page 15: SAP T Code or Quaries

Select the “Standard Area (Client-specific).

Now in the main screen, enter the name of the Query Group in the User Group field and click on

CREATE

Enter the description of the User Group in the next popup that

appears.

User Group ZSAPTECH_GRP is created.

Assign Users to Query Groups

Click on the “Assign Users and InfoSets”

button

Page 16: SAP T Code or Quaries

Enter the SAP User-Ids of all the users you wish to include in the test group.

Click on SAVE to save your entries.

Go to transaction SQ02

        Ensure that you are in the correct SAP Query area by navigating to Environment  Query Areas

 

        Enter the name of the InfoSet you wish to create and click on CREATE. 

 

Page 17: SAP T Code or Quaries

        Enter the title and the logical database on the popup screen that

appears.   

We have used the LDB F1S (Flight bookings related) for our demo purpose. 

Page 18: SAP T Code or Quaries

        Change InfoSet screen

appears.   

        Expand the tree on the left hand side to view the fields in each table. As seen on the screen, the left side of the screen shows the tables and the fields. The right side displays the field groups.

        Now we need to assign fields to the field groups. These field groups will display in the SAP Query tool during reporting. Please note that only the fields that are included here will be available for field selection in the SAP Query Tool that uses this infoSet as a data source.

        Select the field group on the right side and then drag and drop the fields from the left side to this field

Page 19: SAP T Code or Quaries

group.        When all the required fields are added, click on SAVE.

        Now generate the InfoSet by clicking on GENERATE. 

Attach each InfoSet to a Query Group

        Go to transaction SQ02

        Enter the InfoSet name created above and click on “User Group Assignment” button. 

 

Page 20: SAP T Code or Quaries

 

        Select the query group “ZSAPTECH_GRP” from the above list and click on SAVE.

 

Working with Infosets, User Groups, Query in detail

By Suraj Kumar Pabbathi, YASH Technologies

In this document we shall cover Topic#2. For topic#1, click here.  

Page 21: SAP T Code or Quaries

Infosets Components 

      InfoSets are special views of data sources.

      An InfoSet describes which fields of a data source can be reported on in queries.

Page 22: SAP T Code or Quaries

      InfoSets are assigned to user groups.

      End-users are able to work only with those InfoSets that are relevant to their particular area, as designated by the role or user group that they are assigned to.

      Eg: Vendor master data can be important in purchasing as well as in accountancy. The relevant InfoSet is assigned to both roles/user groups. This means that queries based on this InfoSet can be copied and executed by both groups. 

Creating and changing Infosets 

 

Creating Infosets – Prerequisites

Assign Data sources

Infoset Display/Change

Definition of field groups

Obtaining additional information

Creating Selections

Further Codes

Application Specific Enhancements

 Creating Infosets – Prerequisites 

The following questions help in meeting the prerequisites of creating an infoset.

      Which data source corresponds to the requirements?

            For example: Material reports in Materials Management

            Document reports in Financial Accounting

      Which fields do you need to include in the InfoSet?

      Do you need additional information which is not available in the data source? (This means you are going to have to connect additional tables and the definitions of additional fields.)

      Do you need parameters and selection criteria? (Parameters and selection criteria appear on the selection screens of queries that are created using the InfoSet).

      Do you need to include any particular measures such as access protection?

      Do you need to be able to change the long texts and headers for the selected fields? 

Page 23: SAP T Code or Quaries

Assign Data sources 

1. Name2. Authorization group: This means that only users authorized to execute programs from this

authorization group are able to execute these queries. Use Tcode: AUTH_DISPLAY_OBJECTS3. Choose Data Source:

     Table join using a table: Is used when Query is prepared for retrieving data from more than one database tables having relationships.

     Reading tables directly: Is used when Query is prepared for retrieving data from one table.

       Logical databases: Is used when Query is prepared for retrieving data based on a Logical database (LDB)

4. Using programs to retrieve data: Here a program can be written with own logic. Declaration in data section of the program will help the query to select the elements of data to be retrieved from database. As per the logic, data is validated, processed. The selection screen can be prepared in Query and data is retrieved for output.

     Sequential datasets

4. Options

      No Automatic Text Recognition

      Fixed Point Arithmetic 

Display/Change Infoset 

      The InfoSet display allows you to examine or change the structure of the InfoSet.

      Assigning additional tables

      Creating additional fields

      Creating additional Structures

      Extras

      Selections

      Further Code

      Application Specific Enhancements 

Page 24: SAP T Code or Quaries

Definition of field groups 

      A field group combines related fields together into a meaningful unit.

      Fields must be assigned to a field group before they can be used in queries.

      Include all table fields

      Include key fields

      Create empty field groups 

Note:

Logical Database having more than 4 structures has different way of creating field groups.Eg: PNP 

User Groups Components 

      The User Groups component is used to maintain user groups. The system administrator uses it to set up the work environment for end-users.

      Every user assigned to the user group is able to execute the query.

      Users are not allowed to modify queries from other user groups, although they may, under certain circumstances, copy and execute

 

Page 25: SAP T Code or Quaries

 

1.Creating infosets or functional areas

       Tcode-SQ02 

 

Page 26: SAP T Code or Quaries

 

Page 27: SAP T Code or Quaries

 

 

Page 28: SAP T Code or Quaries

 

 

Page 29: SAP T Code or Quaries

 

2. To create user groups and assign to infosets

      Tcode-SQ03

 

Page 30: SAP T Code or Quaries

  

 

Page 31: SAP T Code or Quaries

 

3. To create a query 

      Tcode-SQ01 

Page 32: SAP T Code or Quaries

 

 

Page 33: SAP T Code or Quaries

 

 

Steps to create selection criteria to the query

      Tcode-SQ01

Page 34: SAP T Code or Quaries

 

 

Page 35: SAP T Code or Quaries

 

 

Page 36: SAP T Code or Quaries