Вы находитесь на странице: 1из 1

12/7/2017 ABAP Query - ABAP Development - SCN Wiki

Getting Started Store

Community WIKI SAP Community Welcome, Guest Login Register Search the Community

ABAP Development / FAQ

ABAP Query
Created by Mohamed Azharuddin, last modified by Smruti Ranjan Mohanty on Oct 09, 2013

ABAP/4 Query - Retrieving data using a program .

ABAP/4 Query is a pow erful report to generate simple reports. Mainly, there are four different w ays to define data source in ABAP/4 query.

The four methods are

1. Table join using basis table.


2. Direct read of table.
3. Logical database
4. Data retrieval by program (Internal Program / External Program)

This document describes how ABAP/4 Query retrieves data using an External program.
In order to create an ABAP query , one has to do the follow ing.

1. Create an User group.


2. Create a Functional Area
3. Assign the User group to the Functional Area
4. Create the query based on the functional area created.
You can create or execute these, using the transactions below .
SQ01 for Query

SQ02 for Functional Area.

SQ03 for User Group.


First Step is to create a dictionary structure . Include all the fields in this structure that you w ant to output.

then
Error rendering macro 'code': Invalid value specified for parameter 'lang'

REPORT ZEXAMPLE.
TABLES: BKPF, ZEG_STRUCT.
DATA : BEGIN OF ITAB OCCURS 0,
BELNR LIKE BKPF-BELNR,
GJAHR LIKE BKPF-GJAHR,
MONAT LIKE BKPF-MONAT,
BUKRS LIKE BKPF-BUKRS,
END OF ITAB.
SELECTION-SCREEN BEGIN OF BLOCK INPUT WITH FRAME TITLE TEXT-T01.
PARAMETERS: P_CODE LIKE BKPF-BUKRS.
SELECTION-SCREEN END OF BLOCK INPUT.

*Query head

<Query_head>
Error rendering macro 'code': Invalid value specified for parameter 'lang'

START-OF-SELECTION.
SELECT BELNR GJAHR MONAT BUKRS FROM BKPF INTO TABLE ITAB
WHERE BUKRS = P_CODE.
LOOP AT ITAB.
CLEAR YOUTPUT_STRUCT.
MOVE ITAB TO YOUTPUT_STRUCT.
ENDLOOP.
Query body
<Query_body>

Save and Activate this report. Then go to SQ02 transaction to create an infoset. Infoset ->Generate. Go to SQ03 to create a user group. Enter user group name and click on Create button.Enter
description and save it in your development class.In the next screen , click on 'Assign Infosets' button. Here you select the infoset that you have created as show n below and save it. Go to SQ01.
Select the user group that you have created. Then enter the query name and create. It w ill show the list of infoset that you have created. Choose the infoset you w ant. Choose BasicList Button In
the right side of the screen you adjust the output field w idth, background color etc.Go back and select the menu option Query -> Generate Program.Then Execute this Query.
No labels

Contact Us SAP Help Portal


Privacy Terms of Use Legal Disclosure Copyright
Follow SCN

https://wiki.scn.sap.com/wiki/display/ABAP/ABAP+Query 1/1

Вам также может понравиться