Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Update Ztables in VF01 after save - End of MF RV_INVOICE_DOCUMENT_ADD

former_member328919
Participant
0 Kudos

Hello Experts, I need your help please

I want to update some Z table after invoice creation.

For that I created an enhancement in the end of MF RV_INVOICE_DOCUMENT_ADD

When I am in debug the data are updated in Z table but when I am not in debug, nothing is updated.

I was thinking that the debug make a commit, so I added a COMMIT WORK in my code but same problem :
- OK in debug
- KO without debug

Thanks in advance for your precious help

1 ACCEPTED SOLUTION

former_member328919
Participant
0 Kudos

Solved.

The commit is done in MF REFRESH_DOCUMENT.

So I Called in MF before call of REFRESH_DOCUMENT

13 REPLIES 13

p244500
Active Contributor
0 Kudos

Hi,

COMMIT Work will not going to work middle of the enhancement. you should call your Ztable modification IN UPDATE TASK. kindly look at below link it will help you to find correct place to insert your code.

RV_INVOICE_DOCUMENT_ADD

0 Kudos

Hi,

I don't have this perform (userexit_save_document_prepare) in my function RV_INVOICE_DOCUMENT_PREPARE ....

former_member328919
Participant
0 Kudos

Hi,

I created a MF where I inserted my code to update my Ztables

I also tried to call this MF in Update Task -> Same problem

I tried mode : Update module for my MF -> Same problem

0 Kudos

Please use the COMMENT button for comments, questions, adding details, etc., ANSWER is only to propose a solution, dixit SAP text at the right of the answer area.

Sandra_Rossi
Active Contributor

The latest debuggers don't make a database commit anymore because it works in a session different from the debugged session.

You should first determine why your code doesn't work when there's no debug, for instance by adding a MESSAGE X (short dump) when a condition prevents your Z table from being updated.

FredericGirod
Active Contributor
0 Kudos

How is your program when you debug it ? in background process, ... ?

former_member328919
Participant
0 Kudos

My code is here.

I create this enhancement and I called my new function like this

FredericGirod
Active Contributor
0 Kudos

The question about debug option, is to know how RV_INVOICE... has been called.

Did you try (without the update task option) to set directly a break point inside your code ?

former_member328919
Participant
0 Kudos

Yes I tried without Update task and my Ztables are not updated

MF RV_INVOICE_DOCUMENT_ADD is called normally - Not in update task

FredericGirod
Active Contributor
0 Kudos

My question was about, without debugging does your FM has been called ?

Maybe your code needs to have the invoice already in the database, but your function without debug goes to fast.

Could you share the code of Z_MRO_TRK... ?

former_member328919
Participant
0 Kudos

FUNCTION z_mro_trk_invoice_save.

*"----------------------------------------------------------------------
*"*"Update Function Module:
*"
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_VBRK) TYPE VBRKVB
*"----------------------------------------------------------------------
* Program ID : Z_MRO_TRK_INVOICE_SAVE
* Description : Function to Log Event in tracking tool when saving Invoice
* Date : 20.09.19
*--------------
* Function data
*--------------*
DATA: w_daten TYPE yuet001-daten,
ws_trk_fields TYPE zmrot_trk_fields,
w_date TYPE sy-datlo,
w_time TYPE sy-timlo,
w_fieldname TYPE char255,
w_h_fieldname TYPE char255,
w_exit_key TYPE zmro_trk_exit_key,
w_objkey TYPE objkey.

FIELD-SYMBOLS: <fs_fieldname> TYPE ANY,
<fs_h_fieldname> TYPE ANY,
<fs_time> TYPE ANY.

*--------------------
* Check creation mode
*--------------------
IF i_vbrk-updkz <> 'I'.
RETURN.
ENDIF.

*------------------------
* Retrieve field to track
*------------------------
SELECT * UP TO 1 ROWS FROM zmrot_trk_fields INTO ws_trk_fields
WHERE objtype = 'VBRK'
AND filter = i_vbrk-fkart
AND dispcre = 'X'.
ENDSELECT.
IF sy-subrc <> 0.
RETURN.
ENDIF.

* Get date fieldname
MOVE sy-datum TO w_date.

* Get time fieldname
MOVE sy-uzeit TO w_time.


* Get exit key
CONCATENATE i_vbrk-fkart '/VBRK-' ws_trk_fields-fieldname INTO w_exit_key.
MOVE i_vbrk-vbeln TO w_objkey.

*---------------------
* Launch Tracking Tool
*---------------------
CALL FUNCTION 'Z_MRO_TRK_LOG_ON_EXIT'
EXPORTING
l_objkey = w_objkey
l_exit = '003'
l_exit_key = w_exit_key
l_date = w_date
l_time = w_time.

ENDFUNCTION.

FredericGirod
Active Contributor
0 Kudos

Your code looks clean

and without debugging, if you set a trace with ST05, did you show the SELECT statement on zmrot_trk_fields ?

former_member328919
Participant
0 Kudos

Solved.

The commit is done in MF REFRESH_DOCUMENT.

So I Called in MF before call of REFRESH_DOCUMENT