cancel
Showing results for 
Search instead for 
Did you mean: 

Enhancement spot after invoice creation (committed to DB )

manivel
Participant
0 Kudos
699

Dear Friends,

I had some custom logic to be added in invoice creation standard program. This logic to be added after invoice creation ( after committed to DB ). I have created an enhancement implementation in function module RV_INVOICE_DOCUMENT_ADD at enhancement-point RV_INVOICE_DOCUMENT_ADD_30.

The problem I'm facing here is, at run-time the custom logic is not getting executed (means the billing document is not committed in DB), but while debugging I'm getting the result as expected.

I'm calling a custom function module in the enhancement implementation. In the custom function module the invoice number is an input and the select queries for VBRK and VBRP is written in source code. Since the invoice is not committed in DB, the select queries are getting failed.

Please suggest me how to proceed on this or is there any other solution available to achieve this scenario.

Accepted Solutions (0)

Answers (2)

Answers (2)

raymond_giuseppi
Active Contributor

In your Enhancement, call a function module IN BACKGROUND UNIT/TASK (define FM as RFC enabled) or in UPDATE (define FM as an update v2 delayed) so it will be executed after database update. If you only insert some data in some table use the update FM if you use some BAPI or COMMIT use the RFC enabled FM.

manivel
Participant
0 Kudos

Dear Raymond Giuseppi,

Thanks for the reply. Let me try and come back.

Regards,

Manivel S

nabheetscn
Active Contributor
0 Kudos

Another crazy way can be check if any event is raised in SWELS on invoice creation and then you can create a background task and attach to the event and execute your code. Of course the one suggested by Raymond will work and is straightforward, just letting you know we have N number of ways doing same things.

Nabheet

kiran_k8
Active Contributor
0 Kudos

"I'm calling a custom function module in the enhancement implementation. In the custom function module the invoice number is an input and the select queries for VBRK and VBRP is written in source code. Since the invoice is not committed in DB, the select queries are getting failed."

You want this custom FM to get called in BACKGROUND UNIT/TASK by declaring the FM as RFC Enabled. Right ?

But I didn't get the statement " define FM as an update v2 delayed ".

Can you please share more info on the above statement.

raymond_giuseppi
Active Contributor
0 Kudos

Either 'Remote-Enabled' module and IN BACKGROUND, either 'Update Module' 'Start delayed' and IN UPDATE, not both.

manivel
Participant
0 Kudos

Dear Raymond Giuseppi,

I've tried this method and found unsuccessful. I've achieved this problem by using the output types. Created a custom output type and transmission medium as special function(8). In this special function I've called my custom program and it is working as expected.

We can close this thread.

Regards,

Manivel S