SlideShare a Scribd company logo
1 of 16
Lecture 11 Subroutines & Function Modules BCO5647 Applications Programming Techniques (ABAP)
Readings & Objectives ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Modularisation Techniques ,[object Object],[object Object],[object Object],[object Object],[object Object]
Internal Subroutines (“Forms”) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Global and Local Data ,[object Object],[object Object]
Passing Parameters ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Passing Parameters - Example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Calling by Value and by Reference ,[object Object],[object Object],[object Object]
External Subroutines ,[object Object],[object Object],[object Object],[object Object]
Function  M odules ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Searching for a Function Module ,[object Object],[object Object],[object Object],[object Object],Click Matchcode Button
Displaying a Function Module ,[object Object],[object Object],[object Object],[object Object]
Displaying a Function Module ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Calling a Function Module ,[object Object],[object Object]
Calling a Function Module
Calling a Function Module

More Related Content

What's hot (20)

User Defined Functions in C
User Defined Functions in CUser Defined Functions in C
User Defined Functions in C
 
Sap scripts
Sap scriptsSap scripts
Sap scripts
 
DAC training-batch -2020(PLSQL)
DAC training-batch -2020(PLSQL)DAC training-batch -2020(PLSQL)
DAC training-batch -2020(PLSQL)
 
user defined function
user defined functionuser defined function
user defined function
 
Functions
FunctionsFunctions
Functions
 
Smartforms interview questions with answers
Smartforms interview questions with answersSmartforms interview questions with answers
Smartforms interview questions with answers
 
structure of a c program
structure of a c programstructure of a c program
structure of a c program
 
Abap package concept
Abap package conceptAbap package concept
Abap package concept
 
Functions in C - Programming
Functions in C - Programming Functions in C - Programming
Functions in C - Programming
 
Function
Function Function
Function
 
Sap Abap Reports
Sap Abap ReportsSap Abap Reports
Sap Abap Reports
 
INTRODUCTION TO C PROGRAMMING - PART 2
INTRODUCTION TO C PROGRAMMING - PART 2INTRODUCTION TO C PROGRAMMING - PART 2
INTRODUCTION TO C PROGRAMMING - PART 2
 
Abap course chapter 7 abap objects and bsp
Abap course   chapter 7 abap objects and bspAbap course   chapter 7 abap objects and bsp
Abap course chapter 7 abap objects and bsp
 
User defined functions
User defined functionsUser defined functions
User defined functions
 
Built in function
Built in functionBuilt in function
Built in function
 
Programming style guideline very good
Programming style guideline very goodProgramming style guideline very good
Programming style guideline very good
 
Ms vb
Ms vbMs vb
Ms vb
 
Procedure n functions
Procedure n functionsProcedure n functions
Procedure n functions
 
Notes part5
Notes part5Notes part5
Notes part5
 
Chap 2 structure of c programming dti2143
Chap 2  structure of c programming dti2143Chap 2  structure of c programming dti2143
Chap 2 structure of c programming dti2143
 

Similar to Lecture11 abap on line

Functions-Computer programming
Functions-Computer programmingFunctions-Computer programming
Functions-Computer programmingnmahi96
 
Chapter 5 modularization & catch statement (paradiso-a45b1d's conflicted co...
Chapter 5   modularization & catch statement (paradiso-a45b1d's conflicted co...Chapter 5   modularization & catch statement (paradiso-a45b1d's conflicted co...
Chapter 5 modularization & catch statement (paradiso-a45b1d's conflicted co...marco_paradiso
 
Abap function module help
Abap function module helpAbap function module help
Abap function module helpKranthi Kumar
 
Functions part1
Functions part1Functions part1
Functions part1yndaravind
 
Fnctions part2
Fnctions part2Fnctions part2
Fnctions part2yndaravind
 
Chapter One Function.pptx
Chapter One Function.pptxChapter One Function.pptx
Chapter One Function.pptxmiki304759
 
Functions assignment
Functions assignmentFunctions assignment
Functions assignmentAhmad Kamal
 
AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1guest38bf
 
Functions and modular programming.pptx
Functions and modular programming.pptxFunctions and modular programming.pptx
Functions and modular programming.pptxzueZ3
 
USER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdf
USER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdfUSER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdf
USER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdfSowmyaJyothi3
 

Similar to Lecture11 abap on line (20)

Unit 2
Unit 2Unit 2
Unit 2
 
Functions-Computer programming
Functions-Computer programmingFunctions-Computer programming
Functions-Computer programming
 
Chapter 5 modularization & catch statement (paradiso-a45b1d's conflicted co...
Chapter 5   modularization & catch statement (paradiso-a45b1d's conflicted co...Chapter 5   modularization & catch statement (paradiso-a45b1d's conflicted co...
Chapter 5 modularization & catch statement (paradiso-a45b1d's conflicted co...
 
Abap function module help
Abap function module helpAbap function module help
Abap function module help
 
Functions part1
Functions part1Functions part1
Functions part1
 
Fnctions part2
Fnctions part2Fnctions part2
Fnctions part2
 
FUNCTION CPU
FUNCTION CPUFUNCTION CPU
FUNCTION CPU
 
PSPC-UNIT-4.pdf
PSPC-UNIT-4.pdfPSPC-UNIT-4.pdf
PSPC-UNIT-4.pdf
 
Ch07.pdf
Ch07.pdfCh07.pdf
Ch07.pdf
 
Chapter One Function.pptx
Chapter One Function.pptxChapter One Function.pptx
Chapter One Function.pptx
 
User defined functions in matlab
User defined functions in  matlabUser defined functions in  matlab
User defined functions in matlab
 
Functions assignment
Functions assignmentFunctions assignment
Functions assignment
 
AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1AVB201.1 MS Access VBA Module 1
AVB201.1 MS Access VBA Module 1
 
Functions and modular programming.pptx
Functions and modular programming.pptxFunctions and modular programming.pptx
Functions and modular programming.pptx
 
USER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdf
USER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdfUSER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdf
USER DEFINED FUNCTIONS IN C MRS.SOWMYA JYOTHI.pdf
 
cp Module4(1)
cp Module4(1)cp Module4(1)
cp Module4(1)
 
Chapter - 4.pptx
Chapter - 4.pptxChapter - 4.pptx
Chapter - 4.pptx
 
Lecture 11 - Functions
Lecture 11 - FunctionsLecture 11 - Functions
Lecture 11 - Functions
 
C functions list
C functions listC functions list
C functions list
 
Ch4 functions
Ch4 functionsCh4 functions
Ch4 functions
 

More from Milind Patil

Abap slide class4 unicode-plusfiles
Abap slide class4 unicode-plusfilesAbap slide class4 unicode-plusfiles
Abap slide class4 unicode-plusfilesMilind Patil
 
Step by step abap_input help or lov
Step by step abap_input help or lovStep by step abap_input help or lov
Step by step abap_input help or lovMilind Patil
 
Step bystep abap_fieldhelpordocumentation
Step bystep abap_fieldhelpordocumentationStep bystep abap_fieldhelpordocumentation
Step bystep abap_fieldhelpordocumentationMilind Patil
 
Step bystep abap_field help or documentation
Step bystep abap_field help or documentationStep bystep abap_field help or documentation
Step bystep abap_field help or documentationMilind Patil
 
Abap slides user defined data types and data
Abap slides user defined data types and dataAbap slides user defined data types and data
Abap slides user defined data types and dataMilind Patil
 
Abap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checksAbap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checksMilind Patil
 
Step bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecordStep bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecordMilind Patil
 
Abap slide lockenqueuedataclustersauthchecks
Abap slide lockenqueuedataclustersauthchecksAbap slide lockenqueuedataclustersauthchecks
Abap slide lockenqueuedataclustersauthchecksMilind Patil
 
Abap slide exceptionshandling
Abap slide exceptionshandlingAbap slide exceptionshandling
Abap slide exceptionshandlingMilind Patil
 
Step bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecordStep bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecordMilind Patil
 
Lecture16 abap on line
Lecture16 abap on lineLecture16 abap on line
Lecture16 abap on lineMilind Patil
 
Lecture14 abap on line
Lecture14 abap on lineLecture14 abap on line
Lecture14 abap on lineMilind Patil
 
Lecture13 abap on line
Lecture13 abap on lineLecture13 abap on line
Lecture13 abap on lineMilind Patil
 
Lecture12 abap on line
Lecture12 abap on lineLecture12 abap on line
Lecture12 abap on lineMilind Patil
 
Lecture10 abap on line
Lecture10 abap on lineLecture10 abap on line
Lecture10 abap on lineMilind Patil
 
Lecture09 abap on line
Lecture09 abap on lineLecture09 abap on line
Lecture09 abap on lineMilind Patil
 
Lecture08 abap on line
Lecture08 abap on lineLecture08 abap on line
Lecture08 abap on lineMilind Patil
 

More from Milind Patil (20)

Abap slide class4 unicode-plusfiles
Abap slide class4 unicode-plusfilesAbap slide class4 unicode-plusfiles
Abap slide class4 unicode-plusfiles
 
Step by step abap_input help or lov
Step by step abap_input help or lovStep by step abap_input help or lov
Step by step abap_input help or lov
 
Step bystep abap_fieldhelpordocumentation
Step bystep abap_fieldhelpordocumentationStep bystep abap_fieldhelpordocumentation
Step bystep abap_fieldhelpordocumentation
 
Step bystep abap_field help or documentation
Step bystep abap_field help or documentationStep bystep abap_field help or documentation
Step bystep abap_field help or documentation
 
Abap slides user defined data types and data
Abap slides user defined data types and dataAbap slides user defined data types and data
Abap slides user defined data types and data
 
Abap slides set1
Abap slides set1Abap slides set1
Abap slides set1
 
Abap slide class3
Abap slide class3Abap slide class3
Abap slide class3
 
Abap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checksAbap slide lock Enqueue data clusters auth checks
Abap slide lock Enqueue data clusters auth checks
 
Step bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecordStep bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecord
 
Abap slide lockenqueuedataclustersauthchecks
Abap slide lockenqueuedataclustersauthchecksAbap slide lockenqueuedataclustersauthchecks
Abap slide lockenqueuedataclustersauthchecks
 
Abap slide exceptionshandling
Abap slide exceptionshandlingAbap slide exceptionshandling
Abap slide exceptionshandling
 
Step bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecordStep bystep abap_changinga_singlerecord
Step bystep abap_changinga_singlerecord
 
Abap reports
Abap reportsAbap reports
Abap reports
 
Lecture16 abap on line
Lecture16 abap on lineLecture16 abap on line
Lecture16 abap on line
 
Lecture14 abap on line
Lecture14 abap on lineLecture14 abap on line
Lecture14 abap on line
 
Lecture13 abap on line
Lecture13 abap on lineLecture13 abap on line
Lecture13 abap on line
 
Lecture12 abap on line
Lecture12 abap on lineLecture12 abap on line
Lecture12 abap on line
 
Lecture10 abap on line
Lecture10 abap on lineLecture10 abap on line
Lecture10 abap on line
 
Lecture09 abap on line
Lecture09 abap on lineLecture09 abap on line
Lecture09 abap on line
 
Lecture08 abap on line
Lecture08 abap on lineLecture08 abap on line
Lecture08 abap on line
 

Recently uploaded

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
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
 
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
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
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
 
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
 
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
 
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 Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
[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
 
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
 
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
 

Recently uploaded (20)

Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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
 
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
 
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
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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...
 
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
 
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
 
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 Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
[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
 
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
 
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)
 

Lecture11 abap on line

Editor's Notes

  1. Advantages : Because the external subroutines and function modules are self-contained, they can be debugged independently of each other. Changes only have to be made in the one program - all other programs that call that subroutine or function module will be affected by the change. The overall complexity of the program is reduced.
  2. When the perform command is executed, all statements between the form and endform are processed. Data defined in the ‘main’ program is global and can be used and changed in the subroutine. Double-Click on the subroutine name in the perform statement to create the subroutine at the bottom of the program code with documentation .
  3. The output from the above program would be 1 2 1. Where possible, local data should be used in a subroutine. The contents of a local data object can be retained from one call of the subroutine to the next by using static variables. Example : perform count. perform count. ….. form count. statics calls type i. calls = calls + 1. write calls. endform. … will produce the output 1 2.
  4. This is the preferred method for passing data to a subroutine. Internal tables are always global.
  5. The result from the first call : answer = 6. The result from the second call : answer = 3. The parameter names in the PERFORM statement are called ACTUAL PARAMETERS. The parameter names in the FORM statement are called FORMAL PARAMETERS. The above example passes parameters by reference. The next slide explains this.
  6. Parameters can be called either by reference or by value. Calling by reference: The address of the actual parameter is called. Within the subroutine, the variable is addressed using the formal parameter name and changes have an immediate. If only the formal parameter name is specified in the subroutine interface, then the parameter is called by reference. Calling by value: When the subroutine is called the actual parameter value is copied to the formal parameter. There are two types of call by value: Calling by value: the formal parameter is listed in the interface after the USING clause with the addition VALUE( <parameter name> ) . When the subroutine is called, the actual parameter is copied to the formal parameter. Changes made to the formal parameter only affect the local copy, not the actual parameter. Calling by value and result: the formal parameter is listed in the interface after the CHANGING clause with the addition VALUE( <parameter name> ) . When the subroutine is called, the actual parameter is copied to the formal parameter. Changes made to the formal parameter initially only affect the local copy. When the ENDFORM statement is reached, the formal parameter value is copied back to the actual parameter.
  7. All rules re passing of data as for internal subroutines, except that using parameters is the only way of passing data. (Global data in the calling program may not be referenced in the called subroutine.) SAP do not recommend using External Subroutines.
  8. Examples of Function Modules : Calculates whether a date falls on a Sunday. Rounding a number with decimals to 2 places. Function modules possess a clearly defined fixed interface for data exchange. This makes it easier for you to pass input and output parameters to and from the function module. The function module interface supports exception handling. This allows you to catch errors and pass them back to the calling program for handling. Function modules use their own memory area. The calling program and the function module cannot exchange data using a shared memory area - they must use the function module interface. This avoids unpleasant side effects such as accidentally overwriting data. How many function modules are supplied with SAP? In release 3.1, more than 43,000 function modules are available. In rel 4.5 more than 80,000 function modules are available. (4.6B > 98,000; Enterprise > 170,000) The are many thousands of function groups which contain function modules.
  9. Hint: Add Function Builder to Favorites Information system allows you to search for function modules using search criteria of function name, short description and/or function group. SAP Applications allows you to list function modules associated with application components such as FI, SD, MM.
  10. NOTES: Changing parameters appears to be new in ver 4.0 or greater Documentation can be found in the Goto pull-down menu.
  11. {Pattern} button will display Insert Statement dialog. Enter or search for required function and click Continue to insert function into ABAP Editor. Ctrl-F6 shortcut to produce Insert Statement dialog.
  12. Once the function module template is inserted, it is up to the programmer to fill it in. Note the use of ‘X’ for export SIGN variable. This comes from the function’s documentation where the code “X” indicates commercial rounding. The use of the MESSAGE Statement with system message codes allows the function to handle error processing and produce appropriate error messages. IF SY-SUBRC <> 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4. ENDIF. You can choose to handle errors yourself and define your own error messages by replacing the above code with something like: CASE SY-SUBRC. WHEN 0. write: inputnum, ' commercially rounded = ', rounded. WHEN 1. write 'Input Invalid'. WHEN 2. write 'Overflow Error'. WHEN 3. write 'Output Field type Invalid'. WHEN 4. write 'Unknown Error'. ENDCASE.