Error catch of a function module exception in a method
Hello,
how do you catch the error of a function module that is called from within a method. Presently the process terminates in case of an exceptions. Sy-subrc seems also not to work.
E.G.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
client = sy-mandt
date = SOURCE_FIELDS-xxx
foreign_amount = SOURCE_FIELDS-xxx
foreign_currency = SOURCE_FIELDS-xxx
local_currency = SOURCE_FIELDS-xxx
IMPORTING
local_amount = RESULT
EXCEPTIONS
NO_RATE_FOUND = 1
OVERFLOW = 2
NO_FACTORS_FOUND = 3
NO_SPREAD_FOUND = 4
DERIVED_2_TIMES = 5
OTHERS = 6.
HI,
use 'EXCEPTIONS' to catch the error happens in FM.
uncomment all your exceptions when calling FM.
and you will get the exception number in sy-subrc.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
client = sy-mandt
date = SOURCE_FIELDS-xxx
foreign_amount = SOURCE_FIELDS-xxx
foreign_currency = SOURCE_FIELDS-xxx
local_currency = SOURCE_FIELDS-xxx
IMPORTING
local_amount = RESULT
EXCEPTIONS
NO_RATE_FOUND = 1
OVERFLOW = 2
NO_FACTORS_FOUND = 3
NO_SPREAD_FOUND = 4
DERIVED_2_TIMES = 5
OTHERS = 6.
if sy-subrc = 2.
message e000(su) 'overflow.
endif.
Regards,
Similar Messages
-
How to catch excpetions of function module?
Hallo everybody,
how can i catch the exception from function module "exception" and deliver it to call function parameter table --exception table.
For example,a function module 'RPY_TABLE_INSERT' is called by Call Function (parameter_table)in order to create a new table.When the table exists already, a exception "Already_exist" activated.But it can not be caught,since it is raised by "message raise". Therefore in the exception-table of caller no error is caught.
How can I deal with it?
Thanks in advance!
Message was edited by: Liying WangCALL FUNCTION 'RPY_TABLE_INSERT'
EXPORTING
LANGUAGE = SY-LANGU
TABLE_NAME =
WITH_DOCU = ' '
DOCUTYPE = 'T'
TRANSPORT_NUMBER = ' '
DEVELOPMENT_CLASS = '$TMP'
TABL_INF =
TABL_TECHNICS = ' '
TABLES
TABL_FIELDS =
DOCU_TABLE_USER =
DOCU_TABLE_TECH =
EXCEPTIONS
CANCELLED = 1
ALREADY_EXIST = 2
PERMISSION_ERROR = 3
NAME_NOT_ALLOWED = 4
NAME_CONFLICT = 5
DB_ACCESS_ERROR = 6
OTHERS = 7
IF SY-SUBRC <> 0.
as per the error sy-subrc will be set, you can see in the exceptions ( 1 for cancel, 2 for already exit)
so using this subrc you can determine the error
ENDIF. -
Error while activating the function module
hi,
am getting error while activating the function module i.e. program or report statement is missing.
thank you in advance
karthikhii vinu,
hi there....
make sure that the Processing type in Attributes tab is 'Normal function module'. Also chk the general data, it must be having some name in the Program Name and include name column.try checking the program names in se38, if the program is of type include or not. you can also chk by writting a program call the function module and test it
I hope this will solve the query. in my case, SAPLZ123 is the program name and LZ123U28 is the include name.
or
Its common prob with Function module.
Goto SE80->Give Function group name->Right click on it->Activate.
regards,
Shweta -
Reading function module exception text
Hi Experts,
I would like to read the function module exception text programatically. i.e., If sy-subrc value of a FM is 2, then I would like to
take the exception and associated exception text and I would like to display the exception text to the end user. Exceptions are
stored in FUPARAREF table. Which table stores exception text. Is there any FM to read it?
Thanks and regards,
Venkat.Hello
Table FUNCT will help you. -
Function module or ABAP-OO method to start DTP via Coding
Hello experts,
is there any function module or ABAP-OO-method, which I can use to start DTP's via ABAP-Coding (e.g. in my own programm)? I know there are FM's to start, change, delete, etc. InfoPackges. Are there any functions like them also available for DTP's?
Kind regards,
AndréHello Andre,
[Re: CL_RSBK_DTP - How to use...]
I've tested and it works fine!
Regards,
William -
Function Module Exception in CMS
hi all,
im using this fm CMS_API_MOV_SAVE_SNG to change the equipment data in CMS.
Its throwing a exception
Error in change document creation/analysis: OPEN_MISSING
Message no. CD327
Diagnosis
Error during change document creation or evaluation.
The following errors may have occurred:
Nametab error
Change document item could not be inserted
Change document object could not be opened
Object name is invalid
Change document header could not be inserted
No CHANGEDOCUMENT_CLOSE was called for the last change document object.
when i debugged the FM its calling a change document FM "CHANGEDOCUMENT_MULTIPLE_CASE" ... Here the error is thrown.
Its clear that the error is because CHANGEDOCUMENT_OPEN is not done before changing ie (calling "CHANGEDOCUMENT_MULTIPLE_CASE")
in other FM's such as CMS_API_INS_SAVE_SNG - Insurance ,CMS_API_INS_SAVE_SNG - Vehicle...this CHANGEDOCUMENT_OPEN is called in the standard function module itself
but in CMS_API_MOV_SAVE_SNG its not called ... why ????
is there any other way to solve this ???HI,
use 'EXCEPTIONS' to catch the error happens in FM.
uncomment all your exceptions when calling FM.
and you will get the exception number in sy-subrc.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
client = sy-mandt
date = SOURCE_FIELDS-xxx
foreign_amount = SOURCE_FIELDS-xxx
foreign_currency = SOURCE_FIELDS-xxx
local_currency = SOURCE_FIELDS-xxx
IMPORTING
local_amount = RESULT
EXCEPTIONS
NO_RATE_FOUND = 1
OVERFLOW = 2
NO_FACTORS_FOUND = 3
NO_SPREAD_FOUND = 4
DERIVED_2_TIMES = 5
OTHERS = 6.
if sy-subrc = 2.
message e000(su) 'overflow.
endif.
Regards, -
Error when call RFC Function module in R/3
Dear All,
We are trying to call RFC function module CBIF_GLM1_PROCESS_ORDER_READ (This is not a BAPI and also not released ) in R/3 from XI system.
we are facing the error "Error while lookup Exception during processing the payload. Error when calling an adapter by using the communication channel CC_PPPI_MES_RFC_Rcvr (Party: , Service: WCD_320, Object ID: 16563889b449328eac76caa6a3bc592e) XI AF API call failed. Module exception: 'error while processing the request to rfc-client: com.sap.aii.adapter.rfc.afcommunication.RfcAFWException: error while processing message to remote system:com.sap.aii.adapter.rfc.core.client.RfcClientException: failed to parse BAPI response due to: com.sap.aii.adapter.rfc.util.bapi.BapiException: Parameter with name RETURN not found.'. Cause Exception: 'com.sap.aii.adapter.rfc.afcommunication.RfcAFWException: error while processing message to remote system:com.sap.aii.adapter.rfc.core.client.RfcClientException: failed to parse BAPI response due to: com.sap.aii.adapter.rfc.util.bapi.BapiException: Parameter with name RETURN not found.'."
This is the first time we are doing this configuration.
Could you please let me know what woulbe the reason.read the original message
We are trying to call RFC function module CBIF_GLM1_PROCESS_ORDER_READ (This is not a BAPI and also not released ) in R/3 from XI system.
I am talking about the above Receiver RFC channel which you guys are using to call R/3 from XI. That where you need to change the commit parameter -
Error while using the function module GUI_UPLOAD
Hi,
My requirement is to upload the data from .txt file into internal table.
I have given my code like this
PARAMETERS: p_fname LIKE rlgrap-filename.
data: begin of gt_string occurs 0,
record type char255,
end of gt_string.
AT SELECTION-SCREEN ON VALUE-REQUEST for p_fname.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = ' '
CHANGING
file_name = p_fname
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_fname
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
tables
data_tab = gt_string
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Here I am getting dump error as 'Type conflict when calling a function module.
The function module interface allows you to specify only fields
of a particular type under "FILENAME". The field "P_FNAME" specified here has a different field type'.
What would be the reason for this error?
Can anyone help me?
Regards,
Hemasee this sample program for F4 help
*& Report ZSD_EXCEL_INT_APP
REPORT ZSD_EXCEL_INT_APP.
parameter: file_nm type localfile.
types : begin of it_tab1,
f1(20),
f2(40),
f3(20),
end of it_tab1.
data : it_tab type table of ALSMEX_TABLINE with header line,
file type rlgrap-filename.
data : it_tab2 type it_tab1 occurs 1,
wa_tab2 type it_tab1,
w_message(100) TYPE c.
at selection-screen on value-request for file_nm.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = 'X'
MASK = ' '
CHANGING
file_name = file_nm
EXCEPTIONS
MASK_TOO_LONG = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
start-of-selection.
refresh it_tab2[].clear wa_tab2.
file = file_nm.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '10'
i_end_row = '35'
tables
intern = it_tab
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at it_tab.
case it_tab-col.
when '002'.
wa_tab2-f1 = it_tab-value.
when '004'.
wa_tab2-f2 = it_tab-value.
when '008'.
wa_tab2-f3 = it_tab-value.
endcase.
at end of row.
append wa_tab2 to it_tab2.
clear wa_tab2.
endat.
endloop.
data : p_file TYPE rlgrap-filename value 'TEST3.txt'.
OPEN DATASET p_file FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
*--- Display error messages if any.
IF sy-subrc NE 0.
MESSAGE e001(zsd_mes).
EXIT.
ELSE.
*---Data is downloaded to the application server file path
LOOP AT it_tab2 INTO wa_tab2.
TRANSFER wa_tab2 TO p_file.
ENDLOOP.
ENDIF.
*--Close the Application server file (Mandatory).
CLOSE DATASET p_file.
loop at it_tab2 into wa_tab2.
write : / wa_tab2-f1,wa_tab2-f2,wa_tab2-f3.
endloop. -
Error BT616 when calling function module SXPG_COMMAND_EXECUTE in background
Hi All,
We use function module SXPG_COMMAND_EXECUTE with a custom command we defined in SM69 to move files in unix (mv command).
The function module call has worked fine for almost a year and recently we have been seeing an error (BT616) in our job lob (SM37) when the program is run in background. We have not been able to reproduce the error in foreground mode and it seems to be occuring only periodically in the background. (The appropriate SAP authorization objects where assigned to the batch job ID and the steps on the batch job.) We are in the process of setting up the trace flag and performing analysis on the trace log via ST11 to help identify the issue.
After perform analysis on SXPG_COMMAND_EXECUTE, the error is occurring when calling function module SAPXPG_END_XPG for exception 2, system failure, yet function module SAPXPG_END_XPG does not exist. I assume this is a program at the operating system level and is just a signature of the parameters to be passed to the operating system program.
Below is part of the SAP function module SXPG_COMMAND_EXECUTE that is failing.
* Now we have to wait for the termination of the external
* command if the caller wants us to.
IF TERMINATIONWAIT = 'X'.
CALL FUNCTION 'SAPXPG_END_XPG'
DESTINATION DESTINATION
IMPORTING EXITSTAT = STATUS
EXITCODE = EXITCODE
TABLES LOG = LOG
EXCEPTIONS COMMUNICATION_FAILURE = 1 MESSAGE MSG
SYSTEM_FAILURE = 2 MESSAGE MSG.
I performed a where used on function module SXPG_COMMAND_EXECUTE, and most of SAP programs call the function module with the parameter TERMINATIONWAIT = 'X', so I assume we should pass X as well.
Any ideas on what could be causing this issue?
Mike VondranI also remember I have this kind of issue, as I have some UNIX script at OS( UNIX) level . The problem was with the ID , as it dont have proper authorization at OS level ( UNIX ) . Please check this ID authorization. This could be the one of reasons if youre sure from SAP standpoint.
Hope thisll give you some guide line..
Thanks
Bye -
How to capture error message from standard function module
Dear friends
when i execute standard function module in finance , i am getting error message , pls check the below screen shot,
how to capture the below error message so that i have display in my webdynpro component
Thanks
VijayaHello Vijaya,
Incase of BAPI's they have a return table parameter T_RETURN. Just read that return table to get the error message.
Incase of normal function modules, there will be exceptions raised for the message used inside the function module. Just read the sy-subrc after the FM and based on the sy-subrc value find the respective exception raised.
May be you can try like this, whenever the message is raised it will be stored in the system variable.
CALL FM.
check for the system variables.
sy-msgid = Message ID of the latest message raised.
sy-msgno = message number of the latest message raised.
sy-msgty = message type of the latest message raised.
sy-msgv1 = variable1 of the latest message raised.
sy-msgv2 = variable2 of the latest message raised.
sy-msgv3 = variable3 of the latest message raised.
sy-msgv4 = variable4 of the latest message raised.
Regards,
TP -
Is it possible to circumvent error message within a function module?
Hello friends,
Is it possible to circumvent error message generation from within a function module? My program calls a FM (namely FKK_S_CADOCUMENT_WRITEOFF) to do some updates. However, in certain cases this FM throws error messages and terminates the whole process. I cannot control the aftermath because it never gets back to the calling program.It stops at the FM level and not at my program level.
In essence, what I would like to do is to let the FM do its thing, generate some kind of exception (but no error message), come back to the calling program, and then I can capture the status in my program and do what is necessary from then on.
Your help is greatly appreciatedHi,
Do not use Excerption Tab.
Instead declare a variable or Structure at export parameter.
Which will return you error Description or Status of the FM.
For Example.
Goto Se37 ---> key in FM name of yours.
Go to Table tab
At Parameter Name Column key in RETURN, Type as LIKE and Associate type as BAPIRET2.
ThankS & regards,
ShreeMohan
Edited by: ShreeMohan Pugalia on Aug 10, 2009 12:31 PM -
Error in creation of function module in e.c.c 6.0
HI GURUS,
i encountered a problem while creating function module in e.c.c 6.0, the error is 'THE MAIN PROGRAM OF DOES NOT BEGIN WITH "FUNCTION-POOL". kindly help me in solving this issue.Hi,
You need to activate the Function Group.
GO to Se80 --> Select function group from list box --> press enter --> Select you function group > Right click> Activate.
Thanks,
Sriram Ponna. -
Unknown error calling a RFC Function Module in BODI
Hi all,
I am having an issue identifying the error that my batch job in BODI is giving with regards to a RFC function module call in my query. The value returned by the standard parameter 'AL_RFC_RETCODE' are square characters ( ).
At the completion of the job, the error message 'RFC CallReceive error <Function ZCT_INDSLS_SLS_TRN_INSERT: Invalid request.. Invalid request.>.' is being output.
Correct me if I'm wrong but the parameter 'AL_RFC_RETCODE' should return standard values as per the techical manual provided to undertand any errors that might occur during a RFC FM call.
Can anyone help me on this?
Best regards,
Andrew WongHi Senthil,
I think you answered your query in your question itself
The user ID and password need to be maintained in RFC destination in SM59.
Go to SM59 and then click on test connection..if it does not ask for ID and passwoed that means correct ID and password is maintained in SM59 otherwise maintain it.
Regards,
Atish -
Error while executing the function module BAPI_RE_CN_CREATE
Dear All
I was using the the function module BAPI_RE_CN_CREATE. When I am trying to execute the function module I am getting the error message u201CBusiness transaction RECN doest existu201D. While inputting the parameters for the function module I have given RECN In the input field TRANS. Requesting you to please kindly suggest.
Regards.
VaraprasadHi Varaprasad,
please try the following.
1. Create a contract manually in the system
2. Use BAPI_RE_CN_GET_DETAIL to show how the fields and structures are filled.
3. Check and change the parameters for BAPI_RE_CN_CREATE accordingly.
Hope that helps.
Regards, Franz -
Error while creating a function module
Hii Experts
I am adding a table name to the tables parameter in a already created function module, But it is giving a error : TABLES parameter is obselete
the table which I am adding is
IT_GRAPH TYPE ZTY_GRAPH ( zty_graph is a structure which i made in se11 comprising of 2 fields)
Thanx in advanceHi,
Give table parameters as:
IT_GRAPH LIKE ZTY_GRAPH,
It will give a warning, just press enter and proceed.
Thanks & Regards,
Navneeth K.
Maybe you are looking for
-
Sending report output via E-mail (excel pivoted format)
Hi all, i have a written a report where i need to send the report output to somebody via E-mail.i am sending this report output via E-mail successfully.The receiver receives, my output in excel format.but this excel is not <b>pivoted</b>. i want , th
-
Lightroom won't download after updating to cc 2014
Hi everyone I updated all the apps to CC 2014 today. After that Lightroom said I would need to renew my membership (seems to be a common problem) and I tried the solutions posted here on this forum. I couldn't find the SLCache or SLStore folders anyw
-
The Apple iPod Battery replacement program what does it cover? Does it cover Completely dead iPod batteries, iPod batteries that don't hold a full charge or something else not mentioned.
-
hi im getting the below error when im trying to deploy a web service in Jdeveloper using Weblogic 8.0. Error: WARNING: Unable to connect to URL: http://localhost:7001/Test-Sample-context-root/MyWebService1SoapHttpPort due to java.security.PrivilegedA
-
Any Alternate to use ORACLE GRAPHIC BUILDER through Reports
Hello , After long research some option of creating complex graphs does not serve my problem like BI GRAPHS . I want to create graph in such a way that for example I have one view in which trainno, station no, scheduled time and departure time are st