2014 Mar 19 9:49 AM
Hi Experts,
I have an requirement of creating materials. I am doing this in an update task FM. Now i want that if some error comes during creation of material then i display them in an alv on the screen.So inside the FM in case of error i populated it in the tables parameter of FM.But when i come back to the calling program this table is always coming empty. Could anybody please explain how to solved this problem or how we can pass the data back to the main program.
Thanks in advance
2014 Mar 19 9:55 AM
Unfortunately, this type of error cannot be handled in the calling routine. They occur after the update has been passed.
You have to use SM13 or SM14 to examine the problem.
Unfortunately, this type of error cannot be handled in the calling routine. They occur after the update has been passed.
You have to use SM13 or SM14 to examine the problem.
2014 Mar 19 9:55 AM
Unfortunately, this type of error cannot be handled in the calling routine. They occur after the update has been passed.
You have to use SM13 or SM14 to examine the problem.
2014 Mar 19 10:01 AM
Hi ,
But if i am updating in synchronus mode then the calling routine wait for the update work to be completed.But even in this case i am getting the tables parameters empty..If we are not able to find out in calling routine that whethere updation has been successful or not then what is the advantage of synchronus update.
2014 Mar 19 10:28 AM
You are using in Update task, that is asynchronous. The values to update are send in a separate LUW, an update LUW.
You will nedd to add checks before you call the update module like read the database if the entry already exist or any other error warning that you are expecting.
2014 Mar 19 9:58 AM
you cant use exporting / changing / tables parameters in update task as it is not synchronous. You can't easily get the success / erro information. Therefore your code has to be written so that all errors are catched before the update task function module is called. You can turn on the update debugging and test, what happens.
2014 Mar 19 10:00 AM
2014 Mar 19 1:09 PM
Why Update Task FM? If you can use STARTING NEW TASK.....then I think below option is available.
I am not sure whether this is correct (haven't tried)....but there is one more addition called
... {CALLING meth}|{PERFORMING subr} ON END OF TASK
In the above case....u can mention a subroutine which would be called after the FM is executed in ....
and you can pass your parameters also...which could be retrieved using below addition...
RECEIVE RESULTS FROM FUNCTION func
[KEEPING TASK]
2014 Mar 19 1:21 PM
I guess because it is an Update Function Module that is the reason why he used Update task.
2014 Mar 19 1:33 PM
From what has been written....it seems he designed the FM as an update function module....So I am trying to understand what might be the reason behind this....
2014 Mar 19 1:33 PM
2014 Mar 19 1:57 PM
Hi,
Do you know how an update BAPI ( Create, Change ) works .
1) At First, it does validation for important fields for every tables passed in the BAPI.
perform check_on_header.
* In the subroutine called, if error occurs, it sets sy-subrc value to 8 and fills the bapireturn parameter.
check sy-subrc < 8.
perform check_on_items.
check sy-subrc < 8.
------
------
At the end, when all the data is clean, it calls the update task
if sy-subrc = 0.
CALL FUNCTION 'BAPI_XXX_POST' in update task.
endif.
2) We check the return parameters of the bapi call and if successful call 'BAPI_TRANSACTION_COMMIT'.
3) The actual posting in 'BAPI_XXX_POST' happens once commit work statement is called in 'BAPI_TRANSACTION_COMMIT' .
You too have to adopt similar approach.
Regards,
DPM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |