Exception Handling for a function module
There is a function module the program in which exceptions are handled. When the program is ran as a background job and when there is a exception arises does the background job fails or the exception gets handled ??? Pls help me out.....
it raises an exception you can catch it.
cx_root is the root class for exceptions.
DATA: ex TYPE REF TO CX_ROOT.
TRY.
call fm.
CATCH cx_root INTO ex.
ENDTRY.
message = cx_root->get_text( ).
this way your program will not stop..
regards,
Aparna
Similar Messages
-
Hi
We are on CRM 7.0 with ECC 6.0 as backend system.
I have maintained all the settings that are required to create a sales order.
But i am getting one error in header area::
Found no handler for remote function module SPC_GET_PRICING_PROCEDURE_INFO
Could any one provide me information on this.
Thanks in advanceHi,
Check this note.
884991
Your problem is related to VMC
Feel free to revert back.
-=-Ragu -
Error handling for inbound function module
Dear all,
I have written my custom function module for matmas idoc extention.In the begining of function module i have used IDOC_INPUT_MATMAS01 and then have coded my BDC.For handling errors in caese BDC fails i am filling table idoc_status. wih status 51.
But this gives eror as-
Status records with status 51 after status 53
Message no. B1357
Diagnosis
The application function module controlling the ALE inbound processing has passed several status records to ALE. The status of the last of these was '51'. Before this, a status of '53' was passed.
Procedure
If you have written the application function module yourself, you need to change the program.
Can anybody guide me how to get the exact application errors in Application log.
Thank you.Hi,
You are using BDC after the FM 'IDOC_INPUT_MATMAS01'. Right??.... The problem is, The function Module IDOC_INPUT_MATMAS01 itself posts the material and set the status '53' i.e. document posted. You can not have any error status '51' after that.
I don't understand the need of BDC in spite of the FM 'IDOC_INPUT_MATMAS01'. But if whatever the reason, you still want to use the BDC and set the status to 51, After the FM 'IDOC_INPUT_MATMAS01' call, Delete status table where status = '53'. and then proceed for the BDC... -
How to use Exceptions for a function module
Hi folks,
I have created a new function module.Its working fine, but i am not aware of using exceptions for a function module. I hav just declared an exception in the 'exception' tab. Could any body explain me how to use that in my FM source code....Thanks...Hi Shyam,
Have a look at this,
START-OF-SELECTION.
gd_file = p_infile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = gd_file
has_field_separator = 'X' "file is TAB delimited
TABLES
data_tab = it_record
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 NE 0.
write: 'Error ', sy-subrc, 'returned from GUI_UPLOAD FM'.
skip.
endif.
Regards,
Sai -
Alternative for STRING_CENTER function module
Hi,
Can any one give me the Alternative for STRING_CENTER function module.
it is there in 4.7 when i am using the same in ecc 6.0 it is giving as absolute statement .
Please give the solution for this.Hi,
C147_STRING_SPLIT_AT_POSITION
STRING_SPLIT
STRING_SPLIT_AT_POSITION
check this sample code
DATA: text(10) TYPE c VALUE '0123456789',
text1(6) TYPE c,
text2(6) TYPE c.
PARAMETERS position TYPE i.
CALL FUNCTION 'STRING_SPLIT_AT_POSITION'
EXPORTING
string = text
pos = position
IMPORTING
string1 = text1
string2 = text2
EXCEPTIONS
string1_too_small = 1
string2_too_small = 2
pos_not_valid = 3
OTHERS = 4.
Regards -
How to insert a code for a function module into a Customer Exit Variable?
I have two Key Figures viz., Net Prchs Rtl, and Net Prchs Unt. Both these Key figures have This Week (TW) and Last Week (LW). There is a variable for This week but there is no variable defined for Last week.
I need to get data in the column LW (Last Week) for both the key figures.
In function module EXIT_SAPLRRS0_001 one of the functions I have is:
Get the previous Fiscal Week
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
I need to create a new variable to get values in the Last week column for different key figures and use function 'DATE_TO_PERIOD_CONVERT' in that variable.
Can anyone please explain me the steps as to how to use a function module in a variable so that when the variable is used in a key figure it shows the output.
In other words what I want to know is after creating a Customer exit variable of type Characteristic value how do I refer the above mentioned function moduel and insert the code for the function module into the Customer exit variable that I created.
Thank you.
TR.Hi Wond,
Thanks a lot for your reply. I understand what you mean but I have never done this before so can you please explain it in a detailed manner. I have the following code:
Get the previous Fiscal Week
CALL FUNCTION 'DATE_TO_PERIOD_CONVERT'
EXPORTING
i_date = ld_date
i_periv = lc_periv
IMPORTING
e_buper = ln_poper
e_gjahr = ln_bdatj
EXCEPTIONS
input_false = 1
t009_notfound = 2
t009b_notfound = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
lc_poper = ln_poper.
CONCATENATE ln_bdatj lc_poper+1(2) INTO wa_e_t_range-low.
wa_e_t_range-sign = 'I'.
wa_e_t_range-opt = 'EQ'.
APPEND wa_e_t_range TO e_t_range.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
I believe I should now use the above code in my customer exit variable. If that's right can you please explain me the steps as to how should I do this so that the variable gets populated.
Thank you.
Regards,
TR. -
Short dump for update function module
Hi Folks,
If I try to raise exception in Update Task function module which is in turn called in Custom BAPI function module. When I test the BAPI stand-alone using explicit COMMIT WORK (For testing)I can see the error in SM13 and it processes further in BAPI. Now when I am using this BAPI for ALE Inbound processing function module to SAP, when I test using testing tool WE19 it crashes when it passes the update FM inside BAPI, and encounteres BAPI_TRANSACTION_COMMIT, the update Function module is executed as encountered and gives me dump at the raised exception and does not show error in SM13. Please suggest how I could overcome this dump.
Regards,
TimHi there,
Yes. I know that I can details from ST22 Analysis. And I did go through that.
Here's the Section that explains:
How to correct the error
Try to find out why the number of decimal places of the field should be
2.
There are various possible options:
1. The number of decimal places of the imported field has changed in the
Data Dictionary. Make sure that the number of decimal places of the
imported field matches the number of decimal places of the field in
the Data Dictionary.
If the data cannot be restored from another source, the data of the
'old' structure must be read by the 'old' structure, converted und
again eported with the new structure, so that future IMPORTs will
always function with the new structure.
2. A new program version is active, which no longer fits the dataset.
Try to solve the error generating the program
"ZFI_FM_GET_STD_COSTS==========FT" again. This
works as follows: Select transaction SE38 in the SAP system. Enter
the program name "Z_GET_COSTS==========FT". Then activate the
function 'Generate'.
1. I made sure that the decimal places matches.
2. I did re-generate the program.
But still got the same dump. Interestingly, the program where I am using this FM is working absolutely fine.
Thanks. -
Hi Friends
I am having performance issue for this function-module(HR_TIM_REPORT_ABSENCE_DATA) and one my client got over 8 thousend employees . This function-module taking forever to read the data. is there any other function-module to read the absences data IT2001 .
I did use like this .if i take out this F.M 'HR_TIM_REPORT_ABSENCE_DATA_INI' its not working other Function-module.please Suggest me .
call function 'HR_TIM_REPORT_ABSENCE_DATA_INI'
exporting "Publishing to global memory
option_string = option_s "string of sel org fields
trig_string = trig_s "string of req data
alemp_flag = sw_alemp "all employee req
infot_flag = space "split per IT neccessary
sel_modus = sw_apa
importing
org_num = fdpos_lines "number of sel org fields
tables
fieldtab = fdtab "all org fields
field_sel = fieldnametab_m. "sel org fields
To Read all infotypes from Absences type.
RP_READ_ALL_TIME_ITY PN-BEGDA PN-ENDDA.
central function unit to provide internal tables: abse orgs empl
call function 'HR_TIM_REPORT_ABSENCE_DATA'
exporting
pernr = pernr-pernr
begda = pn-begda
endda = pn-endda
IMPORTING
SUBRC = SUBRC_RTA
tables
absences = absences_01
org_fields = orgs
emp_fields = empl
REFTAB =
APLTAB =
awart_sel_p = awart_s[]
awart_sel_a = awart_s[]
abstp_sel = abstp_s[]
i0000 = p0000
i0001 = p0001
i0002 = p0002
i0007 = p0007
i2001 = p2001
i2002 = p2002
i2003 = p2003.
Thanks & Regards
Reddyguessing will not help you much, check with SE30 to get a better insight
SE30
The ABAP Runtime Trace (SE30) - Quick and Easy
what is the total time, what are the Top 10 in the hitlist.
Siegfried -
How to check for a function module with its description and functionality
Hi all,
How to check for a function module,with its description and its functionality,in detail how can I know the purpose of a particular function module,how to search for a function module which suits my requirement .Hi,
You can search a FM of your requirement by putting in the Key words and searching for a FM. Like * KEYWORD * and then pressing F4.
Say for example you need to search something regarding converstion.
Search for * CONVERT * and press F4.
If there is something specfic like converting date to something you can give
DATE * CONVERT *
OR
CONVERT * DATE * and press F4.
Once you narrow down your search you will have a Function module documentation inside the Function module. Please note that all the FMs willl not have documentation.
Regards,
Pramod -
Test web service for a function module
Hello,
I have created web service for a functiona module. I can see the same service in SE80 in Enterprise Services.
How do I test this service?
I can see the URL in WSDL tab but when I try to execute it give me following error,
What has happened?
URL http://emhbssap15.domain.local:8027/sap/bc/srt/wsdl/sdef_service_name/wsdl11/ws_policy/document call was terminated because the corresponding service is not available.
Note
The termination occurred in system BDV with error code 403 and for the reason Forbidden.
The selected virtual host was 0 .
What can I do?
Please select a valid URL.
If you do not yet have a user ID, contact your system administrator.
ErrorCode:ICF-NF-http-c:000-u:SAPSYS-l:E-i:EMHBSSAP15_BDV_27-v:0-s:403-r:Forbidden
HTTP 403 - Forbidden
Your SAP Internet Communication Framework Team
The URL I am trying is
http://emhbssap15.domainname:8027/sap/bc/srt/wsdl/sdef_servicename/wsdl11/ws_policy/document?sap-client=400
Can anyone help me?
Regards,,,
Sunil Joyous
Edited by: Sunil Joyous on Dec 2, 2009 1:52 PMThanks Venu for your input.
Unfortunetly we do not have Java stack on our development system. You said we can test it by SOAP UI tool. Where do I see the WSDL file for the service?
I used WSDL from SE80 --> Service --> WSDL tab, but SOAP UI does not accept this format ?
What are the other ways I can test this web service? I think about SAP PI, importing RFC & creating web service or creating ABAP proxies... Which is the best way to go forward in case you do not have Java stck.
Regards,,,
Sunil Joyous -
Exception handling for all the insert statements in the proc
CREATE PROCEDURE TEST (
@IncrStartDate DATE
,@IncrEndDate DATE
,@SourceRowCount INT OUTPUT
,@TargetRowCount INT OUTPUT
,@ErrorNumber INT OUTPUT
,@ErrorMessage VARCHAR(4000) OUTPUT
,@InsertCase INT --INSERT CASE INPUT
WITH
EXEC AS CALLER AS
BEGIN --Main Begin
SET NOCOUNT ON
BEGIN TRY
DECLARE @SuccessNumber INT = 0
,@SuccessMessage VARCHAR(100) = 'SUCCESS'
,@BenchMarkLoadFlag CHAR(1)
,@BenchmarkFlow INT
,@MonthYearStart DATE
,@MonthYearEnd DATE
,@StartDate DATE
,@EndDate DATE
/* Setting the default values of output parameters to 0.*/
SET @SourceRowCount = 0
SET @TargetRowCount = 0
/*Setting the Start and end date for looping */
SET @MonthYearStart = @IncrStartDate;
SET @MonthYearEnd = @IncrEndDate;
/* Setting the @InsertCase will ensure case wise insertion as this sp will load data in different tables
@InsertCase =0 means data will be inserted in the target TAB1
@InsertCase =1 means data will be inserted in the target TAB2
@InsertCase =2 means data will be inserted in the target TAB3
@InsertCase =3 means data will be inserted in the target TAB4
@InsertCase =4 means data will be inserted in the target TAB5
@InsertCase =5 means data will be inserted in the target TAB6
if @InsertCase =0
WHILE (@MonthYearStart <= @MonthYearEnd)
BEGIN
SET @StartDate = @MonthYearStart;
SET @EndDate = @MonthYearEnd;
/* Delete from target where date range given from input parameter*/
DELETE FROM TAB1
WHERE [MONTH] BETWEEN MONTH(@StartDate) AND MONTH(@EndDate)
AND [YEAR] BETWEEN year(@StartDate) and year(@EndDate)
/*Insert data in target-TAB1 */
BEGIN TRANSACTION
INSERT INTO TAB1
A,B,C
SELECT
A,BC
FROM XYZ
COMMIT TRANSACTION
SET @MonthYearStart = DATEADD(MONTH, 1, @MonthYearStart)
SELECT @TargetRowCount = @TargetRowCount + @@ROWCOUNT;
END -- End of whileloop
END TRY
BEGIN CATCH
IF @@TRANCOUNT>0
ROLLBACK TRANSACTION
SELECT @ErrorNumber = ERROR_NUMBER() ,@ErrorMessage = ERROR_MESSAGE();
END CATCH
END--End of Main Begin
I have the above proc inserting data based on parameters where in @InsertCase is used for case wise execution.
I have written the whole proc with exception handling using try catch block.
I have just added one insert statement here for 1 case now I need to add further insert cases
INSERT INTO TAB4
A,B,C
SELECT
A,BC
FROM XYZ
INSERT INTO TAB3
A,B,C
SELECT
A,BC
FROM XYZ
INSERT INTO TAB2
A,B,C
SELECT
A,BC
FROM XYZ
I will be using following to insert further insert statements
if @InsertCase =1
I just needed to know where will be my next insert statement should be fitting int his code so that i cover exception handling for all the code
MudassarHi Erland & Mudassar, I have attempted to recreate Mudassar's original problem..here is my TABLE script;
USE [MSDNTSQL]
GO
/****** Object: Table [dbo].[TAB1] Script Date: 2/5/2014 7:47:48 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[TAB1](
[COL1] [nvarchar](1) NULL,
[COL2] [nvarchar](1) NULL,
[COL3] [nvarchar](1) NULL,
[START_MONTH] [int] NULL,
[END_MONTH] [int] NULL,
[START_YEAR] [int] NULL,
[END_YEAR] [int] NULL
) ON [PRIMARY]
GO
Then here is a CREATE script for the SPROC..;
USE [MSDNTSQL]
GO
/****** Object: StoredProcedure [dbo].[TryCatchTransactions1] Script Date: 2/5/2014 7:51:33 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[TryCatchTransactions1] (
@IncrStartDate DATE
,@IncrEndDate DATE
,@SourceRowCount INT OUTPUT
,@TargetRowCount INT OUTPUT
,@ErrorNumber INT OUTPUT
,@ErrorMessage VARCHAR(4000) OUTPUT
,@InsertCase INT --INSERT CASE INPUT
WITH
EXEC AS CALLER AS
BEGIN --Main Begin
SET NOCOUNT ON
BEGIN TRY
DECLARE @SuccessNumber INT = 0
,@SuccessMessage VARCHAR(100) = 'SUCCESS'
,@BenchMarkLoadFlag CHAR(1)
,@BenchmarkFlow INT
,@MonthYearStart DATE
,@MonthYearEnd DATE
,@StartDate DATE
,@EndDate DATE
/* Setting the default values of output parameters to 0.*/
SET @SourceRowCount = 0
SET @TargetRowCount = 0
/*Setting the Start and end date for looping */
SET @MonthYearStart = @IncrStartDate;
SET @MonthYearEnd = @IncrEndDate;
/* Setting the @InsertCase will ensure case wise insertion as this sp will load data in different tables
@InsertCase =0 means data will be inserted in the target TAB1
@InsertCase =1 means data will be inserted in the target TAB2
@InsertCase =2 means data will be inserted in the target TAB3
@InsertCase =3 means data will be inserted in the target TAB4
@InsertCase =4 means data will be inserted in the target TAB5
@InsertCase =5 means data will be inserted in the target TAB6
IF @InsertCase =0
WHILE (@MonthYearStart <= @MonthYearEnd)
BEGIN
SET @StartDate = @MonthYearStart;
SET @EndDate = @MonthYearEnd;
/* Delete from target where date range given from input parameter*/
DELETE FROM TAB1
WHERE START_MONTH BETWEEN MONTH(@StartDate) AND MONTH(@EndDate)
AND START_YEAR BETWEEN year(@StartDate) and YEAR(@EndDate)
/*Insert data in target-TAB1 */
BEGIN TRANSACTION
INSERT INTO TAB1 (COL1,COL2,COL3)
VALUES ('Z','X','Y')
SELECT COL1, COL2, COL3
FROM TAB1
COMMIT TRANSACTION
SET @MonthYearStart = DATEADD(MONTH, 1, @MonthYearStart)
SELECT @TargetRowCount = @TargetRowCount + @@ROWCOUNT;
END -- End of whileloop
END TRY
BEGIN CATCH
IF @@TRANCOUNT > 0
ROLLBACK TRANSACTION
SELECT @ErrorNumber = ERROR_NUMBER() ,@ErrorMessage = ERROR_MESSAGE();
END CATCH
PRINT @SUCCESSMESSAGE
END--End of Main Begin
GO
I am just trying to help --danny rosales
UML, then code -
Search for a function module for deleting document originals (DMS)
Hi,
I'm searching for a function module to delete originals in documents (like manually with transaction cv02n). I'm only able to set an delete mark with the module 'BAPI_DOCUMENT_DELETE'.
The module 'BAPI_DOCUMENT_CHANGE2' can only add new originals to an existing document. I need a possibility to delete all originals in an document without deleting the document itself.
Has anyone an idea?
Thanks.
Jan-Christian TreuschMany thanks!
That's especially the method I've searched for so long....
best regards.
Jan-Christian Treusch -
Exception Handling for many bean objects of a container class in a JSP page
Hello,
I have on container bean class. In this container class, there are several others class objects and the getter methods to get these objects out to the JSP pages.
I have one JSP page which will use different objects in the container class object through the getter methods of the container class.
My question is how to implement the exception handler for all the objects in the container so that the JSP page can handle all exceptions if occurrs in any object in the container?
Please give me some suggestions. Thanks
TuThanks for your reply.
Since the container is the accessor class, I have no other super class for this container class, I think I will try the try catch block in the getter methods. -
Need help for the Function Module 'PFL_GET_PARAMETER_INFO'
Hi Experts,
The FM 'PFL_GET_PARAMETER_INFO' returns the value for Profile Parameters for a system .
The inputs required for this FM are :
1. Parameter name : ( eg . login/min_password_lng etc. )
2 . Parameter Type
I am not sure about what the value of Parameter Type should be .
Its a mandatory field.
I have tried to search but could not find anything.
Can you please help me on this?
Thanks in Advance,
Harshit Rungta
Edited by: harshit rungta on May 27, 2011 8:15 AMWhat exactly is the use-case for this?
Many developers "c-call" the params and neglect this feature of the type - also whether it is static or dynamic. Some params are even dynamic as system profiles in one direction but static as instance parameters in the other direction when changing the value.
As you cannot create your own system profile parameters, I do not see the use-case for why you are wanting to check it in advance, because the application APIs should do this.
What you are possibly looking for is function module SUSR_GENERATE_PASSWORD in this case. It will respect "the rules" in the params.
Do not use the legacy function RSEC_GENERATE_PASSWORD directly.
Cheers,
Julius -
Creating a Structure for BAPI Function Module
Hi,
I need to create an RFC for a BAPI call. For that I have to create a structure for the function module. Now, do I need to specify both import and export parameters in the same structure or do I need to create two different structures for Import as well as export parameters? If the import and export parameters are specified aleady, Do I need to supply this structures again under "TABLES"?
Thanks,
John.if u have/get more one records , then u have to use tables ?
Regards
Prabhu
Maybe you are looking for
-
After restore from time capsule, login doesn't accept password
hi there after a hard disc crash I've restored my system from a time caspule backup. now I can not login to my system, as it doesn't recognize my password and there's only one user. any idea, thanks for your help eric
-
Can anyone help with my iphone 3gs activation?
Hi, I am trying to get help with my iphone 3gs. It's not being activated.
-
Error in mail box work item not executable
HI, i build simple WF for approve and reject that send for user to sap inbox some decision ,when i check the inbox of the user and double click on the line i get some red triangle in the status Colman with error work item not executable, what can
-
KM - Setting state of documents
Hi, I've exported an entire folder with documents and further folders over WEBDAV into Macromedia Dreamweaver. Now the state of all documents is "in progress". Is there any possibility to change the state of all documents in one step to "released"? I
-
Proxy-Service without a proxy-service.xml
HI all, I'm trying to use the BlazeDS proxy-service to proxy my Web Service calls through so I can avoid the security issues of directly speaking to a remote SOAP Service. I am using Spring-Actionscript on the client now so I can externalize all of t