Sie sind auf Seite 1von 13

HOW IT WORKS (/HOW-IT-WORKS/)

BE A FIXER (/BE-A-FIXER/)
RESOURCES (/RESOURCES/)
ABOUT (/ABOUT/)

LOGIN (HTTP://APP.ERPFIXERS.COM/LOGIN)

September 14, 2016 (/blog/2016/9/12/using-abap-coding-in-sap-standard-query)


Search

Using ABAP Coding In SAP Standard Query (https://www.facebook.com/ERPfixers/)


(https://twitter.com/ERPfixers)
(https://www.linkedin.com/company/erpfix
(https://plus.google.com/u/0/b/1136

(/blog/2016/9/12/using-abap-coding-
in-sap-standard-query) HAVE A SIMILAR
Roberto Caas (/blog/?author=57d6f010b8a79b87928f540a) Tips / How To (/blog/? SAP QUESTION?
category=Tips+%2F+How+To), Modules (/blog/?category=Modules)

POST A REQUEST
(HTTP://APP.ERPFIXERS.COM/POSTAREQUEST)

GET MORE
AWESOME
CONTENT!
Sign up for our newsletter.

First Name

Last Name

Email Address
It is hard to find an easy explanation about ABAP coding in standard queries. In some cases
you cant easily attach additional information to a field in a Query or you need to call and ABAP
SIGN UP
function module to do an specific calculation, then adding coding to a local field may be a
suitable solution. To demonstrate this we are going to make a standard query with one table
using ABAP Coding on it, instead of creating an infoset with three tables (inner join) as usual.
In order to illustrate this Im going to create a query using MARD table (Materials per Plant)
adding names for Plant and Storage Location with ABAP coding. MARD table includes fields
WERKS (Plant) and LGORT (Storage Location) and their names are stored on tables T001W and
T001L respectively. A previous knowledge of standard SAP Query and basic ABAP
programming is needed for plenty understanding of this guide .

Infoset Creation
First we launch SQ02 in SAPs command line to load Infoset Initial Screen:

Then select:

Fill Infoset Name and Direct read of table:

After filling data on screen aboveit is necessary save infoset:


Here second option is marked and click on the button:

Here we proceed to create a custom field in the query clicking on:

For field creation click on button:


We are going to create 2 fields PLANTN (plant name) and STORN (storage location name):

Click on button:

On this screen it is necessary to fill Long text and Header. Field format has to be declared too.
There are two ways declaring field format (using a direct field type or using a text):
As a default first field declared get the first number of Sequence Code. Finally click on button
to save field:

Then we proceed to create the next field STORN using the same process described above
(assigning sequence number 2):
After click on

we have:

In my practice I have found that if you want to include additional coding for each field at every
select iteration code should be written in the last field declared. In this case STORN. It is done
clicking on field STONR and then click on

Here we have an ABAP editor where our coding can be written to find Plant and Storage
Location names:
After coding we need to check syntax code clicking on:

And save:

Then we have to return to main infoset screen:

In order to make our fields and their codes work it is necessary to include Additional Fields to
Storage Location Data for Material Field Group. To do this expand Additional fields and
Storage Location Data for Material:

Then drag fields PLANTN and STORN to group 01 Storage Location Data:
Then we have to generate our infoset clicking on

To save we click on:

Click on:

Finally we assign infoset to User Group.[u=


After creation this must be assigned to user group:

Next step is creation of query in SQ01 using ZTEST001 infoset.

Query Creation
Executing SQ01 we can create our query named ZTEST:

Now click on

and then assign it to infoset created above:


Click on

In the next screen we add a title for query:

Then click to next screen


Now check filed group and follow next screen clicking

We have to check fields to be used in our query, then go to next screen

Then marking Material Number as unique selection criteria we call Basic List design
In order to test it we click on

Then we use a material to test query:

Fields Plant and SLoc are key fields from MARD, then Pl and Storage Loc Name are
additional fields.

(/blog/?author=57d6f010b8a79b87928f540a)

Author: Roberto Caas (/blog/?author=57d6f010b8a79b87928f540a)


RCANAS2005

Roberto is a responsible IT professional with 15+ years of experience in functional support,


configuration and programming in SAP ERP. Now seeking to contribute his skills and expertise in new
SAP projects. Proven Skills in the following areas: SAP FICO Configuration and Functional Support
SAP MM Configuration and Functional Support SAP SD Configuration and Functional Support SAP
ABAP programming of reports, module pools, enhancements, user exits, etc. SAP Administration of
Roles and Authorization Objects.

Module(s): ABAP, Basis, Controlling, Enterprise Controlling, Financial Accounting, Human Resources,
Logistics Information System, Materials Management, Sales and Distribution
Tagged: ABAP (/blog/?tag=ABAP)

6 Likes Share

COMMENTS (1) Subscribe via


Newest First e-mail

Preview POST COMMENT

Sidharatg A month ago

you can use simple select and for all entries instead of this long long process

Newer Post Older Post


Ask a Fixer: Demystifying the GR/IR Process Q&A: Find Out About the New Functionality
(/blog/ask-a-fixer-demystifying-the-grir- Available with SAP S/4HANA Finance
process) (/blog/new-functionality-available-with-sap-
s4hana-finance)

(https://www.facebook.com/ERPfixers/)
(https://twitter.com/ERPfixers)
(https://www.linkedin.com/company/erpfixers?
(https://plus.google.com/u/0/b/113616486343442134301/113616486343442134301)

FIXER PROCESS (/HOW-TO-FIX/)


MEMBER PROCESS (/MEMBER-PROCESS/)
MODULES LIST (/MODULES-LIST/)
PRICING (/PRICING/)

(http://www.asug.com)

+1 (888) 293-1680 / info@erpfixers.com

Das könnte Ihnen auch gefallen