天天看點

Jerry的ABAP原創技術文章合集

1. Jerry的ABAP, Java和JavaScript亂炖

這篇文章包含我多年來在SAP成都研究院使用ABAP, Java和JavaScript工作過程中的一些感悟: 三種語言裡一些具體技術點的橫向比較。随便提一些:

ABAP Load Vs Java Byte code

ABAP和Java的weak reference比較

ABAP和Java的垃圾回收比較

ADBC和JDBC

用ABAP模拟閉包/柯裡化/動态代理/Spring依賴注入

2. ABAP開發人員未來應該學些什麼

這篇文章包含了一些關于ABAP開發人員如何保持競争力這個話題我的一些個人看法。

3. Jerry 2017年的五一小長假:8種經典排序算法的ABAP實作

而本篇文章是我過去寫的關于純ABAP的技術分享文章的合集。這個合集裡包含的文章有的是我對ABAP新知識的學習筆記,有的是解決一些具體問題的思路分享,還有的則是我如何用ABAP提升自己工作效率的分享。

總共有59篇文章,連結較多。微信個人公衆号不允許插入超連結,是以大家如果想直接點選超連結跳轉,麻煩點選文末的“閱讀原文”, 在該頁面上點選超連結即可直接跳轉。給您帶來的不便敬請諒解。

1. A real example:how to leverage ABAP breakpoint with type “Exception”

Jerry的ABAP原創技術文章合集

介紹這種異常類型的斷點在調試中的一個具體應用。

https://blogs.sap.com/2013/11/07/a-real-example-how-to-leverage-abap-breakpoint-with-type-exception/

2. Six kinds of debugging tips to find the source code where the message is raised

我2013年寫的文章,應用場景是假設您在SAPGUI裡遇到了一個錯誤資訊,您想知道具體哪一行代碼抛出的該錯誤資訊?

文章裡介紹了6種不同的辦法。我個人認為靈活掌握了這些方法,不僅僅對于在SAPGUI環境的排錯,還是對于在Web環境,比如Fiori或者WebClient UI, 都是很有用的。

往往有的朋友反映CRM中間件裡報得很多錯誤資訊都不是特别有用,看了之後仍然不知道從哪裡入手來避免。我一般處理這種問題的辦法就是通過本文介紹的方法找到具體哪一行代碼抛出的錯誤資訊,然後在附近一般就能找到檢查的邏輯,因為這些錯誤資訊幾乎都是在檢查失敗之後的ELSE分支裡抛的,通過閱讀檢查邏輯的代碼我就能了解到正确的邏輯應該是怎樣的,然後就能做對應的處理。

https://blogs.sap.com/2013/11/15/six-kinds-of-debugging-tips-to-find-the-source-code-where-the-message-is-raised/

3. Single step debugging on Macro

ABAP宏的單步調試。

很多程式設計語言裡的宏都是無法單步調試的。我們得感謝SAPGUI, 在工具層面提供了宏的單步調試功能。

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2013/11/17/single-step-debugging-on-macro/

4. Have fun with system log – your debugging activity is being recorded by System

SAP不推薦直接在生産系統通過調試的方式修改資料或者在程式執行的時候通過調試器裡的Shift+F12更改程式的執行流,這樣可能造成生産系統的資料不一緻或者程式執行出錯。我們不能存在僥幸心理,認為自己悄悄在調試器裡修改一個變量的值, 沒人會知道。其實所有這一切都記錄在系統日志裡:

https://blogs.sap.com/2013/11/20/have-fun-with-system-log-your-debugging-activity-is-being-recorded-by-system/

5. Four different TEST ISOLATION techniques to build your ABAP unit test

設計并實作ABAP單元測試的一些技巧和方法論。SAP的标準開發對于新的功能代碼的單元測試有很嚴格的要求。

https://blogs.sap.com/2013/11/21/four-different-test-isolation-techniques-to-build-your-abap-unit-test/

6. A compare tool: Download and analyze the runtime performance result from SAT

我自己寫的工具,用于SAP内部項目。比如我在兩個系統HN1和Q2U分别用SAT執行了同一段代碼,我想side by side比較這兩個系統裡這同一段代碼執行的性能。标準的事務碼SAT隻提供導出功能,但沒有導入并比較的功能,是以我自己寫了一個。

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2013/11/21/a-compare-tool-download-and-analyze-the-runtime-performance-result-from-sat/

7. ABAP Mesh in 740: Connect your internal table as BO node association

ABAP 740新文法的學習筆記,沒有在實際項目中遇到。

https://blogs.sap.com/2013/12/06/abap-mesh-in-740-connect-your-internal-table-as-bo-node-association/

8. New Open SQL Enhancement in 740

ABAP 740 Open SQL的增強介紹:

https://blogs.sap.com/2013/12/06/new-open-sql-enhancement-in-740/

9. An example of AMDP( ABAP Managed Database Procedure ) in 740

ABAP存儲過程,在我的公衆号文章裡提到的原型開發中使用到了這個技術。

https://blogs.sap.com/2013/12/10/an-example-of-amdp-abap-managed-database-procedure-in-740/

10. A small tip to find all classes which are registered to a given event – And how I find this tip via SM50

小技巧, 事務碼SM50的另類用法:

https://blogs.sap.com/2013/12/10/a-small-tip-to-find-all-classes-which-are-registered-to-a-given-event-and-how-i-find-this-tip-via-sm50/

11. ABAP Class documentation generator

如何自動給ABAP class生成文檔, 在SAPGUI裡點選按鈕之後能看到生成的文檔:

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2013/12/12/class-documentation-generator/

12. ABAP static analysis tool SQF

事務碼SQF介紹,強大的靜态代碼分析工具

https://blogs.sap.com/2013/12/23/abap-static-analysis-tool-sqf/

13. A small tip of class cl_system_transaction_state

工具類cl_system_transaction_state的介紹:

https://blogs.sap.com/2014/01/03/a-small-tip-of-class-clsystemtransactionstate/

14. A small tip to get a list of changed objects at the given time period

提高工作效率的小技巧:處于工作需要,我經常得快速找到在指定的時間段内我修改了哪些ABAP代碼,用這個技巧很快能得到清單。

https://blogs.sap.com/2014/02/07/a-small-tip-to-get-a-list-of-changed-objects-at-the-given-time-period/

15. Use report RSDEPEND to analyze ABAP load dependencies

借助标準report RSDEPEND介紹ABAP load依賴管理原理

介紹了為什麼下面這個程式進行文法檢查時會遇到這個奇怪的錯誤消息?

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2014/02/07/use-report-rsdepend-to-analyze-abap-load-dependencies/

16. 用ABAP生成二維碼(QRCode)

https://blogs.sap.com/2014/02/24/%E7%94%A8abap-%E7%94%9F%E6%88%90%E4%BA%8C%E7%BB%B4%E7%A0%81/

17. ABAP動态類型建立介紹

自己寫了一個工具,能在運作期動态建立新的資料類型(RTTC Tool),用于内部工具開發。

https://blogs.sap.com/2014/02/28/a-handy-rttc-tool/

18. How to add a view into favourite

如何把視圖添加到SAPGUI的收藏夾裡

https://blogs.sap.com/2014/03/06/how-to-add-a-view-into-favourite/

19. General properties of ABAP Classes / Interfaces

介紹了這些CCDEF, CCIMP和CCMAC等等是什麼鬼。

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2014/03/14/general-properties-of-abap-classes-interfaces/

20. A small tip of viewing RAWSTRING field in SE16

事務碼SE16裡不能直接檢視這種類型為RAWSTRING的字段内容,需要一些技巧。

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2014/03/25/a-small-tip-of-viewing-rawstring-field-in-se16/

21. Favorite List Management Tool

SAPGUI裡的收藏夾管理工具,我需要該功能但是SAPGUI不提供,隻能自己寫了一個。

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2014/04/24/favorite-list-management-tool/

22. Step by step to create, consume and trace web service in ABAP system

ABAP裡如何建立,消費和監控Web Service

https://blogs.sap.com/2014/05/20/step-by-step-to-create-consume-and-trace-web-service-in-abap-system/

23. Learn more detail about Standard logon procedure

介紹這個登入過程的一些細節。

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2014/05/21/learn-more-detail-about-standard-logon-procedure/

24. Manipulate Docx document with ABAP

使用ABAP編輯Word文檔

https://blogs.sap.com/2014/05/28/manipulate-docx-document-with-abap/

25. Create word attachment which consumes external web service

使用Word文檔消費Web Service:

https://blogs.sap.com/2014/06/05/create-word-attachment-which-consumes-external-web-service/

26. One approach to trace a dedicated workprocess

介紹report RSTRC000的用法:

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2014/07/08/one-approach-to-trace-a-dedicated-workprocess/

27. An issue caused by implicit conversion during RFC call

15寫成’15’引起的血案:

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2014/08/09/an-issue-caused-by-implicit-conversion-during-rfc-call/

28. An example to help you understand how does ADT work

ABAP in Eclipse的前台Java代碼和背景ABAP Server的互動原理

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2014/08/12/an-example-to-help-you-understand-how-does-adt-work/

29. A Small tip to get all transparent tables used in ABAP code

小技巧: 如何得到一段ABAP代碼裡使用到的所有透明表(Transparent Table)的清單

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2015/06/15/a-small-tip-to-get-all-transparent-tables-used-in-abap-code/

30. Useful tips regarding ABAP code inspector that you may not know

ABAP Code inspector還能這樣用:推薦ABAP開發人員浏覽本文以了解這些隐藏功能

https://blogs.sap.com/2015/06/15/useful-tips-regarding-abap-code-inspector-that-you-may-not-know/

31. Do SAT trace on applications which could not be launched by SAT

使用事務碼SAT對UI應用進行性能監控

Jerry的ABAP原創技術文章合集

這是我很喜歡的一個強大功能,性能監控僅僅是其用途之一。本文介紹的另一個用途是當我拿到一個陌生的UI應用,無論是Fiori, C4C UI還是CRM WebClient UI,假設我需要知道一段操作背景執行了哪些ABAP代碼, 但是我對這個應用的背景實作一點都不了解,無從下手。此時我可以用SAT跑一次UI應用,是以背景執行的代碼被SAT忠實地記錄了下來,非常友善我研究。下圖是一個例子:

Jerry的ABAP原創技術文章合集

這個技巧幫助我順利完成了很多别人布置給我的研究任務。

https://blogs.sap.com/2015/07/11/do-sat-trace-on-applications-which-could-not-be-launched-by-sat/

32. ABAP keyword syntax diagram

介紹了ABAP幫助文檔裡的文法圖

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2015/09/10/abap-keyword-syntax-diagram/

33. Step by Step to generate ABAP code automatically using Code Composer

介紹了ABAP Code Composer的概念

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2015/09/11/step-by-step-to-generate-abap-code-automatically-using-code-composer/

34. One order document application log read optimization

一個API性能優化案例,優化前後性能對比:

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2015/12/12/one-order-document-application-log-read-optimization/

35. A simple performance comparison against different types of internal tables

一個簡單的性能評測: 标準表, 有序表和哈希表的讀寫性能比較

Jerry的ABAP原創技術文章合集
Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2015/12/19/a-simple-performance-comparison-against-different-types-of-internal-tables/

36. An ABAP tool to get ABAP source codes line number

統計指定條件的ABAP代碼的總行數,例如一個Package或者一個function group下面的所有ABAP代碼總行數, 效果如下圖:

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2016/04/03/an-abap-tool-to-get-abap-source-codes-line-number/

37. Three ways to achieve conditional break point in your ABAP program

三種方式實作ABAP條件斷點: 這是SAP成都同僚提的問題,需求是希望斷點僅當滿足特定條件時才觸發。

https://blogs.sap.com/2016/05/26/three-ways-to-achieve-conditional-break-point-in-your-abap-program/

38. Some more technical details about SAP note

SAP note, 每一個SAP從業者都不陌生。這篇文章介紹了SAP note背後的一些技術細節,以及如何開發一些小工具來更高效地使用SAP note.

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2016/06/19/some-more-technical-details-about-sap-note/

39. Display content in table DDLOG

如何通過代碼通路類型為LRAW的字段

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2016/06/22/display-content-in-table-ddlog/

40. An example of Database deadlock in SAP table

SAP ABAP開發人員面試題: 寫一段會出現死鎖的ABAP代碼。先别急着看代碼,看看您有思路麼?

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2016/06/27/an-example-of-database-deadlock-in-sap-table/

41. ABAP開發面試題

說出下面4個列印語句的輸出?

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2016/11/02/can-you-answer-this-simple-question-regarding-conversion-rule-correctly-without-hesitation/

42. ABAP調試腳本的兩個具體使用案例

Jerry的ABAP原創技術文章合集

Use ABAP debugger script to view BOL entity content in an efficient way:https://blogs.sap.com/2016/11/03/use-abap-debugger-script-to-view-bol-entity-content-in-an-efficient-way/

Use ABAP debugger script to view dynamic query service selection parameter in an efficient way:

https://blogs.sap.com/2016/11/04/use-abap-debugger-script-to-view-dynamic-query-service-selection-parameter-in-an-efficient-way/

43. CL_OBJECT_COLLECTION, iterator and Polymorphism

文末其他網友的回複裡有幹貨。

https://blogs.sap.com/2016/11/05/cl_object_collection-iterator-and-polymorphism/

44. Use ABAP Multi-“Thread” programming to deal with a real performance issue

ABAP并發程式設計(Parallel Programming)的一次嘗試:

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2017/02/10/use-abap-multi-thread-programming-to-deal-with-a-real-performance-issue/

45. Some small ABAP tools I write to improve daily work efficiency or just for fun

我自己寫的一些ABAP小工具,有的能提升工作效率,有的用來惡作劇。

比如列印一個user在過去某個時間段使用事務碼的次數,從高到低排列。

比如下圖2017年3月,我總共使用了692次事務碼SAT, 這讓我很容易回憶起去年這個月我在處理一個和性能相關的ticket.

Jerry的ABAP原創技術文章合集

或者是這種,在某位同僚聚精會神調試代碼時,給TA的SAPGUI視窗填一個對話框出來,建議TA起身休息一會?

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2017/03/25/some-small-abap-tools-i-write-to-improve-daily-work-efficiency-or-just-for-fun/

46. ABAP裡有三組關鍵字, 傻傻分不清楚

IS BOUND

IS INITIAL

IS ASSIGNED

https://blogs.sap.com/2017/04/01/is-bound-is-initial-and-is-assigned/

47. Implement Custom Syntax Check in SAP GUI

介紹如何增強SAPGUI的文法檢查。我做了一個例子,強制要求每個類的方法源代碼行數不得超過100行。當您點選SAPGUI文法檢查的按鈕或者快捷鍵Ctrl+F2時,一旦超過,會看到我自定義的錯誤消息:

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2017/04/13/implement-custom-syntax-check-in-sap-gui/

48. Bitwise operation ( OR, AND, XOR ) on ABAP Integer

用ABAP内表模拟的ABAP位操作,僅能用于教學目的,因為性能太差。不過ABAP應用的開發也幾乎不會遇到需要借助像Java支援的那種位操作功能。

https://blogs.sap.com/2017/04/28/bitwise-operation-or-and-xor-on-abap-integer/

49. An interview question: Compare two integers without +,-,*,/ or > and <

ABAP面試題: 實作兩個整數比較大小的方法,要求不能在方法體内使用加減乘除或者大小于比較符号。

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2017/04/29/an-interview-question-compare-two-integers-without-or-and/

50. Replicate ABAP database table definition to PostgreSQL

把ABAP資料庫表的定義導入到PostgreSQL資料庫裡

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2017/05/08/replicate-abap-database-table-definition-to-postgresql/

51. Locators in ABAP Open SQL

一種新的使用Locator(定位器)讀取資料庫表資料的方式

這篇文章介紹了Locator的使用場合以及和傳統OPEN SQL的性能比較。

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2017/05/11/locators-in-abap-open-sql/

52. Export ABAP transparent table content to PostgreSQL table

把ABAP的資料庫表的内容導到PostgreSQL資料庫裡

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2017/05/12/export-abap-transparent-table-content-to-postgresql-table/

53. CL_ABAP_CORRESPONDING, CL_JAVA_CORRESPONDING and CL_JS_CORRESPONDING

CL_ABAP_CORRESPONDING是ABAP标準的工具類,後兩個是我參照它的思路用Java和JavaScript重寫的,ABAPer可以隻關注ABAP的工具類。

https://blogs.sap.com/2017/05/14/cl_abap_corresponding-cl_java_corresponding-and-cl_js_corresponding/

54.  A real case to use REDUCE to finish a task in daily work

ABAP 740提供的新關鍵字REDUCE, 一直想在工作中用它實踐。本文介紹了一個例子。

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2017/05/14/a-real-case-to-use-reduce-to-finish-a-task-in-daily-work/

55. Use ABAP Channels to build a trace tool used in my daily work

SAP community上有一些對ABAP Channel技術的介紹,本文則是我用這個技術提升我工作效率的嘗試之一。

Netweaver上有各種各樣的trace工具,這些trace工具的一個共有之處是需要先打開工作的trace狀态,然後在trace狀态下運作應用,應用結束之後關閉trace,然後檢視trace檔案。典型的比如事務碼ST05, ST12和SAT。

我覺得這樣太麻煩了,有沒有可能應用在運作時,trace資訊實時地顯示在浏覽器裡呢?可以!用ABAP Channel就行。

https://blogs.sap.com/2017/05/16/use-abap-channels-to-build-a-trace-tool-used-in-my-daily-work/

56. A list of some “magic” tables and reports I collect in my daily work for ABAP development

一些ABAP小工具

https://blogs.sap.com/2017/06/18/a-list-of-some-magic-tables-and-reports-i-collect-in-my-daily-work-for-abap-development/

57. A Github repository issue tool developed by ABAP

自己寫的小工具。Github自帶的倉庫備份工具我覺得太難用,我自己用ABAP寫了一個,能滿足我的需求:把公網上個人倉庫裡的issue備份到ABAP伺服器上。

https://blogs.sap.com/2017/07/14/a-github-repository-issue-tool-developed-by-abap/

58. Regarding cookie manipulation in CL_HTTP_CLIENT to avoid CSRF token validation failure issue

使用CL_HTTP_CLIENT需要避開的一個cookie陷阱:

https://blogs.sap.com/2017/08/04/regarding-cookie-manipulation-in-cl_http_client-to-avoid-csrf-token-validation-failure-issue/

59. Just for fun – Implement a + b using pure bitwise operation in ABAP

在ABAP裡使用純粹的位操作實作兩個整數相加

Jerry的ABAP原創技術文章合集
https://blogs.sap.com/2017/10/13/just-for-fun-implement-a-b-using-pure-bitwise-operation-in-abap/