0% found this document useful (0 votes)
409 views5 pages

Basics For Inline Declarations With Sap-Abap Author: Pradyut S. Vyas Mentored By: Pranesh Kumar

Inline declarations in ABAP allow developers to simplify programming by reducing unnecessary data declarations. Inline declarations are most useful for declaring onetime, local variables that do not need to be accessed globally. For example, a variable can be declared inline and used locally within a function module or subroutine. The documentation provides examples of declaring internal tables, work areas, variables, and field symbols inline within ABAP code using the DATA and FIELD-SYMBOL declaration operators. Key points are that sorting can be done directly in a SELECT query, and variables declared within subroutines cannot be accessed outside of the subroutine.

Uploaded by

sathish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
409 views5 pages

Basics For Inline Declarations With Sap-Abap Author: Pradyut S. Vyas Mentored By: Pranesh Kumar

Inline declarations in ABAP allow developers to simplify programming by reducing unnecessary data declarations. Inline declarations are most useful for declaring onetime, local variables that do not need to be accessed globally. For example, a variable can be declared inline and used locally within a function module or subroutine. The documentation provides examples of declaring internal tables, work areas, variables, and field symbols inline within ABAP code using the DATA and FIELD-SYMBOL declaration operators. Key points are that sorting can be done directly in a SELECT query, and variables declared within subroutines cannot be accessed outside of the subroutine.

Uploaded by

sathish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

BASICS FOR INLINE DECLARATIONS WITH SAP-ABAP

Author : Pradyut S. Vyas


Mentored by : Pranesh Kumar
One of the most useful concept introduced in SAP NetWeaver 7.4 is ABAP inline declarations, this
will help an ABAP Developer to simplify programming help to reduce unnecessary data declarations
in a program.

Inline declarations are most useful in reducing onetime and local data declarations in a ABAP Object,
for example If you want to store some value inside in a Function Module/Perform and you don`t
need to access them globally, you can declare a inline variable and use it locally.

For further clarity on this topic, I created a reference program locally parallel to this documentation
and tried to put up as much as I can of the recent learnings on this topic, feel free to refer at the
same:

Server: D90; Client: 551(ABAP Client) / 570(Test Client); Program Name: ZINLDECL_TRY1.

To start with, writing a basic report with a selection screen and a select query to fetch data based on
user input and noting the observation for the same, that ways we can see how to declare an
internal table in the program.

For the code written above, following things are to be observed:


1- No type/data declaration is being used for the internal table in which the data is being
fetched, prior to select query. The table is directly declared in the select query at ”INTO
TABLE” clause by using @data(internal_table).
2- A comma(,) between each two fields that are required to fetch in the select statement.
3- WHERE CLAUSE, “@” used before writing every parameter/select-option.

Running the same program in debugger mode, to observe we get to see:

Further, if we are required to dump data from one internal table to another for some operation an
internal table can be declared by simply using the declaration operator “DATA”.
Moving forward, similarly we can use the “DATA” declaration operator for further declaring a work
area as well as variables, below shown code are several examples for the same:
Further for declaring a field symbol, SAP has provided a new declaration operator FIELD-
SYMBOL(…).

SOME POINTS TO REMEMBER:


 SORTING can be done on database level using ORDER BY keyword in select query right after
WHERE clause.

 Observations of using inline declarations in subroutines:


(a) Declaring a variable in main program and using it in it’s subroutine.
(b)Declaring a variable in subroutine and trying to use it outside post the subroutine’s execution.

Hence, objects declared in subroutines are unusable outside it.

You might also like