Skip to Content
0
Jun 13 at 08:23 AM

preprocessor directives

36 Views Last edit Jun 14 at 07:20 AM 2 rev

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?