Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Simple Abap Programming Question

Former Member
8,724

Hi everyone,

I have very simple abap programming question.

Can sombody tell me why do we use prefixes ls, lo, lr ,lt when defining local variables inside abap.

Example:

DATA: lo_dim TYPE REF TO cl_uja_dim,
      lr_dim_data
TYPE REF TO if_uja_dim_data,
      lt_attr_name
TYPE uja_t_attr_name,
      lt_sel
TYPE uj0_t_sel,
      ls_sel
TYPE uj0_s_sel.

What is the meaning of programming this way. Why cant people in abap use simple variable names the way we do it java.

Also whats the different between all these.

So far I found out that cl is used to denote classes and if denotes interfaces.

but these lo, lr, lt, ls, lv have been confusing for me to understand.  I tried to look all over the place and couldn't find meaning for it.

Helpful answers would be rewarded points.

Much Thanks.

Ibrahim


2 REPLIES 2
Read only

former_member491621
Contributor
3,554

lo - local object

lr - local range (not sure about this)

lt - local table

ls - local structure

lv - local variable

These kinds of declarations may be project specific as specified by the client or used in one project in order to have uniformity in coding practices within the team.

Read only

kakshat
Product and Topic Expert
Product and Topic Expert
0 Likes
3,554

Hi Ibrahim,

To your question, why can't you use simple variable names like in other programming languages, the answer is you can. You can very well go ahead and name your ABAP variables without the prefixes you mentioned. However, these prefixes have the advantage that just looking at the name you know the scope ('l' standing for local and 'g' standing for global) as well as the type (variable, structure, internal table etc.) of the variable.