Jerry的ABAP原創技術文章合集

i042416發表於2018-02-10

我之前發過三篇和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依賴注入

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

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

  1. 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/

  1. 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/

  1. 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/

  1. 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/

  1. ABAP Class documentation generator

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

Jerry的ABAP原創技術文章合集

https://blogs.sap.com/2013/12/12/class-documentation-generator/

  1. ABAP static analysis tool SQF

事務碼SQF介紹,強大的靜態程式碼分析工具

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

  1. 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/

  1. 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/

  1. 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/

  1. Learn more detail about Standard logon procedure

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

Jerry的ABAP原創技術文章合集

https://blogs.sap.com/2014/05/21/learn-more-detail-about-standard-logon-procedure/

  1. 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/

  1. 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/

  1. 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/

  1. ABAP keyword syntax diagram

介紹了ABAP幫助文件裡的語法圖

Jerry的ABAP原創技術文章合集

https://blogs.sap.com/2015/09/10/abap-keyword-syntax-diagram/

  1. 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/

  1. One order document application log read optimization

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

Jerry的ABAP原創技術文章合集

https://blogs.sap.com/2015/12/12/one-order-document-application-log-read-optimization/

  1. 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/

  1. 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/

  1. 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/

  1. Display content in table DDLOG

如何通過程式碼訪問型別為LRAW的欄位

Jerry的ABAP原創技術文章合集

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

  1. 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/

  1. CL_OBJECT_COLLECTION, iterator and Polymorphism

文末其他網友的回覆裡有乾貨。

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

  1. 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/

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

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

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

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

Jerry的ABAP原創技術文章合集

或者是這種,在某位同事聚精會神除錯程式碼時,給他的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/

  1. 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/

  1. 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/

  1. 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/

  1. 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/

  1. 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/

  1. 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/

  1. 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/

  1. 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/

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


Jerry的ABAP原創技術文章合集
Jerry的ABAP原創技術文章合集

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2151013/,如需轉載,請註明出處,否則將追究法律責任。

相關文章