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

CASTING IN ABAP

waqasalikhan
Discoverer
0 Likes
1,388

hello ,

my question is about narrow and wide casting.

when i read from text books of sap its appear to be in opposite definition according to in scn search (experts opinion )?

thank-you
regards

student.

1 ACCEPTED SOLUTION
Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
1,315

To be honest, in some early stage of ABAP Objects we said in fact

"Narrowing Cast" for "Up Cast" and "Widening Cast" for "Down Cast".

Since Release 7.0, we do it as the rest of the world and say

"Narrowing Cast" for "Down Cast" and "Widening Cast" for "Up Cast".

This is even documented!

Terminology change for narrowing and widening casts

So you might have read old SAP textbooks

hello ,

my question is about narrow and wide casting.

when i read from text books of sap its appear to be in opposite definition according to in scn search (experts opinion )?

thank-you
regards

student.

5 REPLIES 5
Read only

former_member202771
Contributor
0 Likes
1,315

Hi Waqas,

When you loose attributes during assignment, it is narrow casting. And When you gain new attributes, it is widening.

Does text books say it differently ?

Thanks,

Anil

Read only

Sandra_Rossi
Active Contributor
0 Likes
1,315

No, it's exactly the same definition for ABAP and for "all" other OO languages (I don't know all of course)

Read only

0 Likes
1,315

thank-you  

Read only

retired_member
Product and Topic Expert
Product and Topic Expert
0 Likes
1,316

To be honest, in some early stage of ABAP Objects we said in fact

"Narrowing Cast" for "Up Cast" and "Widening Cast" for "Down Cast".

Since Release 7.0, we do it as the rest of the world and say

"Narrowing Cast" for "Down Cast" and "Widening Cast" for "Up Cast".

This is even documented!

Terminology change for narrowing and widening casts

So you might have read old SAP textbooks

Read only

0 Likes
1,315

great thank u ..