11-07-2019 8:11 PM
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
11-16-2019 4:30 PM
Solved.
The commit is done in MF REFRESH_DOCUMENT.
So I Called in MF before call of REFRESH_DOCUMENT
11-07-2019 8:38 PM
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.
11-08-2019 8:45 AM
Hi,
I don't have this perform (userexit_save_document_prepare) in my function RV_INVOICE_DOCUMENT_PREPARE ....
11-07-2019 8:44 PM
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
11-08-2019 7:53 AM
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.
11-08-2019 8:03 AM
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.
11-08-2019 8:51 AM
How is your program when you debug it ? in background process, ... ?
11-08-2019 8:59 AM
My code is here.
I create this enhancement and I called my new function like this
11-08-2019 9:03 AM
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 ?
11-08-2019 9:06 AM
Yes I tried without Update task and my Ztables are not updated
MF RV_INVOICE_DOCUMENT_ADD is called normally - Not in update task
11-08-2019 9:18 AM
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... ?
11-08-2019 9:27 AM
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.
11-08-2019 9:29 AM
Your code looks clean
and without debugging, if you set a trace with ST05, did you show the SELECT statement on zmrot_trk_fields ?
11-16-2019 4:30 PM
Solved.
The commit is done in MF REFRESH_DOCUMENT.
So I Called in MF before call of REFRESH_DOCUMENT