2011 Oct 27 9:22 AM
Good day Gurus,
I implemented BAPI_RE_CN_CREATE inside a BADI.
The syntax that I use is CALL FUNCTION BAPI_RE_CN_CREATE IN BACKGROUND TASK. I used "IN BACKGROUND TASK" because without that, the function keeps on looping. After adding the command, the BAPI works. Here is my question, how can I retrieve immediately the contract number that the BAPI created? I hope you can help me.
Thanks in advance.
Elly
2011 Oct 27 9:28 AM
What do you mean by function keeps on looping ? Could you please explain the neccesity of the return value ?
The return value( contract number ) will be available in database if the transaction gets executed successfully.
Kesav
Good day Gurus,
I implemented BAPI_RE_CN_CREATE inside a BADI.
The syntax that I use is CALL FUNCTION BAPI_RE_CN_CREATE IN BACKGROUND TASK. I used "IN BACKGROUND TASK" because without that, the function keeps on looping. After adding the command, the BAPI works. Here is my question, how can I retrieve immediately the contract number that the BAPI created? I hope you can help me.
Thanks in advance.
Elly
2011 Oct 27 9:28 AM
What do you mean by function keeps on looping ? Could you please explain the neccesity of the return value ?
The return value( contract number ) will be available in database if the transaction gets executed successfully.
Kesav
2011 Oct 27 9:59 AM
Hi Kesav,
We put the BADI in AFTER_SAVE Method. The code is like this......
if sy-ucomm = 'TRANS_NEXT'.
CALL FUNCTION BAPI_RE_CN_CREATE
importing
.
.
.
endif.
When the the system reach at CALL FUNCTION part, it does'nt execute it and it jumps back to "IF" condition part. We look for solution in the forum and someone suggest to put "IN BACKGROUND TASK" and we didi that. It works actually. But after excuting the CALL FUNCTION and search the contract that was save in VICNCN table, it was not updated yet.
OUr scenario is that we want to know what is the contract number being created after the CALL FUNCTION module because we have another requirement that we will use that field after creating the contract.
Elly
2011 Oct 27 10:40 AM
If the method AFTER_SAVE is triggered after the commit work of the transaction then the record will not be saved if you execute the function in background task, to check if this is the case add a bapi_transaction_commit after the bapi call. First of all let us know what is the badi you are using and the standard transaction being used.
Kesav
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |