zoukankan      html  css  js  c++  java
  • ABAP 740的新语法

    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.

    DATA: lt_developer TYPE tt_developer,
             lt_manager TYPE tt_manager.
    
       DATA(Jerry) = VALUE t_developer( name = 'Jerry' salary = 1000 manager = 'Jason' ).
    
       DATA(Tom) = VALUE t_developer( name = 'Tom' salary = 2000 manager = 'Jason' ).
    
       DATA(Bob) = VALUE t_developer( name = 'Bob' salary = 2100 manager = 'Jason' ).
    
       DATA(Jack) = VALUE t_developer( name = 'Jack' salary = 1000 manager = 'Thomas' ).
    
       DATA(David) = VALUE t_developer( name = 'David' salary = 2000 manager = 'Thomas' ).
    
       DATA(John) = VALUE t_developer( name = 'John' salary = 2100 manager = 'Thomas' ).
    
       DATA(Jason) = VALUE t_manager( name = 'Jason' salary = 3000 ).
    
       DATA(Thomas) = VALUE t_manager( name = 'Thomas' salary = 3200 ).
    
       INSERT Jerry INTO TABLE lt_developer.
    
       INSERT Tom INTO TABLE lt_developer.
    
       INSERT Bob INTO TABLE lt_developer.
    
       INSERT Jack INTO TABLE lt_developer.
    
       INSERT David INTO TABLE lt_developer.
    
       INSERT John INTO TABLE lt_developer.
    
       INSERT Jason INTO TABLE lt_manager.
    
       INSERT Thomas INTO TABLE lt_manager.
    

    Now I define one ABAP mesh t_team with two component managers and developers. With association ‘my_employee’, I connect the internal table managers to developers, so that I could easily find all developers of a given manager. The association ‘my_manager’ just enables the connection in opposite direction: find out the manager of a given developer.

    You can compare how I find Jerry’s manager and find all developers whose manager are Thomas using new ABAP mesh and the traditional way.

    The result are exactly the same.

    要获取更多Jerry的原创文章,请关注公众号"汪子熙":

  • 相关阅读:
    kali64位 安装 adb
    ZendStudio在kali下无法启动
    VS2010配置OpenGL开发环境(转)
    OpenGL程序无法启动此应用程序,因为计算机中丢失glut32.dll(转))
    vs2010 出错:error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏(转)
    AnyCAD三维控件(转)
    C# WinForm程序中使用Unity3D控件 (转)
    SharpGL学习笔记(一) 平台构建与Opengl的hello World (转)
    c# Invoke的新用法
    c# 在静态方法里,怎么能得到调用者的类名?
  • 原文地址:https://www.cnblogs.com/sap-jerry/p/13447555.html
Copyright © 2011-2022 走看看