SlideShare a Scribd company logo
1 of 4
REPORT    ZTYPES .

* Table declaration (old method)
DATA: BEGIN OF tab_ekpo OCCURS 0,                         "itab with header line
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
 END OF tab_ekpo.

*Table declaration (new method)     "USE THIS WAY!!!
TYPES: BEGIN OF t_ekpo,
ebeln TYPE ekpo-ebeln,
ebelp TYPE ekpo-ebelp,
 END OF t_ekpo.
DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0,      "itab
wa_ekpo TYPE t_ekpo.                    "work area (header line)

* Build internal table and work area from existing internal table
DATA: it_datatab LIKE tab_ekpo OCCURS 0,      "old method
wa_datatab LIKE LINE OF tab_ekpo.

* Build internal table and work area from existing internal table,
* adding additional fields
TYPES: BEGIN OF t_repdata.
INCLUDE STRUCTURE tab_ekpo. "could include EKKO table itself!!
TYPES: bukrs TYPEekpo-werks,
bstyp TYPEekpo-bukrs.
TYPES: END OF t_repdata.
DATA: it_repdata TYPE STANDARD TABLE OF t_repdata INITIAL SIZE 0,   "itab
wa_repdata TYPE t_repdata.                 "work area (header line)




Appending Table Lines
There are several ways of adding lines to index tables. The following statements have no equivalent that
applies to all internal tables.

Appending a Single Line
To add a line to an index table, use the statement:
APPEND line TO itab.
line is either a work area wa that is convertible to the line type, or the expression INITIAL LINE. If
you use wa, the system adds a new line to the internal table itab and fills it with the contents of the work
area. INITIAL LINE appends a blank line containing the correct initial value for each field of the
structure. After each APPEND statement, the system field sy-tabix contains the index of the appended
line.
Appending lines to standard tables and sorted tables with a non-unique key works regardless of whether
lines with the same key already exist in the table. Duplicate entries may occur. A runtime error occurs if
you attempt to add a duplicate entry to a sorted table with a unique key. Equally, a runtime error occurs if
you violate the sort order of a sorted table by appending to it.
Appending Several Lines
You can also append internal tables to index tables using the following statement:
APPEND LINES OF itab1 TO itab2.
This statement appends the whole of itab1 to itab2. itab1can be any type of table. The line type
of itab1 must be convertible into the line type of itab2.
When you append an index table to another index table, you can specify the lines to be appended as
follows:
APPEND LINES OF itab1 [FROM n1] [TO n2] TO itab2.
n1 and n2 specify the indexes of the first and last lines of itab1 that you want to append to itab2.
This method of appending lines of one table to another is about 3 to 4 times faster than appending them
line by line in a loop. After the APPEND statement, the system field sy-tabix contains the index of the
last line appended. When you append several lines to a sorted table, you must respect the unique key (if
defined), and not violate the sort order. Otherwise, a runtime error will occur.

Ranked Lists
You can use the APPEND statement to create ranked lists in standard tables. To do this, create an empty
table, and then use the statement:
APPEND wa TO itab SORTED BY f.
The new line is not added to the end of the internal table itab. Instead, the table is sorted by
field f in descending order. The work area wamust be compatible with the line type of the internal table.
You cannot use the SORTED BY addition with sorted tables.
When you use this technique, the internal table may only contain as many entries as you specified in
the INITIAL SIZE parameter of the table declaration. This is an exception to the general rule, where
internal tables can be extended dynamically. If you add more lines than specified, the last line is
discarded. This is useful for creating ranked lists of limited length (for example "Top Ten"). You can use
the APPEND statement to generate ranked lists containing up to 100 entries. When dealing with larger
lists, it is advisable to sort tables normally for performance reasons.


             DATA: BEGIN OF wa,
                      col1(1) TYPE c,
                      col2 TYPE i,
                    END OF wa.
             DATA itab LIKE TABLE OF wa.
             DO 3 TIMES.
               APPEND INITIAL LINE TO itab.
               wa-col1 = sy-index. wa-col2 = sy-index ** 2.
               APPEND wa TO itab.
             ENDDO.
             LOOP AT itab INTO wa.
               WRITE: / wa-col1, wa-col2.
             ENDLOOP.
             The list output is:
                           0
             1             1
                           0
             2             4
                           0
             3             9
This example creates an internal table itab with two columns that is filled in the DO loop.
Each time the processing passes through the loop, an initialized line is appended and then
the table work area is filled with the loop index and the square root of the loop index and
appended.


DATA: BEGIN OF line1,
         col1(3) TYPE c,
         col2(2) TYPE n,
         col3    TYPE i,
      END OF line1,
      tab1 LIKE TABLE OF line1.
DATA: BEGIN OF line2,
         field1(1) TYPE c,
         field2     LIKE tab1,
      END OF line2,
      tab2 LIKE TABLE OF line2.
line1-col1 = 'abc'. line1-col2 = '12'. line1-col3                   = 3.
APPEND line1 TO tab1.
line1-col1 = 'def'. line1-col2 = '34'. line1-col3                   = 5.
APPEND line1 TO tab1.
line2-field1 = 'A'. line2-field2 = tab1.
APPEND line2 TO tab2.
REFRESH tab1.
line1-col1 = 'ghi'. line1-col2 = '56'. line1-col3                   = 7.
APPEND line1 TO tab1.
line1-col1 = 'jkl'. line1-col2 = '78'. line1-col3                   = 9.
APPEND line1 TO tab1.
line2-field1 = 'B'. line2-field2 = tab1.
APPEND line2 TO tab2.
LOOP AT tab2 INTO line2.
  WRITE: / line2-field1.
  LOOP AT line2-field2 INTO line1.
    WRITE: / line1-col1, line1-col2, line1-col3.
  ENDLOOP.
ENDLOOP.
The list output is:
A
abc 12                3
def 34                5
B
ghi 56                7
jkl 78                9
The example creates two internal tables tab1 and tab2. tab2 has a deep structure
because the second component of line2 has the data type of internal table tab1. line1 is
filled and appended totab1. Then, line2 is filled and appended to tab2. After
clearing tab1 with the REFRESH statement, the same procedure is repeated.


DATA: BEGIN OF line,
        col1(1) TYPE c,
        col2 TYPE i,
      END OF line.
DATA: itab1 LIKE TABLE OF line,
       jtab LIKE itab.
DO 3 TIMES.
  line-col1 = sy-index. line-col2 = sy-index ** 2.
  APPEND line TO itab1.
  line-col1 = sy-index. line-col2 = sy-index ** 3.
  APPEND line TO jtab.
ENDDO.
APPEND LINES OF jtab FROM 2 TO 3 TO itab1.
LOOP AT itab1 INTO line.
  WRITE: / line-col1, line-col2.
ENDLOOP.
The list output is:
1             1
2             4
3             9
2             8
3            27
This example creates two internal tables of the same type, itab and jtab. In
the DO loop, itab is filled with a list of square numbers, and jtab with a list of cube
numbers. Then, the last two lines ofjtab are appended to itab.


DATA: BEGIN OF line3,
         col1 TYPE i,
         col2 TYPE i,
         col3 TYPE i,
       END OF line3.
DATA itab2 LIKE TABLE OF line3 INITIAL SIZE 2.
line3-col1 = 1. line3-col2 = 2. line3-col3 = 3.
APPEND line3 TO itab2 SORTED BY col2.
line3-col1 = 4. line3-col2 = 5. line3-col3 = 6.
APPEND line3 TO itab2 SORTED BY col2.
line3-col1 = 7. line3-col2 = 8. line3-col3 = 9.
APPEND line3 TO itab2 SORTED BY col2.
LOOP AT itab2 INTO line3.
  WRITE: / line3-col2.
ENDLOOP.
The list output is:
             8
             5
The program inserts three lines into the internal table itab using the APPEND statement
and the SORTED BY addition. The line with the smallest value for the field COL2 is deleted
from the table, since the number of lines that can be appended is fixed to 2 through the
INITIAL SIZE addition.

More Related Content

What's hot

"Excelling in Excel" workshop
"Excelling in Excel" workshop"Excelling in Excel" workshop
"Excelling in Excel" workshopAngelina Teneva
 
SAP ABAP Interview Questions-XploreSAP Online Trainings
SAP ABAP Interview Questions-XploreSAP Online TrainingsSAP ABAP Interview Questions-XploreSAP Online Trainings
SAP ABAP Interview Questions-XploreSAP Online TrainingsPooja Arani
 
ADS_Lec2_Linked_Allocation
ADS_Lec2_Linked_AllocationADS_Lec2_Linked_Allocation
ADS_Lec2_Linked_AllocationHemanth Kumar
 
Sql cheat-sheet
Sql cheat-sheetSql cheat-sheet
Sql cheat-sheetSteve Tran
 
Lecture06 abap on line
Lecture06 abap on lineLecture06 abap on line
Lecture06 abap on lineMilind Patil
 
BIS 155 Education Specialist / snaptutorial.com
BIS 155  Education Specialist / snaptutorial.comBIS 155  Education Specialist / snaptutorial.com
BIS 155 Education Specialist / snaptutorial.comMcdonaldRyan131
 
Bis 155 Exceptional Education / snaptutorial.com
Bis 155 Exceptional Education / snaptutorial.comBis 155 Exceptional Education / snaptutorial.com
Bis 155 Exceptional Education / snaptutorial.comDavis142
 
Queues and Stacks
Queues and StacksQueues and Stacks
Queues and StacksProf Ansari
 
Bis 155 Enhance teaching / snaptutorial.com
Bis 155  Enhance teaching / snaptutorial.comBis 155  Enhance teaching / snaptutorial.com
Bis 155 Enhance teaching / snaptutorial.comHarrisGeorg46
 
Manual for Troubleshooting Formulas & Functions in Excel
Manual for Troubleshooting Formulas & Functions in ExcelManual for Troubleshooting Formulas & Functions in Excel
Manual for Troubleshooting Formulas & Functions in ExcelChristopher Ward
 
Ds important questions
Ds important questionsDs important questions
Ds important questionsLavanyaJ28
 
2 marks- DS using python
2 marks- DS using python2 marks- DS using python
2 marks- DS using pythonLavanyaJ28
 
IBM Informix Database SQL Set operators and ANSI Hash Join
IBM Informix Database SQL Set operators and ANSI Hash JoinIBM Informix Database SQL Set operators and ANSI Hash Join
IBM Informix Database SQL Set operators and ANSI Hash JoinAjay Gupte
 

What's hot (20)

"Excelling in Excel" workshop
"Excelling in Excel" workshop"Excelling in Excel" workshop
"Excelling in Excel" workshop
 
STACK REALIZATION IN ARM
STACK REALIZATION IN ARMSTACK REALIZATION IN ARM
STACK REALIZATION IN ARM
 
SAP ABAP Interview Questions-XploreSAP Online Trainings
SAP ABAP Interview Questions-XploreSAP Online TrainingsSAP ABAP Interview Questions-XploreSAP Online Trainings
SAP ABAP Interview Questions-XploreSAP Online Trainings
 
Informatica faq's
Informatica faq'sInformatica faq's
Informatica faq's
 
ADS_Lec2_Linked_Allocation
ADS_Lec2_Linked_AllocationADS_Lec2_Linked_Allocation
ADS_Lec2_Linked_Allocation
 
Sql cheat-sheet
Sql cheat-sheetSql cheat-sheet
Sql cheat-sheet
 
Lecture06 abap on line
Lecture06 abap on lineLecture06 abap on line
Lecture06 abap on line
 
Bioinformatica 27-10-2011-t4-alignments
Bioinformatica 27-10-2011-t4-alignmentsBioinformatica 27-10-2011-t4-alignments
Bioinformatica 27-10-2011-t4-alignments
 
Interview Preparation
Interview PreparationInterview Preparation
Interview Preparation
 
PLSQL Practices
PLSQL PracticesPLSQL Practices
PLSQL Practices
 
BIS 155 Education Specialist / snaptutorial.com
BIS 155  Education Specialist / snaptutorial.comBIS 155  Education Specialist / snaptutorial.com
BIS 155 Education Specialist / snaptutorial.com
 
Bis 155 Exceptional Education / snaptutorial.com
Bis 155 Exceptional Education / snaptutorial.comBis 155 Exceptional Education / snaptutorial.com
Bis 155 Exceptional Education / snaptutorial.com
 
Queues and Stacks
Queues and StacksQueues and Stacks
Queues and Stacks
 
Bis 155 Enhance teaching / snaptutorial.com
Bis 155  Enhance teaching / snaptutorial.comBis 155  Enhance teaching / snaptutorial.com
Bis 155 Enhance teaching / snaptutorial.com
 
258lec11
258lec11258lec11
258lec11
 
Manual for Troubleshooting Formulas & Functions in Excel
Manual for Troubleshooting Formulas & Functions in ExcelManual for Troubleshooting Formulas & Functions in Excel
Manual for Troubleshooting Formulas & Functions in Excel
 
Ds important questions
Ds important questionsDs important questions
Ds important questions
 
2 marks- DS using python
2 marks- DS using python2 marks- DS using python
2 marks- DS using python
 
IBM Informix Database SQL Set operators and ANSI Hash Join
IBM Informix Database SQL Set operators and ANSI Hash JoinIBM Informix Database SQL Set operators and ANSI Hash Join
IBM Informix Database SQL Set operators and ANSI Hash Join
 
linked list
linked list linked list
linked list
 

Viewers also liked

Mengelola kebun kelapa sawit muktahir .ppt
Mengelola kebun kelapa sawit muktahir .pptMengelola kebun kelapa sawit muktahir .ppt
Mengelola kebun kelapa sawit muktahir .pptambar1966
 
Automation - fabric, django and more
Automation - fabric, django and moreAutomation - fabric, django and more
Automation - fabric, django and moreIlian Iliev
 
Leonardo da Vinci
Leonardo da VinciLeonardo da Vinci
Leonardo da VinciPetrasek
 
Teks sukan 2014
Teks sukan 2014Teks sukan 2014
Teks sukan 2014Mat De
 
TWNKLS AWE13 Enterprise Augmented Reality
TWNKLS AWE13 Enterprise Augmented RealityTWNKLS AWE13 Enterprise Augmented Reality
TWNKLS AWE13 Enterprise Augmented RealityGerben Harmsen
 
Laporan
LaporanLaporan
LaporanMat De
 
Functions in python
Functions in pythonFunctions in python
Functions in pythonIlian Iliev
 
Introduction to django
Introduction to djangoIntroduction to django
Introduction to djangoIlian Iliev
 
Mengelola kebun kelapa sawit muktahir .ppt
Mengelola kebun kelapa sawit muktahir .pptMengelola kebun kelapa sawit muktahir .ppt
Mengelola kebun kelapa sawit muktahir .pptambar1966
 
棉花糖趣味實驗!量身定做你的「自我控制力」增強計畫!
棉花糖趣味實驗!量身定做你的「自我控制力」增強計畫!棉花糖趣味實驗!量身定做你的「自我控制力」增強計畫!
棉花糖趣味實驗!量身定做你的「自我控制力」增強計畫!葉恒志 Yeh, Heng-Zhi
 
How to document a community project with digital media
How to document a community project with digital mediaHow to document a community project with digital media
How to document a community project with digital mediaabcopen_centralvic
 
ABC Open and Neighbourhood Houses in Victoria
ABC Open and Neighbourhood Houses in VictoriaABC Open and Neighbourhood Houses in Victoria
ABC Open and Neighbourhood Houses in Victoriaabcopen_centralvic
 

Viewers also liked (15)

Insitution
Insitution Insitution
Insitution
 
Mengelola kebun kelapa sawit muktahir .ppt
Mengelola kebun kelapa sawit muktahir .pptMengelola kebun kelapa sawit muktahir .ppt
Mengelola kebun kelapa sawit muktahir .ppt
 
Automation - fabric, django and more
Automation - fabric, django and moreAutomation - fabric, django and more
Automation - fabric, django and more
 
Leonardo da Vinci
Leonardo da VinciLeonardo da Vinci
Leonardo da Vinci
 
Teks sukan 2014
Teks sukan 2014Teks sukan 2014
Teks sukan 2014
 
Iconik 2012
Iconik 2012Iconik 2012
Iconik 2012
 
Iconik spring12
Iconik spring12Iconik spring12
Iconik spring12
 
TWNKLS AWE13 Enterprise Augmented Reality
TWNKLS AWE13 Enterprise Augmented RealityTWNKLS AWE13 Enterprise Augmented Reality
TWNKLS AWE13 Enterprise Augmented Reality
 
Laporan
LaporanLaporan
Laporan
 
Functions in python
Functions in pythonFunctions in python
Functions in python
 
Introduction to django
Introduction to djangoIntroduction to django
Introduction to django
 
Mengelola kebun kelapa sawit muktahir .ppt
Mengelola kebun kelapa sawit muktahir .pptMengelola kebun kelapa sawit muktahir .ppt
Mengelola kebun kelapa sawit muktahir .ppt
 
棉花糖趣味實驗!量身定做你的「自我控制力」增強計畫!
棉花糖趣味實驗!量身定做你的「自我控制力」增強計畫!棉花糖趣味實驗!量身定做你的「自我控制力」增強計畫!
棉花糖趣味實驗!量身定做你的「自我控制力」增強計畫!
 
How to document a community project with digital media
How to document a community project with digital mediaHow to document a community project with digital media
How to document a community project with digital media
 
ABC Open and Neighbourhood Houses in Victoria
ABC Open and Neighbourhood Houses in VictoriaABC Open and Neighbourhood Houses in Victoria
ABC Open and Neighbourhood Houses in Victoria
 

Similar to Sap internal

Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESSowmya Jyothi
 
Excel Tutorials - VLOOKUP and HLOOKUP Functions
Excel Tutorials - VLOOKUP and HLOOKUP FunctionsExcel Tutorials - VLOOKUP and HLOOKUP Functions
Excel Tutorials - VLOOKUP and HLOOKUP FunctionsMerve Nur Taş
 
Data Definition Language (DDL)
Data Definition Language (DDL) Data Definition Language (DDL)
Data Definition Language (DDL) Mohd Tousif
 
MS Sql Server: Joining Databases
MS Sql Server: Joining DatabasesMS Sql Server: Joining Databases
MS Sql Server: Joining DatabasesDataminingTools Inc
 
MS SQL SERVER: Joining Databases
MS SQL SERVER: Joining DatabasesMS SQL SERVER: Joining Databases
MS SQL SERVER: Joining Databasessqlserver content
 
MS SQLSERVER:Joining Databases
MS SQLSERVER:Joining DatabasesMS SQLSERVER:Joining Databases
MS SQLSERVER:Joining Databasessqlserver content
 
V.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptx
V.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptxV.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptx
V.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptxEmmanuelAzuela3
 
Join in SQL - Inner, Self, Outer Join
Join in SQL - Inner, Self, Outer JoinJoin in SQL - Inner, Self, Outer Join
Join in SQL - Inner, Self, Outer JoinSouma Maiti
 
Joins and Views.pptx
Joins and Views.pptxJoins and Views.pptx
Joins and Views.pptxSangitaKabi
 
Data Structure.pdf
Data Structure.pdfData Structure.pdf
Data Structure.pdfMemeMiner
 
Excel Project 2 Check FiguresSteps 1-2-3 As instructedStep
Excel Project 2 Check FiguresSteps 1-2-3  As instructedStepExcel Project 2 Check FiguresSteps 1-2-3  As instructedStep
Excel Project 2 Check FiguresSteps 1-2-3 As instructedStepgalinagrabow44ms
 

Similar to Sap internal (20)

Aspire it sap abap training
Aspire it   sap abap trainingAspire it   sap abap training
Aspire it sap abap training
 
Joins
JoinsJoins
Joins
 
Stacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURESStacks IN DATA STRUCTURES
Stacks IN DATA STRUCTURES
 
Unit_9.pptx
Unit_9.pptxUnit_9.pptx
Unit_9.pptx
 
Dounly linked list
Dounly linked listDounly linked list
Dounly linked list
 
Chapter9 more on database and sql
Chapter9 more on database and sqlChapter9 more on database and sql
Chapter9 more on database and sql
 
Excel Tutorials - VLOOKUP and HLOOKUP Functions
Excel Tutorials - VLOOKUP and HLOOKUP FunctionsExcel Tutorials - VLOOKUP and HLOOKUP Functions
Excel Tutorials - VLOOKUP and HLOOKUP Functions
 
Data Definition Language (DDL)
Data Definition Language (DDL) Data Definition Language (DDL)
Data Definition Language (DDL)
 
MS Sql Server: Joining Databases
MS Sql Server: Joining DatabasesMS Sql Server: Joining Databases
MS Sql Server: Joining Databases
 
MS SQL SERVER: Joining Databases
MS SQL SERVER: Joining DatabasesMS SQL SERVER: Joining Databases
MS SQL SERVER: Joining Databases
 
MS SQLSERVER:Joining Databases
MS SQLSERVER:Joining DatabasesMS SQLSERVER:Joining Databases
MS SQLSERVER:Joining Databases
 
Basic programming
Basic programmingBasic programming
Basic programming
 
V.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptx
V.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptxV.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptx
V.6 CSPro Tabulation Application_Creating Tables with PostCalc Application.pptx
 
Join in SQL - Inner, Self, Outer Join
Join in SQL - Inner, Self, Outer JoinJoin in SQL - Inner, Self, Outer Join
Join in SQL - Inner, Self, Outer Join
 
Joins and Views.pptx
Joins and Views.pptxJoins and Views.pptx
Joins and Views.pptx
 
Spreadsheets[1]
Spreadsheets[1]Spreadsheets[1]
Spreadsheets[1]
 
Join query
Join queryJoin query
Join query
 
Unit 3 stack
Unit 3   stackUnit 3   stack
Unit 3 stack
 
Data Structure.pdf
Data Structure.pdfData Structure.pdf
Data Structure.pdf
 
Excel Project 2 Check FiguresSteps 1-2-3 As instructedStep
Excel Project 2 Check FiguresSteps 1-2-3  As instructedStepExcel Project 2 Check FiguresSteps 1-2-3  As instructedStep
Excel Project 2 Check FiguresSteps 1-2-3 As instructedStep
 

Recently uploaded

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 

Recently uploaded (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 

Sap internal

  • 1. REPORT ZTYPES . * Table declaration (old method) DATA: BEGIN OF tab_ekpo OCCURS 0, "itab with header line ebeln TYPE ekpo-ebeln, ebelp TYPE ekpo-ebelp, END OF tab_ekpo. *Table declaration (new method) "USE THIS WAY!!! TYPES: BEGIN OF t_ekpo, ebeln TYPE ekpo-ebeln, ebelp TYPE ekpo-ebelp, END OF t_ekpo. DATA: it_ekpo TYPE STANDARD TABLE OF t_ekpo INITIAL SIZE 0, "itab wa_ekpo TYPE t_ekpo. "work area (header line) * Build internal table and work area from existing internal table DATA: it_datatab LIKE tab_ekpo OCCURS 0, "old method wa_datatab LIKE LINE OF tab_ekpo. * Build internal table and work area from existing internal table, * adding additional fields TYPES: BEGIN OF t_repdata. INCLUDE STRUCTURE tab_ekpo. "could include EKKO table itself!! TYPES: bukrs TYPEekpo-werks, bstyp TYPEekpo-bukrs. TYPES: END OF t_repdata. DATA: it_repdata TYPE STANDARD TABLE OF t_repdata INITIAL SIZE 0, "itab wa_repdata TYPE t_repdata. "work area (header line) Appending Table Lines There are several ways of adding lines to index tables. The following statements have no equivalent that applies to all internal tables. Appending a Single Line To add a line to an index table, use the statement: APPEND line TO itab. line is either a work area wa that is convertible to the line type, or the expression INITIAL LINE. If you use wa, the system adds a new line to the internal table itab and fills it with the contents of the work area. INITIAL LINE appends a blank line containing the correct initial value for each field of the structure. After each APPEND statement, the system field sy-tabix contains the index of the appended line. Appending lines to standard tables and sorted tables with a non-unique key works regardless of whether lines with the same key already exist in the table. Duplicate entries may occur. A runtime error occurs if you attempt to add a duplicate entry to a sorted table with a unique key. Equally, a runtime error occurs if you violate the sort order of a sorted table by appending to it.
  • 2. Appending Several Lines You can also append internal tables to index tables using the following statement: APPEND LINES OF itab1 TO itab2. This statement appends the whole of itab1 to itab2. itab1can be any type of table. The line type of itab1 must be convertible into the line type of itab2. When you append an index table to another index table, you can specify the lines to be appended as follows: APPEND LINES OF itab1 [FROM n1] [TO n2] TO itab2. n1 and n2 specify the indexes of the first and last lines of itab1 that you want to append to itab2. This method of appending lines of one table to another is about 3 to 4 times faster than appending them line by line in a loop. After the APPEND statement, the system field sy-tabix contains the index of the last line appended. When you append several lines to a sorted table, you must respect the unique key (if defined), and not violate the sort order. Otherwise, a runtime error will occur. Ranked Lists You can use the APPEND statement to create ranked lists in standard tables. To do this, create an empty table, and then use the statement: APPEND wa TO itab SORTED BY f. The new line is not added to the end of the internal table itab. Instead, the table is sorted by field f in descending order. The work area wamust be compatible with the line type of the internal table. You cannot use the SORTED BY addition with sorted tables. When you use this technique, the internal table may only contain as many entries as you specified in the INITIAL SIZE parameter of the table declaration. This is an exception to the general rule, where internal tables can be extended dynamically. If you add more lines than specified, the last line is discarded. This is useful for creating ranked lists of limited length (for example "Top Ten"). You can use the APPEND statement to generate ranked lists containing up to 100 entries. When dealing with larger lists, it is advisable to sort tables normally for performance reasons. DATA: BEGIN OF wa, col1(1) TYPE c, col2 TYPE i, END OF wa. DATA itab LIKE TABLE OF wa. DO 3 TIMES. APPEND INITIAL LINE TO itab. wa-col1 = sy-index. wa-col2 = sy-index ** 2. APPEND wa TO itab. ENDDO. LOOP AT itab INTO wa. WRITE: / wa-col1, wa-col2. ENDLOOP. The list output is: 0 1 1 0 2 4 0 3 9
  • 3. This example creates an internal table itab with two columns that is filled in the DO loop. Each time the processing passes through the loop, an initialized line is appended and then the table work area is filled with the loop index and the square root of the loop index and appended. DATA: BEGIN OF line1, col1(3) TYPE c, col2(2) TYPE n, col3 TYPE i, END OF line1, tab1 LIKE TABLE OF line1. DATA: BEGIN OF line2, field1(1) TYPE c, field2 LIKE tab1, END OF line2, tab2 LIKE TABLE OF line2. line1-col1 = 'abc'. line1-col2 = '12'. line1-col3 = 3. APPEND line1 TO tab1. line1-col1 = 'def'. line1-col2 = '34'. line1-col3 = 5. APPEND line1 TO tab1. line2-field1 = 'A'. line2-field2 = tab1. APPEND line2 TO tab2. REFRESH tab1. line1-col1 = 'ghi'. line1-col2 = '56'. line1-col3 = 7. APPEND line1 TO tab1. line1-col1 = 'jkl'. line1-col2 = '78'. line1-col3 = 9. APPEND line1 TO tab1. line2-field1 = 'B'. line2-field2 = tab1. APPEND line2 TO tab2. LOOP AT tab2 INTO line2. WRITE: / line2-field1. LOOP AT line2-field2 INTO line1. WRITE: / line1-col1, line1-col2, line1-col3. ENDLOOP. ENDLOOP. The list output is: A abc 12 3 def 34 5 B ghi 56 7 jkl 78 9 The example creates two internal tables tab1 and tab2. tab2 has a deep structure because the second component of line2 has the data type of internal table tab1. line1 is filled and appended totab1. Then, line2 is filled and appended to tab2. After clearing tab1 with the REFRESH statement, the same procedure is repeated. DATA: BEGIN OF line, col1(1) TYPE c, col2 TYPE i, END OF line.
  • 4. DATA: itab1 LIKE TABLE OF line, jtab LIKE itab. DO 3 TIMES. line-col1 = sy-index. line-col2 = sy-index ** 2. APPEND line TO itab1. line-col1 = sy-index. line-col2 = sy-index ** 3. APPEND line TO jtab. ENDDO. APPEND LINES OF jtab FROM 2 TO 3 TO itab1. LOOP AT itab1 INTO line. WRITE: / line-col1, line-col2. ENDLOOP. The list output is: 1 1 2 4 3 9 2 8 3 27 This example creates two internal tables of the same type, itab and jtab. In the DO loop, itab is filled with a list of square numbers, and jtab with a list of cube numbers. Then, the last two lines ofjtab are appended to itab. DATA: BEGIN OF line3, col1 TYPE i, col2 TYPE i, col3 TYPE i, END OF line3. DATA itab2 LIKE TABLE OF line3 INITIAL SIZE 2. line3-col1 = 1. line3-col2 = 2. line3-col3 = 3. APPEND line3 TO itab2 SORTED BY col2. line3-col1 = 4. line3-col2 = 5. line3-col3 = 6. APPEND line3 TO itab2 SORTED BY col2. line3-col1 = 7. line3-col2 = 8. line3-col3 = 9. APPEND line3 TO itab2 SORTED BY col2. LOOP AT itab2 INTO line3. WRITE: / line3-col2. ENDLOOP. The list output is: 8 5 The program inserts three lines into the internal table itab using the APPEND statement and the SORTED BY addition. The line with the smallest value for the field COL2 is deleted from the table, since the number of lines that can be appended is fixed to 2 through the INITIAL SIZE addition.