1

Are there any know limits of meshes? I know, that the table-types need to be non-generic.

But can it be, that a 5-key-dbtable as base for local table-type-definition is not ok ??? (I really doubt it).

I simply have a two-level table hierarchy and want to retrieve ALL mesh-results of the second table py passing the key of the main-table. I only have forward-associations, have a look, this is, what I try to achieve (pattern found on some website):

TYPES: lty_types    TYPE STANDARD TABLE OF zordertype WITH NON-UNIQUE KEY table_line,
       lty_excludes TYPE STANDARD TABLE OF zexcludeorder WITH NON-UNIQUE key table_line.

DATA: lt_types    TYPE lty_types,
      lt_excludes TYPE lty_excludes.

TYPES:
  BEGIN OF MESH ty_type_excludes,
    types    TYPE lty_types
               ASSOCIATION to_excludes
               TO excludes ON order_type = order_type,
    excludes TYPE lty_excludes,
  END OF MESH ty_type_excludes.

DATA: ls_mesh TYPE ty_type_excludes.

START-OF-SELECTION.

  SELECT * FROM zordertype
               INTO TABLE @lt_types
               ORDER BY order_type.

  SELECT * FROM zexcludeorder
           INTO TABLE @lt_excludes
             ORDER BY order_type.

  ls_mesh-types    = lt_types.
  ls_mesh-excludes = lt_excludes.

  DATA wf_check TYPE zorder_type VALUE 'CAT'.

  DATA(chk) = ls_mesh-types\to_excludes[ wf_check ].

  break myuser.

This dumps with "CX_ITAB_LINE_NOT_FOUND".

But I did it exactly, how it was written. And, I think, this must work, because I use this approach to get a subset from another table based on the keyentries of the first table. I tried to add additional association-params, which did not dump anymore, but anyway, just returned only one record of the second table.

I seem to overlook some basic thingy, but which one ?

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
icbytes
  • 1,831
  • 1
  • 17
  • 27

1 Answers1

2

As stated in the ABAP documentation, a mesh path expression, "the result of a mesh path expression is a row from the last path node of the mesh path".

PS: there are the programs DEMO_MESH_EXPRESSION* to play with mesh path expressions. Here is a shorter standalone demo program, taken from the chapter 12 of blog post ABAP 7.40 Quick Reference :

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.

TYPES: BEGIN OF MESH m_team,
         managers   TYPE tt_manager  ASSOCIATION my_employees TO developers
                                                            ON manager = name,
         developers TYPE tt_developer ASSOCIATION my_manager TO managers
                                                            ON name = manager,
       END OF MESH m_team.

DATA: ls_team TYPE m_team.

LS_TEAM-MANAGERS = value #(
( Name = 'Jason'  Salary = 3000 )
( Name = 'Thomas' Salary = 3200 ) ).

LS_TEAM-DEVELOPERS = value #(
( Name = 'Bob'   Salary = 2100 manager = 'Jason' )
( Name = 'David' Salary = 2000 manager = 'Thomas' )
( Name = 'Jack'  Salary = 1000 manager = 'Thomas' )
( Name = 'Jerry' Salary = 1000 manager = 'Jason' )
( Name = 'John'  Salary = 2100 manager = 'Thomas' )
( Name = 'Tom'   Salary = 2000 manager = 'Jason' ) ).

" Get details of Jerry's manager
ASSIGN ls_team-developers[ name = 'Jerry' ] TO FIELD-SYMBOL(<ls_jerry>).
DATA(ls_jmanager) = ls_team-developers\my_manager[ <ls_jerry> ].

WRITE: / |Jerry's manager: { ls_jmanager-name }|,30
                  |Salary: { ls_jmanager-salary }|.

" Get Thomas' developers
SKIP.
WRITE: / |Thomas' developers:|.

ASSIGN ls_team-managers[ name = 'Thomas' ] TO FIELD-SYMBOL(<ls_thomas>).
LOOP AT ls_team-managers\my_employees[ <ls_thomas> ]
        ASSIGNING FIELD-SYMBOL(<ls_emp>).

  WRITE: / |Employee name: { <ls_emp>-name }|.
ENDLOOP.

" the result of a mesh path expression is a row from the last path node of the mesh path
DATA(thomas_employee) = ls_team-managers\my_employees[ <ls_thomas> ].
SKIP.
WRITE: / |Thomas's "any" Employee name: { thomas_employee-name }|.
Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
  • 1
    .... "the result of a mesh path expression is a row from the last path node of the mesh path".... shame on me... – icbytes Jun 08 '18 at 10:26