A segment in IDocs (Intermediate Documents) is a structure that groups related data fields.
Each segment has:
- A unique name (e.g., E1KNA1M for customer master data).
- Defined fields with fixed length and data types.
- A hierarchy (segments can have child segments).
Create a segment. (WE31)
Create a segment as per the fields you want to get fetched. Like in zlibrary we can fetch the bookid bookname bookauthor etc.
Segment name: ZSEGDPM

Now, release the segment.

After release, you can see the output as

After saving the segment if you want to make some changes then you need to first cancel the release and then make the changes.

By following the Above steps we can create a segment for an IDOC.