Getting Started with ABAP: How to Create Flat and Nested Structure
This is the next blog post in this series. Here is the previous blog post Getting Started With ABAP: Table Maintenance Generator
In the previous blog post, we learned what is table maintenance generator.
In this blog post we will learn types of structure and how to create flat and nested structure.
Types of Structure
- Flat Structure
- Nested Structure
- Deep Structure
For more information you can refer this document Types of structures
We can create this structure from SE11 that is global structure that means we can reuse it in more than one program. Also, we can create structure through ABAP programming that we will see in later part.
In this blog post we will see how to create structure through SE11.
How to Create Flat Structure
Step 1: Go to SE11 and click on Data Type.
Step 2: Enter the name of Structure that you want to create and click on Create.
Step 3: Select Structure and press Enter.
Step 4: Give the short description.
Step 5: Enter Component that means field name Employee_id and select typing method as Types.
Step 6: We have already created Employee_id field in table so we can use here. Enter Component type as data element name which is created earlier. If not created you can create data element first and enter that name.
In this way, you can add more fields as per your requirement.
Step 7: Save and activate structure.
Here Flat Structure is created.
How to create Nested Structure
Step 1: Go to SE11 and select Data type. Enter name of structure that you want to create. Click on Create.
Step 2: Select Structure and Press Enter.
Step 3: Give short description. Enter the name of component and select types.
Step 4: Enter component type as flat structure name that we have created earlier. Save and activate it.
You can add more components and more than one flat structure as component. Nested structure contains at least one flat structure.
Here you can check next blog post Getting Started with ABAP: How to Create Table Type and Deep Structure
Here we have completed the how to create Flat and Nested structure.
Follow my profile to be notified of the next blog post. Please feel free to ask any questions you have in the comments section below.
I understand that your series is to take people from begin to end to start ABAP, but people might also later read only one blog post to answer their question how to create a structure, and they might be mislead because they could think it's the only way to create a structure.
Why limiting your blog post to only "flat"? It's exactly the same way for creating any type of structure (except that your example selects a data element). If you want to create one blog post for "nested structure" and one for "deep structure", why not one blog post for DDIC structure generally speaking, and after that, you create blog posts to add explanations of terms, and what these terms are for.
There are 2 ways to define a Structure type. DDIC-based or ABAP-based (TYPES). If it's not required to have it DDIC-based (RFC, things like that), I advise to define them inside programs, interfaces and classes, depending on the required scope, either local to only the program itself or global to be shared by many programs.
Any type of structure is made of "components", whatever they are elementary, structured, table or reference types.
So, a flat structure is not just a collection of components.
It's also not just a collection of fields, because fields of type String and Xstring are not flat types, they are considered deep types.
A Structure is Deep when it contains at least one Deep component, like String, XString, Deep Structure, Table Type or reference type.
In this blog post, maybe you should not explain the concept of Flat, Deep, Nested, as I guess you just make beginners discover the user interface of SE11 for creating a Structure.
Last, you could give some links to the ABAP documentation, so that people can read the exact definitions of Deep, Flat and more.
No offence but to continue with your observation, I think such blogs should not be allowed because these are not personal experiences of a scenario that can help another ABAPer, rather they claim to be tutorial and are flawed outright as they provide a myopic view of a well documented topic.
I think there is an urge to blog today, nothing wrong and appreciate worthy but the problem I see are-
Hi Sandra Rossi,
Thanks for the feedback. I have done the changes in my blog post. Also, I have added link for exact definition of Deep, flat and nested structure.
I think you need to be more clear yourself on the topic first. Refer to SAP documentation. Its an interesting topic in its own right as Sandra corrected you. You have many stuffs like box type etc. to explore. Anyways good start... 🙂