Thursday 20 March 2014

SAP ABAP QUERY



ABAP QUERY
Step 1 : Create User Group – SQ03
Follow the menu path – SAP Menu -> Tools -> ABAP Workbench -> Utilities -> SAP Query -> User Groups
a) In the User Group : Initial Screen - 
- Enter User Group Code (self named)
- Click on “Create”
b) In the User Group (Code) : Create or Change pop-up window -
- Enter the User Group Description 
- Click on “Save”
c) In the Create Object Directory Entry pop-up window - 
- Click on “Local Object” button
- The User Group Created is Saved
Step 2 : Create User Group – SQ02
Follow the menu path – SAP Menu > Tools > ABAP Workbench > Utilities > SAP Query > Infosets
a) In the Infoset : Initial screen -
- Enter Infoset Code (self named)
- Click on “Create” button 
b) In the Infoset : Title & Database Screen - 
- Enter Description of Infoset in the “Name” field
- In the Data Source selection : Select appropriate Data Source by clicking the radio button
Source the data can either be multiple tables OR single table. There are 4 options for the user to select from
- Click on “Continue” (Enter)
- Selected Table gets displayed in the Infoset : Initial Screen
c) In the Infoset : Initial Screen - 
- Click on “Insert Table” button
d) In the Add Table Screen - 
- Enter the Table Name that is to be inserted
- Click “Continue” (Enter)
e) In the Infoset: Initial Screen - 
- Click on “Back” button
f) In the Field Group Defaults pop-up Screen - 
- Select Appropriate Field Group Option by clicking on the radio button
There are 3 options to select from. User can select Empty Field Group option and then select the data fields in the steps explained further.  Alternatively, User can select an option which clubs all the data fields from all the tables selected.
- Click “Continue” (Enter)
g) In the Change Infoset Screen - 
The left side lists the Tables that the user has selected in step b, c & d
- In the right side, system creates field groups, one for each table listed in the left part. Initially, the Field Groups are empty.
- In the Left Side, Click on the arror next to the table name and expand and display all the data fields in the table.
- Select a Data Field from the expanded Table view, which is to be added to the Field Group on the right.
- Select a Field Group on the right side, in which Data Field selected above has to be added.
- Right click on the Data Field selected and click on “Add Field to Field Group”.
- The selected Data Field gets added to the selected Field Group, which is indicated by an arrow next to the Field Group.
- Carry out the steps above to add the required Data Fields to the respective Field Groups
- After transferring Data Fields to Field Groups click on “Generate” button
h) In the Create Object Directory Entry Screen - 
- Click on “Logical Object” button to generate the infoset
i) In the Change Infoset Screen - 
- Click on the “Back” button
j) User is taken back to the “Infoset: Initial Screen” which displays the created Infoset record.
Step 3 : Assigning User Group to Infoset – SQ03
Follow the menu path – SAP Menu -> Tools -> ABAP Workbench -> Utilities -> SAP Query -> User Groups
a) In the User Groups : Initial screen - 
- Enter the User Group for which Infoset is to be assigned
- Click on “Assign Users & Infosets” button
b) In the User Group: Assign Users Screen -
- Click on “Assign Infosets” button
c) In the next screen, select the Infoset, which needs to be attached to the User Group selected
d) Click on the “Back” button
Step 4: Creating Query – SQ00 & SQ01
Follow the menu path – SAP Menu -> Tools -> ABAP Workbench -> Utilities -> SAP Query -> Queries
a) In the “Query from User Group: Initial Screen - 
- Click on “Other User Groups” button
- In the pop-up screen, User Groups, select the User Group for which the Query has to created. The pop-up screen closes.
- Enter the Query Code in the “Query” field
- Click on “Create” button
b) A pop-up screen “Restrict Value Range” shows the list of Infosets assigned to the User Group
- Select the Infoset for which Query has to be created
c) In the new screen Create Query: Title, Format - 
- Enter the Description of the Query in the “Title” field
- Click on the “Next Screen” button
d) In the Select Field Group” screen
- Select the Field Groups from which Data Fields have to be selected for the Output
- Click on the “Next Screen” button
e) In the “Select Field” screen - 
- Select the Data Fields which should appear in the output
- Click on the “Next Screen” button
f) In the Screen “Selection” -
- Select the Data Fields for the selection criteria
- Enter the sequence in which the selected fields would appear in the input screen of the query.
- Define if the selection criteria should be Single Value or Multiple Value Rangeby clicking in the appropriate check boxes
- Click on the “Basic List’ button
g) In the screen “Query Layout Design” - 
- Select the Output Fields from the Data Fields section by clicking the appropriate check box
- Change the sequence of Data Field columns if required
- Click on the “Test” button to test the query created
h) On the “Test Query” screen click “Continue”
i) In the “Query” screen -
- Enter the selection criteria
- Click on “Execute” button
j) Save the Query created
Step 5: Running the Query – SQ00
a) In the Query From User Group: Initial screen – 
b) Click on “Other User Groups” button to select the User Group
c) In the pop-up screen “User Groups” select the User Group
d) System lists all the queries created for the User Group
e) Select the appropriate Query
f) Click on “Execute” button
g) User is taken to the Selection screen
h) Enter the selection criteria and click on “Execute” button
i) System runs the query and gives the output