1

I'm learning SAP and ABAP language, I need to create a structure with all the fields of the SFLIGHT database table and a few more. Do I have to enter all the fields of the SFLIGHT table manually or is there any possibility to add all the fields of a given table at once?

I have to create DDIC structure like that: Ready structure screen

Do I have to fill this component names manually? My screen

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
Abapito
  • 73
  • 7
  • 1
    In what you show, `ZFLIGHT_S_ALV` already contains all columns of `SPFLI` table (via `.INCLUDE`). So your question is also the answer. – Sandra Rossi Jul 06 '22 at 11:43
  • 1
    Are you asking about creating the structure type in the dictionary or about declaring a structure type/variable in your program? – Philipp Jul 06 '22 at 11:44
  • @Philipp About declaring all datatable components in new structure. Something like Suncatcher's answer :) – Abapito Jul 07 '22 at 07:49
  • @SandraRossi Now i know :) I was confused by the example in the tutorial, where .INCLUDE was declared, plus all the components. Now I know that all we need to do is write .INCLUDE and we will have all the components of the table. – Abapito Jul 07 '22 at 07:52

2 Answers2

2

The code solution is given by Jonas, but if you are asking about SE11-way then

Edit => scroll down to Include => click on Insert

enter image description here

https://techazmaan.com/ddic-include-structure/

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
0

With the TYPES ... LINE OF statement one can declare a type which represents a structure for one line of a table:

TYPES flight TYPE LINE OF sflight.

" the structure type can then be used in the program
DATA(scheduled_flight) = VALUE flight(
  " ...
).
INSERT scheduled_flight INTO sflight.

Thus usually there is no need to declare such a structure in the dictionary, as it already exists implicitly through the table creation.

Jonas Wilms
  • 132,000
  • 20
  • 149
  • 151