Vous êtes sur la page 1sur 4

3/8/2019 Using exceptions in Function Modules in SAP - Modularization techniques in SAP ABAP | Sapnuts.

com

You are here → /  Sapnuts.com /  Courses /  SAP ABAP /  Modularization techniques in SAP ABAP /  Using exceptions in Function Modules in SAP

Using exceptions in Function Modules in Search Sapnuts Search

SAP
Last Updated: August 10th 2017 by Ashok Kumar Reddy

What are exception in Function Modules ? Using exception in Function Modules


to raise error messages, exception handling in Function modules

A+ A-

Exceptions: Exceptions are used to catch certain type of errors in Function Modules.

Whenever an exception is raised, it will be caught in system variable SY-SUBRC.

Continuation to the previous lesson Creating and using of Function Modules in SAP ABAP , we add an
exception for no input.

In the previous example, we are getting material details for a material input, now we add an exception to
check whether the input is provided or not.

Go to 'Exceptions' tab and add NO_MATNR under Exception and short text.

Learn SAP Courses online, SAP Certi cation


mock exams and SAP tutorials

SAP ABAP Tutorials, SAP ABAP Online


Training, SAP Webdynpro for ABAP,
Webdynpro for ABAP tutorials, Webdynpro for
ABAP online training, SAP Work ow training,
SAP Online Training, SAP Certi cation, SAP
Training, SAP mock exams, SAP Exams, SAP
ERP, SAP Interview questions, SAP ABAP
interview Questions

Write below code under Source Code .


SAP ABAP Course Content

SAP Introduction

SAP ABAP Consultant

System Landscape and Introduction to


ABAP/4

Data Dictionary

Internal Tables and Work Areas

Select Statements types

Selection Screen Design using SAP


ABAP

Modularization techniques in SAP


https://www.sapnuts.com/courses/core-abap/modularization-in-abap/function-exceptions.html 1/4
3/8/2019 Using exceptions in Function Modules in SAP - Modularization techniques in SAP ABAP | Sapnuts.com

Save, Activate and execute ABAP

Classical Reports in SAP ABAP

Interactive Reporting in SAP ABAP

Menu painter in SAP

ALV Reports

Sapscripts

Smartforms

A popup will open, just click on 'Save' without giving any value. Batch Data Communication

Open SQL Statements in SAP ABAP

SAP memory and ABAP memory

Performance Tuning in SAP ABAP

Control break statements in sap abap

Enhancements in SAP

BADI in SAP

Now you can see NO_MATNR exception.


SD and MM ows in SAP

Dialog Module Pool Programming

String Operations and eld symbols

SAP ABAP real-time scenarios

MM Basics for ABAP Consultants

SD Basics for ABAP Consultants

Register for Premium SAP


Training

Using Function module exceptions in SE38 program.


Training will be provided through
When ever an exception is raised, it will be stored in system variable SY-SUBRC . online platform ex: gotomeetings

Name *

Name

Email *

Email

Mobile *

10 digit mobile number


Your privacy will be protected always

Select Courses *
SAP ABAP

https://www.sapnuts.com/courses/core-abap/modularization-in-abap/function-exceptions.html 2/4
3/8/2019 Using exceptions in Function Modules in SAP - Modularization techniques in SAP ABAP | Sapnuts.com

Web Dynpro ABAP

Object Oriented ABAP

SAP Cross Apps (RFC,BAPI,IDOC)

Comments

Comments

Submit

REPORT ZSAPN_GET_MATERIAL.

DATA : WA_MARA TYPE MARA .


PARAMETERS : P_MATNR TYPE MARA-MATNR .

START-OF-SELECTION.

CALL FUNCTION 'ZSAPN_GET_MATERIAL'


EXPORTING
IM_MATNR = P_MATNR
IMPORTING
EX_MARA = WA_MARA
EXCEPTIONS
NO_MATNR = 1
OTHERS = 2.
IF SY-SUBRC = 1.
* Implement suitable error handling here
MESSAGE 'Please enter a material no' TYPE 'E'.
ENDIF.

WRITE : WA_MARA-MATNR, WA_MARA-MTART, WA_MARA-MEINS, WA_MARA-MBRSH . "Display


result

Excute the program without giving any input, we will get an error message.

Learner Questions

No Questions by learners, be rst one to ask ..!!

Please Sign in to ask a question

Was this lesson helpful to you? Yes No 106 People out of 109 think this lesson helpful

https://www.sapnuts.com/courses/core-abap/modularization-in-abap/function-exceptions.html 3/4
3/8/2019 Using exceptions in Function Modules in SAP - Modularization techniques in SAP ABAP | Sapnuts.com

Lesson Navigation
What are Function Modules ? How to create a Function Module in SAP ? ←Previous Chapter
Next Chapter → Using changing and table parameters in Function Modules in SAP
? Support About Feedback Privacy Terms & Conditions Report Abuse © SURAPU TECHNOLOGY SERVICES PVT LTD Google Twitter Facebook Version: V.2.0

https://www.sapnuts.com/courses/core-abap/modularization-in-abap/function-exceptions.html 4/4

Vous aimerez peut-être aussi