关于abap:ABAP-动态内表-read-table

这个程序展现了 如何动静内表的时候read 操作 loop 的时候 where条件的拼接 REPORT ztest_xy6.DATA: BEGIN OF lt_tmp OCCURS 10, hkont TYPE char10, sumty(2) TYPE c, END OF lt_tmp.DATA: ls_tmp LIKE lt_tmp, ls_tp2 LIKE lt_tmp.FIELD-SYMBOLS: <st_x> TYPE x.DEFINE m_tmp. clear lt_tmp. lt_tmp-hkont = &1. lt_tmp-sumty = &2. append lt_tmp.END-OF-DEFINITION.m_tmp '0090020020' '22'.m_tmp '0090020020' '21'.m_tmp '0090010010' 'C1'.m_tmp '0020110100' 'C1'.ASSIGN: ls_tmp TO <st_x> CASTING.ls_tmp-hkont = '0090020020'. ls_tmp-sumty = '22'.DATA gt_where TYPE TABLE OF string.gt_where = VALUE #(* ( |with key| ) ( | HKONT = '0090020020' AND| ) ( | SUMTY = '21'| ) ).DATA:gv_where TYPE string.gv_where = |Hello | & |world| .WRITE:/ gv_where.READ TABLE lt_tmp WITH KEY <st_x>.IF sy-subrc = 0. WRITE: / lt_tmp-hkont,lt_tmp-sumty.ENDIF.LOOP AT lt_tmp WHERE (gt_where). WRITE: / lt_tmp-hkont,lt_tmp-sumty.ENDLOOP.

April 1, 2021 · 1 min · jiezi

关于abap:一个问题CDS-view在HANA-studio里执行显示的耗时比在ABAP-open-SQL里少

Sent: Samstag, 8. Juli 2017 11:03Subject: RE: have a quick discussion about why the CDS view has a bad performance displayed in ST05 or SAT but the trace displayed in HANA studio shows a good performance Thanks a lot for your support. I have executed the report repeatedly for 5 times and the average time in ABAP is still 16 seconds. And when the SQLScript is executed in HANA studio, only 2.4 seconds is consumed.I plan to create an incident to HANA. ...

December 5, 2020 · 4 min · jiezi

关于abap:如何通过调试找到自己需要的ABAP增强

Jerry有一个SAP技术交换群,外面有很多参谋敌人们一起交换SAP开发技术。 有一个敌人提了这样一个对于加强点进口的问题。其实这类问题能够通过调试的方法本人找到答案。 场景一:查找SE18里的classic BAdI在CL_EXITHANDLER的GET_INSTANCE办法里设置断点,而后从新运行程序,如果断点触发,就把变量exit_name的值抄下来: SE18, 粘贴到BAdI Name字段里去, 就能看到这个加强定义下所有的实现了。 场景二 - 查找GET BADI关键字调用的旧式加强这种形式须要先以调试模式运行想要寻找加强的利用,在调试器的Break/Watchpoints里新建一个动静断点: 输出GET BADI, 回车: 动静断点创立胜利,此时F8继续执行: 如果断点停下来,双击GET BADI后的变量lr_badi, 把名称COM_MERGE_DATA_SET抄下来,这就是SE18里Enhancement Spot的BAdI定义名称。 把这个名称输出SE18的Enhancement Spot里,也能看到该Enhancement Spot下创立的所有加强实现。 更多Jerry的原创文章,尽在:"汪子熙":

December 5, 2020 · 1 min · jiezi

关于abap:不同类型的ABAP内表读写性能比较

I construct three internal tables with different table types: The complete test source code could be found in the end part of the blog. insert operation comparisonThe hashed table is least efficient since additional overhead is paid to maintain the internal administrative information for hash logic.The standard table is fastest due to the fact that there is no overhead. read operation comparisonThe standard table read is slowest due to o(n) complexity. ...

September 9, 2020 · 3 min · jiezi

关于abap:如何把一个ABAP视图添加到SAP-GUI的收藏夹里

The idea comes from Sougata Chatterjee’s anwser in this thread: Suppose I need to add the maintenance view COMV_PARTNER_FCT to my favorite list. I expect once the entry in the favorite list is double clicked, it will automatically navigate to the view detail like below ( the initial screen of SM30 is not expected ) Create a new transaction code and maintain SM30 as default value for transaction: ...

September 5, 2020 · 1 min · jiezi

关于abap:如何在SAP-CRM-WebClient-UI里创建web-service并使用ABAP消费

In this blog I will create a web service which is exposed via Genil model PROD in CRM web client UI and consume it via a simple ABAP program. Create web service in CRM Webclient UI(1) log on CRM Web UI with business role SERVICEPRO, work center Service Operation, Create a new Web service:Choose Material as Business Object, choose Product/Individual Product as Component, Product as Root object.Mark check box Read, Create and Change. ...

September 5, 2020 · 4 min · jiezi

关于abap:如何创建ABAP的text-table

(1) create a main table as usual: define the key field CHANNEL: (2) create another table which will be used as text table. Ensure a field with data element SPRAS is included as primary key. The primary key CHANNEL of main table must also be included in the text table. (3) mark field CLIENT and click button "Foreign Keys": Click Yes ...

September 5, 2020 · 1 min · jiezi

关于abap:SAP-CRM-Cross-Component级别的跳转如果出了问题该如何调试

Created by Jerry Wang on Feb 06, 2014(1) Click Hyperlink “Workflow document”: The following method is called to handle the navigation. Step into method SET_WORKAREA_CONTENT.(2) Inside method SET_WORKAREA_CONTENT, there is a method analyze_navigation: The information of navigation target is contained in the importing parameters. (3) Inside method SET_WORKAREA_CONTENT, there is a method analyze_navigation:The information of navigation target is contained in the importing parameters. ...

September 5, 2020 · 1 min · jiezi

关于abap:如何在SAP-ABAP系统里创建和消费Web-Service

This document could be used as guide for beginners to learn and use ABAP web service. How to create web service provider in ABAP systemThe following steps demonstrates how to expose a function module as a web service provider in SAP CRM system. (1) create a new function module to return product description by given input product ID.Signature and source code of function module: FUNCTION ZGET_PROD_DESCRIPTION.*"----------------------------------------------------------------------*"*"Local Interface:*" IMPORTING*" VALUE(IV_PROD_ID) TYPE COMM_PRODUCT-PRODUCT_ID*" EXPORTING*" VALUE(RV_TEXT) TYPE STRING*"----------------------------------------------------------------------SELECT SINGLE A~short_text INTO rv_text FROM COMM_PRSHTEXT AS A INNER JOIN comm_product AS B ON B~product_id = iv_prod_id AND B~product_guid = A~product_guid.ENDFUNCTION.Make sure the FM is marked as “Remote enabled”. ...

September 4, 2020 · 3 min · jiezi

关于abap:SAP-ABAP-Development-Tool的本地存储原理local-storage

Recently I have developed some CDS views in Eclipse and I would like to share the source codes in github. I am reluctant 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: ...

September 4, 2020 · 1 min · jiezi

关于abap:ABAP实现设计模式里的观察者发布者模式

This is an interview question from Wechat development team. The candidates are required to answer with JavaScript. Nevertheless I think it is also beneficial for an ABAPer if we master the design pattern contained in this question –Publish and Subscribe pattern. The requirement(1) The chain operations could be performed on instance of class ZCL_PERSON.For example, the red line 10 in ABAP code should generate the following output highlighted in red, and blue and green color accordingly.(2) The “sleep_first” operation has the highest priority, see ABAP line 14 and its output for reference. ...

August 31, 2020 · 3 min · jiezi

关于abap:使用ABAP实现Mock测试工具Mockito

What is Mockito? Mockito is a mocking framework, JAVA-based library that is used for effective unit testing of JAVA applications. In our unit test there are usually some dependency on other external service implementation for example network or database service. Usually in order to isolate our test code from these dependencies we have to create mock class against them. Mockito in Java can create transient mock class ( which is only available in current test session ) for us in a very easy way. See one example below: ...

August 31, 2020 · 5 min · jiezi

关于abap:干了SAP开发这么多年我都积累了哪些程序调试技巧

Tip1. Rubber Duck DebuggingTip1.1 blog your finding outTip1.2 Index your raw material into your knowledge repositoryTip2. ComparisonTip3. The Mini-System methodology for issue-isolationTip4. Google the error messageTip5. Try to be a master about the trouble shooting tool you useTip6. “I don’t know where to set breakpoint?”One of my new colleague is asking me whether I have some best practice which could be followed as a general way to analyze some issue more efficiently. ...

August 31, 2020 · 12 min · jiezi

关于abap:我ABAP开发生涯中搜集的一些有意思的数据库表

Magic tables CUS_IMGACH – IMG ActivitiesRFCATTRIB – Administration table for RFC destinationsSEOSUBCO – Class/interface subcomponentTVIMF – User routines called from view maintenanceMore to be added soonMagic reports RADPROTA – Display DDIC activation logRSTABLESIZE – Determining Table SizesRSSDOCTB – export transparent table definition locally4.A simple HTTP test tool RSICFCLTST01More to be added soon During my daily work I get to know the existence of some magic tables and reports which can enable me to achieve some work more efficiently and conveniently. Now I shared them with you. ...

August 31, 2020 · 4 min · jiezi

关于abap:用ABAP模拟JavaScript的柯里化语言特性Curry

As I mentioned in What should an ABAPer continue to learn as an application developer, function programming language is a mind -blower to ABAPers who have got used to ABAP as an imperative programming language. One of important concept in functional programming is Currying. Currying intensively manipulates functions. The name “Currying”, coined by Christopher Strachey in 1967, is a reference to logician Haskell Curry. Although the concept defined in wikipedia looks a little bit obscure, in fact every one should have already learned it during his / her high school in mathematics class. ...

August 31, 2020 · 5 min · jiezi

关于abap:使用ABAP-CLHTTPCLIENT类消费OData服务时如何避免CSRF令牌验证失败错误

Recently I meet with this cookie issue so I document it as a blog in case any other guys might meet with the same problem. I am trying to create some Opportunity transaction data by consuming OData service via CL_HTTP_CLIENT. Since this is a update operation which needs to be finished by HTTP POST, so a CSRF token is needed in this HTTP post. Let’s first have a look what is a typical scenario running in Chrome extension postman: ...

August 30, 2020 · 4 min · jiezi

关于abap:ABAP-Debugging-Script调试器脚本使用的一些实际例子

例子1:Use ABAP debugger script to view BOL entity content in an efficient wayIn CRM, if we could like to review a BOL entity content in debugger, for example consider the following sample code which fetches line item product of a given one order document: DATA: lo_collection TYPE REF TO if_bol_entity_col, lv_view_name TYPE crmt_view_name, lv_query_name TYPE crmt_ext_obj_name, ls_parameter TYPE genilt_query_parameters, lt_query_parameter TYPE genilt_selection_parameter_tab, ls_query_parameter LIKE LINE OF lt_query_parameter. ls_query_parameter-attr_name = 'OBJECT_ID'. ls_query_parameter-low = iv_oppt_id. ls_query_parameter-option = 'EQ'. ls_query_parameter-sign = 'I'. APPEND ls_query_parameter TO lt_query_parameter. ls_query_parameter-attr_name = 'PROCESS_TYPE'. ls_query_parameter-low = iv_process_type. ls_query_parameter-option = 'EQ'. ls_query_parameter-sign = 'I'. APPEND ls_query_parameter TO lt_query_parameter. so_core = cl_crm_bol_core=>get_instance( ). so_core->load_component_set( 'BT' ). lv_query_name = 'BTQ1Order'. DATA(lo_result) = so_core->dquery( iv_query_name = lv_query_name is_query_parameters = ls_parameter it_selection_parameters = lt_query_parameter iv_view_name = lv_view_name ). CHECK lo_result->size( ) = 1. DATA(lo_order_result) = lo_result->get_first( ). DATA(lo_bt_order) = lo_order_result->get_related_entity( 'BTADVS1Ord' ). CHECK lo_bt_order IS NOT INITIAL. DATA(lo_header) = lo_bt_order->get_related_entity( 'BTOrderHeader' ). CHECK lo_header IS NOT INITIAL. DATA(lo_items) = lo_header->get_related_entities( iv_relation_name = 'BTHeaderItemsExt' ). CHECK lo_items->size( ) = 1. DATA(lo_item) = lo_items->get_first( ). DATA(lo_admini) = lo_item->get_related_entity( 'BTItemsFirstLevel' ). CHECK lo_admini IS NOT INITIAL. DATA(lo_product) = lo_admini->get_related_entity( 'BTItemProductExt' ).If you would like to review the content of lo_product, you have to: ...

August 29, 2020 · 7 min · jiezi

关于abap:使用纯粹的ABAP位操作实现两个整数相加

Recently I came across this very funny picture and I would like to share with you. This picture shows totally five different approaches to implement “a + b”, and how your brain reacts when you read these code From this picture we know that for most guys, they will be crazy when they read the source code of the last solution as the code is really difficult to understand compared with all other four solutions. ...

August 28, 2020 · 3 min · jiezi

关于abap:如何找到ABAP里被动态调用的update-function-module

In this SCN discussion,Find a Function Module in Update Task dynamically called,a question is asked. For example, if the update function module CRM_PRODUCT_I_UPDATE_DU is called statically as:CALL FUNCTION ‘CRM_PRODUCT_I_UPDATE_DU’ … Then we can easily find all calling places where this function module is called.On the other hand, if the function module name is determined dynamicall in the runtime, for example: CALL FUNCTION lv_func_name, the where used list will not work.In this case, even though I have already set the breakpoint in update function module itself and the breakpoint is triggered in the runtime, I still could not figure out which programs calls this update function module. ...

August 27, 2020 · 1 min · jiezi

关于abap:ABAP数据库表的元数据

For project reason I need to fill some excel. The content of each column comes from content in SE11: In order to avoid such boring task, I write a small ABAP class to automate it. This class will first read corresponding database table name based on CRM settype id, then call function module DDIF_NAMETAB_GET to get all metadata of each table field, and then send the data to clipboard. ...

August 27, 2020 · 3 min · jiezi

关于abap:如何使用ABAP代码创建SAP-Product-Category

In ERP we can create new material type by copying from existing one using tcode OMS2: This new type could be downloaded into CRM system via customizing download. A product category with prefix MAT_ will be automatically created. And here below is source code to create new product category using MAT_ as parent category by ABAP code. METHOD replicate_category. CONSTANTS: BEGIN OF gc_application, sales TYPE comt_application VALUE '01', "r3-produkthier purchasing TYPE comt_application VALUE '02', "r3 mat class product TYPE comt_application VALUE '03', "r3 mat types config TYPE comt_application VALUE '04', internet TYPE comt_application VALUE '05', END OF gc_application. CONSTANTS: BEGIN OF gc_product_type, material TYPE comt_product_type VALUE '01', service TYPE comt_product_type VALUE '02', finance TYPE comt_product_type VALUE '03', ip_prod TYPE comt_product_type VALUE '04', warranty TYPE comt_product_type VALUE '05', tradeitem TYPE comt_product_type VALUE '06', fs_prod TYPE comt_product_type VALUE '07', END OF gc_product_type. rv_success = abap_false. DATA: lv_hierarchy_guid TYPE comt_hierarchy_guid, lv_parent_guid TYPE comt_category_guid, lt_categoryt TYPE comt_categoryt_tab.* Prerequisite: the corresponding hierarchy is already downloaded from ERP* Read the hierarchy which is assigned to application 03* (product type material) in transaction COMM_PRAPPLCAT CALL FUNCTION 'COM_HIERARCHY_READ_WITH_APPL' EXPORTING iv_application = gc_application-product iv_product_type = gc_product_type-material IMPORTING ev_hierarchy_guid = lv_hierarchy_guid EXCEPTIONS not_found = 1 OTHERS = 2. CHECK sy-subrc = 0. DATA(ls_cat_text) = VALUE comt_categoryt( langu = sy-langu category_text = iv_text text_upper_case = iv_text ). TRANSLATE ls_cat_text-text_upper_case TO UPPER CASE. APPEND ls_cat_text TO lt_categoryt. select single category_guid into lv_parent_guid FROM comm_category where category_id = 'MAT_'. CALL FUNCTION 'COM_PRODCAT_API_CREATE_CAT' EXPORTING iv_category_id = iv_cat_id iv_hierarchy_guid = lv_hierarchy_guid iv_parent_guid = lv_parent_guid iv_product_type = gc_product_type-material it_categoryt = lt_categoryt iv_logsys = iv_log_sys " 'QI3CLNT502' iv_non_assignable = abap_false EXCEPTIONS hierarchy_not_maintained = 1 wrong_call = 2 category_id_exists = 3 id_scheme_error = 4 error = 5 OTHERS = 6. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE 'X' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. RETURN. ENDIF. CALL FUNCTION 'COM_PRODUCT_CATEGORY_SAVE_ALL' EXPORTING iv_update_task = ' ' iv_update_pme = ' ' iv_hierarchy_guid = lv_hierarchy_guid EXCEPTIONS internal_error = 1 OTHERS = 2. ASSERT sy-subrc = 0. COMMIT WORK AND WAIT. rv_success = abap_true. ENDMETHOD.Method signature: ...

August 27, 2020 · 2 min · jiezi

关于abap:Java和SAP-ABAP的异常处理

Recently I am prepare an internal training and have been racking my brains to find a real example for my attendees about writting a “correct” program which gets rejected by compiler. The tricky point here is as a programmer, we always treat compiler as our god: if compiler complains that our program has errors, then we are wrong. Programmers tend to believe in that compiler will NEVER make mistakes. ...

August 26, 2020 · 4 min · jiezi

关于abap:一些能提高ABAP开发人员日常工作效率的ABAP小工具

I write some small ABAP tools for my daily work. Some of them might not be so useful at first glance – I just write them for fun. Some of them could be used to improve work efficiency, to just reduce several mouse clicks – I am too lazy Tcode Usage Statistics ToolThis 56 lines of report can print the tcode usage for a given user per month. ...

August 26, 2020 · 14 min · jiezi

关于abap:ABAPJavaJavaScript里的字符串模板String-Template

As an ABAP you probably be very familiar with String Template. String Template in ABAPA string template creates a string from literal text, embedded expressions, and control characters in a string expression. The most powerful feature I like is we can insert ABAP variable inside the template by wrapper variable with “{ }”, see one example below: In the runtime, ABAP will replace the String Template content with actual value stored in that variable. This functionality is especially useful when you need to populate string dynamically based on some ABAP variable, for example you need to create some ABAP class or function module whose signature is only known in the runtime specified by consumer. ...

August 26, 2020 · 4 min · jiezi

关于abap:ABAP和JavaScript的懒加载单例和桥接模式的实现和比较

According to Wikipedia Lazy loading is a design pattern commonly used in computer programming to defer initialization of an object until the point at which it is needed. It can contribute to efficiency in the program’s operation if properly and appropriately used.In this blog, I will use an example of SCN log on to illustrate its usage in JavaScript and how to simulate the implementation in ABAP.When we click log on link in SCN: ...

August 25, 2020 · 6 min · jiezi

关于abap:ABAP数据库表的元数据

For project reason I need to fill some excel. The content of each column comes from content in SE11: In order to avoid such boring task, I write a small ABAP class to automate it. This class will first read corresponding database table name based on CRM settype id, then call function module DDIF_NAMETAB_GET to get all metadata of each table field, and then send the data to clipboard. ...

August 24, 2020 · 3 min · jiezi

关于abap:在SAP-ABAP里使用注解Inject模拟Java-Spring

Recently I will deliver a session regarding dependency inversion principle to my team. As Java Spring is already widely used in all other Java development teams in my site, some ABAPers are not well aware of its idea and implementation under the hood. In order for ABAPers to easily understand the mechanism of Java Spring dependency inversion, I wrote a prototype in ABAP after going through related Java source code of Spring. ...

August 24, 2020 · 5 min · jiezi

关于abap:如何使用ABAP代码创建SAP-Product-Category

In ERP we can create new material type by copying from existing one using tcode OMS2: This new type could be downloaded into CRM system via customizing download. A product category with prefix MAT_ will be automatically created. And here below is source code to create new product category using MAT_ as parent category by ABAP code. METHOD replicate_category. CONSTANTS: BEGIN OF gc_application, sales TYPE comt_application VALUE '01', "r3-produkthier purchasing TYPE comt_application VALUE '02', "r3 mat class product TYPE comt_application VALUE '03', "r3 mat types config TYPE comt_application VALUE '04', internet TYPE comt_application VALUE '05', END OF gc_application. CONSTANTS: BEGIN OF gc_product_type, material TYPE comt_product_type VALUE '01', service TYPE comt_product_type VALUE '02', finance TYPE comt_product_type VALUE '03', ip_prod TYPE comt_product_type VALUE '04', warranty TYPE comt_product_type VALUE '05', tradeitem TYPE comt_product_type VALUE '06', fs_prod TYPE comt_product_type VALUE '07', END OF gc_product_type. rv_success = abap_false. DATA: lv_hierarchy_guid TYPE comt_hierarchy_guid, lv_parent_guid TYPE comt_category_guid, lt_categoryt TYPE comt_categoryt_tab.* Prerequisite: the corresponding hierarchy is already downloaded from ERP* Read the hierarchy which is assigned to application 03* (product type material) in transaction COMM_PRAPPLCAT CALL FUNCTION 'COM_HIERARCHY_READ_WITH_APPL' EXPORTING iv_application = gc_application-product iv_product_type = gc_product_type-material IMPORTING ev_hierarchy_guid = lv_hierarchy_guid EXCEPTIONS not_found = 1 OTHERS = 2. CHECK sy-subrc = 0. DATA(ls_cat_text) = VALUE comt_categoryt( langu = sy-langu category_text = iv_text text_upper_case = iv_text ). TRANSLATE ls_cat_text-text_upper_case TO UPPER CASE. APPEND ls_cat_text TO lt_categoryt. select single category_guid into lv_parent_guid FROM comm_category where category_id = 'MAT_'. CALL FUNCTION 'COM_PRODCAT_API_CREATE_CAT' EXPORTING iv_category_id = iv_cat_id iv_hierarchy_guid = lv_hierarchy_guid iv_parent_guid = lv_parent_guid iv_product_type = gc_product_type-material it_categoryt = lt_categoryt iv_logsys = iv_log_sys " 'QI3CLNT502' iv_non_assignable = abap_false EXCEPTIONS hierarchy_not_maintained = 1 wrong_call = 2 category_id_exists = 3 id_scheme_error = 4 error = 5 OTHERS = 6. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE 'X' NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. RETURN. ENDIF. CALL FUNCTION 'COM_PRODUCT_CATEGORY_SAVE_ALL' EXPORTING iv_update_task = ' ' iv_update_pme = ' ' iv_hierarchy_guid = lv_hierarchy_guid EXCEPTIONS internal_error = 1 OTHERS = 2. ASSERT sy-subrc = 0. COMMIT WORK AND WAIT. rv_success = abap_true. ENDMETHOD.Method signature: ...

August 24, 2020 · 2 min · jiezi

关于abap:ABAP面试问题-不使用加减乘除等操作比较两个整数大小

Our team architect has asked us this question which is said to be an interview question from Microsoft long time ago:Please implement one function which accepts two integers as input and generate the following result accordingly: If a > b, return 1,if a = b, return 0,if a < b, return -1For simplification reason here we can just consider unsigned int ( that is, all importing parameter of integers are greater than or equal to 0 ). ...

August 23, 2020 · 4 min · jiezi

关于abap:使用ABAP的RTTI和Java反射机制访问static-private属性

In ABAP we can define a static attribute for a class via keyword CLASS-DATA, whose validity is not associated with instances of a class but with the class itself. In order to prove this fact I use the following simple Pointer class for demonstration: class ZCL_POINT definition public final create public .public section. data X type I . methods CONSTRUCTOR importing !IV_X type I !IV_Y type I .private section. data Y type I . class-data COUNT type I .ENDCLASS.CLASS ZCL_POINT IMPLEMENTATION. method CONSTRUCTOR. me->x = iv_x. me->y = iv_y. count = count + 1. endmethod.ENDCLASS.In this class, static attribute count is responsible to maintain the number of created Point instances.Then create four point instances: ...

August 23, 2020 · 3 min · jiezi

关于abap:ABAPJava和JavaScript的local-class

Local class in ABAPSuppose I have a global class with a public method ADD with following signature. I would like to implement with a local class inside this global class. The local class could be created by clicking button “Local Definitions/Implementions”: Now in my global class I can just delegate the ADD implementation to the local class. Notice that even ADD method is marked as public, it is still displayed as a red light in class builder, which makes sense since this ADD method in local class is not visible to outside consumers. ...

August 23, 2020 · 4 min · jiezi

关于abap:ABAPJava和JavaScript的整型数据类型比较

When I first begin to program with ABAP I get confused with different kinds of integer type available for ABAP developers: i, int1, int2, int4, and int8. According to ABAP help, predefined data types consists of two types: (1) predefined ABAP types: b, c, d, decfloat16, decfloat34, f, i, int8, n, p, s, string, t, x, and xstring.(2) predefined dictionary types: INT1, INT2, INT4, INT8,DEC,DF16_DEC,DF16_RAW,DF34_DEC,DF34_RAW and FLTP. ...

August 23, 2020 · 7 min · jiezi

关于abap:ABAP和Java的tagmarker-interface

In my previous blog How many fat interfaces are there in SAP system I introduce the concept of “fat interface”. In this blog let’s explore the concept of tag interface.There is definition for tag interface in ABAP help: “Specific predefined global interface. By integrating the tag interface, classes or other interfaces stand out against the ABAP runtime environment. A tag interface generally does not contain its own interface components, but instead assigns a particular task to the integrating classes or interfaces and changes the way they are handled by the ABAP Compiler.“And in fact this is not a specific concept of ABAP, but exists in many other language as well. ...

August 23, 2020 · 3 min · jiezi

关于abap:ABAP整型类型的几种位操作-OR-AND-XOR

For training purpose I need to explain to my ABAP team colleagues about how bitwise operation on Integer in Java like below is done. And since the bitwise operation in ABAP can only support data type X and XSTRING, so now I create a prototype which can support bitwise operation OR, AND, XOR on int4 in ABAP for teaching purpose. Still remember the wrapper class Integer in Java which is explained in my blog Integer in ABAP, Java and JavaScript? ...

August 23, 2020 · 3 min · jiezi

关于abap:使用ABAP-Channel实现一个订单跟踪工具提高日常工作效率

There are already many nice blogs introducing nice features provided by ABAP channels in community, for example ABAP Channels Examples. In that blog some demo examples are explained. After going through those impressive tutorials and demos, have you ever thought about building some useful stuff for your daily work by leverage this powerful feature in ABAP? As ABAPers we use various trace / monitor tools in our daily work, such as SAT and ST05. And in CRM, all business transactions are managed by so called One Order framework. This framework uses function module CRM_ORDER_MAINTAIN to create, update and delete the document. ...

August 22, 2020 · 4 min · jiezi

关于abap:SAP-ABAP和Java跨域请求问题的解决方案

There is an excellent blog Cross-domain communications with ABAP and JSONP written by Alessandro Spadoni.And in this blog, I just record down my own study experience about how to achieve cross domain request in ABAP and Java. Cross Domain Request in ABAPCreate a new ICF node in tcode SICF, implement the following source code in its handler class.4 METHOD if_http_extension~handle_request. DATA: lv_text TYPE string value 'hello world'. server->response->append_cdata( data = lv_text length = strlen( lv_text ) ). ENDMETHOD.Access the url in browser, and it works as expected. ...

August 22, 2020 · 3 min · jiezi

关于abap:SAP数据库表DDLOG的设计原理

Today when I am reading this SAP help, I find out this sentence: Then I have opened the definition of table DDLOG in the system and found I cannot directly view the content of field NOTEBOOK due to its data type LRAW. So I have chosen one table with buffer activated, and made some changes on it. Since I can only query this table via timestamp, I cannot figure out which entry is for my change on CRMC_PROC_TYPE. ...

August 21, 2020 · 1 min · jiezi

关于abap:SAP-ABAP数据库表字段checktable的实现原理

For project reasons I need to find all tables whose fields have used a given table say COMM_PRODUCT as check table. The only information I know is that such kind of table metadata is stored in table with name prefix DD*. Unfortunately there are huge number of table starting with DD: How to efficiently find the exact one by yourself? (1) Make the check table field selected, and press F1: ...

August 20, 2020 · 1 min · jiezi

关于abap:SAP-ABAP报表依赖设计原理详解

In SAP note 1230076 “Generation of ABAP loads: Tips for the analysis”, a tool report RSDEPEND is introduced. It is explained in the note “An ABAP program generally depends on many other repository objects. If an object like this changes (for example, an include or a DDIC type), the load of all dependent programs must be invalidated. The load of these programs is then regenerated with the next use, and valid loads are generated again.” ...

August 20, 2020 · 3 min · jiezi

关于abap:ABAP-740里的新语法-LET表达式

A LET expression defines variables var1, var2, … or field symbols <fs1>, <fs2>, … as local auxiliary fields in an expression and assigned values to them. When declared, the auxiliary fields can be used in the operand positions of the expression. There is no way of accessing an auxiliary field statically outside its expression. See example below: in line 25 and line 26 we define two auxiliary fields date and sep with keyword LET, which are used in LET expressions in line 27.in line 27 we define a LET expression by keyword INfinally the value of LET expression will be calculated and filled to inline variable isodate defined in line 24. We use CONV string to explicitly specify that inline defined variable isodate has type STRING. ...

August 6, 2020 · 1 min · jiezi

关于abap:ABAP-740的新语法-使用BO-association的方式进行内表连接操作

ABAP Mesh is also a new feature in 740. Let’s use an example to demonstrate how it works:I have defined two types for developers and managers. developer type has a field manager which points to his manager, while manager type does not have any reference to his managing employee. types: begin of t_manager, name type char10, salary type int4, end of t_manager, tt_manager type sorted table of t_manager with unique key name.types: begin of t_developer, name type char10, salary type int4, manager TYPE char10, end of t_developer, tt_developer type sorted table of t_developer with unique key name.I also use the new grammar – inline data declaration to fill developer and manager table. So far nothing special. ...

August 6, 2020 · 2 min · jiezi

关于abap:ABAP-740新的OPEN-SQL增强特性

The following open SQL statement looks a little weird, however it could really works in 740. (1) The field name of my structure ty_my_sflight is different from field defined in sflight, so in SQL statement I use the format <field in DB table> AS <field in my own structure> to move the content from DB to the corresponding fields of my internal table. (2) I want to calculate the percent about how many seat are occupied and put the result into my field my_seatrate. Now I could push the calculation to DB layer instead of calculating it in ABAP side. ...

August 6, 2020 · 2 min · jiezi

关于abap:ABAP-Webdynpro-如何使用用户自定义的value-help

For input attribute totally five input help mode could be selected. In most of time we would always like to leverage the existing dictionary search help defined in DDIC. However if existing one could not fulfill our requirement, we have to develop our own value help by ourselves. I have used a simple example to demonstrate how to use “Freely Programmed” input help mode. I have one consumer component ZCONSUMER, and one component ZUSER_HELP.ZCONSUMER just have one input field for post ID and post description. When click value help of Post ID, the view of ZUSER_HELP will be opened and there is a SQL select to fetch the description according to post ID from database table. ...

August 6, 2020 · 2 min · jiezi

关于abap:ABAP-Webdynpro里Component-Usage的用法

In NET311 the topic component usage clone is discussed there. One example is also given there:The user of a Web Dynpro application can mark multiple lines of a table to display details for each selected data set. The details of one data set is displayed by one usage of a certain component. Thus, the number of component usages equals the number of marked lines, which is not known at design time. ...

August 6, 2020 · 3 min · jiezi

关于abap:ABAP-Webdynpro-Interface-View的用法

If the component usage is not defined at design time, it is not possible to embed an interface view of this component usage into a ViewUIElementContainer of another view. It is also not possible to define a navigation link connecting any outbound plug of an existing view to an inbound plug of this interface view at design time. In this case methods of the Web Dynpro API have to be applied. ...

August 6, 2020 · 3 min · jiezi

关于abap:ABAP-Webdynpro的跟踪工具WDTRACETOOL

You can use tcode WD_TRACE_TOOL to switch on trace. After that when you launch your webdynpro application, you can observe there is a Webdynpro trace window embedded in the bottom of the application. You can either deactivate the trace in old Dynpro tool or in that embedded window. After you click Store trace as Zip File & Finish trace,you can save the trace file as zip locally. ...

August 6, 2020 · 1 min · jiezi

关于abap:判断ABAP代码是否处于update模式下运行的工具类

The class cl_system_transaction_state contains several useful utility methods: get_in_update_task: return the flag whether current code is running with normal work process or in update work processget_on_commit: return flag whether current code is called because of a previous registration via PERFORM ON COMMIT and triggered by COMMIT WORKget_sap_luw_key: return current LUW IDI just use a very simple report to test them. First I call the FM ZSQF in a normal way, then call it via update task, then register it with PERFORM ON COMMIT and trigger it via COMMIT WORK. ...

August 6, 2020 · 2 min · jiezi

关于abap:四种ABAP单元测试隔离test-isolation技术

Hi friends,As far as I know test isolation is widely used in SAP internal to build unit test code, at least in my team. Test isolation in unit test means that in your production code you make use of some API(class method/Function module) which are developed by other team, and you would not like to really consume them during your unit test, since you would not accept that most red lights in your unit test report are caused by the bugs in those external API,right? Instead, you expect that the call of those external API during your unit test execution will be replaced by some dummy code written by yourself.I will show you four different ways to achieve that.The example comes from one productive class in my project. For simplicity reasons I don’t list unrelevant code here. The class is ZCL_DESTRUCTION_IMG_TOOL_S1. ...

August 2, 2020 · 5 min · jiezi

关于abap:四种ABAP单元测试隔离test-isolation技术

Hi friends,As far as I know test isolation is widely used in SAP internal to build unit test code, at least in my team. Test isolation in unit test means that in your production code you make use of some API(class method/Function module) which are developed by other team, and you would not like to really consume them during your unit test, since you would not accept that most red lights in your unit test report are caused by the bugs in those external API,right? Instead, you expect that the call of those external API during your unit test execution will be replaced by some dummy code written by yourself.I will show you four different ways to achieve that.The example comes from one productive class in my project. For simplicity reasons I don’t list unrelevant code here. The class is ZCL_DESTRUCTION_IMG_TOOL_S1. ...

August 2, 2020 · 5 min · jiezi

关于abap:ABAP工作流workflow的调试方式

There are several posts in SCN talking about workflow debugging. Most of them are manually generating an endless loop and then can launch debugger in SM50. However, if you try to debug standard workflow, you are not allowed to manual inject any endless loop in standard code. If the original developer is not so kind to leave any switchable endless loop in standard code, you have to go another way. ...

August 2, 2020 · 2 min · jiezi

关于abap:ABAP工作流workflow的调试方式

There are several posts in SCN talking about workflow debugging. Most of them are manually generating an endless loop and then can launch debugger in SM50. However, if you try to debug standard workflow, you are not allowed to manual inject any endless loop in standard code. If the original developer is not so kind to leave any switchable endless loop in standard code, you have to go another way. ...

August 2, 2020 · 2 min · jiezi

关于abap:ABAP-Development-Tool前后台交互的原理

在S/4HANA零碎里,SE16,查看表PRGN_CORR2的内容: REL_NAME(release name)指定成751: S_TCODE是ECC里的事务码,而T_TCODE是对应的S/4HANA的新事务码。 Have you even thought about why you could operate on ABAP backend system using ADT? This document just gives a brief introduction about how does the ADT backend infrastructure respond your operation done in Eclipse. It contains a hands-on exercise which you could finish in your own ABAP system. Explore ADT by switching on ABAPcommunication logIn order to explore what has happened when we do operations in Eclipse, we need to switch on ABAP communication log.Click Windows->show view. Make view “ABAP Communication Log” is displayed. ...

August 2, 2020 · 5 min · jiezi

关于abap:给你的ABAP对象打上标签Tag

标签(Tag)简直是信息管理软件的一个必备性能,目标是帮忙用户更迅速地检索出本人须要的数据,以及对海量数据进行更无效的治理。 现在在ABAP Development Tool里也反对标签性能了,能够像应用各种云笔记一样,给罕用类型的ABAP对象增加自定义的标签。这个标签调配的性能并未给ABAP对象削减任何新的性能,而是帮忙使用者可能依照本人的理论需要,迅速将须要的ABAP资源检索进去。 本文先展现给ABAP对象加标签的操作形式,再介绍如何给ABAP Development Tool增加标签性能。 在ABAP Development Tool里增加标签的形式十分间接,右键菜单里抉择Assign Tags即可。但凡应用过云笔记里标签增加和治理性能的敌人们,对此应该十分相熟。 通过Add Tag和Add User Tag按钮治理标签构造,每个ABAP零碎都有一个全局的标签零碎(Global Tag), 这些标签在同一ABAP零碎里所有登录用户均可见。也能够创立只有本人可见的User Tag: 和云笔记的标签零碎一样,ABAP Development Tool里的标签治理也反对树状的层级构造。 在快捷键为Ctrl+H的全局搜寻页面里,削减了一项依据标签搜寻ABAP对象的选项: ABAP Development Tool的标签治理性能来自开源社区的奉献,因而须要使用者自行装置。 Jerry之前的一篇博客介绍了用户在ABAP Development Tool里操作时前后台交互的原理: An example to help you understand how does ADT workhttps://blogs.sap.com/2014/08... 因而这个标签治理性能咱们须要别离装置ABAP Development Tool前后台对应的加强。 首先是前台加强,即ABAP Development Tool里的标签增加,标签树形构造治理和依据标签进行全局搜寻的UI实现。 前台加强间接通过Eclipse的Help菜单里的Install New Software选项在线装置即可,装置网址为:https://stockbal.github.io/ec... 后盾加强的ABAP实现源代码,位于Github上:https://github.com/stockbal/a... 该仓库的源代码须要应用abapGit装置到ABAP后盾零碎上。 如果你的ABAP零碎没有abapGit这个客户端,须要先进行装置,其实就是新建一个报表,再将上面这个Github仓库里的abapGit源代码拷贝到报表里,激活即可。 https://github.com/larshp/aba... 将下图高亮的zabapgit.abap蕴含的源代码下载到本地,用任意一个文本编辑器关上,Ctrl C再Ctrl V到ABAP零碎的报表里,激活: 激活之后运行报表,看到的首页如下。点击右上角的New Online: 将ADT标签治理的后盾实现应用abapGit pull到以后的ABAP零碎,点击Clone online repo: ...

August 2, 2020 · 1 min · jiezi

关于abap:给你的ABAP对象打上标签Tag

标签(Tag)简直是信息管理软件的一个必备性能,目标是帮忙用户更迅速地检索出本人须要的数据,以及对海量数据进行更无效的治理。 现在在ABAP Development Tool里也反对标签性能了,能够像应用各种云笔记一样,给罕用类型的ABAP对象增加自定义的标签。这个标签调配的性能并未给ABAP对象削减任何新的性能,而是帮忙使用者可能依照本人的理论需要,迅速将须要的ABAP资源检索进去。 本文先展现给ABAP对象加标签的操作形式,再介绍如何给ABAP Development Tool增加标签性能。 在ABAP Development Tool里增加标签的形式十分间接,右键菜单里抉择Assign Tags即可。但凡应用过云笔记里标签增加和治理性能的敌人们,对此应该十分相熟。 通过Add Tag和Add User Tag按钮治理标签构造,每个ABAP零碎都有一个全局的标签零碎(Global Tag), 这些标签在同一ABAP零碎里所有登录用户均可见。也能够创立只有本人可见的User Tag: 和云笔记的标签零碎一样,ABAP Development Tool里的标签治理也反对树状的层级构造。 在快捷键为Ctrl+H的全局搜寻页面里,削减了一项依据标签搜寻ABAP对象的选项: ABAP Development Tool的标签治理性能来自开源社区的奉献,因而须要使用者自行装置。 Jerry之前的一篇博客介绍了用户在ABAP Development Tool里操作时前后台交互的原理: An example to help you understand how does ADT workhttps://blogs.sap.com/2014/08... 因而这个标签治理性能咱们须要别离装置ABAP Development Tool前后台对应的加强。 首先是前台加强,即ABAP Development Tool里的标签增加,标签树形构造治理和依据标签进行全局搜寻的UI实现。 前台加强间接通过Eclipse的Help菜单里的Install New Software选项在线装置即可,装置网址为:https://stockbal.github.io/ec... 后盾加强的ABAP实现源代码,位于Github上:https://github.com/stockbal/a... 该仓库的源代码须要应用abapGit装置到ABAP后盾零碎上。 如果你的ABAP零碎没有abapGit这个客户端,须要先进行装置,其实就是新建一个报表,再将上面这个Github仓库里的abapGit源代码拷贝到报表里,激活即可。 https://github.com/larshp/aba... 将下图高亮的zabapgit.abap蕴含的源代码下载到本地,用任意一个文本编辑器关上,Ctrl C再Ctrl V到ABAP零碎的报表里,激活: 激活之后运行报表,看到的首页如下。点击右上角的New Online: 将ADT标签治理的后盾实现应用abapGit pull到以后的ABAP零碎,点击Clone online repo: ...

August 2, 2020 · 1 min · jiezi