SlideShare a Scribd company logo
1 of 2
Download to read offline
2/26/2014 Example of passing internal tables to an subroutine - Code Gallery- SCN Wiki
http://wiki.scn.sap.com/wiki/display/Snippets/Example+of+passing+internal+tables+to+an+subroutine 1/2
Getting Started Newsletters Store
Search the CommunityWelcome, Guest Login Register
Products Services & Support About SCN Downloads
Industries Training & Education Partnership Developer Center
Lines of Business University Alliances Events & Webinars Innovation
Added by ravi r, last edited by Manish Kumar on Sep 06, 2013
Code Gallery
Example of passing internal tables to an subroutine
Submitted by: Ravi r
April 30, 2007
Here is an siple program on how to pass an internal table to an sunbroutine
1)
The produces the follow ing output:
1 1
2 4
3 9
You can define the types of the formal parameters of the parameter interfaces of procedures as internal tables. In the example, the subroutines FILL and OUT each have one formal parameter defined as an
internal table. An internal table w ithout header line is passed to the subroutines. Each subroutine declares a w ork area F_LINE as a local data object. Were ITAB a table w ith a header line, you w ould have to
replace ITAB w ith ITAB[] in the PERFORM and FORM statements.
2)
This example is provided for completeness. The TABLES parameter is only supported for the sake of compatibility and should not be used.
PROGRAMform_test.
DATA:BEGINOFline,
col1TYPEi,
col2TYPEi,
ENDOFline.
DATAitabLIKESTANDARDTABLEOFline.
PERFORMfillCHANGINGitab.
PERFORMoutUSINGitab.
*&---------------------------------------------------------------------*
*& Form FILL
*&---------------------------------------------------------------------*
FORMfillCHANGINGf_itabLIKEitab.
DATAf_lineLIKELINEOFf_itab.
DO3TIMES.
f_line-col1=sy-index.
f_line-col2=sy-index**2.
APPENDf_lineTOf_itab.
ENDDO.
ENDFORM. "FILL
*&---------------------------------------------------------------------*
*& Form OUT
*&---------------------------------------------------------------------*
FORMoutUSINGvalue(f_itab)LIKEitab.
DATAf_lineLIKELINEOFf_itab.
LOOPATf_itabINTOf_line.
WRITE:/f_line-col1,f_line-col2.
ENDLOOP.
ENDFORM. "OUT
PROGRAMform_test.
TYPES:BEGINOFline,
col1TYPEi,
col2TYPEi,
ENDOFline.
DATA:itabTYPESTANDARDTABLEOFlineWITHHEADERLINE,
jtabTYPESTANDARDTABLEOFline.
PERFORMfillTABLESitab.
MOVEitab[]TOjtab.
PERFORMoutTABLESjtab.
2/26/2014 Example of passing internal tables to an subroutine - Code Gallery- SCN Wiki
http://wiki.scn.sap.com/wiki/display/Snippets/Example+of+passing+internal+tables+to+an+subroutine 2/2
The produces the follow ing output:
1 1
2 4
3 9
In this example, an internal table ITAB is declared w ith a header line and an internal table JTAB is declared w ithout a header line. The actual parameter ITAB is passed to the formal parameter F_ITAB of the
subroutine FILL in the TABLES addition. The header line is passed w ith it. After the body of the table has been copied from ITAB to JTAB, the actual parameter is passed to the formal parameter F_ITAB of
the subroutine OUT using the TABLES addition. The header line F_ITAB, w hich is not passed, is generated automatically in the subroutine.
*&---------------------------------------------------------------------*
*& Form FILL
*&---------------------------------------------------------------------*
FORMfillTABLESf_itabLIKEitab[].
DO3TIMES.
f_itab-col1=sy-index.
f_itab-col2=sy-index**2.
APPENDf_itab.
ENDDO.
ENDFORM. "FILL
*&---------------------------------------------------------------------*
*& Form OUT
*&---------------------------------------------------------------------*
FORMoutTABLESf_itabLIKEjtab.
LOOPATf_itab.
WRITE:/f_itab-col1,f_itab-col2.
ENDLOOP.
ENDFORM. "OUT
snippet
Follow SCN
Contact Us SAP Help Portal
Privacy Terms of Use Legal Disclosure Copyright

More Related Content

What's hot

ABAP Message, Debugging, File Transfer and Type Group
ABAP Message, Debugging, File Transfer and Type GroupABAP Message, Debugging, File Transfer and Type Group
ABAP Message, Debugging, File Transfer and Type Groupsapdocs. info
 
Sap abap interview questions
Sap abap interview questionsSap abap interview questions
Sap abap interview questionskssr99
 
Chapter 01 user exits
Chapter 01 user exitsChapter 01 user exits
Chapter 01 user exitsKranthi Kumar
 
Top 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.comTop 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.combigclasses.com
 
BATCH DATA COMMUNICATION
BATCH DATA COMMUNICATIONBATCH DATA COMMUNICATION
BATCH DATA COMMUNICATIONKranthi Kumar
 
Automatic vendor payment advice notes by mail
Automatic vendor payment advice notes by mailAutomatic vendor payment advice notes by mail
Automatic vendor payment advice notes by mailSURESH BABU MUCHINTHALA
 
Ooabap notes with_programs
Ooabap notes with_programsOoabap notes with_programs
Ooabap notes with_programsKranthi Kumar
 
Report Painter in SAP: Introduction
Report Painter in SAP: IntroductionReport Painter in SAP: Introduction
Report Painter in SAP: IntroductionJonathan Eemans
 
Technical specification : SD(Logistics)_Order_Processing
Technical specification : SD(Logistics)_Order_ProcessingTechnical specification : SD(Logistics)_Order_Processing
Technical specification : SD(Logistics)_Order_ProcessingJoshiRavin
 
1000 solved questions
1000 solved questions1000 solved questions
1000 solved questionsKranthi Kumar
 
Sap query creation & transcation code creation for sap query
Sap query creation & transcation code creation for sap querySap query creation & transcation code creation for sap query
Sap query creation & transcation code creation for sap querySURESH BABU MUCHINTHALA
 
Asset accounting config steps
Asset accounting config stepsAsset accounting config steps
Asset accounting config stepskrishnaKumarK33
 

What's hot (20)

Alv theory
Alv theoryAlv theory
Alv theory
 
Sap abap tutorials
Sap abap tutorialsSap abap tutorials
Sap abap tutorials
 
Abap reports
Abap reportsAbap reports
Abap reports
 
ABAP Message, Debugging, File Transfer and Type Group
ABAP Message, Debugging, File Transfer and Type GroupABAP Message, Debugging, File Transfer and Type Group
ABAP Message, Debugging, File Transfer and Type Group
 
Sap abap interview questions
Sap abap interview questionsSap abap interview questions
Sap abap interview questions
 
Chapter 01 user exits
Chapter 01 user exitsChapter 01 user exits
Chapter 01 user exits
 
ABAP Advanced List
ABAP Advanced ListABAP Advanced List
ABAP Advanced List
 
Search help
Search helpSearch help
Search help
 
Top 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.comTop 10 sap abap faqs-www.bigclasses.com
Top 10 sap abap faqs-www.bigclasses.com
 
BATCH DATA COMMUNICATION
BATCH DATA COMMUNICATIONBATCH DATA COMMUNICATION
BATCH DATA COMMUNICATION
 
Automatic vendor payment advice notes by mail
Automatic vendor payment advice notes by mailAutomatic vendor payment advice notes by mail
Automatic vendor payment advice notes by mail
 
Module pool programming
Module pool programmingModule pool programming
Module pool programming
 
Sap scripts
Sap scriptsSap scripts
Sap scripts
 
Ooabap notes with_programs
Ooabap notes with_programsOoabap notes with_programs
Ooabap notes with_programs
 
Report Painter in SAP: Introduction
Report Painter in SAP: IntroductionReport Painter in SAP: Introduction
Report Painter in SAP: Introduction
 
Technical specification : SD(Logistics)_Order_Processing
Technical specification : SD(Logistics)_Order_ProcessingTechnical specification : SD(Logistics)_Order_Processing
Technical specification : SD(Logistics)_Order_Processing
 
Sap abap
Sap abapSap abap
Sap abap
 
1000 solved questions
1000 solved questions1000 solved questions
1000 solved questions
 
Sap query creation & transcation code creation for sap query
Sap query creation & transcation code creation for sap querySap query creation & transcation code creation for sap query
Sap query creation & transcation code creation for sap query
 
Asset accounting config steps
Asset accounting config stepsAsset accounting config steps
Asset accounting config steps
 

Similar to Passing table to subroutine

modularization-160202092213 (1).pdf
modularization-160202092213 (1).pdfmodularization-160202092213 (1).pdf
modularization-160202092213 (1).pdfSreeramBaddila
 
Sydney Oracle Meetup - access paths
Sydney Oracle Meetup - access pathsSydney Oracle Meetup - access paths
Sydney Oracle Meetup - access pathspaulguerin
 
Sql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ISql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ICarlos Oliveira
 
Pos 355 Enhance teaching / snaptutorial.com
Pos 355  Enhance teaching / snaptutorial.comPos 355  Enhance teaching / snaptutorial.com
Pos 355 Enhance teaching / snaptutorial.comHarrisGeorg62
 
Vb6 ch.6-3 cci
Vb6 ch.6-3 cciVb6 ch.6-3 cci
Vb6 ch.6-3 cciFahim Khan
 
Track 2 session 4 db2 for z os optimizer- what’s new in db2 11 and exploiti...
Track 2 session 4   db2 for z os optimizer- what’s new in db2 11 and exploiti...Track 2 session 4   db2 for z os optimizer- what’s new in db2 11 and exploiti...
Track 2 session 4 db2 for z os optimizer- what’s new in db2 11 and exploiti...IBMSystemzEvents
 
SAP BI Generic Extraction Using a Function Module.pdf
SAP BI Generic Extraction Using a Function Module.pdfSAP BI Generic Extraction Using a Function Module.pdf
SAP BI Generic Extraction Using a Function Module.pdfKoushikGuna
 
ORACLE APPS TECHNICAL ONLINE TRAINING
ORACLE APPS TECHNICAL ONLINE TRAININGORACLE APPS TECHNICAL ONLINE TRAINING
ORACLE APPS TECHNICAL ONLINE TRAININGTRAINING ICON
 
Automate sap security user audit
Automate sap security user auditAutomate sap security user audit
Automate sap security user auditSatyajit Deb
 
325546_adding fields in CJI3 & CJI5.pdf
325546_adding fields in CJI3 & CJI5.pdf325546_adding fields in CJI3 & CJI5.pdf
325546_adding fields in CJI3 & CJI5.pdfVaishali Ketkar
 
Introduction to Parallel Execution
Introduction to Parallel ExecutionIntroduction to Parallel Execution
Introduction to Parallel ExecutionDoug Burns
 
Lead time reduction in CAE: Automated FEM Description Report
Lead time reduction in CAE:  Automated  FEM Description ReportLead time reduction in CAE:  Automated  FEM Description Report
Lead time reduction in CAE: Automated FEM Description ReportAltair
 
Final Project Presentation
Final Project PresentationFinal Project Presentation
Final Project Presentationzroserie
 
Introduction to Performance Analysis tools on Shaheen II
Introduction to Performance Analysis tools on Shaheen IIIntroduction to Performance Analysis tools on Shaheen II
Introduction to Performance Analysis tools on Shaheen IIGeorge Markomanolis
 
PIDtuningsoftwareApracticalreview.pdf
PIDtuningsoftwareApracticalreview.pdfPIDtuningsoftwareApracticalreview.pdf
PIDtuningsoftwareApracticalreview.pdfAbdulSalamSagir1
 
Using HP TEST EXEC SL
Using HP TEST EXEC SLUsing HP TEST EXEC SL
Using HP TEST EXEC SLInterlatin
 

Similar to Passing table to subroutine (20)

modularization-160202092213 (1).pdf
modularization-160202092213 (1).pdfmodularization-160202092213 (1).pdf
modularization-160202092213 (1).pdf
 
Do You Know The 11g Plan?
Do You Know The 11g Plan?Do You Know The 11g Plan?
Do You Know The 11g Plan?
 
Sydney Oracle Meetup - access paths
Sydney Oracle Meetup - access pathsSydney Oracle Meetup - access paths
Sydney Oracle Meetup - access paths
 
Copa implementation
Copa implementationCopa implementation
Copa implementation
 
Sql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices ISql and PL/SQL Best Practices I
Sql and PL/SQL Best Practices I
 
Pos 355 Enhance teaching / snaptutorial.com
Pos 355  Enhance teaching / snaptutorial.comPos 355  Enhance teaching / snaptutorial.com
Pos 355 Enhance teaching / snaptutorial.com
 
Vb6 ch.6-3 cci
Vb6 ch.6-3 cciVb6 ch.6-3 cci
Vb6 ch.6-3 cci
 
Track 2 session 4 db2 for z os optimizer- what’s new in db2 11 and exploiti...
Track 2 session 4   db2 for z os optimizer- what’s new in db2 11 and exploiti...Track 2 session 4   db2 for z os optimizer- what’s new in db2 11 and exploiti...
Track 2 session 4 db2 for z os optimizer- what’s new in db2 11 and exploiti...
 
SAP BI Generic Extraction Using a Function Module.pdf
SAP BI Generic Extraction Using a Function Module.pdfSAP BI Generic Extraction Using a Function Module.pdf
SAP BI Generic Extraction Using a Function Module.pdf
 
ORACLE APPS TECHNICAL ONLINE TRAINING
ORACLE APPS TECHNICAL ONLINE TRAININGORACLE APPS TECHNICAL ONLINE TRAINING
ORACLE APPS TECHNICAL ONLINE TRAINING
 
Automate sap security user audit
Automate sap security user auditAutomate sap security user audit
Automate sap security user audit
 
325546_adding fields in CJI3 & CJI5.pdf
325546_adding fields in CJI3 & CJI5.pdf325546_adding fields in CJI3 & CJI5.pdf
325546_adding fields in CJI3 & CJI5.pdf
 
Introduction to Parallel Execution
Introduction to Parallel ExecutionIntroduction to Parallel Execution
Introduction to Parallel Execution
 
Lead time reduction in CAE: Automated FEM Description Report
Lead time reduction in CAE:  Automated  FEM Description ReportLead time reduction in CAE:  Automated  FEM Description Report
Lead time reduction in CAE: Automated FEM Description Report
 
Final Project Presentation
Final Project PresentationFinal Project Presentation
Final Project Presentation
 
Introduction to Performance Analysis tools on Shaheen II
Introduction to Performance Analysis tools on Shaheen IIIntroduction to Performance Analysis tools on Shaheen II
Introduction to Performance Analysis tools on Shaheen II
 
PIDtuningsoftwareApracticalreview.pdf
PIDtuningsoftwareApracticalreview.pdfPIDtuningsoftwareApracticalreview.pdf
PIDtuningsoftwareApracticalreview.pdf
 
Using HP TEST EXEC SL
Using HP TEST EXEC SLUsing HP TEST EXEC SL
Using HP TEST EXEC SL
 
sap
sap sap
sap
 
Achievement Archive
Achievement ArchiveAchievement Archive
Achievement Archive
 

Recently uploaded

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
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
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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
 
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
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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?
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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...
 
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
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 

Passing table to subroutine

  • 1. 2/26/2014 Example of passing internal tables to an subroutine - Code Gallery- SCN Wiki http://wiki.scn.sap.com/wiki/display/Snippets/Example+of+passing+internal+tables+to+an+subroutine 1/2 Getting Started Newsletters Store Search the CommunityWelcome, Guest Login Register Products Services & Support About SCN Downloads Industries Training & Education Partnership Developer Center Lines of Business University Alliances Events & Webinars Innovation Added by ravi r, last edited by Manish Kumar on Sep 06, 2013 Code Gallery Example of passing internal tables to an subroutine Submitted by: Ravi r April 30, 2007 Here is an siple program on how to pass an internal table to an sunbroutine 1) The produces the follow ing output: 1 1 2 4 3 9 You can define the types of the formal parameters of the parameter interfaces of procedures as internal tables. In the example, the subroutines FILL and OUT each have one formal parameter defined as an internal table. An internal table w ithout header line is passed to the subroutines. Each subroutine declares a w ork area F_LINE as a local data object. Were ITAB a table w ith a header line, you w ould have to replace ITAB w ith ITAB[] in the PERFORM and FORM statements. 2) This example is provided for completeness. The TABLES parameter is only supported for the sake of compatibility and should not be used. PROGRAMform_test. DATA:BEGINOFline, col1TYPEi, col2TYPEi, ENDOFline. DATAitabLIKESTANDARDTABLEOFline. PERFORMfillCHANGINGitab. PERFORMoutUSINGitab. *&---------------------------------------------------------------------* *& Form FILL *&---------------------------------------------------------------------* FORMfillCHANGINGf_itabLIKEitab. DATAf_lineLIKELINEOFf_itab. DO3TIMES. f_line-col1=sy-index. f_line-col2=sy-index**2. APPENDf_lineTOf_itab. ENDDO. ENDFORM. "FILL *&---------------------------------------------------------------------* *& Form OUT *&---------------------------------------------------------------------* FORMoutUSINGvalue(f_itab)LIKEitab. DATAf_lineLIKELINEOFf_itab. LOOPATf_itabINTOf_line. WRITE:/f_line-col1,f_line-col2. ENDLOOP. ENDFORM. "OUT PROGRAMform_test. TYPES:BEGINOFline, col1TYPEi, col2TYPEi, ENDOFline. DATA:itabTYPESTANDARDTABLEOFlineWITHHEADERLINE, jtabTYPESTANDARDTABLEOFline. PERFORMfillTABLESitab. MOVEitab[]TOjtab. PERFORMoutTABLESjtab.
  • 2. 2/26/2014 Example of passing internal tables to an subroutine - Code Gallery- SCN Wiki http://wiki.scn.sap.com/wiki/display/Snippets/Example+of+passing+internal+tables+to+an+subroutine 2/2 The produces the follow ing output: 1 1 2 4 3 9 In this example, an internal table ITAB is declared w ith a header line and an internal table JTAB is declared w ithout a header line. The actual parameter ITAB is passed to the formal parameter F_ITAB of the subroutine FILL in the TABLES addition. The header line is passed w ith it. After the body of the table has been copied from ITAB to JTAB, the actual parameter is passed to the formal parameter F_ITAB of the subroutine OUT using the TABLES addition. The header line F_ITAB, w hich is not passed, is generated automatically in the subroutine. *&---------------------------------------------------------------------* *& Form FILL *&---------------------------------------------------------------------* FORMfillTABLESf_itabLIKEitab[]. DO3TIMES. f_itab-col1=sy-index. f_itab-col2=sy-index**2. APPENDf_itab. ENDDO. ENDFORM. "FILL *&---------------------------------------------------------------------* *& Form OUT *&---------------------------------------------------------------------* FORMoutTABLESf_itabLIKEjtab. LOOPATf_itab. WRITE:/f_itab-col1,f_itab-col2. ENDLOOP. ENDFORM. "OUT snippet Follow SCN Contact Us SAP Help Portal Privacy Terms of Use Legal Disclosure Copyright