Exceptions in function module.... for beginner......

Dear all experts,
I am new to ABAP. 
Can anybody please tell, how to use the exceptions in function module ?
and if any exception happens, then how to link some messages to that exceptions?
I will also like to know, how to create those messages ?
<b>Can anybody please illustrate with help of example, so that a beginner will be able to understand. ?</b>
<b>eg,</b> i am adding two numbers in function module, and if any one passing number is negative, then i need to raise exception with message please do not enter -ve numbers for addition.
your help will be surely, rewarded with points.
waiting for reply.
Regards & Thanks


Raising Exceptions
There are two ABAP statements for raising exceptions. They can only be used in function modules:
RAISE <except>.
MESSAGE..... RAISING <except>.
The effect of these statements depends on whether the calling program handles the exception or not. If the name <except> of the exception or OTHERS occurs in the EXCEPTIONS addition of the CALL FUNCTION statement, the exception is handled by the calling program.
If the calling program does not handle the exception
The RAISE statement terminates the program and switches to debugging mode.
The MESSAGE ..... RAISING statement display the specified message. How the processing continues depends on the message type.
If the calling program handles the exception, both statements return control to the program. No values are transferred. The MESSAGE ..... RAISING statement does not display a message. Instead, it fills the system fields SY-MSGID, SY-MSGTY, SY-MSGNO, and SY-MSGV1 to SY-MSGV4.
The entire source code of READ_SPFLI_INTO_TABLE looks like this:
""Local interface:
*"       IMPORTING
*"       EXPORTING
*"             VALUE(ITAB) TYPE  SPFLI_TAB
*"              NOT_FOUND
The function module reads all of the data from the database table SPFLI where the key field CARRID is equal to the import parameter ID and places the entries that it finds into the internal table SPFLI_TAB. If it cannot find any entries, the exception NOT_FOUND is triggered using MESSAGE...RAISING. Otherwise, the table is passed to the caller as an exporting parameter.
Also check these links

Function Modules for absolete

Hi guy's, This is the function modules for absolete. CALL FUNCTION 'WWW_USER_AUTH_MESSAGE' CALL FUNCTION 'DATA_INPUT_CUSTOMIZE' CALL FUNCTION 'FI_DOCUMENT_ARCH_READ_NEXT' Please help me for this solution.Hi , This is first Function module. CALL FUNCT

Function module for retrieving values of the Characteristics?

Hi, is there a function module for retrieving values of the Characteristics? will reward, regards, M.Hello, Check this.     L_OBJECT = G_T_STPO-IDNRK. *--- Merkmale incl. Bewertung zum Objekt/Klassenart lesen ----------*     CALL FUNCTION 'CLAF_CLASS

What is the Exceptions in function module

Hi, wt is the exceptions in function module? can anyone tell me? Thanks swathiException is the mechanism by which you can give the error messages back to the program. Say for the REUSE_ALV_GRID_DISPLAY, we have so many exceptions. Every exception has

Function module for BSEG table

Hi Guru's,   SELECT bukrs          belnr          gjahr          budat          monat          waers          awkey     FROM bkpf     INTO TABLE i_bkpf_data     WHERE  bukrs EQ pa_bukrs AND            budat IN so_budat. SORT i_bkpf_data BY bukrs beln

Function module for  Fiscal period ( monat field name)

Hi , please suggest the function module for (monat) Fiscal period. our reqirement is default to previous accounting period from the current month. Thnks SrinivasHi, Refer to the following code: DATA: LV_FISCAL_YEAR_VAR(2) TYPE C,            LV_PERIOD

Z function modules for OLE

Hi all, Is there any Z function modules for OLE, which will download the data directly to Excel with 2 sheets. Regards, ShaliniHi Shalini Reddy there is no FM  but code is there... u can see... *& Report  YOLE_FOR_EXCEL REPORT  yole_for_excel. *REPOR

Function module for mass changes in Scheduling agreements in 4.7

Dear All, Can any one tell me the function module for mass changes in Scheduling agreements in 4.7 Regards MSRclosing questionRead other 2 answers

Error in function module  for inbound processingwhile testing from we19

hi, I have developed a custom function module for processing inbound idoc for creating material using bdc...the problem is that when i am trying to test my idoc using we19 and calling my function module in debug mode an error is displayed showing 'in

Function Module for Discount Date

Hi,      Can somebody tell me whether there is any function module for determining the Discount Date (DATS) and Payment Due Date(DATS) based on Payment Terms (ZTERM)? Thanks, John.FI_FIND_PAYMENT_CONDITIONS DETERMINE_DUE_DATERead other 2 answers

Function module for custom report for cost center group

Hello all, I wonder, if there is any SAP function module for following query: We have got a custom program, which evaluates cost centers. We would like to evaluate a cost center group, like it is available within the report painter - the output scree

Function module for creation of Installed base along with product

Hi,         Function module for creation of installed based with product for the business partner.Try BAPI_IBASE_CREATE IB_IBASE_CREATE IB_IBASE_CREATE_INITIAL CRM_IBASE_COMP_CREATE CRM_IBASE_CREATE IB_COM2_CREATE_IBASE IB_COM_CREATE_IBASE_INITIAL Re

Function Module for splitting(field) in CO02 t-code

Function Module or enhancement for splitting(field) in CO02 t-code Need function module for inserting a value in field(Max No of splits) in Transaction CO02 Message was edited by:         Mohan KumarYou can use this SAP enhancement PPCO0012 to displa

BAPI/Function Module for tx PR05(Travel Expense Manager)

Hi All, I am searching for BAPI/Function Module for tx PR05(Travel Expense Manager). Thanks.Hi All Thanks for your input. I choose BDC option for PR05 maintain. As the BAPIs are calling PR01. -RPRead other 3 answers


Is there any function module for getting data from Microsoft Word document? I had tried 'GUI_UPLOAD' but some data could not be recognized. Probably because of format in Microsoft Word.Hi use this fun module LXE_SP_MSWORD_TO_ITF and convert from MS w

Function module for attachments

Is there any function module for attaching excel sheet? Thanks.....Hi, I am not clear with ur question.You mean u want to send an attachment through mail.Then check this link http://www.sapdevelopment.co.uk/reporting/email/attach_xls.htm Hope this he

Any Function Module For getting Shipment Details

Hi All, I want to get all details of shipment. i tired , but unable to get any function? I was able to find the creation or change shipment function modules, but not able to find the function module for getting the details for Shipment. like BAPI_SHI

Inbound function module for IDoc type INFRECMASS01

Hello everybody, What is the inbound function module for IDoc type INFRECMASS01? I tried IDOC_INPUT_INFREC (as for IDoc INFREC01), but I got the following message (B1 044): Incorrect function module IDOC_INPUT_INFREC called up Thanks in advance Rolan

How to create ENQUEUE function module for s567 table

Hi Experts, Anyone Plz tell the steps how to create a ENQUEUE function module for the table s567. Its somewht urgent, plz help me. <REMOVED BY MODERATOR> Mohana Edited by: Alvaro Tejada Galindo on Mar 10, 2008 4:21 PMHi, You can create a lock on a o

Function modules for Individual Work maintenance

Hi all, We're planning to use the functionality of individual work for our customer. And we're planning to use custom screens rather than GUI for creation, maintenance, deletion etc - as GUI screens seem to have some bugs (especially when you try to