2005 IBM Corporation ABAP Objects - Obsolete statements
| 11.04.02 March-2005 ABAP Objects Obsolete Statements IBM Global Services 2005 IBM Corporation 2 March-2005 ABAP Objects - Obsolete statements | 11.04.02 Objectives The participants will be able to : Describe the context of obsolescence of certain syntax in ABAP Language Describe some of the most common examples of obsolete ABAP syntax Obsolete Declarations Obsolete Flow control Obsolete Internal Table Processing IBM Global Services 2005 IBM Corporation 3 March-2005 ABAP Objects - Obsolete statements | 11.04.02 Context of Obsolescence of certain syntax in ABAP Language SAP has carried out a clean-up of the ABAP language in ABAP Objects. As part of this language clean-up, in ABAP Objects stricter syntax checks are performed for constructs that were previously allowed and sometimes obsolete statements are not allowed at all. For reasons of backward compatibility , obsolete statements are still allowed outside of ABAP objects, but every effort should be made not to use these obsolete statements in newly developed programs. IBM Global Services 2005 IBM Corporation 4 March-2005 ABAP Objects - Obsolete statements | 11.04.02 Obsolete Declarations : Internal Standard Tables Defining a standard table with addition OCCURS is not permitted. Obsolete syntax : DATA t_mara LIKE mara OCCURS 10.
New syntax : DATA t_mara TYPE STANDARD TABLE OF mara INITIAL SIZE 0.
IBM Global Services 2005 IBM Corporation 5 March-2005 ABAP Objects - Obsolete statements | 11.04.02 Obsolete Declarations : Internal Standard Tables Table declaration with header line is not permitted. Obsolete syntax : DATA : BEGIN OF t_info OCCURS 10, v_data(10) type c, END OF t_info.
New syntax: DATA : BEGIN OF w_info, v_data(10) type c, END OF w_info.
DATA t_info LIKE STANDARD TABLE OF w_info.
IBM Global Services 2005 IBM Corporation 6 March-2005 ABAP Objects - Obsolete statements | 11.04.02 Obsolete Internal table Processing When reading an internal table you have to mention the work area explicitly as table with header line is not supported in OO context. Obsolete syntax : READ TABLE t_spfli WITH KEY carrid = AA.
New syntax : READ TABLE t_spfli WITH KEY carrid = AA INTO w_spfli.
IBM Global Services 2005 IBM Corporation 7 March-2005 ABAP Objects - Obsolete statements | 11.04.02 Obsolete Declarations : Ranges Tables Declaration of range table is changed. Obsolete syntax : RANGES r_vbeln FOR vbap-vbeln.
New syntax : DATA r_vbeln LIKE RANGE OF vbap-vbeln INITIAL SIZE 10. DATA: wa_range LIKE LINE OF r_vbeln.
APPEND wa_range TO r_vbeln. IBM Global Services 2005 IBM Corporation 8 March-2005 ABAP Objects - Obsolete statements | 11.04.02 Obsolete Flow Control : Relational Operators Obsolete Relational Operators should be used only outside of ABAP Objects in Logical expressions Obsolete Operator Valid Operator >< <> , NE =< <= , LE => >= , GE IBM Global Services 2005 IBM Corporation 9 March-2005 ABAP Objects - Obsolete statements | 11.04.02 Replacement of the ON CHANGE OF Statement ON CHANGE OF statement should not be used in the OO context as it has side-effect that produces wrong result.
Obsolete Syntax : ON CHANGE OF dobj. statement block. ENDON.
New Syntax : Use IF control structure with an explicit buffer variable used to track change.
IBM Global Services 2005 IBM Corporation 10 March-2005 ABAP Objects - Obsolete statements | 11.04.02 Replacement of the ON CHANGE OF Statement (Contd.) Example with Replacement Syntax using a Buffer (Auxiliary field) New Replacement Syntax : CLEAR carrid_buffer. SELECT * FROM spfli INTO spfli_wa ORDER BY carrid deptime. IF spfli_wa-carrid <> carrid_buffer. carrid_buffer = spfli_wa-carrid. append spfli_wa to t_spfli. ENDIF. ENDSELECT.
IBM Global Services 2005 IBM Corporation 11 March-2005 ABAP Objects - Obsolete statements | 11.04.02 Demonstration Showing the syntax error when using obsolete statement (s) in ABAP objects with suitable example. IBM Global Services 2005 IBM Corporation 12 March-2005 ABAP Objects - Obsolete statements | 11.04.02 Practice Showing the syntax error when using obsolete statement (s) in ABAP objects with suitable example. IBM Global Services 2005 IBM Corporation 13 March-2005 ABAP Objects - Obsolete statements | 11.04.02 Summary Defining a standard table with addition OCCURS is not permitted Table declaration with header line is not permitted Declaration of range table is changed New syntax : DATA r_vbeln LIKE RANGE OF vbap-vbeln. ON CHANGE OF statement should not be used in the OO context as it has side- effect that produces wrong result. In stead of this statement use IF control structure when outside the table loop and AT NEW and AT END OF statement when inside the table loop
IBM Global Services 2005 IBM Corporation 14 March-2005 ABAP Objects - Obsolete statements | 11.04.02 Questions What is the new syntax for range table? What side effect is produced by ON CHANGE OF statement?