SlideShare uma empresa Scribd logo
1 de 39
Day 3
Modularisation Technique
&
BDCs
Modularization techniques
• Macros
• Include program
• Subroutines
• Function Module
Macros
• Callable modules of program code
Defining Macros - Syntax
DEFINE <macro>.
<statements>
ENDDEFINE.
Calling Macros - Syntax
<macro> [ <p1> <p2> ….<p9>].
Macros…
Example
Defining Macros
DEFINE arithmetic.
result = &1 &2 &3.
Write: / ‘The result is ‘, result.
ENDDEFINE.
Calling Macros
arithmetic 4 + 5.
Output
The result is 9
Include Programs
• If we want to use the same sequence of statements in
several programs, we can code them once in an include
program and call it in the other programs wherever it is
required
• Include programs cannot contain PROGRAM or
REPORT Statements
• Include programs cannot call themselves
• Include programs must contain complete statements
Using Include programs
Syntax
INCLUDE <name_of_the_include>.
Example
REPORT zrssales10.
INCLUDE zrsdecla10.
….
Write: / ‘Date:’, sy-datum.
Subroutines
• Program module that can be called by any program.
• You use subroutines to avoid having to write frequently
used program components more than once. Data can be
passed explicitly from and to subroutines.
• Types of subroutine
– internal subroutines
– external subroutines
Defining and calling subroutine
Definition - Syntax
FORM <subr_name>.
<statement block>.
ENDFORM.
Calling - syntax
Internal Subroutines
PERFORM <subr_name>.
External Subroutines
PERFORM <subr_name> (<prog>) [IF FOUND].
<Prog> - Program name
IF FOUND - If this is specified and there is no
subroutine <sub> in the program <prog>,
the system ignores the PERFORM statement.
Defining and calling subroutine…
Example
Defining the subroutine
PROGRAM formpool.
FORM show.
WRITE: / ‘Program started by’, sy-uname.
ENDFORM.
Calling the subroutine from a program
PROGRAM sapmztst.
PERFORM show(formpool) IF FOUND
Passing parameters
Defining
FORM <subr> [TABLES <formal table list>]
[USING <formal input list>]
[CHANGING <formal output list>].…
Calling
PERFORM <subr>[(<prog>)] [TABLES <actual table list>]
[USING <actual input list>]
[CHANGING <actual output list>].…
Methods of passing parameters
1. Calling by Reference
2. Calling by value
3. Calling by value and result
1. Call by reference
FORM..... [USING <fi1>... <fi n>] [CHANGING <fo 1>... <fo n>]...
PERFORM... [USING <ai1>... <ai n>] [CHANGING <ao 1>... <ao n>]...
Call by reference
PERFORM calculate_tax USING fl1 fl2.
……..
FORM calculate_tax USING f1 f2.
CLEAR itab.
MOVE f1 TO itab-fl1.
APPEND itab.
ENDFORM.
Actual Parameters
Formal Parameters
In this example, parameters are passed by
reference. This is the most common, and most
cost effective, method of parameter passing.
Methods of passing parameters
2. Call by value
FORM..... USING...VALUE(<fii>)..
PERFORM... USING.......<aii>..
3. Call by value and result
FORM..... CHANGING...VALUE(<fii>)..
PERFORM... CHANGING.......<aii>..
Terminating the Subroutines
• Terminating subroutines unconditionally by Using the
command
EXIT
• Terminating Subroutines conditionally by Using the
command
CHECK
Function Builder
• An ABAP Workbench Tool
• ABAP routines that are stored in a central function library
• Non application-specific, and available system wide
• Must belong to a pool called a function group
Creating a Function Module – Step 1 of 7
Initial Parameters
SE37
Creating a Function Module – Step 2 of 7
General Attributes
Creating a Function Module – Step 3 of 7
Import and Changing Interface Parameters
Creating a Function Module – Step 4 of 7
Export Interface Parameters
Creating a Function Module – Step 5 of 7
Tables Interface Parameters
Creating a Function Module – Step 6 of 7
Exceptions
Creating a Function Module – Step 7 of 7
Source Code and Activation
Function module - Interface parameters
Import
Contains a list of the formal parameters that are used to
pass data to a function module.
Export
Contains a list of the formal parameters that are used to
receive data from a function module.
Changing
Contains a list of the formal parameters that are used
both to pass data to and receive data from a function
module.
Function module - Interface parameters
Tables
Specifies the tables that are to be passed to a function
module. Table parameters are always passed by
reference.
Exceptions
Shows how the function module reacts to exceptions.
The function definition is written in the editor (Source code)
Adding the function module to the program
Click PATTERN button
in the edit program
screen of the ABAP
Editor
Adding the function module to the program
Choose the Call Function
Radio button and give the
name of the function
module and enter it
File Handling – OPEN DATASET
• Opens a file for reading, writing or for appending
• Syntax:
OPEN DATASET <dsn> [FOR INPUT|OUTPUT|APPENDING]
[IN BINARY|TEXT MODE]
[AT POSITION <pos>]
[MESSAGE <mess>]
[FILTER <filt>].
• <dsn> can be a logical or physical file names
File Handling – READ DATASET
• Reads a file
• Syntax:
READ DATASET <dsn> INTO <f> [LENGTH <len>].
• <dsn> can be a logical or physical file names
• Logical file names can be created in customizing
File Handling – TRANSFER DATASET
• Syntax:
- Writing to a dataset
TRANSFER <f> TO <dsn> [LENGTH <len>].
- Closing a dataset
CLOSE DATASET <dsn>.
BDC - Batch Data Communication
• To transfer data from non-SAP systems ( ie. already
available in electronic form )
• Suitable for entering large amounts of data as it
executes the transactions automatically
• Similar to entering the data in the transactions manually -
All validations are done
Advantages of Batch input
• No manual intervention is needed
• Ensures data integrity
BDC - Methods
Sequential dataset
bdc table
queue dataset
function “batch input”
Application function
SAP Database
Sequential dataset
bdc table
call transaction /
call dialog
Application function
SAP Database
Batch Input Call transaction / call dialog
BDC Methods
• Classical Method
• Call Transaction
• Call Dialog
BDC Methods
• Creating a session on the batch input queue
Standard method.
1) Offers management of sessions
2) Support for playing back
3) Correcting sessions that contain errors
4) Detailed logging
BDC Methods
• Call transaction using
1) Offers faster processing than standard method
2) The playback, interactive correction, and logging
facilities offered for batch input sessions are not
available for CALL TRANSACTION USING.
• Call dialog
1) Outdated and more complex (Not Recommended)
Preparing a BDC Table
• The BDC table should have five fields viz.,
1) Program name
2) Screen number
3) Screen begin
4) Field name
5) Field value
Preparing a BDC Table
Example
Prog Screen Scrn Field Field
name No begin name value
SAPMMO3M 0060 X RM03M- MATNR mat.no
RM03M-MBRSH indu. sec
.
.
SAPMM03M 0080 X RM03M-WERKS target pla
.
.
Creating a session on the batch input queue
• The BDC program can be generated by recording the
transaction . Transaction code - SHDB
• To execute the session, go to transaction code
SM35 and execute by selecting the session ( All session
methods will automatically create as a job)
• The BDC can be run in foreground, background or
it can display only the error screens.
Call Transaction using
Uses the command
CALL TRANSACTION <tran code> USING <bdctab>
MODE <mode>.
Bdctab - BDC Table ( Internal table )
mode
‘A’ - All screens
‘N’ - No screens
‘E’ - Error screens only
Job Scheduling
• Schedule a job – SM35
– Create a job
– Add program to be executed
– Set timing and date to be executed

Mais conteúdo relacionado

Mais procurados

Skillwise - Cobol Programming Basics
Skillwise - Cobol Programming BasicsSkillwise - Cobol Programming Basics
Skillwise - Cobol Programming BasicsSkillwise Group
 
The Easytrieve Presention by Srinimf
The Easytrieve Presention by SrinimfThe Easytrieve Presention by Srinimf
The Easytrieve Presention by SrinimfSrinimf-Slides
 
Cobol programming language
Cobol programming languageCobol programming language
Cobol programming languageBurhan Ahmed
 
PLI Presentation for Mainframe Programmers
PLI Presentation for Mainframe ProgrammersPLI Presentation for Mainframe Programmers
PLI Presentation for Mainframe ProgrammersSrinimf-Slides
 
Modular programming
Modular programmingModular programming
Modular programmingbhuwanbist1
 
Modularization & Catch Statement
Modularization & Catch StatementModularization & Catch Statement
Modularization & Catch Statementsapdocs. info
 
Abap function module help
Abap function module helpAbap function module help
Abap function module helpKranthi Kumar
 
Presentation of computer
Presentation of computerPresentation of computer
Presentation of computerSabinDhakal13
 
Mainframe refresher-part-1
Mainframe refresher-part-1Mainframe refresher-part-1
Mainframe refresher-part-1vishwas17
 

Mais procurados (12)

Skillwise - Cobol Programming Basics
Skillwise - Cobol Programming BasicsSkillwise - Cobol Programming Basics
Skillwise - Cobol Programming Basics
 
The Easytrieve Presention by Srinimf
The Easytrieve Presention by SrinimfThe Easytrieve Presention by Srinimf
The Easytrieve Presention by Srinimf
 
Ms vb
Ms vbMs vb
Ms vb
 
Modular programming
Modular programmingModular programming
Modular programming
 
Basics of cpp
Basics of cppBasics of cpp
Basics of cpp
 
Cobol programming language
Cobol programming languageCobol programming language
Cobol programming language
 
PLI Presentation for Mainframe Programmers
PLI Presentation for Mainframe ProgrammersPLI Presentation for Mainframe Programmers
PLI Presentation for Mainframe Programmers
 
Modular programming
Modular programmingModular programming
Modular programming
 
Modularization & Catch Statement
Modularization & Catch StatementModularization & Catch Statement
Modularization & Catch Statement
 
Abap function module help
Abap function module helpAbap function module help
Abap function module help
 
Presentation of computer
Presentation of computerPresentation of computer
Presentation of computer
 
Mainframe refresher-part-1
Mainframe refresher-part-1Mainframe refresher-part-1
Mainframe refresher-part-1
 

Semelhante a 3 modularisation and bdc

Bdc BATCH DATA COMMUNICATION
Bdc BATCH DATA COMMUNICATIONBdc BATCH DATA COMMUNICATION
Bdc BATCH DATA COMMUNICATIONHitesh Gulani
 
ERP Magazine April 2018 Issue 1
ERP Magazine April 2018 Issue 1 ERP Magazine April 2018 Issue 1
ERP Magazine April 2018 Issue 1 Rehan Zaidi
 
ERP Magazine April 2018 - The magazine for SAP ABAP Professionals
ERP Magazine April 2018 - The magazine for SAP ABAP ProfessionalsERP Magazine April 2018 - The magazine for SAP ABAP Professionals
ERP Magazine April 2018 - The magazine for SAP ABAP ProfessionalsRehan Zaidi
 
Software cost estimation
Software cost estimationSoftware cost estimation
Software cost estimationdeep sharma
 
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
 
Complete reference to_abap_basics
Complete reference to_abap_basicsComplete reference to_abap_basics
Complete reference to_abap_basicsAbhishek Dixit
 
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 bspMilind Patil
 
C++ advanced PPT.pdf
C++ advanced PPT.pdfC++ advanced PPT.pdf
C++ advanced PPT.pdfDinashMaliya3
 
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxFundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxVigneshkumar Ponnusamy
 
Understanding DB2 Optimizer
Understanding DB2 OptimizerUnderstanding DB2 Optimizer
Understanding DB2 Optimizerterraborealis
 
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
 
Cs 568 Spring 10 Lecture 5 Estimation
Cs 568 Spring 10  Lecture 5 EstimationCs 568 Spring 10  Lecture 5 Estimation
Cs 568 Spring 10 Lecture 5 EstimationLawrence Bernstein
 
SAP Batch data communication
SAP Batch data communicationSAP Batch data communication
SAP Batch data communicationJugul Crasta
 

Semelhante a 3 modularisation and bdc (20)

Bdc BATCH DATA COMMUNICATION
Bdc BATCH DATA COMMUNICATIONBdc BATCH DATA COMMUNICATION
Bdc BATCH DATA COMMUNICATION
 
Savitch Ch 04
Savitch Ch 04Savitch Ch 04
Savitch Ch 04
 
Savitch Ch 04
Savitch Ch 04Savitch Ch 04
Savitch Ch 04
 
Abap sample
Abap sampleAbap sample
Abap sample
 
ERP Magazine April 2018 Issue 1
ERP Magazine April 2018 Issue 1 ERP Magazine April 2018 Issue 1
ERP Magazine April 2018 Issue 1
 
ERP Magazine April 2018 - The magazine for SAP ABAP Professionals
ERP Magazine April 2018 - The magazine for SAP ABAP ProfessionalsERP Magazine April 2018 - The magazine for SAP ABAP Professionals
ERP Magazine April 2018 - The magazine for SAP ABAP Professionals
 
Software cost estimation
Software cost estimationSoftware cost estimation
Software cost estimation
 
Sap abap
Sap abapSap abap
Sap abap
 
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...
 
Complete reference to_abap_basics
Complete reference to_abap_basicsComplete reference to_abap_basics
Complete reference to_abap_basics
 
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
 
C++ advanced PPT.pdf
C++ advanced PPT.pdfC++ advanced PPT.pdf
C++ advanced PPT.pdf
 
Fundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptxFundamentals of Data Structures Unit 1.pptx
Fundamentals of Data Structures Unit 1.pptx
 
Understanding DB2 Optimizer
Understanding DB2 OptimizerUnderstanding DB2 Optimizer
Understanding DB2 Optimizer
 
Spr ch-02
Spr ch-02Spr ch-02
Spr ch-02
 
Conformiq Tutorial
Conformiq TutorialConformiq Tutorial
Conformiq Tutorial
 
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...
 
Cs 568 Spring 10 Lecture 5 Estimation
Cs 568 Spring 10  Lecture 5 EstimationCs 568 Spring 10  Lecture 5 Estimation
Cs 568 Spring 10 Lecture 5 Estimation
 
Savitch ch 04
Savitch ch 04Savitch ch 04
Savitch ch 04
 
SAP Batch data communication
SAP Batch data communicationSAP Batch data communication
SAP Batch data communication
 

Último

latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answersdalebeck957
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactisticshameyhk98
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentationcamerronhm
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 

Último (20)

latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 

3 modularisation and bdc

  • 2. Modularization techniques • Macros • Include program • Subroutines • Function Module
  • 3. Macros • Callable modules of program code Defining Macros - Syntax DEFINE <macro>. <statements> ENDDEFINE. Calling Macros - Syntax <macro> [ <p1> <p2> ….<p9>].
  • 4. Macros… Example Defining Macros DEFINE arithmetic. result = &1 &2 &3. Write: / ‘The result is ‘, result. ENDDEFINE. Calling Macros arithmetic 4 + 5. Output The result is 9
  • 5. Include Programs • If we want to use the same sequence of statements in several programs, we can code them once in an include program and call it in the other programs wherever it is required • Include programs cannot contain PROGRAM or REPORT Statements • Include programs cannot call themselves • Include programs must contain complete statements
  • 6. Using Include programs Syntax INCLUDE <name_of_the_include>. Example REPORT zrssales10. INCLUDE zrsdecla10. …. Write: / ‘Date:’, sy-datum.
  • 7. Subroutines • Program module that can be called by any program. • You use subroutines to avoid having to write frequently used program components more than once. Data can be passed explicitly from and to subroutines. • Types of subroutine – internal subroutines – external subroutines
  • 8. Defining and calling subroutine Definition - Syntax FORM <subr_name>. <statement block>. ENDFORM. Calling - syntax Internal Subroutines PERFORM <subr_name>. External Subroutines PERFORM <subr_name> (<prog>) [IF FOUND]. <Prog> - Program name IF FOUND - If this is specified and there is no subroutine <sub> in the program <prog>, the system ignores the PERFORM statement.
  • 9. Defining and calling subroutine… Example Defining the subroutine PROGRAM formpool. FORM show. WRITE: / ‘Program started by’, sy-uname. ENDFORM. Calling the subroutine from a program PROGRAM sapmztst. PERFORM show(formpool) IF FOUND
  • 10. Passing parameters Defining FORM <subr> [TABLES <formal table list>] [USING <formal input list>] [CHANGING <formal output list>].… Calling PERFORM <subr>[(<prog>)] [TABLES <actual table list>] [USING <actual input list>] [CHANGING <actual output list>].…
  • 11. Methods of passing parameters 1. Calling by Reference 2. Calling by value 3. Calling by value and result 1. Call by reference FORM..... [USING <fi1>... <fi n>] [CHANGING <fo 1>... <fo n>]... PERFORM... [USING <ai1>... <ai n>] [CHANGING <ao 1>... <ao n>]...
  • 12. Call by reference PERFORM calculate_tax USING fl1 fl2. …….. FORM calculate_tax USING f1 f2. CLEAR itab. MOVE f1 TO itab-fl1. APPEND itab. ENDFORM. Actual Parameters Formal Parameters In this example, parameters are passed by reference. This is the most common, and most cost effective, method of parameter passing.
  • 13. Methods of passing parameters 2. Call by value FORM..... USING...VALUE(<fii>).. PERFORM... USING.......<aii>.. 3. Call by value and result FORM..... CHANGING...VALUE(<fii>).. PERFORM... CHANGING.......<aii>..
  • 14. Terminating the Subroutines • Terminating subroutines unconditionally by Using the command EXIT • Terminating Subroutines conditionally by Using the command CHECK
  • 15. Function Builder • An ABAP Workbench Tool • ABAP routines that are stored in a central function library • Non application-specific, and available system wide • Must belong to a pool called a function group
  • 16. Creating a Function Module – Step 1 of 7 Initial Parameters SE37
  • 17. Creating a Function Module – Step 2 of 7 General Attributes
  • 18. Creating a Function Module – Step 3 of 7 Import and Changing Interface Parameters
  • 19. Creating a Function Module – Step 4 of 7 Export Interface Parameters
  • 20. Creating a Function Module – Step 5 of 7 Tables Interface Parameters
  • 21. Creating a Function Module – Step 6 of 7 Exceptions
  • 22. Creating a Function Module – Step 7 of 7 Source Code and Activation
  • 23. Function module - Interface parameters Import Contains a list of the formal parameters that are used to pass data to a function module. Export Contains a list of the formal parameters that are used to receive data from a function module. Changing Contains a list of the formal parameters that are used both to pass data to and receive data from a function module.
  • 24. Function module - Interface parameters Tables Specifies the tables that are to be passed to a function module. Table parameters are always passed by reference. Exceptions Shows how the function module reacts to exceptions. The function definition is written in the editor (Source code)
  • 25. Adding the function module to the program Click PATTERN button in the edit program screen of the ABAP Editor
  • 26. Adding the function module to the program Choose the Call Function Radio button and give the name of the function module and enter it
  • 27. File Handling – OPEN DATASET • Opens a file for reading, writing or for appending • Syntax: OPEN DATASET <dsn> [FOR INPUT|OUTPUT|APPENDING] [IN BINARY|TEXT MODE] [AT POSITION <pos>] [MESSAGE <mess>] [FILTER <filt>]. • <dsn> can be a logical or physical file names
  • 28. File Handling – READ DATASET • Reads a file • Syntax: READ DATASET <dsn> INTO <f> [LENGTH <len>]. • <dsn> can be a logical or physical file names • Logical file names can be created in customizing
  • 29. File Handling – TRANSFER DATASET • Syntax: - Writing to a dataset TRANSFER <f> TO <dsn> [LENGTH <len>]. - Closing a dataset CLOSE DATASET <dsn>.
  • 30. BDC - Batch Data Communication • To transfer data from non-SAP systems ( ie. already available in electronic form ) • Suitable for entering large amounts of data as it executes the transactions automatically • Similar to entering the data in the transactions manually - All validations are done Advantages of Batch input • No manual intervention is needed • Ensures data integrity
  • 31. BDC - Methods Sequential dataset bdc table queue dataset function “batch input” Application function SAP Database Sequential dataset bdc table call transaction / call dialog Application function SAP Database Batch Input Call transaction / call dialog
  • 32. BDC Methods • Classical Method • Call Transaction • Call Dialog
  • 33. BDC Methods • Creating a session on the batch input queue Standard method. 1) Offers management of sessions 2) Support for playing back 3) Correcting sessions that contain errors 4) Detailed logging
  • 34. BDC Methods • Call transaction using 1) Offers faster processing than standard method 2) The playback, interactive correction, and logging facilities offered for batch input sessions are not available for CALL TRANSACTION USING. • Call dialog 1) Outdated and more complex (Not Recommended)
  • 35. Preparing a BDC Table • The BDC table should have five fields viz., 1) Program name 2) Screen number 3) Screen begin 4) Field name 5) Field value
  • 36. Preparing a BDC Table Example Prog Screen Scrn Field Field name No begin name value SAPMMO3M 0060 X RM03M- MATNR mat.no RM03M-MBRSH indu. sec . . SAPMM03M 0080 X RM03M-WERKS target pla . .
  • 37. Creating a session on the batch input queue • The BDC program can be generated by recording the transaction . Transaction code - SHDB • To execute the session, go to transaction code SM35 and execute by selecting the session ( All session methods will automatically create as a job) • The BDC can be run in foreground, background or it can display only the error screens.
  • 38. Call Transaction using Uses the command CALL TRANSACTION <tran code> USING <bdctab> MODE <mode>. Bdctab - BDC Table ( Internal table ) mode ‘A’ - All screens ‘N’ - No screens ‘E’ - Error screens only
  • 39. Job Scheduling • Schedule a job – SM35 – Create a job – Add program to be executed – Set timing and date to be executed

Notas do Editor

  1. Navigate to the Function Builder using one of the methods: From the main menu, go to Tools  ABAP Workbench  Development, or Type SE37 on the Command Field. Type a valid function module name (starting with Y or Z). Press the “Create” pushbutton. In the popup window that appears, enter the Function Group name (if you have not created it already, create it by navigating to Goto  Function Groups  Create group. Click on the “Save” Button.
  2. To get a list of valid Function Groups and Applications, click on the Possible Entries pushbutton on the standard toolbar or press F4. An existing function module can be copied by entering its name in the Copy from input field. Process Type of a function module must be declared: Normal if the function module can only be called from this system, and is not tailored for asynchronous database table updates. Remote-enabled for function modules that can be called from other systems (R/3 or non R/3 supporting LU6.2 or TCP/IP) Update for function modules that will perform asynchronous database updates: Start Immediately will run in the V1 update task. Immediate start no restart, same as above, but cannot be restarted using SM13. Start delayed will run in the V2 update task, after V1 update has completed. Collective run, will sit in the update queue until a background job is scheduled to clear them up. This is mostly used for sending OLTP data to BW or other information systems. The Attributes tab displays General Data about the Function module such as the person in charged of the function module, the date the function module was last changed, the development class, the status, etc.
  3. Define the Import and Changing parameters in the appropriate tabs. Import and Changing parameters are flat in structure. Changing parameters can be used to change values in the Function Module while Import parameters are mostly passed by value. For each parameter, specify the type either: Nothing. Calling a function module is like calling a subroutine, you do not have to use actual/formal parameters. This method is not recommended for performance reasons, since type assignment will be done by the system at run time. LIKE by a reference to a structure or field of the Dictionary. TYPE by reference to a SAP supplied pre-defined data type (Char, Integer, Numeric Character) or data element. TYPE REFERENCE to a user defined data type(TYPE REF must be defined in the top include for the function module). If parameters are typed, then calling program must use same types, otherwise a run time error will occur. An Import or Changing parameter can have a default value that is used when the calling program does not set this parameter explicitly. Enter the default value in the default value column. Import parameters (from the function point of view) and Changing parameters can be classified by the developer as optional parameters. In this case, the caller of the function need not pass a value to this parameter, and the runtime system chooses the initial value of the corresponding type. Parameters with a value in the default value column are always optional. If an input parameter is not classified as optional, it should be set by the caller; otherwise, a runtime error occurs.
  4. Export Parameters would be passed back to the calling program by the function module. We could use the Changing parameters for passing back values to the program as well. Export parameters are generally passed by value.
  5. Internal Tables are also included in the interface. For performance reasons, an internal table is always passed by reference parameter. Like Import and Changing parameters, Tables parameters can also be marked “Optional”. Internal tables must be typed if the structure of the table must be known to the function module.
  6. Exceptions are used to handle abnormal conditions in the processing logic in the function module. The exceptions defined can be “raised” in the main function module for raising any user-defined errors. The “RAISE” ABAP command is used to raise an exception (RAISE RECORD_NOT_FOUND). On raising an exception, the processing terminates in the function module and control is handed over to the calling program. In the calling program, sy-subrc is set to positive number greater than zero corresponding to the position of the exception in the exception definition. For example, in the above screen, raising RECORD_NOT_FOUND would set sy-subrc to 1 while raising INVALID_DATE would set sy-subrc to 4.
  7. The source code would contain ABAP code which would receive the input parameters, process the data and pass the output back to a calling program (or another function module). All the main processing logic should be contained within the FUNCTION – ENDFUNCTION boundaries. If there are any subroutines (FORMs) that need to be created for modularizing code in the function module, the FORM definitions should be after the ENDFUNCTION statement. Typically, one would create a separate INCLUDE (program of type “I”) to hold the subroutines. A TOP include could also be created to define global variables that can be accessed by any function module in the function group. All includes created need to be separately activated. Once, a syntax check is successfully completed, the function module can be Activated by pressing the “Activate” button on the Application Toolbar.
  8. Opens a file &amp;lt;dsn&amp;gt; on the application server. The additions determine whether the file is for reading or writing, whether the contents are to be interpreted in binary or character form, the position in the file, the location to which an operating system can be written, and allow you to execute an operating system command. Filenames are platform-specific. You must therefore use file- and pathnames that conform to the rules of the operating system under which your R/3 System is running. However, you can also use logical filenames to ensure that your programs are not operating system-specific.
  9. Reads the contents of the file &amp;lt;dsn&amp;gt; on the application server to the variable &amp;lt;f&amp;gt;. The number of bytes transferred can be written to &amp;lt;len&amp;gt;.
  10. Before reading or writing to a dataset, the dataset should be OPENed using the OPEN DATASET and in appropriate mode. After completing the process, it is a good practice to close the dataset using the CLOSE DATASET statement.