Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
pokrakam
Active Contributor
2,739
Just a tiny tip for a little shortcut I discovered today. When working with inline declarations, the type may be wrong, we may be doing dynamic programming, or we want to change the data type such as when reading order numbers from a text field.
ASSIGN sometextfield TO FIELD-SYMBOL(<salesorder>). "<== text/string

Inline declarations like this need to be changed to an explicit FIELD-SYMBOLS declaration up front.

However I discovered a neat way to do this when using Field Symbols, namely with CASTING TYPE:
ASSIGN sometextfield TO FIELD-SYMBOL(<ordernumber>) CASTING TYPE vbeln.

Some of you may of course already know this. CASTING TYPE has been around since well before 7.4, which is why I never considered using it for inline declarations. But it worked, and I thought it is an elegant and readable way to do an inline field symbol constructor with type conversion.

PS. Please do "Like" or comment on blogs you find useful. It's the only feedback authors get on whether to write more on similar topics. It only takes one click.
5 Comments
Labels in this area