1. 程式人生 > >Jerry的ABAP原創技術文章合集

Jerry的ABAP原創技術文章合集

工作效率 細節 raise 文章 系統日誌 spring 分享圖片 是我 nta

我之前發過三篇和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"

技術分享圖片

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

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, 在工具層面提供了宏的單步調試功能。

技術分享圖片

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只提供導出功能,但沒有導入並比較的功能,所以我自己寫了一個。

技術分享圖片

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裏點擊按鈕之後能看到生成的文檔:

技術分享圖片

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依賴管理原理

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

技術分享圖片

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等等是什麽鬼。

技術分享圖片

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的字段內容,需要一些技巧。

技術分享圖片

https://blogs.sap.com/2014/03/25/a-small-tip-of-viewing-rawstring-field-in-se16/

21. Favorite List Management Tool

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

技術分享圖片

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

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

技術分享圖片

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的用法:

技術分享圖片

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‘引起的血案:

技術分享圖片

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的交互原理

技術分享圖片

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)的清單

技術分享圖片

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應用進行性能監控

技術分享圖片

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

技術分享圖片

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

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幫助文檔裏的語法圖

技術分享圖片

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的概念

技術分享圖片

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性能優化案例,優化前後性能對比:

技術分享圖片

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

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

技術分享圖片

技術分享圖片

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代碼總行數, 效果如下圖:

技術分享圖片

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.

技術分享圖片

https://blogs.sap.com/2016/06/19/some-more-technical-details-about-sap-note/

39. Display content in table DDLOG

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

技術分享圖片

https://blogs.sap.com/2016/06/22/display-content-in-table-ddlog/

40. An example of Database deadlock in SAP table

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

技術分享圖片

https://blogs.sap.com/2016/06/27/an-example-of-database-deadlock-in-sap-table/

41. ABAP開發面試題

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

技術分享圖片

https://blogs.sap.com/2016/11/02/can-you-answer-this-simple-question-regarding-conversion-rule-correctly-without-hesitation/

42. 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)的一次嘗試:

技術分享圖片

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.

技術分享圖片

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

技術分享圖片

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時,一旦超過,會看到我自定義的錯誤消息:

技術分享圖片

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面試題: 實現兩個整數比較大小的方法,要求不能在方法體內使用加減乘除或者大小於比較符號。

技術分享圖片

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數據庫裏

技術分享圖片

https://blogs.sap.com/2017/05/08/replicate-abap-database-table-definition-to-postgresql/

51. Locators in ABAP Open SQL

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

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

技術分享圖片

https://blogs.sap.com/2017/05/11/locators-in-abap-open-sql/

52. Export ABAP transparent table content to PostgreSQL table

把ABAP的數據庫表的內容導到PostgreSQL數據庫裏

技術分享圖片

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, 一直想在工作中用它實踐。本文介紹了一個例子。

技術分享圖片

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裏使用純粹的位操作實現兩個整數相加

技術分享圖片

https://blogs.sap.com/2017/10/13/just-for-fun-implement-a-b-using-pure-bitwise-operation-in-abap/

要獲取更多Jerry的原創技術文章,請關註公眾號"汪子熙"或者掃描下面二維碼:
技術分享圖片

技術分享圖片

Jerry的ABAP原創技術文章合集