What is the Exceptions in function module
Hi,
wt is the exceptions in function module? can anyone tell me?
Thanks
swathi
Exception 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 some meaning. Say the exception PROGRAM_NOT_FOUND will be raised when you had passed wrong program name in the CALLBACK program.
PROGRAM_NOT_FOUND = 1...
If the exception was raised than this value will be set to the SY-SUBRC.
SO, by accessing SY-SUBRC, you can get to know which exception was raised.
Regards,
Naimesh Patel
Similar Messages
-
How to write the exceptions in function module
dear all,
how to write the exceptions in function modules with example.
thanq
jyothiHi,
Raising Exceptions
There are two ABAP statements for raising exceptions. They can only be used in function modules:
RAISE except.
und
MESSAGE.....RAISING except.
The effect of these statements depends on whether the calling program handles the exception or not. The calling program handles an exception If the name of the except exception or OTHERS is specified after the EXCEPTION option of the CALL FUNCTION statement.
If the calling program does not handle the exception
· The RAISEstatement terminates the program and switches to debugging mode.
· The MESSAGE..... RAISING statement displays the specified message. Processing is continued in relation to 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:
FUNCTION read_spfli_into_table.
""Local Interface:
*" IMPORTING
*" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
*" EXPORTING
*" VALUE(ITAB) TYPE SPFLI_TAB
*" EXCEPTIONS
*" NOT_FOUND
SELECT * FROM spfli INTO TABLE itab WHERE carrid = id.
IF sy-subrc NE 0.
MESSAGE e007(at) RAISING not_found.
ENDIF.
ENDFUNCTION.
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 with MESSAGE ... RAISING. Otherwise, the table is passed to the caller as an exporting parameter.
Calling READ_SPFLI_INTO_TABLE
The following program calls the function module READ_SPFLI_INTO_TABLE:
REPORT demo_mod_tech_fb_read_spfli.
PARAMETERS carrier TYPE s_carr_id.
DATA: jtab TYPE spfli_tab,
wa LIKE LINE OF jtab.
CALL FUNCTION 'READ_SPFLI_INTO_TABLE'
EXPORTING
id = carrier
IMPORTING
itab = jtab
EXCEPTIONS
not_found = 1
OTHERS = 2.
CASE sy-subrc.
WHEN 1.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno.
WHEN 2.
MESSAGE e702(at).
ENDCASE.
LOOP AT jtab INTO wa.
WRITE: / wa-carrid, wa-connid, wa-cityfrom, wa-cityto.
ENDLOOP.
The actual parameters carrier and jtab have the same data types as their corresponding interface parameters in the function module. The exception NOT_FOUND is handled in the program. It displays the same message that the function module would have displayed had it handled the error.
Or
just have to decide what exceptions u want and under what conditions.
then declarethese exeptions under the exceptions tab.
in the source code of ur function module.
if
like this u can code .
now when u call the function module in tme mainprogram.
if some error occurs and u have declared a exception for this then it will set sy-subrc = value u give inthe call of this fm.
in the fm u can program these sy-subrc values and trigger the code for ur exception.
Please reward if useful
Regards,
Ravi
Edited by: Ravikanth Alapati on Mar 27, 2008 9:36 AM -
What are the parameters of Function Module
Hi,
What are the parameters of Function Module?Function Modules are special external subroutine stored in a central library. The R/3 system provides numerous predefined function modules that you can call from the ABAP/4 programs.
All the function Modules are created under the Function Groups. Function Groups are nothing but the related group of function modules.
The function modules can be maintained through T.CodeSE37 and T.Code SE80.
In general the function module has the following components.
Documentation:
This is the place where you can find the discription/purpose of the function module.
Import & Export Parameters.
Import parameters correspond to the formal input parameters of subroutines. They pass data from the calling program to the function module.
Export parameters correspond to the formal input parameters of subroutines. They pass data from the function module back to the calling program.
Table Parameters.
Table parameters are internal tables. Internal tables are treated like changing parameters and are always passed by reference.
Exceptions.
Exceptions are used to handle error scenarios which can occur in the function modules. The function modules checks for any type of error and raise exception and returns SY-SUBRC value to the calling program.
Source Code:
the programming logic of the function module is written in this source code.
Rewards if useful. -
How to raise the exception in function module
Dear abaper's.
I am creating a Function module .In that in' EXCEPTION' Tab i am giving
3 exception .1.NO_DATA_FOUND 2.NO_PRINTER_FOUND 3.SMARTFORM_INTERFACE_NOT_FOUND.
In my coding if this condtion matches i want to raise this exception.how can i do this in my coding .can any one suggest me..
advance thanks,
Warm regards,
VeeraHi,
if that condition is not satisfied,and u didn't handle that exception while calling function module then in the runtime error u will get the text as the description of the exception in function module definition.
rgds,
bharat. -
What are the Includes in Function Module...? if the fuction group IS ZSJ_FC..?
How can I access SAP through Internet....?
Moderator Message: Interview-like question(s). Thread locked.
Edited by: Suhas Saha on Sep 30, 2011 11:14 AMHi
No! U can insert an own you Z-INCLUDE or somethingelse, try to regenerate the index of the program.
Max -
What is the table contains Function module include program name
Hi,
What is the table contains Function module include program name
Regards,
RajaTry this FUNCTION_INCLUDE_INFO to get the include number to which function module belongs to.From this u ll get only the particular include name.
or
if u need the all the includes used in the function group u have use INNER JOIN on TFDIR and D010INC table
<b>Select binclude into itab from trdir as a inner join d010inc as b on apname = bmaster where apname = fmodname.</b>
I hope this will help u.
Thanks & Regards
Santhosh
Message was edited by:
santhosh ds -
What are the sequence of function modules executed in payroll result
Dear all,
what are the sequence of function modules executed while retrivieng pryroll result.or
functionmodule sequence in payroll programming.
By
boseHi Bose,
The sequence of FM executed in payroll result are
1. cu_read_rgdir ---> from this u will get the country key.
2. cd_read_last -
> from this fm u will identify the seqnr for the latest record and finally for the payroll result
3. pyxx_read_payroll_result. -
Hi,
What are the exceptions in function module.
Thanks in advanceHI,
Exceptions are used to return the error which happens in function module to the calling program.
You can't show error messages directly from Function modules. So when there are some error occurs in function module it raises the desired exception. and this exception number is passed back to calling program. in this way calling program can trace out the error happens in function module.
REgards, -
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.hi..
Raising Exceptions
There are two ABAP statements for raising exceptions. They can only be used in function modules:
RAISE <except>.
and
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:
FUNCTION READ_SPFLI_INTO_TABLE.
""Local interface:
*" IMPORTING
*" VALUE(ID) LIKE SPFLI-CARRID DEFAULT 'LH '
*" EXPORTING
*" VALUE(ITAB) TYPE SPFLI_TAB
*" EXCEPTIONS
*" NOT_FOUND
SELECT * FROM SPFLI INTO TABLE ITAB WHERE CARRID = ID.
IF SY-SUBRC NE 0.
MESSAGE E007(AT) RAISING NOT_FOUND.
ENDIF.
ENDFUNCTION.
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
http://help.sap.com/search/highlightContent.jsp
http://help.sap.com/search/highlightContent.jsp
http://help.sap.com/search/highlightContent.jsp
regards,
veeresh -
What are all the types of Function module?
Hi,
What are all the types of Function module.
Pls reply me.Hi,
Function modules are one element. There are no types. However sometimes an RFC enabled function module is referred to as RFC Function module, but really it is just a function module. Also BAPIs are function modules, but are usually referred to as just BAPI as opposed to BAPI Function module.
There is no different function module types , but calling the function module will be different.
check this function calls syntax
1. Calls a function module:
- CALL FUNCTION func.
2. Call a function module in a different mode (asynchronous Remote Function Call):
- CALL FUNCTION func STARTING NEW TASK taskname.
3. Call a function module in the update task:
- CALL FUNCTION func IN UPDATE TASK.
4. Call a function module in a remote system (Remote Function Call, RFC ):
- CALL FUNCTION func DESTINATION dest.
5. Asynchronous call to a function module with transactional processing (transactional Remote Function Call):
- CALL FUNCTION func IN BACKGROUND TASK.
qRFC with output queue
6. Call a function module that can be activated in the context of enhancements:
- CALL CUSTOMER-FUNCTION func.
plz go through the below links
http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db988735c111d1829f0000e829fbfe/content.htm
Thanks,
Reward If Helpful. -
Whats the use of function module RSAP_IDOC_SEND?
Hi Gurus,
Can anyone please let me know the use of Function Module - RSAP_IDOC_SEND.
Regards
Avi....Hi
Check this...
Send IDOC in parallel dialog process.
CALL FUNCTION 'RSAP_IDOC_SEND'
STARTING NEW TASK l_task
PERFORMING callback_parallel_idoc ON END OF TASK
EXPORTING
i_mestyp = p_mestyp
i_rcvprt = p_rcvprt
i_rcvprn = p_rcvprn
i_flag_commit_work = sbiwa_c_flag_on
i_s_rqstprms = l_s_rorqstprms
TABLES
i_t_idoc_data = p_t_idoc_data
EXCEPTIONS
system_failure = 1
communication_failure = 2.
<b>reward if Helpful</b> -
Hi,
How to use exception in Function module ?
How Can I use the exception my program while calling the Function Module ?
Can anyone explain with example ?
Thanks
NKHI,
if something happens in ur FM and u want it to be tracked in ur calling program, then u can use exception...............
If u r having(say) 3 exceptions in ur FM....
and in ur calling program its like below.
EXCEPTIONS
exception1 = 1
exception2 = 2
exception3 = 3
then if the first exception is raised in ur FM,then sy-subrc value ll be 1( exception1 = 1 )....llly if the second exception is raised in ur FM,then sy-subrc value ll be 2( exception2 = 2 ).........
now u can use this sy-subrc values like below....
If sy-subrc = '1'.
message 'First exception is raised' type 'I'.
else.
message '2nd or 3rd exception is raised' type 'I'.
endif.
Cheers,
jose. -
Tcode for the execution of function module
Hi!
A very simple question:
What is the Tcode for the execution of function module? (Se38,???)
I have to execute the function module RRSI_INITIAL_LINE_INSERT with import parameter I_CHABASNM = 0REQUID.
Thank you very much!
regards
Thomhi,
You create new or edit Fm in SE37. You also put the code for that FM in SE37.
You can call it through pattern button in SE38, where u pass the importing and exporting parameters of that Fm
Hope this helps, Do rewad. -
What are the different 'Add-on modules' available with LabVIEW?
What are the different 'Add-on modules' available with LabVIEW?
What are the types of 'Add-on Cards'?
Cards and modules are different,thats true.Is it that modules means software and are they same as 'add-on toolsets'.Please give the details/URL which would give me various toolsets in detail and also the specifications of various add-on cards?
Kindly do the needful
I require these details immediately.I am an Engg student and learning LabVIEWduplicate post
-
What are the Built-In-Functions in XSLT mapping?
what are the Built-In-Functions in XSLT mapping?
hi praveen
check the below blogs
XSLT MAPPING
Step u2013 By u2013 Step Simple Approach for XSLT Mapping
Step By Step Simple Approach for XSLT Mapping
XSLT mapping for multiple segments of XML
XSLT mapping for multiple segments of XML
IF - ELSE IF and XSLT - A Better work around ?
IF - ELSE IF and XSLT - A Better work around ?
Calling instance (object) method of ABAP Class into xslt mapping by using SAP: CALL-EXTERNAL
Calling instance (object) method of ABAP Class into xslt mapping by using SAP: CALL-EXTERNAL
xpath functions in xslt mapping
xpath functions in xslt mapping
Using XSLT Mapping within the J2EE Adapter Framework
https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3823 [original link is broken] [original link is broken] [original link is broken]
EDIFACT to XML - Stylus Studio Solution
EDIFACT to XML - Stylus Studio Solution
Running NetWeaver's XSLT processor from XMLSpy
Running NetWeaver's XSLT processor from XMLSpy
generic xslt mapping part 1
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/01a57f0b-0501-0010-3ca9-d2ea3bb983c1
generic xslt mapping part 1 part2
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/9692eb84-0601-0010-5ca0-923b4fb8674a
xslt recursive templates
XSLT: Recursive Templates
Generating Generic XML / HTML files without using XSLT Mappings
Generating Generic XML / HTML files without using XSLT Mappings
regards
kummari
Maybe you are looking for
-
I have itunes on 5 of by 8 computers and 6 of the 8 had hard drive issues. I was unable to deauthorize any of the computers and now I can't watch or listen to any of the tings I've purchased from the iTunes store. Help Tsuki56
-
Fluid got in my iPhone 4 screen - how can I clean it?
I've had my iPhone 4 for almost a year now, and I got sunscreen on it. Ugh. Everything works fine, but there is a transparent white blob on the inside of the screen near the headphone jack. I worry about cracking it open to clean it, but can't think
-
How to create an Assets Library using C# in SharePoint 2010?
currentWeb.Lists.Add( "List Name", "List Description", SPListTemplateType.AssetsLibrary); This code does not work for me in Visual Studio. The SPListTemplateType enumerator does not have an assets library item. How can I programmatically create an As
-
How to supress LDB selection screen
Hi All I am using selection screen in report and LDB too. Can anyone tell how to supress default selction screen of LDB? Thanx Kamal
-
Prevent ldap crawling for e-mail addresses
Hello, does anybody know can we prevent e-mail crawling from an ldap server. Thanks