ABAP Blog Posts
cancel
Showing results for 
Search instead for 
Did you mean: 


Agentic AI on Eclipse ADT with ADT MCP and GitHub Copilot.

This is similar to this SAP help on Agentic AI but SAP help is on VS Code. 

Agentic AI for ABAP Development | SAP Help Portal

Prerequisite

  1. Eclipse 2026-06 or later and SAP ABAP Development Tools (ADT) 3.60.0 or later. To install this check on SAP Development Tools
  2. GitHub Copilot 0.21.0 or later with account to login. To install, check on Installing GitHub Copilot in Eclipse ADT.

Note: Version in pre-requisite is the version in my laptop at the time of writing. Real version supported may be a little lower. 
Tip: Click on Eclipse menu Help->Check for updates to update these to latest version if already installed in lower version.

MCP Setup in Eclipse ADT

  1. Enabling MCP Server in Eclipse ADT menu at Window->Preferences...
    chaiphon_0-1788215026490.png
  2. Then click on enable ADT MCP Server in ABAP Development->MCP Server then apply.
    Copy the token to use in next step. Leave the port as is unless you use it for something else already.
    chaiphon_2-1788215261311.png
  3. Set MCP Server for GitHub Copilot menu. Copilot->Edit Preferences...
     
    chaiphon_4-1788215527936.png
  4.  Select Model Context Protocol(MCP) and update server configurations with snippet below and token from step 2. Then apply.
{
  "servers": {
    abap-mcp": {
      "url": "http://localhost:2234/mcp",
      "requestInit": {
        "headers": {
          "Authorization": "Bearer <Token from step 2>"
        }
      }
    }
  }
}​

chaiphon_5-1788215824862.png

  • Now. It is ready for testing via Chat.

Testing

Test Connection

  1. Check whether MCP can connect to SAP system. Type "List connection" in Chat and hit enter.
    chaiphon_8-1788216400451.png
  2. Allow MCP to run. You can use for this "Allow tools from "abap-mcp" in this session". As long as this chat is still open then it won't ask again. You can change your selection for next session unless you select as always allow then it won't ask for permission again.
    chaiphon_7-1788216316783.png
  3. Result.
    chaiphon_9-1788216646010.png 

Create Test Program.

Here is the prompt "create a program to send hello world email to [email protected] in package $TMP."

chaiphon_11-1788217001093.png

Result

chaiphon_15-1788217612214.png

 

Here is generated code.

REPORT zrca_r0001_hello_email.

CONSTANTS:
  lc_subject   TYPE so_obj_des VALUE 'Hello World',
  lc_recipient TYPE ad_smtpadr VALUE '[email protected]'.

START-OF-SELECTION.
  DATA: lt_body         TYPE soli_tab,
        lo_send_request TYPE REF TO cl_bcs,
        lo_document     TYPE REF TO cl_document_bcs,
        lo_recipient    TYPE REF TO if_recipient_bcs,
        lv_sent_to_all  TYPE os_boolean,
        lx_bcs          TYPE REF TO cx_bcs.

  APPEND 'Hello World' TO lt_body.

  TRY.
      lo_send_request = cl_bcs=>create_persistent( ).

      lo_document = cl_document_bcs=>create_document(
        i_type    = 'RAW'
        i_text    = lt_body
        i_subject = lc_subject ).

      lo_send_request->set_document( lo_document ).

      lo_recipient = cl_cam_address_bcs=>create_internet_address( lc_recipient ).
      lo_send_request->add_recipient( i_recipient = lo_recipient ).

      lv_sent_to_all = lo_send_request->send( i_with_error_screen = abap_true ).
      COMMIT WORK.

      IF lv_sent_to_all = abap_true.
        WRITE: / 'Email sent successfully to', lc_recipient.
      ELSE.
        WRITE: / 'Email send request was created, but not all recipients were confirmed.'.
      ENDIF.

    CATCH cx_bcs INTO lx_bcs.
      WRITE: / 'Error while sending email:', lx_bcs->get_text( ).
  ENDTRY.

Refactor created ABAP program into class structure.

Use prompt "Restructure this into class".

chaiphon_14-1788217538986.png

Result

chaiphon_17-1788218864017.png

 

REPORT zrca_r0001_hello_email.

CLASS lcl_application DEFINITION FINAL.
  PUBLIC SECTION.
    CLASS-METHODS run.

  PRIVATE SECTION.
    CONSTANTS:
      lc_subject   TYPE so_obj_des VALUE 'Hello World',
      lc_recipient TYPE ad_smtpadr VALUE '[email protected]'.

    CLASS-METHODS send_mail
      RETURNING VALUE(rv_sent_to_all) TYPE os_boolean
      RAISING   cx_bcs.
ENDCLASS.

CLASS lcl_application IMPLEMENTATION.
  METHOD run.
    TRY.
        DATA(lv_sent_to_all) = send_mail( ).

        IF lv_sent_to_all = abap_true.
          WRITE: / 'Email sent successfully to', lc_recipient.
        ELSE.
          WRITE: / 'Email send request was created, but not all recipients were confirmed.'.
        ENDIF.

      CATCH cx_bcs INTO DATA(lx_bcs).
        WRITE: / 'Error while sending email:', lx_bcs->get_text( ).
    ENDTRY.
  ENDMETHOD.

  METHOD send_mail.
    DATA: lt_body         TYPE soli_tab,
          lo_send_request TYPE REF TO cl_bcs,
          lo_document     TYPE REF TO cl_document_bcs,
          lo_recipient    TYPE REF TO if_recipient_bcs.

    APPEND 'Hello World' TO lt_body.

    lo_send_request = cl_bcs=>create_persistent( ).

    lo_document = cl_document_bcs=>create_document(
      i_type    = 'RAW'
      i_text    = lt_body
      i_subject = lc_subject ).

    lo_send_request->set_document( lo_document ).

    lo_recipient = cl_cam_address_bcs=>create_internet_address( lc_recipient ).
    lo_send_request->add_recipient( i_recipient = lo_recipient ).

    rv_sent_to_all = lo_send_request->send( i_with_error_screen = abap_true ).
    COMMIT WORK.
  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
  lcl_application=>run( ).

Note:
Result may vary by LLM used.
Copilot Instruction was added to create program according to naming convention. 

Labels in this area