02-13-2007 2:15 AM
Hi everyone,
I did Extended program Check (including Obsolete statements check) for the below codes.
FORM F_OUTPUT_LOG TABLES L_XXX STRUCTURE ZXXX
USING VALUE(LPXXX) TYPE CHAR
CHANGING LPXXXXX.
But the following error message will appears.
The current ABAP command is obsolete and problematic, especially so in ABAP
Objects
Within classes and interfaces, you can only use "TYPE" to refer to ABAP Dictionary
types, not "LIKE" or "STRUCTURE".
Could you give me some ideas to remove this error? Any suggestion is appreciated.
Best regards,
Julian
02-13-2007 2:17 AM
HI,
Better give TYPE ANY, do not specify any particular reference.
Regards
Subramanian
02-13-2007 2:19 AM
Try using this:
FORM F_OUTPUT_LOG TABLES L_XXX <b>TYPE</b> ZXXX
USING VALUE(LPXXX) TYPE CHAR
CHANGING LPXXXXX.
Thanks,
Santosh
02-13-2007 2:20 AM
Julian,
In the newer versions of SAP for object oriented programming we declare objects using TYPE statements.
Obsolete:
DATA: V_MATNR LIKE MATNR.
DATA: V_TABLETYPE LIKE BSEG_T.
To be used.
DATA: V_MATNR TYPE MATNR.
DATA: V_TABLETYPE TYPE BSEG_T.
For declaring structures we need to use below code:
LVC_T_FCAT is a table type
LVC_S_FCAT is a structure
DATA: i_fcat1 TYPE lvc_t_fcat.
DATA: i_fcat2 TYPE TABLE OF lvc_s_fcat.
Here W_FCAT1 and W_FCAT2 are same but the way they are declared are
different. If you are referring to a TABLE TYPE you can use TYPE LINE OF
method or you can directly say TYPE referring to that structure (lvc_s_fcat).
DATA: w_fcat1 TYPE lvc_s_fcat.
DATA: w_fcat2 TYPE LINE OF lvc_t_fcat.
Thanks
02-13-2007 3:16 AM
Julian,
In your program whereever you are using the LIKE statement
use TYPE statement to declare the fields or Structures.