SlideShare a Scribd company logo
1 of 22
Download to read offline
ABAP QUERY – AN EXAMPLE
Applies To :
ECC 5.0
Created On :
18.12.2007
Author :
Sylvia Chandra
Company :
Telco Company
Summary :
This article will introduce you about ABAP Query and explain how to
create an ABAP Query based on a case scenario.
Table Of Contents
What Is ABAP Query ? …………………………………………………………………………. 1
A Case Scenario ………...………………………………………………………………………… 2
Creating ABAP Query ...………………………………………………………………………… 3
Result OF ABAP Query ..………………………………………………………………………. 4
Tips And Tricks …………………………………………………………………………………….. 5
What Is ABAP Query
A tool to generate report without ABAP coding.
All you need is to join the table and drag and drop field that you
wish to occur in the report.
Type of reports provided by ABAP Query :
1. Basic List
Simple Report.
2. Statistics
Report containing statistical functions like Average & Percentage.
3. Ranked List
Report written for analytical purpose.

A Case Scenario
There is a request to generate a report display who should release a
PO and message status of the PO.
The selections are based on :
Date on which the record was created
Purchasing Organization
Purchasing Group
Release Code
Vendor’s Account Number
Purchasing Document Type
For example :
We would like to display all PO which was created on a certain date.
With information about who should release the PO or who is the latest
releaser (for PO that has been full release) and the message type of
the PO (has been print, mail, fax).

Creating ABAP Query
Now, we come to step in creating ABAP Query. There are 3 steps :
1. Create User Group (SQ03)
Specify the users who should be authorized to run the query.
2. Create Infoset (SQ02)
Indicates from which part of the SAP database the data is going
to be retrieved and how the data is to be retrieved by the query.
3. Create Queries (SQ01)
Create the query and arrange the layout.
Here are the detail explanation of each step :
Create User Group (SQ03)
Go to SQ03 to create User Group

Clik Assign users and Infosets
Assign user to this user group.
Create Infoset
This report need information about PO, PO releaser and PO Message
Status. So that the table relation could be describe as below :

Release
Strategy

T16FV,
T16FS

Output
Status

NAST

PO

EKKO
Go To SQ02 to create Infoset
Give the title of the Infoset.
On Table join using basis table enter the basic table that u want
to join (for this case example we want to join several table with
basic table is T16FV, because the selection based on release
code and T16FV is a Release Prerequisites table).
Join The Table
Give a relation between the tables that you are going to join.
Choose The Field For Display
Choose field (from tables you have joined before) that you would
like to display.
Create Additional Fields
Create additional fields if you need them.
Create Coding
You can add some coding in some section. Click the button
inside the red circle.

On this case I add coding at code section:

•

•

DATA

TABLES : T16FS, NAST.
DATA : condition(5) TYPE c,
ld_frgc1 LIKE t16fs-frgc1,
ld_kschl LIKE nast-kschl.
*
ctrneu TYPE i,
*
ctrneu2 TYPE i,
*
ctrneu3 TYPE i.

Record Processing

CLEAR : NEU, NEU1, NEU2.
SELECT kschl INTO ld_kschl FROM nast
WHERE kappl = 'EF' AND objky = ekko-ebeln
AND ( kschl = 'NEU' OR kschl = 'NEU1' OR kschl = 'NEU2' )
AND spras = 'E' AND vstat = '1'.
IF sy-subrc = 0.
IF ld_kschl = 'NEU'.
NEU = 'X'.
ELSEIF ld_kschl = 'NEU1'.
NEU1 = 'X'.
ELSEIF ld_kschl = 'NEU2'.
NEU2 = 'X'.
ENDIF.
ENDIF.
ENDSELECT.
*
*

ctrneu = ctrneu2 = ctrneu3 = 0.
CLEAR : NEU, NEU2, NEU3.
IF T16FV-frggr IS NOT INITIAL AND T16FV-frgsx IS NOT INITIAL.
CASE EKKO-frgzu.
WHEN ' '.
condition = 'frgc1'.
WHEN 'X'.
condition = 'frgc2'.
WHEN 'XX'.
condition = 'frgc3'.
WHEN 'XXX'.
condition = 'frgc4'.
WHEN 'XXXX'.
condition = 'frgc5'.
WHEN 'XXXXX'.
condition = 'frgc6'.
WHEN 'XXXXXX'.
condition = 'frgc7'.
WHEN 'XXXXXXX'.
condition = 'frgc8'.
WHEN 'XXXXXXXX'.
condition = 'frgc8'.
ENDCASE.
SELECT SINGLE (condition) INTO ld_frgc1
FROM t16fs
WHERE frggr = T16FV-frggr AND frgsx = T16FV-frgsx.
IF ld_frgc1 IS INITIAL.
CASE EKKO-frgzu.
WHEN 'X'.
condition = 'frgc1'.
WHEN 'XX'.
condition = 'frgc2'.
WHEN 'XXX'.
condition = 'frgc3'.
WHEN 'XXXX'.
condition = 'frgc4'.
WHEN 'XXXXX'.
condition = 'frgc5'.
WHEN 'XXXXXX'.
condition = 'frgc6'.
WHEN 'XXXXXXX'.
condition = 'frgc7'.
WHEN 'XXXXXXXX'.
condition = 'frgc8'.
ENDCASE.
SELECT SINGLE (condition) INTO ld_frgc1
FROM t16fs
WHERE frggr = T16FV-frggr AND frgsx = T16FV-frgsx.
ENDIF.
*

IF T16FV-frgco <> ld_frgc1.
CLEAR : EKKO, T16FV.
DELETE : EKKO, T16FV.
ELSE.
MODIFY EKKO.
ENDIF.
ENDIF.

Create Queries
Go to SQ01 to create Queries
Firstly, choose the Infoset that you are going to use for this
query.

Then give a title to this Query.
Select Field that would be display by this Query.
Started by choosing the Field Group.
Thus select The field.
Field For Selection
Select field that will be used for the selection screen.
Furthermore, you can define the sequence of these fields.
Basic List Display
Arrange how you wish you report to be displayed.
Result Of ABAP Query
Selection Screen
Report Layout
Tips And Tricks
Complex Report
Every Query actually make a program. Find the program name then
copy it to new program then modify it as you wish.

Infoset cannot be found
If you find difficulty in finding an Infoset for a query :
Just go to SQ03, enter the user group for the query then click
Assign Users And Infoset Buttons.
Click Assign Infosets Button.
At Infoset you would like to use in SQ01, untick and tick again the
Infoset. Then click save button.

Now, all step has been describe. It’s time for you to try.
Good Luck.

More Related Content

Similar to ABAP QUERY EXAMPLE REPORT

ContentsCOSC 2436 – LAB4TITLE .............................docx
ContentsCOSC 2436 – LAB4TITLE .............................docxContentsCOSC 2436 – LAB4TITLE .............................docx
ContentsCOSC 2436 – LAB4TITLE .............................docxdickonsondorris
 
The ultimate-guide-to-sql
The ultimate-guide-to-sqlThe ultimate-guide-to-sql
The ultimate-guide-to-sqlMcNamaraChiwaye
 
Exceljet excel shortcuts_160623
Exceljet excel shortcuts_160623Exceljet excel shortcuts_160623
Exceljet excel shortcuts_160623Rishav Singh
 
100 COOL MAINFRAME TIPS
100 COOL MAINFRAME TIPS100 COOL MAINFRAME TIPS
100 COOL MAINFRAME TIPSNirmal Pati
 
Applied Econometrics assignment3
Applied Econometrics assignment3Applied Econometrics assignment3
Applied Econometrics assignment3Chenguang Li
 
Elementary Data Analysis with MS Excel_Day-4
Elementary Data Analysis with MS Excel_Day-4Elementary Data Analysis with MS Excel_Day-4
Elementary Data Analysis with MS Excel_Day-4Redwan Ferdous
 
The ultimate-guide-to-sql
The ultimate-guide-to-sqlThe ultimate-guide-to-sql
The ultimate-guide-to-sqlMcNamaraChiwaye
 
Essential Biology 3.6, 7.6, C2 Enzymes
Essential Biology 3.6, 7.6, C2 EnzymesEssential Biology 3.6, 7.6, C2 Enzymes
Essential Biology 3.6, 7.6, C2 EnzymesStephen Taylor
 
Collect 50 or more paired quantitative data items. You may use a met.pdf
Collect 50 or more paired quantitative data items. You may use a met.pdfCollect 50 or more paired quantitative data items. You may use a met.pdf
Collect 50 or more paired quantitative data items. You may use a met.pdfivylinvaydak64229
 
fyp....fyp.....fyp.....
fyp....fyp.....fyp.....fyp....fyp.....fyp.....
fyp....fyp.....fyp.....VisualBee.com
 
Bis 345-final-exam-guide-set-1-new
Bis 345-final-exam-guide-set-1-newBis 345-final-exam-guide-set-1-new
Bis 345-final-exam-guide-set-1-newassignmentcloud85
 
Introduction to MATLAB Programming and Numerical Methods for Engineers 1st Ed...
Introduction to MATLAB Programming and Numerical Methods for Engineers 1st Ed...Introduction to MATLAB Programming and Numerical Methods for Engineers 1st Ed...
Introduction to MATLAB Programming and Numerical Methods for Engineers 1st Ed...AmeryWalters
 
VelociDoc 16.1 Release Notes for LinkedIn
VelociDoc 16.1 Release Notes for LinkedInVelociDoc 16.1 Release Notes for LinkedIn
VelociDoc 16.1 Release Notes for LinkedInRich Johnson
 
Data Structures & Algorithms Coursework Assignment for Sem.docx
Data Structures & Algorithms Coursework Assignment for Sem.docxData Structures & Algorithms Coursework Assignment for Sem.docx
Data Structures & Algorithms Coursework Assignment for Sem.docxsimonithomas47935
 
@RISK Unchained Webinar
@RISK Unchained Webinar@RISK Unchained Webinar
@RISK Unchained WebinarAndrew Sich
 
Basics in algorithms and data structure
Basics in algorithms and data structure Basics in algorithms and data structure
Basics in algorithms and data structure Eman magdy
 

Similar to ABAP QUERY EXAMPLE REPORT (20)

ContentsCOSC 2436 – LAB4TITLE .............................docx
ContentsCOSC 2436 – LAB4TITLE .............................docxContentsCOSC 2436 – LAB4TITLE .............................docx
ContentsCOSC 2436 – LAB4TITLE .............................docx
 
The ultimate-guide-to-sql
The ultimate-guide-to-sqlThe ultimate-guide-to-sql
The ultimate-guide-to-sql
 
FINAL PROJECT
FINAL PROJECTFINAL PROJECT
FINAL PROJECT
 
Exceljet excel shortcuts_160623
Exceljet excel shortcuts_160623Exceljet excel shortcuts_160623
Exceljet excel shortcuts_160623
 
100 COOL MAINFRAME TIPS
100 COOL MAINFRAME TIPS100 COOL MAINFRAME TIPS
100 COOL MAINFRAME TIPS
 
1746nm002
1746nm0021746nm002
1746nm002
 
Applied Econometrics assignment3
Applied Econometrics assignment3Applied Econometrics assignment3
Applied Econometrics assignment3
 
Elementary Data Analysis with MS Excel_Day-4
Elementary Data Analysis with MS Excel_Day-4Elementary Data Analysis with MS Excel_Day-4
Elementary Data Analysis with MS Excel_Day-4
 
The ultimate-guide-to-sql
The ultimate-guide-to-sqlThe ultimate-guide-to-sql
The ultimate-guide-to-sql
 
Essential Biology 3.6, 7.6, C2 Enzymes
Essential Biology 3.6, 7.6, C2 EnzymesEssential Biology 3.6, 7.6, C2 Enzymes
Essential Biology 3.6, 7.6, C2 Enzymes
 
Collect 50 or more paired quantitative data items. You may use a met.pdf
Collect 50 or more paired quantitative data items. You may use a met.pdfCollect 50 or more paired quantitative data items. You may use a met.pdf
Collect 50 or more paired quantitative data items. You may use a met.pdf
 
fyp....fyp.....fyp.....
fyp....fyp.....fyp.....fyp....fyp.....fyp.....
fyp....fyp.....fyp.....
 
somhelpdoc
somhelpdocsomhelpdoc
somhelpdoc
 
Bis 345-final-exam-guide-set-1-new
Bis 345-final-exam-guide-set-1-newBis 345-final-exam-guide-set-1-new
Bis 345-final-exam-guide-set-1-new
 
Parallel sysplex
Parallel sysplexParallel sysplex
Parallel sysplex
 
Introduction to MATLAB Programming and Numerical Methods for Engineers 1st Ed...
Introduction to MATLAB Programming and Numerical Methods for Engineers 1st Ed...Introduction to MATLAB Programming and Numerical Methods for Engineers 1st Ed...
Introduction to MATLAB Programming and Numerical Methods for Engineers 1st Ed...
 
VelociDoc 16.1 Release Notes for LinkedIn
VelociDoc 16.1 Release Notes for LinkedInVelociDoc 16.1 Release Notes for LinkedIn
VelociDoc 16.1 Release Notes for LinkedIn
 
Data Structures & Algorithms Coursework Assignment for Sem.docx
Data Structures & Algorithms Coursework Assignment for Sem.docxData Structures & Algorithms Coursework Assignment for Sem.docx
Data Structures & Algorithms Coursework Assignment for Sem.docx
 
@RISK Unchained Webinar
@RISK Unchained Webinar@RISK Unchained Webinar
@RISK Unchained Webinar
 
Basics in algorithms and data structure
Basics in algorithms and data structure Basics in algorithms and data structure
Basics in algorithms and data structure
 

Recently uploaded

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 

Recently uploaded (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 

ABAP QUERY EXAMPLE REPORT

  • 1. ABAP QUERY – AN EXAMPLE Applies To : ECC 5.0 Created On : 18.12.2007 Author : Sylvia Chandra Company : Telco Company Summary : This article will introduce you about ABAP Query and explain how to create an ABAP Query based on a case scenario.
  • 2. Table Of Contents What Is ABAP Query ? …………………………………………………………………………. 1 A Case Scenario ………...………………………………………………………………………… 2 Creating ABAP Query ...………………………………………………………………………… 3 Result OF ABAP Query ..………………………………………………………………………. 4 Tips And Tricks …………………………………………………………………………………….. 5
  • 3. What Is ABAP Query A tool to generate report without ABAP coding. All you need is to join the table and drag and drop field that you wish to occur in the report. Type of reports provided by ABAP Query : 1. Basic List Simple Report. 2. Statistics Report containing statistical functions like Average & Percentage. 3. Ranked List Report written for analytical purpose. A Case Scenario There is a request to generate a report display who should release a PO and message status of the PO. The selections are based on : Date on which the record was created Purchasing Organization Purchasing Group Release Code Vendor’s Account Number Purchasing Document Type For example : We would like to display all PO which was created on a certain date. With information about who should release the PO or who is the latest releaser (for PO that has been full release) and the message type of the PO (has been print, mail, fax). Creating ABAP Query Now, we come to step in creating ABAP Query. There are 3 steps : 1. Create User Group (SQ03) Specify the users who should be authorized to run the query. 2. Create Infoset (SQ02) Indicates from which part of the SAP database the data is going to be retrieved and how the data is to be retrieved by the query. 3. Create Queries (SQ01) Create the query and arrange the layout.
  • 4. Here are the detail explanation of each step : Create User Group (SQ03) Go to SQ03 to create User Group Clik Assign users and Infosets Assign user to this user group.
  • 5. Create Infoset This report need information about PO, PO releaser and PO Message Status. So that the table relation could be describe as below : Release Strategy T16FV, T16FS Output Status NAST PO EKKO
  • 6. Go To SQ02 to create Infoset Give the title of the Infoset. On Table join using basis table enter the basic table that u want to join (for this case example we want to join several table with basic table is T16FV, because the selection based on release code and T16FV is a Release Prerequisites table).
  • 7. Join The Table Give a relation between the tables that you are going to join.
  • 8. Choose The Field For Display Choose field (from tables you have joined before) that you would like to display.
  • 9. Create Additional Fields Create additional fields if you need them.
  • 10. Create Coding You can add some coding in some section. Click the button inside the red circle. On this case I add coding at code section: • • DATA TABLES : T16FS, NAST. DATA : condition(5) TYPE c, ld_frgc1 LIKE t16fs-frgc1, ld_kschl LIKE nast-kschl. * ctrneu TYPE i, * ctrneu2 TYPE i, * ctrneu3 TYPE i. Record Processing CLEAR : NEU, NEU1, NEU2. SELECT kschl INTO ld_kschl FROM nast WHERE kappl = 'EF' AND objky = ekko-ebeln AND ( kschl = 'NEU' OR kschl = 'NEU1' OR kschl = 'NEU2' ) AND spras = 'E' AND vstat = '1'. IF sy-subrc = 0. IF ld_kschl = 'NEU'. NEU = 'X'.
  • 11. ELSEIF ld_kschl = 'NEU1'. NEU1 = 'X'. ELSEIF ld_kschl = 'NEU2'. NEU2 = 'X'. ENDIF. ENDIF. ENDSELECT. * * ctrneu = ctrneu2 = ctrneu3 = 0. CLEAR : NEU, NEU2, NEU3. IF T16FV-frggr IS NOT INITIAL AND T16FV-frgsx IS NOT INITIAL. CASE EKKO-frgzu. WHEN ' '. condition = 'frgc1'. WHEN 'X'. condition = 'frgc2'. WHEN 'XX'. condition = 'frgc3'. WHEN 'XXX'. condition = 'frgc4'. WHEN 'XXXX'. condition = 'frgc5'. WHEN 'XXXXX'. condition = 'frgc6'. WHEN 'XXXXXX'. condition = 'frgc7'. WHEN 'XXXXXXX'. condition = 'frgc8'. WHEN 'XXXXXXXX'. condition = 'frgc8'. ENDCASE. SELECT SINGLE (condition) INTO ld_frgc1 FROM t16fs WHERE frggr = T16FV-frggr AND frgsx = T16FV-frgsx. IF ld_frgc1 IS INITIAL. CASE EKKO-frgzu. WHEN 'X'. condition = 'frgc1'. WHEN 'XX'. condition = 'frgc2'. WHEN 'XXX'. condition = 'frgc3'. WHEN 'XXXX'. condition = 'frgc4'. WHEN 'XXXXX'. condition = 'frgc5'. WHEN 'XXXXXX'. condition = 'frgc6'. WHEN 'XXXXXXX'. condition = 'frgc7'.
  • 12. WHEN 'XXXXXXXX'. condition = 'frgc8'. ENDCASE. SELECT SINGLE (condition) INTO ld_frgc1 FROM t16fs WHERE frggr = T16FV-frggr AND frgsx = T16FV-frgsx. ENDIF. * IF T16FV-frgco <> ld_frgc1. CLEAR : EKKO, T16FV. DELETE : EKKO, T16FV. ELSE. MODIFY EKKO. ENDIF. ENDIF. Create Queries Go to SQ01 to create Queries Firstly, choose the Infoset that you are going to use for this query. Then give a title to this Query.
  • 13. Select Field that would be display by this Query. Started by choosing the Field Group.
  • 14. Thus select The field.
  • 15. Field For Selection Select field that will be used for the selection screen. Furthermore, you can define the sequence of these fields.
  • 16. Basic List Display Arrange how you wish you report to be displayed.
  • 17. Result Of ABAP Query Selection Screen
  • 19. Tips And Tricks Complex Report Every Query actually make a program. Find the program name then copy it to new program then modify it as you wish. Infoset cannot be found If you find difficulty in finding an Infoset for a query : Just go to SQ03, enter the user group for the query then click Assign Users And Infoset Buttons.
  • 20.
  • 22. At Infoset you would like to use in SQ01, untick and tick again the Infoset. Then click save button. Now, all step has been describe. It’s time for you to try. Good Luck.