How to capture exception in cursors
Hi,
I wnated to bulk collect say 100 record into global temporaary table,suppose if there is a exception in any of the record how could i handle it?
for example 2 records are throwing exception in this case i want remaining 98 to get processed and remaining 2 should be captured in the exception block.
Please share your suggestion
user13710379 wrote:
for example i used a global temporary table..lets be any table am populating using a bulk collect.My point was that BULK COLLECT is used to populated PL/SQL collections, not tables.
exceptions which i'm refering are like..in 100 records for 65 and 68th record some columns has junk values,so it wont get insert into the resultant table..as a result the bulk collect will fail.i want to handle this type of exception so that other 98 records gets inserted without rollingback.You could incorporate something into your SQL to 'correct' the data if it can be corrected, or you could incorporate something in the SQL to 'detect' where values are junk and not insert those rows, then have another SQL that picks out rows with 'junk' values so you can report on them.
There should be very little need to be loading data into expensive PGA memory or looping through row by row (slow by slow) for each record, to try and capture exceptions.
Better still do some SQL analysis on the data, determine what data has 'junk' in it and then get it fixed at source, and then implement something (or get whoever to do that) so that no more junk data can be entered.
Similar Messages
-
How to capture Exception error message in Odata ?
Hi,
I am new to sap gateway. Currently i am creating a Odata Service through the transaction SEGW. In the query i have mapped a RFC. When i execute the service sometimes the RFC throws exception like 'No data Found'. But i dont know how to capture the exception returned from the RFC.
I read some threads which says use
RAISE EXCEPTION TYPE /IWBEP/CX_MGW_BUSI_EXCEPTION
EXPORTING
textid = /iwbep/cx_mgw_busi_exception=>business_error
message = lv_text
message_container = io_message_container.
My doubt is since i have not done any code in the DPC method. As said in many threads should i go to DPC_EXT method and redefine the method or how to capture the exception.
Kindly advise. Thanks in advanceHello Velsankar,
You need not to capture the error messages explicitly by writing custom code in you DPC_EXT if you are using service builder when the return error message table is of type BAPIRET2.
GW itself will handle and return the error messages.
If at all the return error message table is of different type , i mean to say if it is not of type BAPIRET2 then you need to capture explicitly.
The below is the code you need to write in DPC_EXT to capture.
DATA: LO_MECO TYPE REF TO /IWBEP/IF_MESSAGE_CONTAINER.
DATA: LX_BUSI_EXC TYPE REF TO /IWBEP/CX_MGW_BUSI_EXCEPTION.
LO_MECO = MO_CONTEXT->GET_MESSAGE_CONTAINER( ).
LO_MECO->ADD_MESSAGES_FROM_BAPI( IT_BAPI_MESSAGES = LT_ERR_RET_TAB ).
CREATE OBJECT LX_BUSI_EXC
EXPORTING
MESSAGE_CONTAINER = LO_MECO.
RAISE EXCEPTION LX_BUSI_EXC.
Note : where LT_ERR_RET_TAB is your internal table where you would have captured all the error messages.
That is it. You will be able to see the messages .
Regards,
Ashwin -
How to capture exception occurred during request phases processes
Hello
during postback sometimes an exception occurred but no message you can see on output console and this will realy make a problem and slow the project progress,
I want to know how to catch such exceptions and display them in console or in output logs. is there any configuration regarding this?
thanksWhich JSF implementation are you using? Consult the FAQ page for the Sun RI if that is the one you are using.
-
How to capture error message in a FM call during exception
Hi,
The FM i'm trying to call is giving an exception and don't have the built in mechanism to pass on the error message that occured during processing.
However, if i see the job log in SM37, I'm able to see the corresponding error message.
Please let me know on how to capture this error message with in my program.
Thanks,
Vijay.Hi,
add the exceptions...ERROR_MESSAGE to capture the error message..raised in the function module.
EXCEPTIONS
ERROR_MESSAGE = 1.
Thanks
Naren -
How to get information about cursor? I had only a reference on it.
Hello
How to get information about cursor, that I receive in my procedure as a reference. For example I need to know, a number of columns. I know nothing about this cursor, except the link on it.
Best Regards, Kostya Proskudin!However, I would seriously reconsider what you are trying to achieve.
It looks like you are trying to write some ultimately generic cursor processor. i.e. pass any cursor and process it in some generic way.
Good design should include knowledge of what is expected to be passed and that knowledge can be put into the code.
Generic code is inherently difficult to maintain and debug and will never 100% deal with all possible situations e.g. even if you know the table being queried in the cursor you can't rely on the data dictionary to give you all the returned columns if some of the returned columns of the cursor are computed columns.
Be careful you aren't writing something that's going to cause problems later. -
How to capture values dynamically from output screen
Hi all,
I have a new requirement.
i developed a report which is showing output correctly. Here i have to take a check box for every record in output screen. if i check some of the check boxs then it should allow for further processing.
i succeeded upto put checkboxes on output screen.
but i don't know how to capture the values of checkboxes of every record into an internal table. it is necessary to capture into an internal table
will it be work by using LOOP AT SCREEN statement.
could you please explain with examples. it is normal report program only.
i would appreciate an early reply
Regards
PrabhakarSample code for usage:
Internal table for Region and its Description
data: begin of t_t005u occurs 0,
LAND1 like t005u-land1,
BLAND like t005u-bland,
Bezei like t005u-bezei,
end of t_t005u.
Ranges for Country
ranges: r_land1 for t005u-land1.
Get the country codes and their descriptions
refresh r_land1.
clear r_land1.
refresh t_dynpfields.
move 'V_LAND1' to t_dynpfields-fieldname.
append t_dynpfields.
clear t_dynpfields.
Read the value in the Country field on the screen
call function 'DYNP_VALUES_READ'
EXPORTING
dyname = 'SAPLZ_VENDOR_MASTER'
dynumb = '0004'
translate_to_upper = 'X'
TABLES
dynpfields = t_dynpfields
EXCEPTIONS
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07.
read table t_dynpfields with key fieldname = 'V_LAND1'.
if not t_dynpfields-FIELDVALUE is initial.
r_land1-low = t_dynpfields-FIELDVALUE.
r_land1-sign = 'I'.
r_land1-option = 'EQ'.
append r_land1.
clear r_land1.
endif.
Get the Regions to be displayed as F4 Help
select land1
bland
bezei
from t005u
into table t_t005u
where spras = 'EN'
and land1 in r_land1.
if not t_t005u[] is initial..
Popup to display Valid Regions for the selected country
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
ENDPOS_COL = 60
ENDPOS_ROW = 40
STARTPOS_COL = 40
STARTPOS_ROW = 20
TITLETEXT = 'Region'
IMPORTING
CHOISE = v_choice
TABLES
VALUETAB = t_t005u
EXCEPTIONS
BREAK_OFF = 1
OTHERS = 2.
if sy-subrc = 0.
if v_activity = 'V'.
read table t_t005u index v_choice.
if sy-subrc = 0.
v_regio = t_t005u-bland.
move 'V_BEZEI' to t_dynpfields-fieldname.
move t_t005u-bezei to t_dynpfields-fieldvalue.
append t_dynpfields.
Update the Region description on the screen.
call function 'DYNP_VALUES_UPDATE'
EXPORTING
dyname = 'SAPLZ_VENDOR_MASTER'
dynumb = '0004'
TABLES
dynpfields = t_dynpfields
EXCEPTIONS
invalid_abapworkarea = 01
invalid_dynprofield = 02
invalid_dynproname = 03
invalid_dynpronummer = 04
invalid_request = 05
no_fielddescription = 06
undefind_error = 07.
endif.
endif.
endif.
endif. -
How to capture the date and time of a background job
Hi experts,
How to capture the date and time of a background job?
How to find whether it is runned succesfully or not?
If it is not successful how to put error message?
ASAP
Thanx in advance,
SudhaTo Display the STATUS of the JOB which is exectued in background
CLEAR : wa_jobsteplist.
REFRESH : i_jobsteplist.
WRITE:/ 'DISPLAYING JOB STATUS'.
CALL FUNCTION 'BP_JOB_READ'
EXPORTING
job_read_jobcount = w_jobcount
job_read_jobname = w_jobname
job_read_opcode = '20'
JOB_STEP_NUMBER =
IMPORTING
job_read_jobhead = wa_jobhead
TABLES
job_read_steplist = i_jobsteplist
CHANGING
RET =
EXCEPTIONS
invalid_opcode = 1
job_doesnt_exist = 2
job_doesnt_have_steps = 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.
ENDIF.
To Display the status text as per the status type
CASE wa_jobhead-status.
WHEN 'S'. WRITE: / 'Scheduled'.
WHEN 'R'. WRITE: / 'Released'.
WHEN 'F'. WRITE: / 'Completed'.
WHEN 'A'. WRITE: / 'Cancelled'.
WHEN OTHERS.
ENDCASE. -
How to capture the DB Errors to display more specific error on the screen
HI,
How to capture the DB Errors to display more specific error on the screen?
Can any one suggest on this please.
Thankshi,
in your db package or procedure write this in ur exception handler
as
excpetion when others
FND_MSG_PUB.ADD_EXEC_MSG (pkg_name, proc_name,
substr(sqlerrm, 1, 240))
now in your java code you can catch and throw this excpetion by using
OAExceptionHelper.checkErrors (Tx, messageCount, returnStatus, messageData); -
How to capture errors when a Function module is called as BACKGROUND TASK
How to capture errors when a Function module is called as BACKGROUND TASK?.Please advise.
FUNCTION ZRPM_DELETE_PROJECT_DATA_API.
""Local interface:
*" IMPORTING
*" VALUE(IV_EXTERNAL_ID) TYPE RPM_TV_EXTID OPTIONAL
*" VALUE(IV_PROJECT_GUID) TYPE RPM_TV_GUID OPTIONAL
*" VALUE(FLAG) TYPE BOOLEAN OPTIONAL
*" EXPORTING
*" VALUE(EV_RC) TYPE I
*" VALUE(EV_MSG) TYPE STRING
*" VALUE(ET_MSG) TYPE RPM_TT_MESSAGES
IF flag = cl_rpm_co=>sc_true.
Call function 'RPM_DELETE_PROJECT_DATA' IN BACKGROUND TASK
EXPORTING
IV_EXTERNAL_ID = IV_EXTERNAL_ID
IV_PROJECT_GUID = IV_PROJECT_GUID
IMPORTING
EV_RC = EV_RC
EV_MSG = EV_RC
ET_MSG = ET_MSG.
COMMIT WORK.
ELSE.
CALL FUNCTION 'RPM_DELETE_PROJECT_DATA'
EXPORTING
IV_EXTERNAL_ID = IV_EXTERNAL_ID
IV_PROJECT_GUID = IV_PROJECT_GUID
IMPORTING
EV_RC = EV_RC
EV_MSG = EV_MSG
ET_MSG = ET_MSG.
ENDIF.
ENDFUNCTION.
In above code how to capture 'EV_RC' when FM is called as background task.Prakash,
CALL FUNCTION IN BACKGROUND TASK allows no IMPORTING parameters, so that your code will produce a syntax error.
The calling program can only handle errors of remote function calls (RFC) if these are either
- synchronous RFC (that is CALL FUNCTION ... DESTINATION ...) or
- asynchronous RFC (that is CALL FUNCTION STARTING NEW TASK ... DESTINATION ...).
Both synchronous and asynchronous RFC allow the capturing of errors by means of exceptions. But that is a different topic. -
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 -
How to capture errors records in flat file in BDC
hi ,
i would like to know how to capture error records while uploading a flat file to screen through BDC .
appreciatable solutions are rewarded.
thanks,
shanHi shan,
write this code, it will solve your problem.
DATA : BDCTAB LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
DATA : I_MSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF I_ERR OCCURS 0,
MATNR(18),
FLAG(1),
MSG(100),
END OF I_ERR.
DATA :V_LINES TYPE I.
LOOP AT ITAB.
REFRESH BDCTAB.
PERFORM SCREEN USING: 'SAPLMGMM' '0060'.
PERFORM FIELD USING: 'RMMG1-MATNR' ITAB-MATNR,
'RMMG1-MBRSH' ITAB-MBRSH ,
'RMMG1-MTART' ITAB-MTART,
'BDC_OKCODE' '/00'.
PERFORM SCREEN USING: 'SAPLMGMM' '0070'.
PERFORM FIELD USING: 'MSICHTAUSW-KZSEL(01)' 'X' ,
'MSICHTAUSW-KZSEL(02)' 'X' ,
'MSICHTAUSW-KZSEL(09)' 'X' ,
'BDC_OKCODE' '=ENTR'.
PERFORM SCREEN USING: 'SAPLMGMM' '0080'.
PERFORM FIELD USING: 'RMMG1-WERKS' ITAB-WERKS,
'BDC_OKCODE' '=ENTR'.
PERFORM SCREEN USING: 'SAPLMGMM' '4004'.
PERFORM FIELD USING: 'MAKT-MAKTX' ITAB-MAKTX,
'MARA-MEINS' 'EA' ,
'MARA-MATKL' '001',
'BDC_OKCODE' '/00'.
PERFORM SCREEN USING: 'SAPLMGMM' '4004'.
PERFORM FIELD USING: 'BDC_OKCODE' '/00'.
PERFORM SCREEN USING: 'SAPLMGMM' '4000'.
PERFORM FIELD USING: 'MAKT-MAKTX' ITAB-MAKTX,
'MARA-MEINS' 'EA',
'MARC-EKGRP' '001',
'MARA-MATKL' '001',
'BDC_OKCODE' '=BU'.
CALL TRANSACTION 'MM01' USING BDCTAB
MODE 'A'
MESSAGES INTO I_MSG.
FINDING LAST MESSAGE IN THE I_MSG TABLE*****
DESCRIBE TABLE I_MSG LINES V_LINES.
ACCORDING TO THE V_LINES NUMBER TABLE WILL BE READ****
READ TABLE I_MSG INDEX V_LINES.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = I_MSG-MSGID
LANG = '-D'
NO = I_MSG-MSGNR
V1 = I_MSG-MSGV1
V2 = I_MSG-MSGV2
V3 = I_MSG-MSGV3
V4 = I_MSG-MSGV4
IMPORTING
MSG = I_ERR-MSG
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.
IF I_MSG-MSGID EQ 'M3' AND I_MSG-MSGNR EQ '800'.
I_ERR-FLAG = 'S'.
ELSE.
I_ERR-FLAG = 'E'.
ENDIF.
I_ERR-MATNR = ITAB-MATNR.
APPEND I_ERR.
CLEAR I_ERR.
ENDLOOP.
WRITE:/ 'SUCCESS RECORDS' COLOR COL_POSITIVE.
SKIP.
WRITE:/ 'MATERIAL' COLOR COL_HEADING, 20 'MESSAGE' COLOR COL_HEADING.
LOOP AT I_ERR WHERE FLAG EQ 'S'.
WRITE:/ I_ERR-MATNR, 20 I_ERR-MSG.
ENDLOOP.
SKIP 2.
WRITE:/ 'ERROR RECORDS' COLOR COL_NEGATIVE.
SKIP.
WRITE:/ 'MATERIAL' COLOR COL_HEADING, 20 'MESSAGE' COLOR COL_HEADING.
LOOP AT I_ERR WHERE FLAG EQ 'E'.
WRITE:/ I_ERR-MATNR, 20 I_ERR-MSG.
ENDLOOP.
*& Form SCREEN
SCREEN
form SCREEN using P_PROG P_SCREEN.
BDCTAB-PROGRAM = P_PROG.
BDCTAB-DYNPRO = P_SCREEN.
BDCTAB-DYNBEGIN = 'X'.
APPEND BDCTAB.
CLEAR BDCTAB.
endform. " SCREEN
*& Form FIELD
FIELD
form FIELD using FNAME FVAL .
BDCTAB-FNAM = FNAME.
BDCTAB-FVAL = FVAL.
APPEND BDCTAB.
CLEAR BDCTAB.
endform. " FIELD
Thanks,
Murali -
hi all
how to capture a log in bdc to abap programme?Hi,
While doing call transaction, if an error occurs in updation, we declare bdcmsgcoll and store our messages in it, but how to retreive error message from it
Using function module 'FORMAT_MESSAGE' you can capture the messages.
Here is a sample of the program code for that:
LOOP AT it_messtab.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = it_messtab-msgid
lang = it_messtab-msgspra
no = it_messtab-msgnr
v1 = it_messtab-msgv1
v2 = it_messtab-msgv2
IMPORTING
msg = g_msg
EXCEPTIONS
OTHERS = 0.
IF it_messtab-msgtyp = 'S'.
it_sucess-sucess_rec = g_msg.
it_sucess-lifnr = it_header-lifnr." Based on your field
it_sucess-tabix = v_lines.
APPEND it_sucess.
ELSEIF it_messtab-msgtyp = 'E'.
it_error-error_rec = g_msg.
it_error-lifnr = it_header-lifnr.
it_error-tabix = v_lines.
APPEND it_error.
ELSE.
it_info-info_rec = g_msg.
it_info-lifnr = it_header-lifnr.
it_info-tabix = v_lines.
APPEND it_info.
ENDIF.
ENDLOOP.
Cheers,
Simha.
Reward all the helpful answers.. -
How to capture show layer and hide layer event in photoshop through a plugin???
How to capture show layer and hide layer event in photoshop through a plugin???for mac
Use the Listener plug-in found in the SDK to see how you can monitor the show/hide layer event. You can also use the Getter plug-in to show what information you can find out about the current state of Photoshop.
-
How to capture the excise duty on free material purchasing?
Scenario is like this if we purchase a lot of material then vendor gives free on some qty. then we make a purchase order for free material with tax code zero. Vendor supply that free material with excise duty. Now we do GRN & take part1 entry. How to capture part II entry. This is capital item.
If you are following J1IEX route , then Tick MRP indicator & enter Excise duty values & take Part2.
It is assumed that all other master data like chapter heading etc are set.
Hope this will help.
Regards,
AK -
How to capture an image from my usb camera and display on my front panel
How to capture an image from my usb camera and display on my front panel
Install NI Vision Acquisition Software and NI IMAQ for USB and open an example.
Christian
Maybe you are looking for
-
HT4623 Reminders won't work after iOS 6.1 update on iPhone 5?
I updated to the new iOS 6.1 update last night. Went to make a reminder through siri and i get to the point were it asks to confim. When I press confirm Siri tells me that she can't do it. I try to set a reminder manually and the app does not give me
-
Cannot get token by Get-MgmtSvcToken
hi everyone! i'm running this command : $Credential = Get-Credential $Token = Get-MgmtSvcToken -Type Windows –AuthenticationSitehttps://yourauthenticationsite:30072 -ClientRealm http://azureservices/AdminSite -User $Credential -DisableCertificateVali
-
All of a sudden, AI CC won't run - quits unexpectedly
Mac OS X 10.8.4, 6 TB disc space, 18 GB RAM. On attempting to run AI CC today, all I get is the long crash report titled, "Adobe Illustrator CC quit unexpectedly." I ran AI CC yesterday with no problems. I need to run it again today to continue worki
-
MP4 video file-too big to email
I have a MP4 file that is 72.4 MB. It is too big to send it via email. How do I do it? Thxs
-
Is there a list of shortcuts for the camera raw plugin anywhere?
Is there a list of shortcuts for the camera raw plugin anywhere? The link under Bridge no longer works