This is a test message to test the length of the message box.
Login
|
Tools My IDE Actions
Created by Software-Heroes

ADT - Select Converter [MIA]

1828

For MIA, there is now a new action in the ABAP Development Tools that allows you to convert your old Open SQL statements to ABAP SQL and ABAP Cloud.

Advertising


In this article, we'll look at an update to the Select Converter and discuss the new integration in MIA and how it was implemented.

 

Introduction

IDE Actions have been available on the ABAP Environment since release 2502, and we already provided the first action with MIA in an older article. With IDE Actions, you can extend the ABAP Development Tools at specific points and thus make ABAP-based extensions. This allows you to automate certain functions, replace code, or extract information.

 

ABAP Select Converter 

A while ago, we introduced the ABAP Select Converter together with the CDS Extractor. The focus was primarily on converting SELECT statements into the new world, away from traditional tables and toward Core Data Services. The extractor provides the foundation via Git and shows what the mapping looks like at the field level. The converter takes the SELECT statement and breaks it down into its components in order to then replace tables and fields.

 

The converter has now received an overhaul and now completely breaks down the statement in order to generate it as ABAP SQL in the new syntax. This not only replaces the table, but also modernizes the statement.

 

Hint: Since this is a complex action, errors or inaccuracies may still occur.

 

Action

You can now find the new IDE action in the MIA open source project, where the action is documented and can be installed together with the other actions.

 

Structure

This is a fairly simple IDE action that we have implemented here. We define a class for the action and that it can only be executed in a class.

 

To do this, we read the current code of the object in the action and determine the position of the selection or cursor. You can find further information in the documentation below.

DATA(resource) = CAST if_adt_context_src_based_obj( context->get_focused_resource( ) ).
DATA(sources) = resource->get_source_code( ).
DATA(position) = resource->get_position( ).

 

In the next step, we need to extract the entire SELECT statement from the source code. To do this, we use a small function that searches for the beginning and end and compresses the select statement onto one line.

DATA(extraction) = zcl_mia_strings=>extract_statement( statement = `SELECT`
                                                       sources   = sources
                                                       start     = position->pos-start ).

 

If the determination worked, we pass the SELECT to the API, which calls the Select Converter endpoint to convert the statement. We then receive the result back in our response structure.

DATA(conversion) = zcl_mia_core_factory=>create_swh_tools( )->convert_select_statement(
    request = VALUE #( statement  = extraction-statement
                       abap_cloud = abap_true ) ).

 

Finally, we pass the new statement to a Source-Change-Result, which then offers us the appropriate dialog so that you, as the developer, can check the result.

DATA(change_result) = cl_aia_result_factory=>create_source_change_result( ).
change_result->add_code_replacement_delta( content            = conversion-data-new_statement
                                           selection_position = position ).
result = change_result.

 

Execution

How do you now execute the actual action? To do this, you must select the SELECT statement you want to replace in your source code. Then start the IDE action with the keyboard shortcut CTRL + ALT + R and select the IDE action "Migrate SELECT Statement".

 

Finally, the source code comparison will be displayed, and you can decide whether you want to accept the changes. In principle, the action also works in deactivated or activatable source code. This allows you to convert a SELECT that comes from on-premise and that you have only copied into the ABAP environment.

 

GitHub

You can find the open source project on GitHub and use it freely. If you find any errors or have suggestions for improvements, simply open an issue on GitHub.

 

Conclusion

If all the building blocks are in place, integrating it as an IDE action is very easy to implement. Using the SAP documentation, results can also be achieved quickly.

 

Source:
SAP Help - Implementing a Code Insertion


Included topics:
ToolsADTEclipseIDE ActionsMIA
Comments (0)



And further ...

Are you satisfied with the content of the article? We post new content in the ABAP area every Tuesday and Friday and irregularly in all other areas. Take a look at our tools and apps, we provide them free of charge.


ABAP Tools - VS Code (ABAP Cleaner)

Category - ABAP

One feature we missed in Visual Studio Code was the ABAP Cleaner. This has now been made available. Let's take a look at its installation, configuration and usage.

07/07/2026

ABAP Tools - VS Code (Agentic AI)

Category - ABAP

ABAP Development Tools for VS Code is here, so how do you get started with Agentic AI? Let's take a look at a basic configuration and how to get it running.

06/03/2026

ABAP Tools - VS Code (Quick Start)

Category - ABAP

The ABAP Development Tools for VS Code are now available, and in this short guide we'll look at everything you need to get started.

05/30/2026

ABAP Tools - Working with Eclipse (Classes)

Category - ABAP

In this article, we'd like to discuss working with classes and how you can extend them cleanly and easily in Eclipse. We'll also look at further options available in the ABAP Development Tools.

04/21/2026

ADT - RAP Extension Assistent [MIA]

Category - ABAP

You want to extend a RAP object and don't know exactly where to start? Perhaps the Extension Assistant can help you and guide you through the process step by step.

03/06/2026