2012 Jun 27 6:15 AM
Hi guys.
I am using this function to change the storage location (Goods Recipient Tab) and work center in the operations of a Production Order.
We are looping an itab and calling this FM for each record in itab.
Working fine for most of the cases.
At times, this function throws the dump as shown below.
I would like to know the reason for this error.
Code:
gs_loc-storage_location = itab-lgpro1.
gs_loc-storage_location_x = 'X'.
new_wc-operation = oprno.
new_wc-control_key = itab2-steus.
new_wc-work_center = arbpl.
new_wc-work_center_x = 'X'.
APPEND new_wc TO new_wc1.
CLEAR new_wc.
CALL FUNCTION 'CO_SE_PRODORD_CHANGE'
EXPORTING
iv_order_number = itab-aufnr
is_header = gs_loc
it_operation = new_wc1
iv_commit = 'X' "Commit Work
IMPORTING
es_return = main_bapi_ret.
IF main_bapi_ret-type = 'E'.
MESSAGE main_bapi_ret-message TYPE 'S'.
ENDIF.
CLEAR : gs_loc, new_wc, new_wc1[], new_wc1.
Run-time error:
Sample Production Order for which such error occurs:
2012 Jun 27 6:30 AM
The dump says it all ..When a COMMIT WORK is executed all the FM s registered with CALL FM IN UPDATE TASK, PERFORM ON COMMIT etc are executed...no error message or exception should be thrown in the LUW Update.... Try to understand in the dump why the error meesage is raised ??? you need to back track from there ..... probably ur sending some incorrect data in this case.....
2012 Jun 27 6:30 AM
The dump says it all ..When a COMMIT WORK is executed all the FM s registered with CALL FM IN UPDATE TASK, PERFORM ON COMMIT etc are executed...no error message or exception should be thrown in the LUW Update.... Try to understand in the dump why the error meesage is raised ??? you need to back track from there ..... probably ur sending some incorrect data in this case.....
2012 Jun 27 7:01 AM
Thank you for the valuable input.
The error is arising because of wrong data.
How to catch such run time error ?
I want to capture such cases in an internal table and continue processing with the next data in itab and finally display erroneous records as a report to the user.
2012 Jun 27 7:24 AM
Good you were able to track it...can you check whether any parametere are provided in the FM for a simualation /test run ..Also try by not passing the flag in COMMIT WORK parameter and see if you get error messages ...if there are no error messages you make a explicit commit work......
Take a look at BAPIS, usually they have an option for a test run ,one is BAPI_PRODORD_CHANGE(couldnt chk whether test run parameter is provided ,as am not having access to SAP now)
2012 Jun 27 9:27 AM
I changed the iv_commit from 'X' to space and tried to commit by using BAPI_TRANSACTION_COMMIT externally.
Now I am getting the error message thrown from user exit and on pressing F3, I am getting the error "The commit work processing must not be interrupted".
Now I want to know the way to capture a type 'E' message thrown from some program.
Currently this is interrupting (characteristic of type 'E' msg) the processing of other valid records in itab.
2012 Jun 27 10:39 AM
I presume the error message is thrown from a user exit and u want to capture it..???
.First question, what is the User exit in which the error message is thrown ?
If the User exit is called as a part of the Update Task,never ever throw an error message in it....
Last, see the User exit Documentation (if it exists) whether it is allowed to throw error messages