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

Sujith ~ cross applications
Sujith ~ cross applicationsSujith ~ cross applications
Sujith ~ cross applicationsKranthi Kumar
 
1000 solved questions
1000 solved questions1000 solved questions
1000 solved questionsKranthi Kumar
 
Ooabap notes with_programs
Ooabap notes with_programsOoabap notes with_programs
Ooabap notes with_programsKranthi Kumar
 
SAP Modularization techniques
SAP Modularization techniquesSAP Modularization techniques
SAP Modularization techniquesJugul Crasta
 
BATCH DATA COMMUNICATION
BATCH DATA COMMUNICATIONBATCH DATA COMMUNICATION
BATCH DATA COMMUNICATIONKranthi Kumar
 
Upgrade to zOS V2.5 - Planning and Tech Actions.pdf
Upgrade to zOS V2.5 - Planning and Tech Actions.pdfUpgrade to zOS V2.5 - Planning and Tech Actions.pdf
Upgrade to zOS V2.5 - Planning and Tech Actions.pdfMarna Walle
 
SAP Adding fields to dynamic selection for fbln transactions (2)
SAP Adding fields to dynamic selection for fbln transactions (2)SAP Adding fields to dynamic selection for fbln transactions (2)
SAP Adding fields to dynamic selection for fbln transactions (2)Imran M Arab
 
Sap abap interview questions
Sap abap interview questionsSap abap interview questions
Sap abap interview questionskssr99
 
ABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.infoABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.infosapdocs. info
 
Internal tables
Internal tables Internal tables
Internal tables Jibu Jose
 
Zebra sap-smartforms-solution
Zebra sap-smartforms-solutionZebra sap-smartforms-solution
Zebra sap-smartforms-solutionmartin_josep
 
Sap security-administration
Sap security-administrationSap security-administration
Sap security-administrationnanda nanda
 
Queries in SAP: Introduction
Queries in SAP: IntroductionQueries in SAP: Introduction
Queries in SAP: IntroductionJonathan Eemans
 
Ab1011 module pool programming
Ab1011   module pool programmingAb1011   module pool programming
Ab1011 module pool programmingSatheesh Kanna
 

What's hot (20)

Sujith ~ cross applications
Sujith ~ cross applicationsSujith ~ cross applications
Sujith ~ cross applications
 
1000 solved questions
1000 solved questions1000 solved questions
1000 solved questions
 
Ooabap notes with_programs
Ooabap notes with_programsOoabap notes with_programs
Ooabap notes with_programs
 
SAP Modularization techniques
SAP Modularization techniquesSAP Modularization techniques
SAP Modularization techniques
 
BATCH DATA COMMUNICATION
BATCH DATA COMMUNICATIONBATCH DATA COMMUNICATION
BATCH DATA COMMUNICATION
 
Upgrade to zOS V2.5 - Planning and Tech Actions.pdf
Upgrade to zOS V2.5 - Planning and Tech Actions.pdfUpgrade to zOS V2.5 - Planning and Tech Actions.pdf
Upgrade to zOS V2.5 - Planning and Tech Actions.pdf
 
SAP Adding fields to dynamic selection for fbln transactions (2)
SAP Adding fields to dynamic selection for fbln transactions (2)SAP Adding fields to dynamic selection for fbln transactions (2)
SAP Adding fields to dynamic selection for fbln transactions (2)
 
Sap abap interview questions
Sap abap interview questionsSap abap interview questions
Sap abap interview questions
 
ABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.infoABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.info
 
Internal tables
Internal tables Internal tables
Internal tables
 
Badi document
Badi documentBadi document
Badi document
 
Zebra sap-smartforms-solution
Zebra sap-smartforms-solutionZebra sap-smartforms-solution
Zebra sap-smartforms-solution
 
Sap co pa planning
Sap co pa planningSap co pa planning
Sap co pa planning
 
Sap scripts
Sap scriptsSap scripts
Sap scripts
 
Sap security-administration
Sap security-administrationSap security-administration
Sap security-administration
 
Queries in SAP: Introduction
Queries in SAP: IntroductionQueries in SAP: Introduction
Queries in SAP: Introduction
 
Reports
ReportsReports
Reports
 
Search help
Search helpSearch help
Search help
 
Sap scripts
Sap scriptsSap scripts
Sap scripts
 
Ab1011 module pool programming
Ab1011   module pool programmingAb1011   module pool programming
Ab1011 module pool programming
 

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

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Recently uploaded (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

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