As part of some requirement we have created a normal function module which calls MIRO using call transaction. After the call transaction is performed we are getting the invoice number and fiscal year using get parameter id and storing those values into our custom table for later use. Code is like the below. The subroutine is inside the custom function module.
SET PARAMETER ID 'RBN' FIELD invoice_no.
SET PARAMETER ID 'GJR' FIELD l_fyear1.
CALL TRANSACTION 'MIRO'.
GET PARAMETER ID 'RBN' FIELD invoice_no.
GET PARAMETER ID 'GJR' FIELD l_fyear1.
UPDATE zheader SET belnr = invoice_no gjahr = l_fyear1 WHERE <condition>
COMMIT WORK AND WAIT.ENDFORM. " CALLTR_MIRO
Now the problem is some times the custom table zheader is not getting updated with the invoice and fiscal year. Could help in solving the problem.Also could give some tips to use commit work and wait statements in function modules.
Thanking in advance,