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

Difference between - and ~

Former Member
0 Likes
1,069

Hi All,

All of you must be wondering for such a basic question. Could anyone please tell me what is sign ~?

what is the difference between - and ~ sign while writing ABAP?

e.g:

mara-matnr

mara~matnr

1 ACCEPTED SOLUTION
Read only

vinod_vemuru2
Active Contributor
0 Likes
872

Hi Yogesh,

~ This is used when we are using Joins in a select query.

eg: SELECT amatnr bmaktx

INTO TABLE i_mara

FROM mara AS a INNER JOIN makt AS b

ON a~matnr EQ bmatnr

WHERE a~matnr IN so_matnr.

Here this symbol is used to link the connection between table and field in data base level.

- This is used to identify the field from work area.

eg: wa_mara-matnr. i.e wa_mara is a structure having many fields. This - symbol is just to get the required field from the work area.

Hope this is clear.

Thanks,

Vinod.

3 REPLIES 3
Read only

Former Member
0 Likes
872

the symbol ~ is only used in SELECT statement via JOIN:

Example:

select * from mara inner join marc

on maramatnr = marcmatnr

into corresponding fields of table itab

where mara~matkl = '19'

and marc~werks = 'C001'.

there is no difference with -, it's only the sintaxis of select with joins.

Read only

Former Member
0 Likes
872

Hello,

Every time you use and alias in a join you need to use ~, otherwise you use -.

Regards,

Read only

vinod_vemuru2
Active Contributor
0 Likes
873

Hi Yogesh,

~ This is used when we are using Joins in a select query.

eg: SELECT amatnr bmaktx

INTO TABLE i_mara

FROM mara AS a INNER JOIN makt AS b

ON a~matnr EQ bmatnr

WHERE a~matnr IN so_matnr.

Here this symbol is used to link the connection between table and field in data base level.

- This is used to identify the field from work area.

eg: wa_mara-matnr. i.e wa_mara is a structure having many fields. This - symbol is just to get the required field from the work area.

Hope this is clear.

Thanks,

Vinod.