Catching an error in SUBMIT Statement
Hi,
I am using SUBMIT (REPORT) and RETURN.
How to catch an error when there is one in the REPORT Program that i am calling.
hi
Calling Programs
If you need to program an extensive application, one single program can become very complex. To make the program easier to read, it is often a good idea to divide the required functions among several programs.
As well as using external modularization, in which you store procedures in special non-executable ABAP programs like function groups, you can also call independent programs from within an ABAP program.
The following ABAP statements allow you to start an executable program or transaction. You can either exit the calling program, or have the system return to it when the called program finishes running.
Executable Program
Transaction
Call without return
SUBMIT
LEAVE TO TRANSACTION
Call with return
SUBMIT AND RETURN
CALL TRANSACTION
You can use these statements in any ABAP program. For example, while processing a user action in the output list of an executable program, you might call a transaction whose initial screen is filled with data from the selected list line.
The event LOAD-OF-PROGRAM is triggered each time a program is called. If a corresponding event block is defined in the framework program, it is executed once before the first other processing block is executed.
An interesting remark at this point is that each execution of an executable program actually has a SUBMIT statement as its source. When you enter the program name in a transaction like SE38 or SA38 and choose Execute, a SUBMIT statement occurs in the transaction. Technically speaking, therefore, executable programs have the attribute of being able to be called using SUBMIT, although their principal characteristic from a useru2019s point of view is that they are started in the foreground.
Memory Organization in Program Calls
The first ABAP program in a session on the application server opens its own internal session (roll area) within the main session. All externally-called procedures run in the same internal session as the calling program, that is, the main program and working data of the procedure are loaded into the same memory area in the internal session.
When you call an executable program or a transaction, the system opens a new internal session for each program. Here, there are two possible cases: If the second program does not return control to the calling program when it has finished running, the called program replaces the calling program in the internal session. The contents of the memory of the calling program are deleted. If the second program does return control to the calling program when it has finished running, the session of the called program is not deleted. Instead, it becomes inactive, and its memory contents are placed on a stack. The system can open up to 9 further internal sessions in external program calls.
As well as executable programs and transactions, dialog modules also open a new internal session. Dialog modules were previously used for modularizing screen sequences.
Program Calls and SAP LUWs
An SAP LUW is a logical unit consisting of dialog steps, whose changes are written to the database in a single database LUW. There are various bundling techniques that you can use to ensure that all of the database updates belonging to an SAP LUW are made in the same single database LUW.
Externally-called procedures do not open a new SAP LUW.
However, when you start a new executable program or transaction, a new SAP LUW starts. Database updates belonging to these programs are collected in their own database LUW. If the new program does not return control to the calling program, the SAP LUW of the old program concludes when the new program is called. If, on the other hand, the new program does return control to the calling program, the new SAP LUW runs parallel to the SAP LUW of the calling program.
No new SAP LUW is opened when you call a dialog module. Bundling techniques in a dialog module add the database updates to the database LUW of the calling program. You may sometimes need to call a transaction that runs in the same SAP LUW as the calling program. One technique for doing this is to use the existing transaction as a dialog module. To do this, you need to create a new dialog module with the same main program and initial screen as the transaction. Transactions that are used both as transactions and as dialog modules must be programmed to obey certain rules. For further information, refer to Calling Screen Sequences.
The fact that an external program shares (or does not share) the SAP LUW with its caller has special consequences if the program calls update-task functions or uses COMMIT WORK. For further information, refer to Special LUW Considerations.
syntax:
SUBMIT REPORT01 VIA SELECTION-SCREEN USING SELECTION-SET 'VARIANT1' USING SELECTION-SETS OF PROGRAM 'REPORT00' AND RETURN.
Similar Messages
-
Skip errors at SUBMIT statement
Hello gurus,
I have a very simple problem, which i cannot solve it! i hope you ll help me.
All i want is to call a programm (report) or a transaction in a loop statement, and when an error occurs, i want to log it somewhere and go to the next line. How is this possible in ABAP?
Thanks in advance!Hi!
Errors are in place so that the transaction will not continue. What's the use in continuing if you have errors in data? (",)
With CALL TRANSACTION, you get to log all messages encountered by the call transaction statement.
You could also use SUBMIT (program) ... AND RETURN statement but I think this will only give you the last error message that terminated the call through SY-SUBRC check.
Also, if you are using LOOP statement to process a lot of transaction like
LOOP AT itab INTO wa.
CALL TRANSACTION...
IF sy-subrc IS INITIAL.
"Transaction ended most probably successfully.
ENDIF.
"Check the iMessageTab for the messages encountered
ENDLOOP.
The next line of the internal table itab gets processed anyway regardless if the previous call was successful or not.
Edited by: Michael.Sumaya on Feb 2, 2012 9:32 AM -
Catching message errors after submit
Is there any way to catch message after submitting report?
I mean any type of message, i.e. E,S,I and so on. And if it's possible, I need to suppress them. Maybe this can work with help of the system calls?HI Vitaly,
You can try the 'SUBMIT VIA JOB' option and then read the job log and/or spool for any messages. Here is a rough code.
DATA: l_jobcount LIKE tbtcjob-jobcount.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = 'MYTESTJOB'
IMPORTING
jobcount = l_jobcount
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
INTO i_return_messages-message.
i_return_messages-type = 'E'.
APPEND i_return_messages.
CLEAR i_return_messages.
EXIT.
ENDIF.
SUBMIT zbwm_sap_to_dsc_enr_rel_notice
WITH p_relno = release_nbr
USER sy-uname VIA JOB 'MYTESTJOB'
NUMBER l_jobcount AND RETURN.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = l_jobcount
jobname = 'MYTESTJOB'
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
INTO i_return_messages-message.
i_return_messages-type = 'E'.
APPEND i_return_messages.
CLEAR i_return_messages.
ENDIF.
After this, you will have to check if the job has completed or not(in a loop). To do that you can call the function module SHOW_JOBSTATE. This will tell the status of the job. Once the job status is 'FINISHED' or 'ABORTED', you can then call another function module BP_JOBLOG_READ to read the job log.
But again, you will have parse through the text to identify the message type, number, message text etc. -
Connection CLosed Error due to submit statement.
Hi friends,
I have a Method which calls this function
CALL FUNCTION 'Z_SLOT_TRIGGER_PRODUCTS'
EXPORTING
iv_rspar = lt_rspar
iv_variant = lv_variant.
The Function module Z_slot_trigger_prouducts has a form in which there is a submit statement
Submit the slotting transaction to background & process the transaction immediatly
SUBMIT z_slot_products
USING SELECTION-SET gv_variant
WITH SELECTION-TABLE p_lt_rspar_tmp
AND RETURN.
During the debuging i see that when it reaches this submit statement it is giving an error as below in the inbound queue:
ThISend: bad tm type / connection closed (no data)
Can anyone please help me with this error. Thanks in advance.Check the documentation of the submit statement:
When the SUBMIT statement is executed, the system runs an authorization check for the authorization group specified in the program attributes. -
A question About SUBMIT statement
Hi,
By SUBMIT statement, i can trigger another report. If the called report runs into dump, how can i detech/catch the dump in the calling report? I tested. It seems impossible to catch the dump. The calling report will also dump.
My question is, if the called report runs into dump, how to detect the dump and avoid dump in calling report?
Thanks in advance,
Best Regards, Johnney.hi
you can catch this kind of error or exeption from the respective report
then pass this error or exeception to the calling report
go through the example I am giving , ti have done it like this only
SUBMIT zgurep03 AND RETURN WITH SELECTION-TABLE li_seltab .
then in the called reprot
*Check ledger
SELECT SINGLE * FROM t881 WHERE rldnr = p_rldnr.
IF sy-subrc NE 0.
SET CURSOR FIELD 'P_RLDNR'.
MESSAGE e448 WITH p_rldnr
MESSAGE e446 INTO lv_text .
lv_type = 'E'.
Capturing the error messages.
EXPORT lv_text TO MEMORY ID 'TX'(004).
EXPORT lv_type TO MEMORY ID 'TP'(005).
in calling report
IMPORT gv_type1 TO gv_type FROM MEMORY ID 'TP'.
IMPORT gv_text1 TO gv_text FROM MEMORY ID 'TX'.
preparing error message in the callge report for the calling report
PERFORM prepare_message
USING sy-msgid
lv_msgno
lv_msgv1
lv_msgv2
lv_msgv3
lv_msgv4
CHANGING gv_text.
preparing error message
FORM prepare_message USING p_sy_msgid
p_sy_msgno
p_sy_msgv1
p_sy_msgv2
p_sy_msgv3
p_sy_msgv4
CHANGING p_gv_text.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = p_sy_msgid
lang = 'EN'
no = p_sy_msgno
v1 = p_sy_msgv1
v2 = p_sy_msgv2
v3 = p_sy_msgv3
v4 = p_sy_msgv4
IMPORTING
msg = gv_text
EXCEPTIONS
not_found = 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.
I guess this will solve your problem
Regards
Prashant -
Executing SUBMIT statement in background
Hello Experts,
Is it possibe in executing SUBMIT statement in backgound? If yes can anyone provide example code?
Also in terms of performance tuning how does SUBMIT fares against CALL TRANSACTION? Which is much better in terms of performance.
Appreciate your answers. Thanks!Hi
There's no difference for the performance:
if a transaction is assigned to a report (so no dialog program, module pool), it's better to use the SUBMIT if it needs to transfer the value on SELECTION-SCREEN. It can't do it by CALL TRANSACTION.
DATA: VA_JOBNAME LIKE TBTCO-JOBNAME,
VN_JOBCOUNT LIKE TBTCO-JOBCOUNT.
* Open job
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = VA_JOBNAME
IMPORTING
JOBCOUNT = VN_JOBCOUNT
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4.
CASE SY-SUBRC.
WHEN 0.
WHEN OTHERS.
MESSAGE E208(00) WITH 'Error.
ENDCASE.
* Call report
SUBMIT <REPORT> USER SY-UNAME
VIA JOB VA_JOBNAME NUMBER VN_JOBCOUNT
WITH ..................................
AND RETURN.
* Close job
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = VN_JOBCOUNT
JOBNAME = VA_JOBNAME
STRTIMMED = 'X' " start immediatly
EXCEPTIONS
CANT_START_IMMEDIATE = 1
INVALID_STARTDATE = 2
JOBNAME_MISSING = 3
JOB_CLOSE_FAILED = 4
JOB_NOSTEPS = 5
JOB_NOTEX = 6
LOCK_FAILED = 7
OTHERS = 8.
Max -
Problem in submit statement ?
hi friends..
i have one report program (for eg zpgm1) from that i call another program (for eg zpgm2) by using submit statement.
in zpgm1 i have only one radio button
in zpgn2 i have one parameter with obligatory.
the issue is
while executing from zpgm1 it will call the zpgm2 but it show error message like "parameter is required field" because its an mandatory field.
i don't want that message while submit ..
can you plz..
thanx in advancetry this if it works.
in the zpgm2 , instead of making the parameter as OBLIGATORY , do a validation on that field
eg
<b>instead of this</b>
parameters : p_matnr like mara-matnr <b>obligatory</b>.
<b>use this</b>
parameters : p_matnr like mara-matnr.
at selection-screen.
if p_matnr is initial.
message e001(ZE) with 'Matnr is mandatory field'.
endif. -
Submit statement in ABAP program
Hi All,
I am using two submit statements in my program for two different reports. When i run the program i get the output screens of the two reports at the ouptut. Is there any way i can hide the user seeing the output screens of the two programs and display only the output screen of my program. If you have any clues please post it.
Thanks & Regards,
Rahul RathiYou can call executable programs from other ABAP programs using the following statement:
SUBMIT <rep>|(<field>) [AND RETURN] [<options>].
You can either specify the name of the program you want to call statically by entering the program name in the code of the calling program, or dynamically by specifying the name of a field (in parentheses) containing the name of the program. If the system cannot find the specified executable program when trying to execute the SUBMIT statement, a runtime error occurs.
If you omit the AND RETURN addition, all data and list levels of the calling program (the entire internal session) are deleted. After the called executable program has finished, control returns to the level from which you started the calling program.
If you use AND RETURN, the system stores the data of the calling executable program and returns to the calling after processing the called program. The system resumes executing the calling program at the statement following the call.
The SUBMIT statement has a set of additions <options> for passing data to the called program and specifying various other processing options. Some of them are described in the following sections:
Have a look at below link. It will help you.
http://www.sapdevelopment.co.uk/reporting/rep_submit.htm
http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9dd035c111d1829f0000e829fbfe/content.htm
Best Regards,
Vibha
*Please mark all the helpful answers -
Create spool for background jobs which uses submit statement
Hi Gurus,
I have a quick question regarding the backgroud jobs. When we run a program in the background , it should create a spool for us, but, the problem comes when I am running a program in the background, its not creating the spool. This program uses SUBMIT statement. This program collects the data and it will submit to the other program and then retuen. In this case, its not creating a spool. Its very important for us to look at the spool for this program. Does anybody cam across this kind of problem? I need ur inputs.
Thanks in advance, <REMOVED BY MODERATOR>
Regards,
Srinivas.
Edited by: Alvaro Tejada Galindo on Mar 18, 2008 4:31 PMhi check this link ...
Scheduling a submitable program as a background task with the number number in a background request name. After scheduling, the background task is completed by function module JOB_CLOSE and released immediately.
DATA: number TYPE tbtcjob-jobcount,
name TYPE tbtcjob-jobname VALUE 'JOB_TEST',
print_parameters TYPE pri_params.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT submitable TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = number
jobname = name
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
ENDIF.
ENDIF.
https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=backgroundsubmit&adv=false&sortby=cm_rnd_rankvalue
sy-subrc Meaning
0 Background task scheduled successfully.
4 Scheduling cancelled by user on the selection screen.
8 Error during scheduling, i.e. when accessing JOB_SUBMIT internally.
12 Error in internal number assignment.
regards,
venkat.
Edited by: venkat appikonda on Mar 18, 2008 6:32 PM -
Problem using Submit statement
Dear Experts,
I am trying to use submit statement in a report for transaction ML85. I have used the below code.
submit RMSRVF00 with FRGCO = 'S1'
with FRGGR = 'S1'
with listu = 'ENTRY_REL'
with ebeln = '4500000309'
AND RETURN.
But when I execute the report the values which I set are not filled and the screens opens with error message as '' Fill in all required entry fields". I am passing values for fields Releasecode - FRGCO, Release group - FRGGR, Purchase Order - EBELN, Scope of list - LISTU.
Please tell me why this message is coming and values are not set for fields.
KR,
Bharathhai,
try like this
SUBMIT ZVENDOR_REPORT_NEW1 USING SELECTION-SCREEN '100'
WITH SELECTION-TABLE TB_OUTPUT
WITH P_DATE = SY-DATUM
WITH S_ERDAT BETWEEN '01.01.2008' AND '01.06.2008'
AND RETURN.
or you can go in this way using type pools:
TYPE-POOLS RSDS.
DATA: TRANGE TYPE RSDS_TRANGE,
TRANGE_LINE LIKE LINE OF TRANGE,
TRANGE_FRANGE_T_LINE LIKE LINE OF TRANGE_LINE-FRANGE_T,
TRANGE_FRANGE_T_SELOPT_T_LINE LIKE LINE OF TRANGE_FRANGE_T_LINE-SELOPT_T,
TEXPR TYPE RSDS_TEXPR.
TRANGE_LINE-TABLENAME = 'TB_OUTPUT'.
TRANGE_FRANGE_T_LINE-FIELDNAME = 'S_ERDAT'.
TRANGE_FRANGE_T_SELOPT_T_LINE-SIGN = 'I'.
TRANGE_FRANGE_T_SELOPT_T_LINE-OPTION = 'BT'.
TRANGE_FRANGE_T_SELOPT_T_LINE-LOW = '01.01.2008'.
TRANGE_FRANGE_T_SELOPT_T_LINE-HIGH = '01.06.2008'.
APPEND TRANGE_FRANGE_T_SELOPT_T_LINE TO TRANGE_FRANGE_T_LINE-SELOPT_T.
TRANGE_FRANGE_T_SELOPT_T_LINE-SIGN = 'I'.
TRANGE_FRANGE_T_SELOPT_T_LINE-OPTION = 'NE'.
TRANGE_FRANGE_T_SELOPT_T_LINE-LOW = SY-DATUM.
APPEND TRANGE_FRANGE_T_SELOPT_T_LINE TO TRANGE_FRANGE_T_LINE-SELOPT_T.
APPEND TRANGE_FRANGE_T_LINE TO TRANGE_LINE-FRANGE_T.
APPEND TRANGE_LINE TO TRANGE.
CALL FUNCTION 'FREE_SELECTIONS_RANGE_2_EX'
EXPORTING
FIELD_RANGES = TRANGE
IMPORTING
EXPRESSIONS = TEXPR.
SUBMIT ZVENDOR_REPORT_NEW1 VIA SELECTION-SCREEN
WITH SELECTION-TABLE TB_OUTPUT
WITH FREE SELECTIONS TEXPR AND RETURN. -
I AM USING SUBMIT FOR IDOC TRANSACTION WE05 , THE STATEMENT IS BELOW
SUBMIT rseidoc2 WITH SELECTION-TABLE seltab
VIA SELECTION-SCREEN
WITH docnum IN r_doc AND RETURN.
the problem is that when i go directly to weo5 and enter any idoc it is showing me the output but when i go through
submit statement it is giving me error 'NO IDOC FOUND' . please suggestELSEIF rs_selfield-fieldname = 'DOCNUM'.
READ TABLE lit_final INTO ls_final WITH KEY docnum = rs_selfield-value.
IF sy-subrc = 0. "if succesful
* SET PARAMETER ID 'DCN' FIELD rs_selfield-value.
seltab_wa-selname = 'CREDAT'.
seltab_wa-kind = 'S'.
seltab_wa-sign = 'I'.
seltab_wa-option = 'EQ'.
seltab_wa-low = space.
seltab_wa-high = space.
APPEND seltab_wa TO seltab.
CLEAR seltab_wa.
r_doc-sign = 'I'.
r_doc-option = 'BT'.
r_doc-low = rs_selfield-value.
APPEND r_doc.
CLEAR seltab_wa.
SUBMIT rseidoc2 WITH SELECTION-TABLE seltab
VIA SELECTION-SCREEN
WITH docnum IN r_doc AND RETURN.
ENDIF. -
hi
I want to execute program RIMODGEN ( CFM1 transaction ) with some values filled in MA_MATNR
But this program is not able to execute the program with SUBMIT statement and return & close the job, please tell me whats the problem with this....
Points for all helpful answers
* Job open
call function 'JOB_OPEN'
exporting
delanfrep = ' '
jobgroup = ' '
jobname = jobname
sdlstrtdt = sy-datum
sdlstrttm = sy-uzeit
importing
jobcount = jobcount
exceptions
cant_create_job = 01
invalid_job_data = 02
jobname_missing = 03.
if sy-subrc ne 0.
"error processing
endif.
* Insert process into job
* CALL TRANSACTION
SUBMIT cfm1 with MA_MATNR in MA_MATNR
WITH I_MODID = 'TEST_RAJ'
WITH I_LOGSYS = 'D41030'
with I_APPL = 'TEST_RAJ'
user sy-uname
via job jobname
number jobcount
and RETURN.
if sy-subrc > 0.
message e200(zz) with 'RIMODGEN call failed'. "error processing
endif.
* Close job
starttime-sdlstrtdt = sy-datum + 1.
starttime-sdlstrttm = '220000'.
call function 'JOB_CLOSE'
exporting
event_id = starttime-eventid
event_param = starttime-eventparm
event_periodic = starttime-periodic
jobcount = jobcount
jobname = jobname
laststrtdt = starttime-laststrtdt
laststrttm = starttime-laststrttm
prddays = 1
prdhours = 0
prdmins = 0
prdmonths = 0
prdweeks = 0
sdlstrtdt = starttime-sdlstrtdt
sdlstrttm = starttime-sdlstrttm
strtimmed = starttimeimmediate
targetsystem = host
exceptions
cant_start_immediate = 01
invalid_startdate = 02
jobname_missing = 03
job_close_failed = 04
job_nosteps = 05
job_notex = 06
lock_failed = 07
others = 99.
if sy-subrc eq 0.
MESSAGE i200(zz) with 'Done !!'. "error processing
stop.
endif.Rob and I were pointing out that you have the transaction name in the SUBMIT statement in your code that you posted above, so if you are not currently using the program name in your program, make sure that you are. Also, you may want to use the extension " to sap-spool without spool dynpro" of the SUBMIT statement, the ouput will then go to the spool. Here is an example program where I am creating a background job .
report zrich_0004 .
data: sdate type sy-datum,
stime type sy-uzeit,
l_valid,
ls_params like pri_params,
l_jobcount like tbtcjob-jobcount,
l_jobname like tbtcjob-jobname.
start-of-selection.
* Get Print Parameters
call function 'GET_PRINT_PARAMETERS'
exporting
no_dialog = 'X'
importing
valid = l_valid
out_parameters = ls_params.
* Open Job
l_jobname = 'ZRICH_0005'.
call function 'JOB_OPEN'
exporting
jobname = l_jobname
importing
jobcount = l_jobcount.
* Submit report to job
submit zrich_0005
via job l_jobname
number l_jobcount
to sap-spool without spool dynpro
spool parameters ls_params
and return.
* Kick job off 30 seconds from now.
sdate = sy-datum.
stime = sy-uzeit + 30.
* Schedule and close job.
call function 'JOB_CLOSE'
exporting
jobcount = l_jobcount
jobname = l_jobname
sdlstrtdt = sdate
sdlstrttm = stime
* strtimmed = 'X'
Regards,
Rich Heilman . -
How to catch the error if an RFC fails due to short dump
Hi All,
I was calling the RFC Function module in parallel processing depends on the number of work processors available. I am getting the return message from the Function module using the perform statement
PERFORMING task_return ON END OF TASK
But I am not able to catch the errors if the RFC has been terminated due to the dump or manually killing the RFC while running.
I need how to handle the RFC if the call has been terminated due to the dump or system failure. Does the RFC return the sy-subrc at this time or can we able to catch the error in any other way.
Thanks & regards,
VijayHello Vijay,
If you're calling RFC from outside SAP using the OCX-SAPFunctions-Library, then you can catch the dump or any other exception occuring in your SAP-Function.
Assuming that, objRFCFunc is the RFC-Function you can get the Excepetion-Code through objRFCFunc.Exception.
It returns a String. If the error was a dump, the String is "SYSTEM_FAILURE". If it is a "regular" Exception you'll get the Exceptioncode. E.g. "NO_DATA_FOUND".
If you need any sample code e.g. VBA-code for use in Office-Applications, let me know.
regards
Sven -
Throwing and catching deliberate errors in bash
Hello,
In many languages one can throw deliberate errors of a specific kind as well as catch-trap for specific errors. I'm having a hard time determining how to do this in bash 3.2 with it's 'trap' command.
Moreover, I can't figure out whether or not if it's even possible to catch for specific thrown errors defined by a scripter in bash. My own tests have led to a dead end and I haven't come any better understanding from reading the bash info docs, and numerous online and in print examples of the 'trap' command.
Basically, I wish to...
1. First, have scripts throw a specifically, identifiable, unique error when a certain known bad state has been encountered that they can't handle.
2. Secondly, to able to test for whether scripts are throwing an specific error under a certain condition.
3. Trap for and catch only that specific error and then keep on going, performing further automated tests.
Is this possible in bash?
Below is an example which might better illustrate what I've attempted to do. It unfortunately, doesn't do what's needed at the moment. i.e.- It will catch all errors and exits but not a specific one.
#--- The example below traps all errors but not the specific one.
particular_function()
current_status="some known bad condition"
if [ "$current_status" = "some known bad condition" ]; then
# Encountered some known condition we can't handle so throw specific error.
echo "Encountered a, we knew this would happen, type error."
exit -99
fi
testmethod_for_expectederror()
trap 'echo "function threw expected error code as it should."' EXIT
particular_function
testmethod_for_expectederror
echo "Continued passed caught error as desired and continuing further tests..."
Thanks,
-Anthony{quote:title=BobHarris wrote:}The bash trap statement was not intended as an alternate way to return errors.
But if you want to generate your own signals, then use the kill command.
See "man 1 kill". {quote}
It sounds like I'm attempting to pound a square peg through a round hole? Attempting workarounds, like shaving off the corners of the peg, might eventually just lead to loss of sanity, time wasted - gone forever, never to return.
So, perhaps I'll try some other method.
If it offers a little more clarity, I'm trying determine [how to write tests|http://xp123.com/xplor/xp0101/index.shtml|Test-First Stoplight - write a test first before writing a line of code.], in bash, for situations where a script [should halt executing|http://xunitpatterns.com/Test%20Method.html#Expected%20Exception%20Te st|Expected exception test pattern] when it encounters something it can't handle rather than keep on going causing potential mishaps.
Basically, I would like to avoid causing the [xUnit testing framework|http://www.martinfowler.com/bliki/Xunit.html|xUnit testing frameworks in XP] I'm using [(shUnit2)|http://code.google.com/p/shunit2/|shUnit2 project site] from incorrectly reporting expected errors, that are suppose to be thrown, by a script, as failures. An expected, [correctly thrown error|http://books.google.ca/books?id=gFgndevwMAC&pg=PA163&lpg=PA163&dq=%22exceptiontest%22+%22test+driven+development%22patterns&source=bl&ots=enHrtsSunH&sig=PbbvWbea_VkqVAbdGYZwJDUcygI&hl=en&ei=XQslS qzSDs-EmQfIvqCFCA&sa=X&oi=bookresult&ct=result&resnum=1|Catch expected exceptions and ignore them. in TDD by Kent Beck] should be counted as a success by the framework in that context. Assuming, the script didn't exit in a bad way. At the same time, unforeseen errors should not be blocked and should propagate up to be reported as an erring test.
Thanks for your help,
-Anthony -
How to export to memory using submit statement?
hi friends,
There is a standard report RPTQTA10.
After executing this report using submit statement i want get the result from the QTTRANS itable of RPTQTA10 to our local itab of BSP.
After this from local itab of BSP i want display some fields of local itba.
Any solutions plz....
Regards,
shankar.hi,
thanks for ur reply.
but i am getting error like this in IE.
Note
The following error text was processed in the system IT3 : Exception condition "CNTL_ERROR" raised.
The error occurred on the application server itcsvr_IT3_01 and in the work process 0 .
The termination type was: RABAX_STATE
The ABAP call stack was:
Form: CONSTRUCTOR of program CL_GUI_CUSTOM_CONTAINER=======CP
Form: PBO of program SAPLSLVC_FULLSCREEN
Module: PBO of program SAPLSLVC_FULLSCREEN
Function: REUSE_ALV_GRID_DISPLAY of program SAPLSLVC_FULLSCREEN
Form: DISPLAY_LIST of program RPTQTA10
END-OF-SELECTION of program RPTQTA10
And my BSP code is like this in OnInitialization event.
SUBMIT rptqta10
WITH PNPPERNR-LOW = w_pernr
EXPORTING LIST TO MEMORY AND RETURN.
data: field(25).
field-symbols: <fs_tab> type STANDARD table.
field = '(RPTQTA10)QTTRANS[]'.
assign (field) to <fs_tab>.
MOVE <FS_TAB>[] TO it_qttrans[].
Here it_qttrans is local itab of BSP.
Regards,
Shankar.
Maybe you are looking for
-
Hi, Caused by: java.security.NoSuchAlgorithmException: No such algorithm: PbeWithSHAAnd3_KeyTripleDES_CBC at javax.crypto.SunJCE_b.c(DashoA12275) at javax.crypto.SunJCE_b.a(DashoA12275) at javax.crypto.Cipher.a(DashoA12275)
-
Dear all, I'm creatng a import po Gross Price-1,314,117.00 IMP INSURANCE IN VAL-1,280.00 Landed Price-13,153.97 IN Basic customs-66,427.55 IN CVD-223,196.57 Ecess on In CVD-6,695.90 Customs ECess on TD-8,889.61 IN additional duty-65,350.43 Neg.Landed
-
And my question is... WHY?! Basically, my Macbook Pro took a bit of a knock on the hard drive side. Coincidentally, as it was on at the time, (Whoops!), it stopped responding and the colour wheel of death was apparent. I restarted with option held pr
-
Determine if layer is black and white (or desaturated)
Is there a way to programmatically determine if a layer of a PSD is black and white?
-
Multiple and frequent crashes due to spellchecker
Hi, Since the release of the last 2 version of the French dictionaries, I've been experiencing a LOT of crashes due to the spellchecker At first, I was using FF3 and I got so sick of it that I switched to Minefield: the problem is still there, unfort