Application Development 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: 

Valid types in DATA inline declarations

touzik_itc
Active Participant
375

Sometimes names of data elements look rather cryptic. So i prefer inline declarations like

DATA(lv_sap_object) = CONV toav0-sap_object( 'PRINTDOC' ).

instead of

DATA(lv_sap_object) = CONV saeanwdid( 'PRINTDOC' ).

It works. But I never seen declarations like that in the official reference or demos. Is it allowed?

2 REPLIES 2

Sandra_Rossi
Active Contributor
0 Kudos
341

It's what I do too...

Why would it be forbidden?

matt
Active Contributor
341

In my view, yes. Sometimes I'd says it's good practice. For example, I think

DATA: g_matnr TYPE marc-matnr,
      g_werks TYPE marc-werks.
SELECT-OPTIONS: s_matnr FOR g_matnr,
                s_werks FOR g_werks.

is better than

DATA: g_matnr TYPE matnr,
      g_werks TYPE werks_d.
SELECT-OPTIONS: s_matnr FOR g_matnr,
                s_werks FOR g_werks.