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.

📺 Recommended Video: SAP ABAP Full Course Roadmap 2026 | Basic to Advanced (HANA, CDS & OData)

Watch our comprehensive video guide below for step-by-step SAP ABAP concepts and practical demonstrations:

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

    AI-Code Creates More Testing Work: Adapting to Increased Demand |

    Learn about the impact of AI-generated code on QA teams and strategies for adapting to increased testing demands. | Bright-Minds Training Institute, Pune

    Bridging the Gap: How Automation Addresses Understaffing in QA Teams |

    Learn how automation is helping to address the understaffing crisis in quality assurance teams, improving efficiency and enhancing software products. Discover best practices for implementing automation and explore the future of QA automation at Bright-Minds.

    Leave a Reply

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

    You Missed

    AI-Code Creates More Testing Work: Adapting to Increased Demand |

    • By Varad
    • October 24, 2026
    • 4 views
    AI-Code Creates More Testing Work: Adapting to Increased Demand |

    Bridging the Gap: How Automation Addresses Understaffing in QA Teams |

    • By Varad
    • October 23, 2026
    • 12 views
    Bridging the Gap: How Automation Addresses Understaffing in QA Teams |

    Selenium BiDi: A Game Changer for Browser Automation |

    • By Varad
    • October 22, 2026
    • 16 views
    Selenium BiDi: A Game Changer for Browser Automation |

    Catch Regressions First: The Power of Continuous Performance Baselines

    • By Varad
    • October 21, 2026
    • 28 views
    Catch Regressions First: The Power of Continuous Performance Baselines

    uman Oversight in AI Testing

    • By Varad
    • October 19, 2026
    • 21 views
    uman Oversight in AI Testing

    Harnessing Observability for Automated Regression Tests

    • By Varad
    • October 18, 2026
    • 29 views
    Harnessing Observability for Automated Regression Tests