How to send error record to session in call transaction method
Hi experts,
I want to send only the error record to session while executing the program in call transaction method. please give me example on this
regards,
siva kumar
One logiv that I can suggest is that after you have got the details of the record in error, you write another perform build_Session and put the below logic in that.
Logic:
1. Build a internal table for the error records similar to the internal table you used for looping for the call transaction. In short this internal table will have only the records that have an error in call transaction.
2. Copy the recordign that you have done before and put it in the perform inside the loop and build the BDC table.
3. Then .using this BDC table you can build the BDC session.
- Guru
Reward points for helpful answers
3.
Similar Messages
-
Log file in session and call transaction methods
Hi Experts,
How to see log file in session and call transaction methods?hi
If its a session then goto SM35, select ur session and then u can see log button over there at the top... that will give the log
If its a call transaction then in ur program u need to declare internal table IT_MSGS like this
DATA: IT_MSGS LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
LOOP AT IT_SALES.
PERFORM POPULATE_BDC.
CALL TRANSACTION 'VA01' USING IT_BDCDATA
MODE MODE
UPDATE UPDATE
MESSAGES INTO IT_MSGS.
IF NOT IT_MSGS[] IS INITIAL.
LOOP AT IT_MSGS.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = IT_MSGS-MSGID
LANG = 'EN'
NO = IT_MSGS-MSGNR
V1 = IT_MSGS-MSGV1
V2 = IT_MSGS-MSGV2
V3 = IT_MSGS-MSGV3
V4 = IT_MSGS-MSGV4
IMPORTING
MSG = V_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.
WRITE:/ V_MSG.
ENDLOOP.
ENDIF.
ENDLOOP.
This will create a log for you, dont forget to award points if found helpful -
How to create a session using call transaction method.
hi , this is nagaraju,
How to create a session using call transaction method.Hi,
About Data Transfer In R/3 System
When a company decides to implement the SAP R/3 to manage business-critical data, it usually does not start from a no-data situation. Normally, a SAP R/3 project comes into replace or complement existing application.
In the process of replacing current applications and transferring application data, two situations might occur:
The first is when application data to be replaced is transferred at once, and only once.
The second situation is to transfer data periodically from external systems to SAP and vice versa.
There is a period of time when information has to be transferred from existing application, to SAP R/3, and often this process will be repetitive.
The SAP system offers two primary methods for transferring data into SAP systems. From non-SAP systems or legacy system. These two methods are collectively called batch input or batch data communication.
1. SESSION METHOD
2. CALL TRANSACTION
3. DIRECT INPUT
First step for both the methods is to upload the data to internal table. From Internal Table, the data is transferred to database table by two ways i.e., Session method and Call transaction.
Session is intermediate step between internal table and database table. Data along with its action is stored in session i.e., data for screen fields, to which screen it is passed, the program name behind it, and how the next screen is processed.
When the program has finished generating the session, you can run the session to execute the SAP transactions in it. Unless session is processed, the data is not transferred to database table.
A technique similar to SESSION method, while batch input is a two-step procedure, Call Transaction does both steps online, one after the other. In this method, you call a transaction from your program.
SESSION METHOD
Data is not updated in database table unless Session is processed.
No sy-subrc is returned.
Error log is created for error records.
Updation in database table is always synchronous
CALL TRANSACTION
Immediate updation in database table.
Sy-subrc is returned.
Errors need to be handled explicitly
Updation in database table can be synchronous Or Asynchronous.
Regards,
Sruthi. -
Where can i find the theory for session and call transaction method
hi
where can i find the theory for session and call transaction method
byecheck this link
http://www.sap-img.com/abap/learning-bdc-programming.htm
http://www.planetsap.com/bdc_main_page.htm
lsmw, bapi, bdc- session, bdc-calltransaction
u can get it in help.sap.com also -
Error while updating data using session and call transaction method
Hi all,
i have to update data using MM01 transaction from flat file to database.i have used both session method and call transaction method to do that.in both the methods data has been transferred from internal tables to screens but while updating the data that is by clicking the ok-code at the end of the transaction iam getting a dialogue box stating
SAP EXPRESS DOCUMENT "UPDATE WAS TERMINATED" RECEIVED FROM AUTHOR "SAP".
please tell whether the problem lies and solution for that.
thanks and regards.hi,
check your recording.check whether u saved your material no in recording or not.
once again record the transacton mm01.
MATNR LIKE RMMG1-MATNR,
MBRSH LIKE RMMG1-MBRSH,
MTART LIKE RMMG1-MTART,
MAKTX LIKE MAKT-MAKTX,
MEINS LIKE MARA-MEINS,
MATKL LIKE MARA-MATKL,
BISMT LIKE MARA-BISMT,
EXTWG LIKE MARA-EXTWG,
these are the fields which u have to take in internal table.
this is the record which i took in my flatfile.use filetype as asc and hasfieldseperator as 'X'.
SUDHU-6 R ROH MATSUDHU " 001 7890 AA
i did the same.but i didn't get any error. -
Mappimg and updation in bdc 'session ' and 'call transaction' methods
What will happen if error record comes while updating in session method and call transaction method.
Hi,
If any error comes in Session method U can find that error in SM35->Log
and updste again database for those enteries
In cll transaction Method U have to handel error manually . for this u have to use structure BDCMSGCOL and Table T100.
Regards
Gaurav -
Clarification on session and call transaction method.
in session method updation is synchronous and processing is asynchrounous. Session Method can handle Multiple Applications at a time. Where as Call Transaction Method can handle only one Application.
can anyone explain the above lines with a simple example.what is updation and what is meant by processing.how a session handles multiple transactions as we know that sessions cannot be run in parallel?At a time multiple screens are updated in session?how?
in the below thread it has been mentioned "2. If u want to execute the program in future u can create a session and keep it ready so that u can execute it at any point of time. That is not possible in call transaction method."
Session Method & Call Transaction
if we write the bdc program with call transaction , then it can also be used in future ,then what makes the difference.
what is meant by local update?when we need to use local update in call transaction?.We're not your free code factory. Try yourself, search for existing solutions, and come back here with specific problems.
-
How can we correct and process errorrecords in session and call transaction
hai all
how ca we correct and process error records in session and call transaction method . tell me with coding.
Edited by: swamy katta on May 14, 2008 10:25 AM
Edited by: swamy katta on May 14, 2008 10:26 AM
Edited by: swamy katta on May 14, 2008 10:27 AMhi,
Check out the below sample code ...Here are the records are getting posting with call transaction method and a session is getting created with erroreneous records....
REPORT ztest_report
NO STANDARD PAGE HEADING
LINE-SIZE 255
MESSAGE-ID ZRASH.
* Internal Table Declarations *
*--Internal Table for Data Uploading.
DATA : BEGIN OF IT_FFCUST OCCURS 0,
KUNNR(10),
BUKRS(4),
KTOKD(4),
ANRED(15),
NAME1(35),
SORTL(10),
STRAS(35),
ORT01(35),
PSTLZ(10),
LAND1(3),
SPRAS(2),
AKONT(10),
END OF IT_FFCUST.
*--Internal Table to Store Error Records.
DATA : BEGIN OF IT_ERRCUST OCCURS 0,
KUNNR(10),
EMSG(255),
END OF IT_ERRCUST.
*--Internal Table to Store Successful Records.
DATA : BEGIN OF IT_SUCCUST OCCURS 0,
KUNNR(10),
SMSG(255),
END OF IT_SUCCUST.
*--Internal Table for Storing the BDC data.
DATA : IT_CUSTBDC LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
*--Internal Table for storing the messages.
DATA : IT_CUSTMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : V_FLAG1(1) VALUE ' ',
"Flag used for opening session.
V_TLINES LIKE SY-TABIX,
"For storing total records processed.
V_ELINES LIKE SY-TABIX,
"For storing the no of error records.
V_SLINES LIKE SY-TABIX.
"For storing the no of success records.
* Selection screen *
SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETERS : V_FNAME LIKE RLGRAP-FILENAME,
V_SESNAM LIKE RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK B1.
* Start-of-selection *
START-OF-SELECTION.
*-- Form to upload flatfile data into the internal table.
PERFORM FORM_UPLOADFF.
* TOP-OF-PAGE *
TOP-OF-PAGE.
WRITE:/ 'Details of the error and success records for the transaction'
ULINE.
SKIP.
* End of Selection *
END-OF-SELECTION.
*-- Form to Generate a BDC from the Uploaded Internal table
PERFORM FORM_BDCGENERATE.
*--To write the totals and the session name.
PERFORM FORM_WRITEOP.
*& Form form_uploadff
* Form to upload flatfile data into the internal table.
FORM FORM_UPLOADFF .
*--Variable to change the type of the parameter file name.
DATA : LV_FILE TYPE STRING.
LV_FILE = V_FNAME.
*--Function to upload the flat file to the internal table.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = LV_FILE
* FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
DATA_TAB = IT_FFCUST
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.
*--Deleting the headings from the internal table.
DELETE IT_FFCUST INDEX 1.
*--Getting the total number of records uploaded.
DESCRIBE TABLE IT_FFCUST LINES V_TLINES.
ENDIF.
ENDFORM. " form_uploadff
*& Form Form_bdcgenerate
* Form to Generate a BDC from the Uploaded Internal table
FORM FORM_BDCGENERATE .
*--Generating the BDC table for the fields of the internal table.
LOOP AT IT_FFCUST.
PERFORM POPULATEBDC USING :
'X' 'SAPMF02D' '0105',
' ' 'BDC_OKCODE' '/00' ,
' ' 'RF02D-KUNNR' IT_FFCUST-KUNNR,
' ' 'RF02D-BUKRS' IT_FFCUST-BUKRS,
' ' 'RF02D-KTOKD' IT_FFCUST-KTOKD,
'X' 'SAPMF02D' '0110' ,
' ' 'BDC_OKCODE' '/00',
' ' 'KNA1-ANRED' IT_FFCUST-ANRED,
' ' 'KNA1-NAME1' IT_FFCUST-NAME1,
' ' 'KNA1-SORTL' IT_FFCUST-SORTL,
' ' 'KNA1-STRAS' IT_FFCUST-STRAS,
' ' 'KNA1-ORT01' IT_FFCUST-ORT01,
' ' 'KNA1-PSTLZ' IT_FFCUST-PSTLZ,
' ' 'KNA1-LAND1' IT_FFCUST-LAND1,
' ' 'KNA1-SPRAS' IT_FFCUST-SPRAS,
'X' 'SAPMFO2D' '0120',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0125',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0130',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0340',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0360',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0210',
' ' 'KNB1-AKONT' IT_FFCUST-AKONT,
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0215',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0220',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0230',
' ' 'BDC_OKCODE' '=UPDA'.
*--Calling the transaction 'fd01'.
CALL TRANSACTION 'FD01' USING IT_CUSTBDC MODE 'N' UPDATE 'S'
MESSAGES INTO IT_CUSTMSG.
IF SY-SUBRC <> 0.
*--Populating the error records internal table.
IT_ERRCUST-KUNNR = IT_FFCUST-KUNNR.
APPEND IT_ERRCUST.
CLEAR IT_ERRCUST.
*--Opening a session if there is an error record.
IF V_FLAG1 = ' '.
PERFORM FORM_OPENSESSION.
V_FLAG1 = 'X'.
ENDIF.
*--Inserting the error records into already open session.
IF V_FLAG1 = 'X'.
PERFORM FORM_INSERT.
ENDIF.
*--Populating the Success records internal table.
ELSE.
IT_SUCCUST-KUNNR = IT_FFCUST-KUNNR.
APPEND IT_SUCCUST.
CLEAR IT_SUCCUST.
ENDIF.
*--Displaying the messages.
IF NOT IT_CUSTMSG[] IS INITIAL.
PERFORM FORM_FORMATMSG.
ENDIF.
*--Clearing the message and bdc tables.
CLEAR : IT_CUSTBDC[],IT_CUSTMSG[].
ENDLOOP.
*--Getting the total no of error records.
DESCRIBE TABLE IT_ERRCUST LINES V_ELINES.
*--Getting the total no of successful records.
DESCRIBE TABLE IT_SUCCUST LINES V_SLINES.
*--Closing the session only if it is open.
IF V_FLAG1 = 'X'.
PERFORM FORM_CLOSESESS.
ENDIF.
ENDFORM. " Form_bdcgenerate
*& Form populatebdc
* FOrm to Populate the BDC table.
FORM POPULATEBDC USING VALUE(P_0178)
VALUE(P_0179)
VALUE(P_0180).
IF P_0178 = 'X'.
IT_CUSTBDC-PROGRAM = P_0179.
IT_CUSTBDC-DYNPRO = P_0180.
IT_CUSTBDC-DYNBEGIN = 'X'.
ELSE.
IT_CUSTBDC-FNAM = P_0179.
IT_CUSTBDC-FVAL = P_0180.
ENDIF.
APPEND IT_CUSTBDC.
CLEAR IT_CUSTBDC.
ENDFORM. " populatebdc
*& Form FORM_OPENSESSION
* Form to Open a session.
FORM FORM_OPENSESSION .
*--Variable to convert the given session name into reqd type.
DATA : LV_SESNAM(12).
LV_SESNAM = V_SESNAM.
*--Opening a session.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = LV_SESNAM
HOLDDATE = '20040805'
KEEP = 'X'
USER = SY-UNAME
PROG = SY-CPROG
* IMPORTING
* QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
IF SY-SUBRC <> 0.
WRITE :/ 'Session not open'.
ENDIF.
ENDFORM. " FORM_OPENSESSION
*& Form FORM_INSERT
* fORM TO INSERT ERROR RECOED INTO A SESSION.
FORM FORM_INSERT .
*--Inserting the record into session.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'FD01'
* POST_LOCAL = NOVBLOCAL
* PRINTING = NOPRINT
* SIMUBATCH = ' '
* CTUPARAMS = ' '
TABLES
DYNPROTAB = IT_CUSTBDC
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
IF SY-SUBRC <> 0.
WRITE :/ 'Unable to insert the record'.
ENDIF.
ENDFORM. " FORM_INSERT
*& Form FORM_CLOSESESS
* Form to Close the Open Session.
FORM FORM_CLOSESESS .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.
ENDFORM. " FORM_CLOSESESS
*& Form FORM_FORMATMSG
* Form to format messages.
FORM FORM_FORMATMSG .
*--Var to store the formatted msg.
DATA : LV_MSG(255).
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = SY-LANGU
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = LV_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE :/ LV_MSG.
ENDIF.
ULINE.
ENDFORM. " FORM_FORMATMSG
*& Form form_writeop
* To write the totals and the session name.
FORM FORM_WRITEOP .
WRITE :/ 'Total Records Uploaded :',V_TLINES,
/ 'No of Error Records :',V_ELINES,
/ 'No of Success Records :',V_SLINES,
/ 'Name of the Session :',V_SESNAM.
ULINE.
ENDFORM. " form_writeop
* if routeindicator is initial.
* LOOP AT IT_YMMEE00090.
* LV_LENGTH = STRLEN( IT_YMMEE00090-CHANGETYPE ).
* IF SY-TABIX = '1'.
* IF IT_YMMEE00090-CHANGETYPE = 'B' AND LV_LENGTH = 1.
* ROUTEINDICATOR = 'S'.
* ELSEIF IT_YMMEE00090-CHANGETYPE = 'R' AND LV_LENGTH = 1.
* ROUTEINDICATOR = 'S'.
* ELSEIF IT_YMMEE00090-CHANGETYPE = 'S' AND LV_LENGTH = 1.
* ROUTEINDICATOR = 'S'.
* ELSEIF IT_YMMEE00090-CHANGETYPE CA 'BRSCD' AND LV_LENGTH GT 1
* AND LV_LENGTH LE 5.
* ROUTEINDICATOR = 'S'.
* ENDIF.
* ELSE.
* IF IT_YMMEE00090-CHANGETYPE = 'B' AND LV_LENGTH = 1 AND
* ROUTEINDICATOR = 'S'.
* ROUTEINDICATOR = 'S'.
* ELSEIF IT_YMMEE00090-CHANGETYPE = 'R' AND LV_LENGTH = 1 AND
* ROUTEINDICATOR = 'S'.
* ROUTEINDICATOR = 'S'.
* ELSEIF IT_YMMEE00090-CHANGETYPE = 'S' AND LV_LENGTH = 1 AND
* ROUTEINDICATOR = 'S'.
* ROUTEINDICATOR = 'S'.
* ELSEIF IT_YMMEE00090-CHANGETYPE CA 'BRSCD' AND LV_LENGTH GT 1
* AND LV_LENGTH LE 5 AND ROUTEINDICATOR = 'S'.
* ROUTEINDICATOR = 'S'.
* ENDIF.
* ENDIF.
* ENDLOOP.
* endif. -
Bi session vs call transaction
hi,
what i need to clarify is that i only can use either 1 of the asterisk line below, right? if want to create BI session i use bdc_insert else if update directly use call transaction. correct?
as i make use of bdcdata, i still need to have the steps like below .
bdc_open_group
loop
append bdcdata
bdc_insert using t-code
call transaction 'tcode' using bdcdata ......
endloop
bdc_close_group
thanksHi
Yes, it's right. The ABAP code to create a BDC program is the same for the both cases: bi session and call transaction methods.
So it depends on only which method you need or want to use.
If you need to do many transactions perhaps it's better to create a bi session and run the session in the quite moment (so the night).
If you want to use CALL TRANSACTION method it's good thing to create a BI session if the CALL TRANSACTION fails.
Anywway you can insert a parameter to choose the method to be used.
Max -
How to handle Error Records in BDC
Dear All,
I have 100 records in flat file but 10 records have error record.
Use on the BDC method, error records should be move to session and remaining process through call Transaction .
Any one help to me.
With Regards,
BaskaranHi,
Do it like this:
Loop at itab into wa.
gv_flag = 'N'.
If gv_flag = 'N'.
Perform...
wa_opts-dismode = 'N'. "for background
wa_opts-updmode ='S'.
wa_opts-defsize = 'X'.
wa_opts-nobinpt = 'X'.
Where wa_opts TYPE ctu_params.
*Call transaction
CALL TRANSACTION 'PA30' USING gi_bdcdata
OPTIONS FROM wa_opts
MESSAGES INTO gi_messtab.
IF sy-subrc EQ 0.
COMMIT WORK.
ELSE.
IF NOT gi_messtab[] IS INITIAL.
LOOP AT gi_messtab INTO wa_messtab.
IF wa_messtab-msgtyp EQ 'E' OR
wa_messtab-msgtyp EQ 'A' OR
wa_messtab-msgtyp EQ 'X' OR
wa_messtab-msgid EQ 'PBAS_SERVICE'.
CLEAR gv_msg.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = wa_messtab-msgid
lang = sy-langu
no = wa_messtab-msgnr
v1 = wa_messtab-msgv1
v2 = wa_messtab-msgv2
v3 = wa_messtab-msgv3
v4 = wa_messtab-msgv4
IMPORTING
msg = gv_msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
*In case of no error message returned by BDC
IF sy-subrc = 0.
Sending errors stating which infotypes are not updated.
gv_error_flag = 'Y'.
do th required proccesing here.
ELSE.
gv_error_flag = 'Y'.
statements.
ENDIF.
ENDIF.
CLEAR wa_messtab.
ENDLOOP.
endloop.
Regards,
Rajesh Kumar
Edited by: Rajesh Kumar on Sep 17, 2009 7:58 AM -
HOW TO DOWNLOAD ERROR RECORDS IN LSMW
hi abap gurus ,
i have 2 queries .
1) first of all how to identify error records while running in background while using predefined progrmmes .
2) if there are any error records how to download those error records , can any one give the logic to download the error records while handling LSMW with predefined programmes or
bapis .
regards ,
dinesh .1) first of all how to identify error records while running in background while using predefined progrmmes .
If there is a session for that u can moniter the session in SM35 for the error records.....
2) if there are any error records how to download those error records , can any one give the logic to download the error records while handling LSMW with predefined programmes or
bapis .
Hi,
In the field mappings and conversion rules,
in the global section,define an internal table.
data : begin of it_errors occurs 0,
desc type string,
end of it_errors.
and where ever you have wrong or empty values for the fields,populate error there to the internal table.
for example, if Material no is blank,i have to give err msg
IF NOT MATMAS_MRPVIEW-MATNR IS INITIAL.
BMM00-MATNR = MATMAS_MRPVIEW-MATNR.
else.
IT_ERROR-DESC = 'Material no is empty'.
append it_error.
SKIP_RECORD. "to skip further processing of this error record.
ENDIF.
like this you populate all the error records to that IT_ERRORS internal table.
and finally download it using GUI_DOWNLOAD in the event
'__END_OF_PROCESSING__'
there is another way also, you can create a Session in the LSMW, and record the error records in the session then process the error records in the session
Hope you got it
~~Guduri -
Best Practices Question: How to send error message to SSHR web page.
Best Practices Question: How to send error message to SSHR web page from custom PL\SQL procedure called by SSHR workflow.
For the Manager Self-Service application we’ve copied various workflows which were modified to meet business needs. Part of this exercise was creating custom PL\SQL Package Procedures that would gather details on the WF using them on custom notification sent by the WF.
What I’m looking for is if/when the PL\SQL procedure errors, how does one send an failure message back and display it on the SS Page?
Writing information into a log or table at the database level works for trouble-shooting, but we’re looking for something that will provide the end-user with an intelligent message that the workflow has failed.
Thanks ahead of time for your responses.
RichWe have implemented the same kind of requirement long back.
We have defined our PL/SQL procedures with two OUT parameters
1) Result Type (S:Success, E:Error)
2) Result Message
In the PL/SQL procedure we always use below construct when we want to raise any message
hr_utility.set_message(APPL_NO, 'FND_MESSAGE_NAME');
hr_utility.raise_error;
In Exception block we write below( in successful case we just set the p_result_flag := 'S';)
EXCEPTION
WHEN APP_EXCEPTION.APPLICATION_EXCEPTION THEN
p_result_flag := 'E';
p_result_message := hr_utility.get_message;
WHEN OTHERS THEN
p_result_flag := 'E';
p_result_message := hr_utility.get_message;
fnd_message.set_name('PER','FFU10_GENERAL_ORACLE_ERROR');
fnd_message.set_token('2',substr(sqlerrm,1,200));
fnd_msg_pub.add;
p_result_message := fnd_msg_pub.get_detail;
After executing the PL/SQL in java
We have written some thing similar to
orclStmt.execute();
OAExceptionUtils.checkErrors (txn);
String resultFlag = orclStmt.getString(provide the resultflag bind no);
if ("E".equalsIgnoreCase(resultFlag)){
String resultMessage = orclStmt.getString(provide the resultMessage bind no);
orclStmt.close();
throw new OAException(resultMessage, OAException.ERROR);
It safely shows the message to the user with all the data in the page.
We have been using this construct for a long time for all our projects. They are all working as expected.
Regards,
Peddi. -
How to send multiple records in file2file and file2db or all scenarios//
I'm able to send single record for file2file and file2db,
how to send multiple records in file2file and file2db or all scenarios//
what should add or make changes for dis.1 put Occurance 1 to Unbounded in data type of IR
2 In the test tag of message mappings in IR,select one node and use "duplicate subtree" in its context menu
After that,you can download the test data in XML format with the button "save document source"
for example:
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:ZFileDemo xmlns:ns0="http://hand-china.com/mm/po_01">
- <Item>
<ItemNo>1</ItemNo>
<Matnr>2</Matnr>
<Text>3</Text>
</Item>
- <Item>
<ItemNo>4</ItemNo>
<Matnr>5</Matnr>
<Text>6</Text>
</Item>
</ns0:ZFileDemo> -
How to send error message to forms from Database Trigger
Hi, Please help me to send error message to forms from Database Trigger?
RgDs,
Madesh.R.MYou are correct, the On-Error trigger is a Forms trigger. However, if your Form is going to display the error generated by the database stored procedure or trigger - you might not see the database error in your Form unless you check the DBMS_ERROR_CODE in the On-Error trigger and manually display the Error Code and associated Text. I've see this happen with a co-worker. The Form she was working on was based on a table with an Before-Insert trigger. Because she was not explicitely handling the error from the Before-Insert trigger in the Forms On-Error trigger, her Form appeared to halt for no reason at all. Once she added code to the On-Error trigger in the Form to handle the DBMS_ERROR_CODE, she discovered the trigger was producing an error and was able to show the error to the user in the On-Error trigger.
I understand the desire to keep as much as possbile in the database, but with that comes some extra coding in your Forms to handle this. This extra coding could easily be placed in a Forms Library, attached to a Form and called in the On-Error trigger. Your code could look like this:
DECLARE
/*This example assumes you have an Alert defined
in your Form called: 'ERROR' */
al_id ALERT;
al_text VARCHAR2(200); /* Max text of a Forms Alert message*/
al_btn NUMBER;
BEGIN
IF DBMS_ERROR_CODE != 0 THEN
/* Error code is ORA-00000 Normal Successful completion
So only handle non-zero errors */
al_text := DBMS_ERROR_CODE||':'||DBMS_ERROR_TEXT;
al_id := Find_Alert('ERROR');
set_alert_property(al_id, alert_message_text, al_text);
al_btn := show_alert(al_id);
END IF;
END;Your original question was "How to send error message to forms from Database Trigger?" The answer is you don't because Forms already gets the database error code and database message through the Forms DBMS_ERROR_CODE and DBMS_ERROR_TEXT functions. Look these up in the Forms help and it should clear things up for you.
Craig...
Edited by: CraigB on Jun 14, 2010 4:49 PM
Edited by: CraigB on Jun 14, 2010 4:49 PM
Edited by: CraigB on Jun 14, 2010 4:50 PM
Edited by: CraigB on Jun 14, 2010 4:51 PM
Edited by: CraigB on Jun 14, 2010 4:51 PM -
Where can we see error records in session and calltransaction?tcodes
hi
experts
can u help me plzzzzzzzzzzzzzzzzzzzzzz
for thisHI Raviteja,
Error Records in session, go to SM35, select session name and click on log button, we can see there error records,
In Call Transaction We have function module "Format_Message" to see error records and successful record.
Thanks
saradhi
Helpful reward points.
Maybe you are looking for
-
Since the iOS7 upgrade I have had nothing but issues with my iPhone 4. I have redone everything I can, took iTunes off the PC and reloaded. I deauthorized all computers and went to re-authorize my laptop and there is no place to click to reauthoriz
-
Can I set up a home page on the mozilla for android
I would like to set up a homepage versus seeing the tabs is this possible?
-
Save PM Order in Desktop as a PDF doc
Hello Experts, Can anyone explain me as to how to Save a PM Order (Shop papers) in Desktop as a PDF doc? I know we can explore options of workflow/smartforms, etc., Any quick help on this is highly appreciated!!!!!! Thanks in advance.
-
Scrollbar for reports output in html format
We are creating reports with fairly large amounts of data being directed to the screen in HTML format. We were expecting to see a scrollbar along the right hand edge of the report window that allows us to see all of our data. Is this possible? Altern
-
To_date function working correctly?
Hi Guys, Trying to get dates from the table where the date is less than 100 AD but its not working correctly. Could you please comment where Im going wrong? Thanks, St select plan_1_date from TR_PLANNED_EVENT where plan_1_date < to_date('100AD','YYYA