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]

1696

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.


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

ADT - RAP Analyzer [MIA]

Category - ABAP

Getting to grips with and understanding existing RAP objects can not always be easy, especially when dealing with complex objects. Questions such as which pattern is used and which objects are important usually need to be worked out.

02/24/2026

ADT - Metadata Wizard [MIA]

Category - ABAP

In this article, we'll take a look at the Metadata Wizard and how it might simplify your life when creating UI annotations in RAP in the future.

01/16/2026

030: Software-Heroes - My Community

Category - YouTube

Do you want to stay up-to-date with the latest ABAP and SAP knowledge without having to search through every blog individually? My Community brings all community content into a mini-app that you can customize to your liking, so you never miss any news.

12/22/2025

ABAP Tools - IDE Actions (Table)

Category - ABAP

How do you actually create a table and edit it in the IDE Action? Let's look at the input options and how you can ultimately work with the data.

12/09/2025