1 2 3 16 Previous Next

ABAP in Eclipse

231 Posts
Joachim Rees

How to learn to love AdT

Posted by Joachim Rees Jun 14, 2016

[I started to write this as a comment on How to get your colleagues into ABAP in Eclipse but the figured it's probably better to start a blog post on my own]

OK, I know this is a old blog, but I just now stumbled across it (via Abap in Eclipse | AIE - Code Gallery - SCN Wiki , which is a very good resource, as well).

 

 

I'm in the process of learning to love Eclipse right now, so anything pointing out some cool features helps:

 

1. read about the features

2. try them out in a test-report

3. next time you get in a situation, where it is useful, use it in your real programming

--> the more often you make this experience ("wow, that's cool!") them more you will like the new tool. (And, as you pointed out Florian Henninger, if you colleagues see how easy you do $task, they might get eager to be able to use it, too).

 

The problem I sometimes have is, that I'd need to have it the other way round:

 

1. I do some real programming

2. I'd need a feature (I know how it would be done in SE80/SE24, it's really easy there!)

3. But I just don't know how to easily do it in Eclipse.

-> that's a little frustrating!

 

I give you an example I had yesterday: redefining a method:

In SE24:

1. click on redefine

2. code away

--> really, really, easy! (but only because I know what button to click, I'm aware of that!).

 

In Eclipse:

??? I don't know   ???

-> I'm sure it's just as easy, you just need to know the right way.

 

In situations like that, it would be good to have an AiE-Expert (well, just someone using it in her/his daily work) sitting next to you -> you could just ask.

 

Also, events like CodeJam on AdT are great -> remember the features you didn't find and let the experts and peers help you.

 

[Edit 2016-06-16: Of course: Use SCN! There are lot's of resorces here. E.g. I just had that question:  How can I trigger Code Inspector checks with ADT in Eclipse -  and as you see I found the answer easily (using the Content-Tab and the Text-Filter)!

]

 

I'd also suggest NOT to revert to the old way on the first obstacle - as with everything new you try to learn, there is a learning curve -> it usually pays out to go through it!

 

I guess mostly everyone reading this is already an AdT expert, but do you remember you first attempts and frustrating "I don't know how to do it "-experiences? Share them in the comments, if you like!

 

 

best

Joachim

 

PS: Having a total of 3 sad smileys in this blog, I think a should compensate, as in general I do like AiD and lerning new things, so here we go:

Disclaimer: This is a proposal of an SCN Member and not an authorized solution by SAP. Pls. be aware what you do!


Motivation

CSOL Error.png

In my Post I pointed out the Issue that #adt can not handle #csol warnings as #SE80 can. I described a workaround using #SE80 and another using a dirty technique in solutionamanger.

For us in the project this was not sufficient.

The goal is to "auto confirm" the CSOL warnings as we can do in #SE80. Due to project requirements this would be the only way in any case at the moment.

 

You can solve this using two Enhancements and a helper class:

 

Create helper-class:

CLASS zcl_000_adt_service DEFINITION

  PUBLIC

  CREATE PUBLIC.

 

  PUBLIC SECTION.

    CLASS-DATA:

      sv_adt_call          TYPE abap_bool VALUE abap_false,

      sv_csol_check_called TYPE abap_bool VALUE abap_false.

 

  PROTECTED SECTION.

  PRIVATE SECTION.

ENDCLASS.

 

CLASS ZCL_000_ADT_SERVICE IMPLEMENTATION.

ENDCLASS.

 

 

 

Detect if called via ATD in SADT_REST_RFC_ENDPOINT

Create an enhancement at the top of SADT_REST_RFC_ENDPOINT:

 

ENHANCEMENT Z_SADT_REST_RFC_ENDPOINT.    "active version

  **********************************************************************

* Enhancement to register an ADT call.

**********************************************************************

     LOG-POINT ID z000_sap_code_enhancement SUBKEY sy-cprog FIELDS 'Z_SADT_REST_RFC_ENDPOINT'. "Optional

     zcl_000_adt_service=>sv_adt_call = abap_true.

ENDENHANCEMENT.

 

Catch the CSOL message in function module TMW_PRJL_CSOL_CHECK when called from #adt

 

We did not want to do real modification, such that we used a recursive call within the enhancement of TMW_PRJL_CSOL_CHECK. After the recursion we can catch the message if we are called via #adt an ignore it. Create an enhancement at the top:

 

ENHANCEMENT Z_TMW_PRJL_CSOL_CHECK.    "active version

 

**********************************************************************

* Because the confirmation of CSOLocks is still not possible via ADT/Eclipse

* this enhancement helps on an interim basis.

*

* IF a CSOL conflict occurs the Solution Manager (second call of function

* module /TMWFLOW/CHECK_OBJECT_LOCK_CSL) returns a specific message. This

* message will be raised as LOCKING_NOT_ALLOWED.

*

* The conflict will be confirmed with including the object to a transport

* request which is known by the Solution Manager. So catching the specific

* message by a recursive call (depth 2) and ignoring it will cause an

* automatic CSOL conflict confirmation.

*

* To differ a call of function module TMW_PRJL_CSOL_CHECK by Eclipse/ADT and

* by an se80 session there is a flag, which is set by an enhancement of

* function module SADT_REST_RFC_ENDPOINT.

**********************************************************************

 

"   LOG-POINT ID z000_sap_code_enhancement SUBKEY sy-cprog FIELDS 'Z_TMW_PRJL_CSOL_CHECK'.   Optional

 

   IF zcl_000_adt_service=>sv_adt_call = abap_true AND

      zcl_000_adt_service=>sv_csol_check_called = abap_false.

    "AND

    "  new zcl_001_user_service( )->is_user_parameter_set( 'Z_AUTO_CSOL_CONFIRM' ) = abap_true.  "Nice to have

 

     zcl_000_adt_service=>sv_csol_check_called = abap_true. "stop recursion

 

     CALL FUNCTION 'TMW_PRJL_CSOL_CHECK'

       EXPORTING

         iv_request         = iv_request

         iv_suppress_dialog = iv_suppress_dialog

         it_objects         = it_objects

         it_keys            = it_keys

         iv_trfunction      = iv_trfunction

       IMPORTING

         ev_no_check_performed = ev_no_check_performed

       EXCEPTIONS

         locking_not_allowed     = 1

         warning_conflicts_exist = 2

         OTHERS                  = 1.

 

     zcl_000_adt_service=>sv_csol_check_called = abap_false.

 

      CASE sy-subrc.

 

        WHEN 0.

          RETURN.

 

        WHEN 1.

          IF sy-msgid = '00' AND sy-msgty = 'E' AND sy-msgno = '001' AND

             ( sy-langu = 'E' AND sy-msgv1 = 'Customizable CSOL conflict for objects changed in'  AND sy-msgv2 = ' other TR (Note 1591120)' ) OR

             ( sy-langu = 'D' AND sy-msgv1 = 'Anpassbarer CSOL-Konflikt für in and. TA geänderte' AND sy-msgv2 = ' Objekte (Hinw. 1591120'  ).

            "ignore/accept CSOL conflict => confirm CSOL conflict

            RETURN.

          ENDIF.

 

          "re-raise

          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING locking_not_allowed.

 

        WHEN 2.

 

          "re-raise

          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING warning_conflicts_exist.

 

      ENDCASE.

   ENDIF.

ENDENHANCEMENT.

 

 

Additional

 

in the line:

 

  "  new zcl_001_user_service( )->is_user_parameter_set( 'Z_AUTO_CSOL_CONFIRM' ) = abap_true. 

 

we placed some code to ensure that the auto confirm of #csol is only done for user who have set the set/get parameter accordingly.

This is what the coding does.

 

Conclusion

 

Now we have a #adt that "confirms" CSOL warnings immediately such that we can continue to work as normal in #adt.

Thomas Fiedler  and the ATD Team are aware of this issue and are working on a standard solution.

Be aware of the disclaimer at the top.

 

Kind Regards

Timo

 


Hello

we are working in a multi system setup:

 

MaintDEV -> MainTST -> PRD

ProjDEV  -> ProjTST -> prePRD

 

To handle changes in the two dev Systems we have we use Solution Manager Retrofit and CSOL etc.

Now me an my colleges are in the situation that we have transports arrived on project test system where tests are ongoing. Fine.

 

For new features we need to enhance development objects that are still under test.

In ADT we end up with the Error message:

CSOL Error.png

So no possibility to change the source in Eclipse right away.  (The mentioned SAP note does not help, it is responsible for the Error)

 

Workaround:

 

Go to good old SE80, edit every method in form based view:

Csol_se80.png

confirm the Messages, if you know what you are doing

 

csol_info.png

 

unfortunately, this seems not to be possible in adt, what makes it a big hazzle for us to use it with objects that are under test.

 

I hopeThomas Fiedler  & Team will have a solution soon.

Any feedback is welcome on this topic.

 

<<< EDIT >>>>>

See Solution using Enhancements here

<<< END EDIT >>>

 

Second Work around:

use TA: /n/tmwflow/lockmon in Solman to delete the locks.

- be sure, you know what you do -

 

Best

Timo

Last week I've been at the DSAG ABAP Developments Days in Walldorf. At the usual visit of the tapas bar in the evening we had a discussion about the translation of development objects in ABAP in Eclipse (ABAP Development Tools ADT). SAP currently suggests, that we use the SE63 to translate the objects after we finished our developments.

At least my "development workflow" looks a bit different: every time I've created a translation relevant object, for example a new message or text element, I immediately translate this object (let it be from German to English or vice versa, depends on my current project).

 

Let’s play Design Thinking and give the Persona a name:

Hello, my name is Uwe and I’m an ABAP developer. On a daily basis I’m working with translation relevant objects. This is how I’m currently working

 

1. Text elements

I’m using the following format, because no comment for text-xxx is needed

WRITE:/ 'This is just a test'(001).

With <f2> on the text I’m creating the element.

Image2.png

Marking the element and going to the translation are just two clicks away

Image3.png

After entering the text, save and exit I’m finished.

Image4.png

2. Messages

MESSAGE i002(ytestmsg) WITH 'Another test'(002).

<F2> on “i002” and the message will be created.

Again: after entering the text I’m going directly to the translation

Image5.png

Translate the text save and exit. Finished

Image6.png

 

3. Data element labels

After entering the last Field label I’m going immediately to the translation

Image7.png

Translate all text save and exit. Finished

Image8.png

 

Or do you have another translation procedure? Do you have in-house rules?

 

In Eclipse we currently have this situation: after <f3> on a non-existing text element or message we get

Image9.png

(Object not found. Creation via navigation not supported)

 

To be honest: I had to google where to find the text elements. Here you are:

Image10.png

The result is, that we end in the SAP GUI. Would be nice if we’ll get an Eclipse tool for text element, but that’s not part of this blog post.

 

Now my dear developer college it’s up to us to help SAP to “translate” this workflow to the Eclipse world.

 

Suggestion 1

a new Eclipse view which is active for every translation relevant object

 

Suggestion 2

a new tab in the properties view

 

 

Image11.png

 

Looking forward to your opinion. (and I promise you: SAP is listening )

 

You can find me on Twitter and G+

Recently I have developed some CDS views in Eclipse and I would like to share the source codes in github. I am relunctant to manually copy the source code of each view one by one, as a result I am checking whether there are some folders in my local laptops where the source code are cached.

 

I spent some time to research and here is the result.

 

I have created three ABAP projects in Eclipse:

clipboard1.png

And in this location C:\Users\i042416\workspace_adt\.metadata\.plugins\org.eclipse.core.resources.semantic\.cache


How do I find the path "C:\Users\i042416\workspace_adt"? Just right click ABAP project and choose Properties from context menu, and choose Resource->Linked Resources:


clipboard2.png

I could see three folders correspondingly:

clipboard3.png

Enter the first folder and then there are four sub folders. The folder ddic just stores the source code of CDS views which I am looking for.


clipboard4.png

Every CDS view in Eclipse has a corresponding folder in local file system:

clipboard5.png

The asddls file within that folder just contains exactly the source code of CDS view, which could be opened via any text editor.

clipboard6.png

Then I could just upload those folders to github very conveniently to avoid the manual ctrl + c and ctrl + v

Hello,

 

In this post I would like to demonstrate one tool in eclicpse IDE that in my opinion is very usefully, the Local Version History.

 

Through this tool, we can control the changes in source code, before task or request is released. Eclipse record all modifications in source code automatically always we save our code, keeping this changes in a local history.

 

To use the local history is very simply, we only need do a right click in a our source code and in the context menu choose, team -> show local history

 

There you will can see all the modifications made in your code. Of course, this a local history, but can help in many situations.

 

You also can compare the versions, apply the changes etc.

 

 

Imagem_post4.jpg

Imagem_post5.jpg

Imagem_post6.jpg

Syntax coloring is a nice feature every ABAP developer loves since the new ABAP editor was provided a couple of years ago.

But you can only use it to distinguish between keywords, non-keywords, literals and comments. But keywords are all colored the same way in the ABAP editor. 


In Eclipse you have much more possibilities to customize the color settings of the keywords in the editor. With the new ADT version 2.58 it is possible to specify the keyword colors via the eclipse preferences page:


01-04-2016 15-12-14.png



In the example above I specify that "Method" and "Endmethod" statements are colored differently in the editor than the other keywords. I can even specify different font settings for these keywords, e.g. I could strikethrough FORM statements. The code then looks like this:



01-04-2016 15-16-32.png


Have fun with your colored code.


Regards,

Thomas.




Dear ABAP community,

 

I'd like to give you a short summary of the reworked ABAP project wizard of the latest ADT version 2.58 that is now available.

 

Creating or Defining the System Connection as ABAP Projects


Since you work with ADT, you know ABAP projects that represent the connection to your backend system.

 

Now, usability and functionality of the ABAP project creation wizard have been significantly improved as follows:

 

  1. The first creation wizard page displays a table that lists all system connections from the SAP Logon. So, you can skim through the table to find your candidate. In addition a search field is added above the table. From here you start typing the name of the relevant system. Then, only the relevant connections are displayed in the table. Both improvements make it easier for you to find the relevant system connection. Because, now you don't need to know its concrete name anymore. As long as you have found your system, just double-click it, to open the next page.

    bbb.png

  2. On the second page, you will find the "Connection Parameters" and the "Secure Network Settings" in a well structured way. To create a new ABAP project on base of an existing connection, you can modify the displayed data manually or just taking over all settings. In contrast to the previous ADT version, you can now define here more specific settings, for example, SNC, and so on.

Have fun with creating ABAP projects.

Do you know this situation: You are working on a development object in your eclipse IDE and you want to know in which transport request this object is locked. For sure the AIE transport viewer is the tool of choice in that case:



28-01-2016 12-52-26.png

 

In the transport viewer you see all your transport requests and all the objects that are locked within these request.


BUT: In case you have a lot of requests in that list you have an issue. Because you have to open all folders in order to manually do the lookup for the object you are interested in. This takes you a while and you are frustrated about the tool. 


STOP: Why not use the Filter line on top of the view? Just enter the name of the object (or parts of it) and the tree automatically opens the correct folder and you immediately see the request where the object is locked. This makes you happy again.


2.png



I think this is a very helpful feature !


Have Fun.

Thomas.





 


This article could be helpful for you if you are an ABAP developer using ABAP Development Tools (ADT) and you experience one of the following scenarios:

  • Your ADT breakpoints are decorated with small red crosses and you get messages telling you that there is a breakpoint activation conflict
  • You want to debug for a group user (means multiple persons using the same username and password in parallel, e.g. support user or technical group user).
  • You switch between ADT and SAPGUI Debugger (with external breakpoints) for the same system, client and username
  • You use multiple ADT projects for the same system, client and username in parallel

 

The intention of this article is to provide a basic understanding about the specialty of these situations and to show what possibilities ADT offers to deal with them. If you have issues with mass requests and you get too many debug sessions in a short time you can directly go to the section "Mass Requests".

 

ADT Breakpoints and External Requests

 

When using SAPGUI you have to deal with three different kinds of breakpoints (debugger breakpoints, session breakpoints and external breakpoints). Now with using ADT things become much easier as there is only one kind of breakpoint for all purposes. In ADT you just create a breakpoint and by default it can be used to catch any request for the current user, including external requests like RFC or HTTP.

 

Requests.jpg

Once a request hits a breakpoint a new debug session will be started and the project that was used to create the breakpoint will be the owner of this session, regardless where the request was started from.

 

Activation Conflicts

 

ADT breakpoints are easy to handle and work well for 95% of all debugging scenarios. But in some cases like the ones mentioned (group user, multiple IDE case, etc.) things are a bit more complicated. In these cases there are multiple ADT projects / IDEs / persons claiming to debug the same requests (identical system, client and user). The question is now which ADT projects becomes the owner of upcoming debug sessions? This is what we call activation conflict.

 

Requests2.jpg

Remark: Above is mentioned that projects claim their "right to debug" by creating breakpoints. But the debugger should also work in some other situations, e.g. at the statement "break-point". Therefore an ADT Project claims debugging rights already during system logon and conflicts can also occur if no breakpoints are present.

 

So what's the solution? Who will be the owner of the debug session?

 

Before NetWeaver 7.50 it is the project that was most recently used to create a breakpoint (or most recently used to execute the menu action "Refresh Breakpoint" / "Refresh Breakpoint Activation").

 

Starting with NetWeaver 7.50 there is an integrated conflict handling available for these situations that makes conflicts obvious and offers options to deal with it. Additionally there is a new debugger setting that can be used to avoid conflicts completely at the price of a reduced breakpoint validity scope.

 

Conflict Management

 

As long as only one ADT project claims debugging rights for a certain set of requests everything is ok. Once a second project also claims debugging rights for the same requests this is recognized and the second project will change its debugging status to "suspended" while the first project stays unaffected. Within suspended projects all breakpoints are immediately decorated with small red crosses and corresponding texts:

 

RedBreakpoints.jpg

Projects in suspended state cannot be used for debugging at all. But it's easy to reactivate debugging within a suspended project, although this will suspend the currently active project in return.

 

To reactivate a suspended project and suspend the currently active one you can perform one of the following actions:

  • Open the context menu on any breakpoint or the vertical bar where you usually place breakpoints and choose "Refresh Breakpoint Activation"

     BreakpointRefresh.jpg

        To reactivate debugging for yourself (including suspension of someone else) you have to choose "Continue" on the confirmation popup

     CreateBreakpoint.jpg

  • Alternatively create a new breakpoint and choose "Continue" on the confirmation popup

 

The debugger suspension will cause an information popup in the first project:

 

SuspendedInfoPopup.jpg

 

Now the first project is suspended and therefore offers the chance to reactivate debugging including the suspension of the currently active project (= now the second project).

 

Currently running debug sessions are not affected. Even if someone else suspends you while you are debugging you can go on as usual. To remember: The above conflicts are regarding the question who will be the owner of newly upcoming debug sessions.

 

Additionally you will be warned when you are about to change your debug settings in a way that would cause a conflict. For example if you try to debug the requests of one of your colleagues while he is currently working with his user on his own PC / IDE.

        

SettingsConflict.jpg

 

Project Debugging Scope

 

In case you are not interested in external HTTP and RFC requests but only in the requests that are triggered from your own eclipse project (embedded SAP GUI, ABAP Unit) you can also reduce the validity scope of your breakpoints. There will be no more conflicts at all, but you won't be able to debug external HTTP or RFC requests anymore. Additionally nobody else will be able to catch the requests that are fired from your project.

 

Requests4.jpg

To reduce the breakpoint validity scope you can enter your project properties, navigate to ABAP Development -> Debug and choose "This project only".

 

SettingsProjectDebugging.jpg

 

Conflicts between ADT and SAPGUI external breakpoints

 

The conflicts that can occur between SAPGUI and an ADT project are conceptual similar to the conflicts between multiple ADT projects:

 

Requests5.jpg

But there are also some differences. Once an external breakpoint is created in SAP GUI all active ADT projects that are aiming for the same requests will be suspended. There is no further confirmation popup within SAP GUI. Also vice versa ADT projects do not take SAP GUI external breakpoints into account and suspend them without any further confirmation during the creation of an ADT breakpoint or a similar action (breakpoint refresh, system logon).

 

The improvement of NW 7.50 compared to lower releases in this case is that you can easily see within ADT that your project has been suspended.

 

Mass Requests

 

If you have to debug a code position that is executed very often, like one time per second or even more often, then you probably have the problem of too many debug sessions. This is independent from the above explained conflicts but can also be caused by the work with group users, e.g. if you have a web application that uses a shared technical group user:

 

Requests3.jpg

 

In some situations debugging with terminal ID can be useful for this problem. But for tagging HTTP requests with the terminal ID you need to start your browser via the SAP HTTP Plugin for IE (refer to SAP note 1041556), which is also not suitable for some situations.

 

What you can do instead:

  • Use a conditional breakpoint to specify the wanted request(s) more precisely
  • Try to create the breakpoint at a code position that will be reached by the wanted request but not by each and every request
  • Activate your breakpoint only for the short time when you expect the wanted request and deactivate or delete it when the debug session has been started

 

Once you have a running debug session for your wanted request it's easy to go on by using soft breakpoints. These can be used like normal breakpoints in running debug sessions but will not start new debug sessions.

Introduction

 

Many of us have improved development speed by using several custom code templates in SAPGUI Editor. And me too, of course.

img01.png

 

So, when I started working in Eclipse, I was strongly missing my usual templates.

Of course, I could copy all the templates from SAPGUI to Eclipse manually, one by one. But manual uniform repeating action offends real programers

So I have created ABAP program, which display a list of all custom SAPGUI templates, and allows you to copy selected (or all of it) to Eclipse.

 

 

Installation

 

To install program you need to import SAPLink nugget in attachment (you should change extention from .xml to .nugg).

(The program have been created in system with SAP_BASIS 702 SP11)


User’s manual

 

1) Run program ZUTIL_TEMPLATE_SAPGUI_2_ADT.

 

2) The list of all custom templates from file abap_user.xml will be displayed.

img02.png

 

3) You can select individual lines to copy only selected templates or copy all templates. To copy all templates you don’t need to make any selection. (The program will ask you to confirm)

 

4) Press “Copy to Eclipse”.

If you haven’t selected any line, you’ll see the confirmation

img03.png

 

5) Next, the dialog for choosing Eclipse workspace folder will appear.

Choose workspace folder of required Eclipse installation.

(It can’t be defined programmatically because you can have several Eclipse installations)

img04.png

 

6) That’s all

img05.png

 

7) Now let’s check the results.

Start Eclipse (or restart, if it is already running) and check Templates

img06.png

 

Exactly what we need!

 

That’s all.

I hope this small tool will be helpful

 

Best regards,

Vitaliy

Introduction

The immense potential of the Core Data Services (CDS) semantic data layer is aware to all of us. The CDS graphical editor complements this potential by representing CDS entities and their relationships in a graphical form.

 

As an architect or an application developer, you know the difficulty in comprehending complex source codes either developed by you or your colleagues. Every time before you engage in a technical discussion you need to have a relook at the implementation for an effective engagement.

 

The CDS graphical editor takes care of this gap and brings you up to the speed in a shorter span. The graphical view enables you to have implementation discussions between project stakeholders without detailed explanation of concepts and relationships as they are self-explanatory.

 

The graphical view is a read-only view. To make changes to the CDS entity, you need to access the source code editor. Graphical editor enables you to directly navigate to the source code editor and make the required changes.

 

The CDS graphical editor is available in ABAP-in-Eclipse development environment with ABAP Development Tools version 2.51 in SAP NW 7.5 SP00.

 

Access Graphical Editor

 

  1. In Project Explorer, navigate to the required ABAP package.
  2. Navigate to the DDL text editor.
  3. Choose a DDL text editor.
  4. In the context menu, choose Open with Graphical Editor.

       The graphical editor appears on the right and provides a graphical display of the entity as described in the DDL text editor.

 

CDS Graphical Editor Features

In the graphical editor, you can use any of the following options to see the source code of an entity:

  • Double-click the object
  • Use context menu of the object

 

text_editor.png

 

 

Updating the Entity in the Graphical Editor

You can edit the source code in the text editor. Changes made in the text editor appear immediately in the graphical editor. Syntax errors appear as parse error in the object where the error occurred.

 

 

parse_error.png

 

 

 

Opening text editor

Choose the object and from the context menu, choose Open DDL Source Editor to view the text editor.

 

 

open_ddl_source_editor.png

 

 

Where-Used feature

This feature enables you to view the usage of a user-defined type within the DDL source. Choose a user-defined type and from the context menu choose the option "Highlight Used Column". The user-defined type appears highlighted.

 

 

highlight_where_used.png

 

 

Browsing Data Model

If the data model is large such that not all the objects are visible in the drawing pane at once, you can use the Miniature View to browse the data model. Press CTRL + 3 on the keyboard and enter Miniature View in the field.

 

miniature_view.png

 

 

Auto Layout

The graphical editor positions the objects in the editor automatically. You can manually change the position of the objects but these positions are not persisted. The next time you open the DDL source the graphical editor lays out the position of the objects automatically. In the context menu of the graphical editor, choose Auto Layout.

 

 

auto_layout.png

 

 

Printing and Exporting

You can print or export object diagrams using the Print or Export Diagram options available in the context menu of the editor.

 

 

The table below displays the graphical representations of entities with its description:

 

 

Graphical RepresentationDescription
entity_icon.pngThis symbol represents an entity.
key_element_icon.pngThis symbol represents a key element in an entity.
element_icon.pngThis symbol represents elements in an entity.
association_icon.pngThis symbol represents an association in an entity
user_defined_type_icon.pngThis symbol represents a user-defined type.
association_line.pngThis symbol also defines an association. The directed line indicates the relationship between entities.The association name appears on the line. The line also displays cardinality if you have defined a cardinality for the association.
inner_join.pngThis symbol represents an inner join.
left_outer_join.pngThis symbol represents an outer join.
union_icon.pngThis symbol represents a union.

ABAP in Eclipse now offers eclipse native editor support for Web Dynpro ABAP(WDA) Component and Web Dynpro ABAP Application.

 

In the project explorer, right-click on the object or double click to open WDA Component or Application in the eclipse editors. You can also use the shortcut ctrl + shift + A to search and launch the WDA Component or Application editor.

 

Web Dynpro Component Editor:

wdC.png


Web Dynpro Application Editor:

wdA.png


To test any WDA Application, click on the hyperlink "URL" and the application is launched within Eclipse in the pre-configured browser.

SAP NetWeaver AS ABAP 7.5 delivers many new features in the area of ABAP Core Data Services (ABAP CDS). In addition to the new CDS language features there are also many new CDS tools in ABAP in Eclipse. Here is a short overview of some of the tooling highlights.

 

Project Explorer

 

If you’re looking for your DDL sources in 7.5 you will now find them in your ABAP package under Core Data Services > Data Definitions. The CDS objects have been re-organised in the Project Explorer to make accessing your objects easier.

 

ProjectExplorer.png

 

Code Completion

 

Code completion in ADT and in the context of the CDS text editor is certainly nothing new. What is new is that you can now insert all the elements of the data sources into the select list of your CDS view definition with one completion. Trigger the code completion with CTRL+SPACE and choose “Insert all elements”. In addition to the fields, any public associations defined in the data sources are also added to the select list. The completion takes into consideration all data sources, including the joined data sources. After the insertion you can easily delete individual elements from the select list with the Eclipse keyboard shortcut CTRL+D (delete line).

 

InsertAllElements.png

 

There is also code completion support for the CDS predefined functions (SQL, conversion, date and time functions).

 

CodeCompletionPredefinedFunctions.png

 

On Clause Wizard

 

Code completion is great, but sometimes a wizard just gets the job done better. With the On Clause Wizard you can easily create the ON clauses of your SQL joins and your association definitions. To start the wizard place the cursor on the ON keyword and use the keyboard shortcut CTRL+1.  Choose “Define ON conditions”. Create the conditions by mapping the fields of the source data sources (left hand side) with the target data source (right hand side) using drag & drop. Use the Filter to quickly find corresponding fields in the data sources by name or by type. The wizard also offers some pre-defined strategies to automatically generate the mappings. The mappings can be generated “By Name” or, if your sources are database tables, “By Foreign Key”. In this case, any foreign key definitions stored in the ABAP Dictionary for the database tables can be used to generate the mappings.

 

OnClauseWizard.png

 

Active Annotations View

 

In addition to the “core” annotations supported in SAP NetWeaver AS ABAP 7.4, there are now many more domain-specific annotations which you can use in your CDS view definitions. These annotations can be used for OData exposure and analytical consumption of CDS views. If you have defined view hierarchies (“view on view”) then the element annotation values are propagated from the underlying views to the view above. If you want to know which annotations your view contains (including the propagated annotations) and where the individual annotation values originated from, then you can use the Active Annotations View. Start the view in the context menu of the DDL source: Open With > Active Annotations. For each annotation the value and the origin is displayed. Navigate to the origin by double clicking on the  data source or data element name.

 

ActiveAnnotationsView.png

 

Show SQL CREATE Statement

 

If you want to see which SQL joins were generated in the database system for the path expressions in your view definitions or if you want to see the order of the generated joins, then you can easily display the CREATE statement for the corresponding SQL view directly in ADT. Select “Show SQL CREATE Statement” in the context menu of the DDL source.

 

ShowSQLCreateStatement.png

 

Dependency Analyzer

 

Another useful tool to help you analyze the dependencies of your CDS view is the Dependency Analyzer. While the CREATE statement only displays the direct dependencies, the Dependency Analyzer recursively analyzes the data sources and also displays the indirect dependencies to other database objects in the SQL Dependency Tree. In the Dependency Analyzer you can see which database tables are used by your query to select data from the database and you can easily identify redundant joins which might negatively affect the performance of your query. Start the Dependency Analyzer in the context menu of the DDL source: Open With > Dependency Analyzer. Search for database objects by entering the SQL name in the Search Toolbar. Navigate to the objects by double clicking on the SQL name. Finally, you can export the contents of the SQL Dependency Tree to a CSV file to analyze the dependencies in another external tool.

 

DependenyAnalyzer.png

As an experienced trouble-shooting expert you certainly encountered the ABAP statement LOG-POINT.
Using statement LOG-POINT in ABAP you can

  • log the content of nearly all kinds of variables – including internal tables
  • specify an arbitrary subkey for log event aggregation
  • switch on logging dynamically by using transaction SAAB

But as this kind of logging uses dedicated ABAP statements the source code has to be prepared beforehand. However, there is lots of ABAP code around, which is not prepared for logging yet.

What if you need to analyze such code without the possibility to change it, e.g. in a productive system?

 

New: Setting logpoints dynamically

With dynamic logpoints (available with SAP NW ABAP 7.5) you can now set logpoints dynamically -much like you set breakpoints- at arbitrary source code positions and even in productive systems (as long as you have the necessary privileges).
To set a dynamic logpoint simply right-click the marker bar next to the source code line, where you usually set a breakpoint. In the context menu simply click on “Add Logpoint…”.

 

DLP1.jpg

In the “Add Logpoint” dialog you can choose between different predefined activities for different use cases, like “Log Simple Variable Values”, “Log Call Stack” and more or you can use the more advanced “User-Defined Logging”, where you can enter the variables to be logged, the key for aggregation and an optional condition in a free-style way.

DLP_2.jpg

But let us first have a look at a simple example.

 

Example 1: Logging simple variables

Function module RS_TABLE_LIST_CREATE is used by transaction SE16 to create, generate and call the ABAP report needed to display the individual database table contents. It takes a parameter TABLE_NAME, which is the name of the database table to be displayed.

We now want to know, which database tables are being displayed in our system and how often.

Therefore, set a dynamic logpoint at the first executable line of the function module RS_TABLE_LIST_CREATE, choose activity “Log Simple Variable” for your logpoint and specify variable TABLE_NAME as variable to be logged:

 

DLP_3.jpg

 

Don’t limit the logpoint activation for specific users or application servers. Just leave the “Activation” section as is and press “finish”. Now your logpoint is activated for all users at all servers and the system collects the log data for you.

 

In the source code, you can now see the red logpoint symbol in the marker bar. Hover over the symbol and you’ll see the logpoint properties at a glance.

 

DLP_4.jpg

After a while you want to see your log results, so switch to the logpoint view. Refresh the display by using the “Collect logs …” button:

DLP_5.jpg

In the example described here 7 log events have been collected after a while.

DLP_6.jpg

 

If you now highlight the logpoint entry of RS_TABLE_LIST_CREATE, the result display comes up at the right side of the logpoint view:

DLP_7.jpg

You can now see the individual database table names and how often they have been displayed in the system using transaction SE16.

 

 

Example 2: Who is calling my service? (Log Call Stack)

If you need to change the behavior of a specific service  (e.g. a function module or method), you should know, who is calling it. The information of the direct caller might be sufficient sometimes, but often you need to know the complete ABAP call stack for a deeper analysis.

How can we tackle such a task with dynamic logpoints?

 

Assume that we are interested in a special service that is the UTC time stamp conversion to system time implemented in method CL_ABAP_TSTMP=>SYSTEMTSTMP_UTC2SYST. We now want to analyze, who is calling the service and how often.

This is rather simple. Just set a dynamic logpoint at e.g. the first line of the method implementation and use the predefined activity “Log Call Stack”.

DLP_8.jpg

Activate the logpoint and after a while switch to the logpoint view to have a look at the results.

It may look like this.

DLP_9.jpg

 

On the left side of the result display hash key values can be found, representing all individual ABAP stack hierarchies the method CL_ABAP_TSTMP=>SYSTEMTSTMP_UTC2SYST was called from. The “Log Events” column on the right side tells you how often this has happened. If you navigate into the details of one result display row, you can see the involved ABAP stack in the column “Field Values”.

So you just need a few clicks to get complete information about how often a dedicated service was called in a system and who called it along with detailed information about the ABAP call stack.

 

But now you may ask yourself:

Where do the hash key values come from and what they are good for?

To answer this, we first need to look at the more advanced activity “User-Defined Logging” in the next example.

 

 

Example 3: Log the number of ALV items displayed by the transactions executed in the system

In this example you will see, how easy it is to detect the transactions in your system, which are using ALV and how many list items they show. A glimpse of the content displayed by ALV can also easily be added.

To realize this you should use the activity “User-Defined Logging”, with the input fields “Key Definition”, “Field Values” and an “Optional Condition”.

Now set a dynamic logpoint at the first executable line of function module REUSE_ALV_GRID_DISPLAY. Parameter T_OUTTAB contains the data to be displayed.

DLP_10.jpg

In the key definition specify the built-in functions req_type() and req_entrypoint(), which are returning the request type and the name of the current request (e.g. "TA" and "SM50"). Then the literal ‘ALV lines:’ is used for better readability and finally the built-in function lines( ) puts the number of lines of table T_OUTTAB[] into the key string.

In the Field Value section specify the first line of table T_OUTTAB[], just to get an idea what kind of data is displayed in the current transaction.

Last but not least you may want to limit the logging to certain users, which can be done in the condition, like it is shown above.

 

After a while you get results like this:

DLP_11.jpg

You can now clearly see what requests/transactions are using ALV, how many lines they are showing and how often they have been called in the system.

 

 

In this example, we used the built-in functions

  • req_type( )
  • req_entrypoint( )
  • lines ( )

But there are more.

Other useful built-in function are for example

  • stack_hash( )
  • stack( )

The stack_hash( ) function returns a hash key of the current ABAP stack, while function stack( ) delivers the current ABAP stack itself in an internal table.

 

Now you can understand, what the activity "Log Call Stack" in example 2 is doing: It pre-fills the "Key Definition" input field with stack_hash( ) and writes function stack( ) into the "Field Values".

The unique hash value returned by stack_hash() makes the system to count similar and collect different ABAP stacks, while function stack( ) puts the ABAP stack into the "Field Values" of the result display by returning an internal table, filled with the ABAP stack.

Summary

You have seen how easy it is to configure, start and display your individual tailor-made analysis with dynamic logpoints.

Use the predefined activities, like "Log Simple Variable Values" or "Log Call Stack", wherever it is sufficient for you and use the full-fledged flexibility of the "User Defined Logging", where you need it. There is nearly nothing you can not do with dynamic logpoints.

And the best thing is: you not even have to change the source code for it!

Actions

Filter Blog

By author:
By date:
By tag: