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

Product allocation during sales order entry
Product allocation during sales order entryProduct allocation during sales order entry
Product allocation during sales order entrysuryanarayana tata
 
Po vendor down pay process SAP
Po vendor down pay process SAP Po vendor down pay process SAP
Po vendor down pay process SAP Jay Pal
 
SAP STO config
SAP STO configSAP STO config
SAP STO configsamitchak
 
1000 solved questions
1000 solved questions1000 solved questions
1000 solved questionsKranthi Kumar
 
Chapter 01 user exits
Chapter 01 user exitsChapter 01 user exits
Chapter 01 user exitsKranthi Kumar
 
Type casting in ooabap
Type casting in ooabapType casting in ooabap
Type casting in ooabapbiswajit2015
 
Account Assignment Category
Account Assignment CategoryAccount Assignment Category
Account Assignment CategoryRameswara Vedula
 
Dialog Programming Overview
Dialog Programming OverviewDialog Programming Overview
Dialog Programming Overviewsapdocs. info
 
Sap sapscripts tips and tricks
Sap sapscripts tips and tricksSap sapscripts tips and tricks
Sap sapscripts tips and tricksKranthi Kumar
 
Workflow Part1 1
Workflow Part1 1Workflow Part1 1
Workflow Part1 1evil66_in
 
Sap sd question
Sap sd questionSap sd question
Sap sd questionAmit Gupta
 
abap list viewer (alv)
abap list viewer (alv)abap list viewer (alv)
abap list viewer (alv)Kranthi Kumar
 
Sap abap modularization interview questions
Sap abap modularization interview questionsSap abap modularization interview questions
Sap abap modularization interview questionsPradipta Mohanty
 
Simple exercise on o data and sap ui5 application for the basic crud operatio...
Simple exercise on o data and sap ui5 application for the basic crud operatio...Simple exercise on o data and sap ui5 application for the basic crud operatio...
Simple exercise on o data and sap ui5 application for the basic crud operatio...Nagendra Babu
 

What's hot (20)

Product allocation during sales order entry
Product allocation during sales order entryProduct allocation during sales order entry
Product allocation during sales order entry
 
Po vendor down pay process SAP
Po vendor down pay process SAP Po vendor down pay process SAP
Po vendor down pay process SAP
 
SAP STO config
SAP STO configSAP STO config
SAP STO config
 
Abap Objects for BW
Abap Objects for BWAbap Objects for BW
Abap Objects for BW
 
1000 solved questions
1000 solved questions1000 solved questions
1000 solved questions
 
Chapter 01 user exits
Chapter 01 user exitsChapter 01 user exits
Chapter 01 user exits
 
Type casting in ooabap
Type casting in ooabapType casting in ooabap
Type casting in ooabap
 
ABAP Advanced List
ABAP Advanced ListABAP Advanced List
ABAP Advanced List
 
Module pool programming
Module pool programmingModule pool programming
Module pool programming
 
Account Assignment Category
Account Assignment CategoryAccount Assignment Category
Account Assignment Category
 
Dialog Programming Overview
Dialog Programming OverviewDialog Programming Overview
Dialog Programming Overview
 
Sap abap tutorial
Sap abap tutorialSap abap tutorial
Sap abap tutorial
 
Sap sapscripts tips and tricks
Sap sapscripts tips and tricksSap sapscripts tips and tricks
Sap sapscripts tips and tricks
 
Workflow Part1 1
Workflow Part1 1Workflow Part1 1
Workflow Part1 1
 
Bapi programming
Bapi programmingBapi programming
Bapi programming
 
Dialog programming ABAP
Dialog programming ABAPDialog programming ABAP
Dialog programming ABAP
 
Sap sd question
Sap sd questionSap sd question
Sap sd question
 
abap list viewer (alv)
abap list viewer (alv)abap list viewer (alv)
abap list viewer (alv)
 
Sap abap modularization interview questions
Sap abap modularization interview questionsSap abap modularization interview questions
Sap abap modularization interview questions
 
Simple exercise on o data and sap ui5 application for the basic crud operatio...
Simple exercise on o data and sap ui5 application for the basic crud operatio...Simple exercise on o data and sap ui5 application for the basic crud operatio...
Simple exercise on o data and sap ui5 application for the basic crud operatio...
 

Similar to Passing table to subroutine

modularization-160202092213 (1).pdf
modularization-160202092213 (1).pdfmodularization-160202092213 (1).pdf
modularization-160202092213 (1).pdfSreeramBaddila
 
SAP Modularization techniques
SAP Modularization techniquesSAP Modularization techniques
SAP Modularization techniquesJugul Crasta
 
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
 
SAP Modularization techniques
SAP Modularization techniquesSAP Modularization techniques
SAP Modularization techniques
 
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
 

Recently uploaded

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
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
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
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
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
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...
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
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?
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 

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