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

preprocessor directives

abo
Active Contributor
0 Likes
676

On older systems the following statement

cl_salv_table=>factory(  
  IMPORTING r_salv_table = DATA(lo_table)  
  CHANGING  t_table  = <fs_data> ).

must be rewritten as follows:

DATA: lo_table TYPE REF TO cl_salv_table.
cl_salv_table=>factory(  
  IMPORTING r_salv_table = lo_table  
  CHANGING  t_table  = <fs_data> ).

Is there a pragma or some other sort of compiler directive that would enable me to write a single version of the code?

Something like this:

#ifdef BASIS740
cl_salv_table=>factory(  
  IMPORTING r_salv_table = DATA(lo_table)  
  CHANGING  t_table  = <fs_data> ).
#else
DATA: lo_table TYPE REF TO cl_salv_table.
cl_salv_table=>factory(  
  IMPORTING r_salv_table = lo_table  
  CHANGING  t_table  = <fs_data> ).
#endif

At the moment I have to workaround it by having the unused version commented out, although technically this means the two source codes are different. I used inline declarations in this question but there are other language elements which are version-dependent.

I couldn't find anythin either in ABAPDOCU or in the forum.

Comments it is, then?

1 ACCEPTED SOLUTION
Read only

abo
Active Contributor
615

Nevermind: finding an answer is all about picking the right keywords.

This has been discussed before and, no, sadly it can't be done.

1 REPLY 1
Read only

abo
Active Contributor
616

Nevermind: finding an answer is all about picking the right keywords.

This has been discussed before and, no, sadly it can't be done.