All skills
secondsky avatar

/sap-abap

@620a19a
by Eddiesecondsky/sap-skills456 stars
120

Comprehensive ABAP development skill for SAP systems. Use when writing ABAP code, working with internal tables, structures, ABAP SQL, object-oriented programming, RAP (RESTful Application Programming Model), CDS views, EML statements, ABAP Cloud development, string processing, dynamic programming, RTTI/RTTC, field symbols, data references, exception handling, or ABAP unit testing. Covers both classic ABAP and modern ABAP for Cloud Development patterns.

Use this Skill: https://skilld.dev/gh/secondsky/sap-skills/sap-abap

This session only. Nothing lands on disk.

referencestable-grouping.md

≈699 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Internal Table Grouping - Complete Reference

Source: https://github.com/SAP-samples/abap-cheat-sheets/blob/main/11_Internal_Tables_Grouping.md


Basic Grouping

Single Column Grouping

" Representative binding (work area represents group)
LOOP AT spfli_tab INTO wa GROUP BY wa-carrid.
  ... wa-carrid ...
ENDLOOP.

With Member Loop

LOOP AT spfli_tab INTO wa GROUP BY wa-carrid.
  LOOP AT GROUP wa INTO DATA(member).
    ... member-... ...
  ENDLOOP.
ENDLOOP.

Multiple Column Grouping

Structured Group Key

LOOP AT spfli_tab INTO wa
  GROUP BY ( key1 = wa-carrid key2 = wa-airpfrom ).
  ... wa-carrid ... wa-airpfrom ...
ENDLOOP.

Explicit Group Key Binding

Single Column

LOOP AT spfli_tab INTO wa
  GROUP BY wa-carrid
  INTO DATA(key).
  ... key ...
ENDLOOP.

Multiple Columns

LOOP AT spfli_tab INTO wa
  GROUP BY ( key1 = wa-carrid key2 = wa-airpfrom )
  INTO DATA(key).
  ... key-key1 ... key-key2 ...
ENDLOOP.

Group Metadata

GROUP SIZE and GROUP INDEX

LOOP AT spfli_tab INTO wa
  GROUP BY ( key1 = wa-carrid key2 = wa-airpfrom
             index = GROUP INDEX size = GROUP SIZE )
  WITHOUT MEMBERS
  INTO DATA(key).
  ... key-key1 ... key-key2 ... key-index ... key-size ...
ENDLOOP.

WITHOUT MEMBERS

Skip member iteration, only process group keys:

LOOP AT spfli_tab INTO wa
  GROUP BY wa-carrid
  WITHOUT MEMBERS
  INTO DATA(key).
  " Only group key available, no member loop possible
  ... key ...
ENDLOOP.

Binding Types Comparison

Type Description Features
Representative Work area represents group Simpler syntax
Group Key Explicit output area GROUP INDEX, GROUP SIZE, WITHOUT MEMBERS

Advanced Patterns

Aggregation with Grouping

LOOP AT flights INTO DATA(flight)
  GROUP BY flight-carrid
  INTO DATA(carrier).

  DATA(total) = REDUCE i( INIT sum = 0
    FOR member IN GROUP carrier
    NEXT sum = sum + member-price ).

  out->write( |{ carrier }: { total }| ).
ENDLOOP.

Nested Grouping

LOOP AT itab INTO wa
  GROUP BY ( cat1 = wa-field1 cat2 = wa-field2 )
  INTO DATA(group1).

  LOOP AT GROUP group1 INTO DATA(member)
    GROUP BY member-field3
    INTO DATA(group2).

    LOOP AT GROUP group2 INTO DATA(detail).
      " Process detail
    ENDLOOP.
  ENDLOOP.
ENDLOOP.

Best Practices

  1. Use GROUP SIZE for counting without member iteration
  2. Use WITHOUT MEMBERS when only aggregates needed
  3. Prefer structured keys for multi-column grouping
  4. Use REDUCE for aggregations within groups

Source: SKILL.md on GitHub

No alerts16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    A comprehensive reference for SAP ABAP development, providing documentation and code examples for both classic ABAP and modern ABAP Cloud patterns. No security issues were detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer6mo

    3/32 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 620a19a. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated 2 months ago
Other metadata
metadata
{
  "maintainer": "Eduard Jiglau",
  "maintainer_email": "hello@sap-ai-skills.com",
  "website": "https://sap-ai-skills.com",
  "version": "2.4.1",
  "last_verified": "2026-04-02",
  "abap_release": "7.40 SP08+ / 7.50+ / ABAP Cloud",
  "sources": [
    "https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm",
    "https://github.com/SAP-samples/abap-cheat-sheets"
  ]
}

README badge

README badge for secondsky/sap-skills/sap-abap