G-YWWN0NYSS1 NEW Operator – Single Value for All Data Types NEW Operator – Single Value for All Data Types

NEW Operator – Single Value for All Data Types

In the past post, we showed that NEW Administrator is one of the improved elements in EhP7. Here, we would see the use of NEW Administrator for Single Incentive for All Information Types or NEW Operator – Single Value for All Data Types.

For NEW Administrator: NEW Operator – Single Value for All Data Types

I) An articulation determined for information item might itself at any point be a constructor articulation or contain a constructor articulation.

ii) When a constructor articulation is doled out to a reference variable utilizing NEW, this variable focuses to the underlying item all along. This implies that the first reference is as of now not accessible involving the objective variable in the articulation.

* Example 1
PARAMETERS input(10) TYPE c DEFAULT 'EhP7'.
 
DATA d_ref TYPE REF TO string.
 
d_ref =  NEW string( 'Welcome' && ` ` && input ).
 
WRITE:/ d_ref->*.

NEW operator constructs an anonymous data object of the type string, whose value is determined using a string expression.
Note: The chaining operator && concatenates two operands in a string expression as a character string.

* Example 2

TYPES: BEGIN OF ty_marc,
          matnr TYPE matnr,
          werks TYPE werks_d,
       END OF ty_marc.

DATA:  d_ref   TYPE STANDARD TABLE OF REF TO ty_marc,
       wa_marc TYPE ty_marc.

SELECT SINGLE matnr werks FROM marc INTO wa_marc.

APPEND wa_marc TO d_ref.  " Syntax Error

The above statement APPEND wa_marc to d_ref would give syntax error:  “WA_MARC” cannot be converted to the line type of “D_REF”.

Instead if we use the NEW Operator as shown below, the content of the work area can be assigned to the data object d_ref.

APPEND NEW #( wa_marc ) TO d_ref.

For column chose, an organized mysterious information object is made after the SELECT . The substance of the line is doled out to this information object. The article is made in the overall articulation position of the assertion Attach and the NEW information reference is affixed straightforwardly to an inward table with the fitting column type. The outcome is a table that references generally new mysterious information objects.

Currently referenced in past post, when “#” succeeds NEW, it implies the article ref in the Left Hand Side decides the sort.

These are basic models. In resulting posts, we would attempt to investigate more perplexing and genuine undertaking situations. Kindly look at the following post on structures and inner tables in NEW Administrator.

YOU MAY LIKE THIS

SAP FICO Demand In India

SAP FICO as a Career

Proxy in SAP Abap: Seamless Communication

  • Related Posts

    Common SAP ABAP Interview Questions and Answers

    Preparing for your first SAP ABAP interview can feel confusing. Many beginners know the syntax, but still struggle to answer practical questions asked by interviewers. In 2026, companies expect more…

    How to Debug SAP ABAP Programs Like a Pro

    Debugging is one of the most important skills for any SAP ABAP developer. Writing code is only half of the job. In real projects, most of your time is spent…

    Leave a Reply

    Your email address will not be published. Required fields are marked *

    You Missed

    Common SAP ABAP Interview Questions and Answers

    • By Varad
    • March 5, 2026
    • 391 views
    Common SAP ABAP Interview Questions and Answers

    How to Debug SAP ABAP Programs Like a Pro

    • By Varad
    • March 4, 2026
    • 157 views
    How to Debug SAP ABAP Programs Like a Pro

    Can ChatGPT Help in Learning SAP ABAP

    • By Varad
    • March 3, 2026
    • 56 views
    Can ChatGPT Help in Learning SAP ABAP

    Can Automation Replace SAP ABAP Developers?

    • By Varad
    • February 28, 2026
    • 100 views
    Can Automation Replace SAP ABAP Developers?

    SAP Automation vs Manual Testing: Career Comparison

    • By Varad
    • February 27, 2026
    • 110 views
    SAP Automation vs Manual Testing: Career Comparison

    Tools Used For Sap Automation Testing in 2026

    • By Varad
    • February 26, 2026
    • 153 views
    Tools Used For Sap Automation Testing in 2026