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 Vinay.
There are two ABAP statements for raising exceptions. They can only be used in function modules:
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.
Source Code of READ_SPFLI_INTO_TABLE
The entire source code of READ_SPFLI_INTO_TABLE looks like this:
*" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
*" VALUE(ITAB) TYPE SPFLI_TAB
SELECT * FROM SPFLI INTO TABLE ITAB WHERE CARRID = ID.
IF SY-SUBRC NE 0.
MESSAGE E007(AT) RAISING 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
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
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
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
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
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
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
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
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
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 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
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
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
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
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
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
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