‎2007 Mar 09 9:51 PM
Hi ALL,
I AM FACING A PECULIAR SITUATION.
I HAVE TWO ZPROGRAMS SAY ZPGM1 AND ZPGM2.
IAM CALLING ZPGM2 AT THE END OF ZPM1. sO WHEN I EXECUTE ZPGM1 , IAM INDIRECTLY EXECUTING BOTH PROGRAMS
IN zpgm1 before calling zpgm2 , iam updating a ztable (say ztab1) with a record.
and i am retriving the same record from ztab1 in the zpgm2 .
For some reasons its behaves in a odd way.
some times zpgm2 is unable to retrieve that record from ztab1, but some times i am able to retrieve it
After updating the ztab1 in zpgm1 i am using commit work and wait for 1 sec too.
but for some reason its nt able to retrieve the record when the control goes to zpgm2 because i guess its not updated .
The most difficult part is i don't know when its happening .
i execute 100 times it works fine and in the next when i execute it won't for the first but after first time it works fine
let me know as to what iam missing in here
thanks
Kajol
‎2007 Mar 09 9:57 PM
Hi,
INstead of
COMMIT WORK.
WAIT FOR 1 SECONDS.
Use
COMMIT WORK AND WAIT.
Thanks,
Naren
‎2007 Mar 09 9:57 PM
Hi,
INstead of
COMMIT WORK.
WAIT FOR 1 SECONDS.
Use
COMMIT WORK AND WAIT.
Thanks,
Naren
‎2007 Mar 09 9:57 PM
Hi Kajol,
You can use Parameter ID for the same.
Some times wat happens after updating the table immideatly if you are executing any another comment for the same entery it doesnt work. So first check weather table is getting updated after execution of first report and without executing second if it working then you can use Parameter ID.
Regards,
Swapnil
‎2007 Mar 09 10:02 PM
After you update the table ztab1 use
<b>commit work and wait</b>
‎2007 Mar 09 10:32 PM
Hi kajol,
the way you are working opens the door for data inconsistencies. Do not call a program from another program if table update processes are involved. This opens the door for data inconsistencies.
Create functions modules for the table update processes, put the logic into modules and create one program for both purposes.
Regards,
Clemens
‎2007 Mar 10 12:40 AM
Hi
Clemens Li -can you explain this in detail---- Create functions modules for the table update processes, put the logic into modules and create one program for both purposes.
I never used function modules to update tables.can u throw some light
Iam not using BAPI in my program so i cannot use BAPI_TRANSACTION_COMMIT.
THE REASON I AM CALLING MY SECOND PROGRAM IS BECAUSE I HAVE AN OPTION IN MY SELECTION SCREEN.
when they select it i have to call second program , my second program is adriver program for script
by using comit and wait works in this case.
let me know
thanks
kajol
‎2007 Mar 09 11:25 PM
Hi kajol,
Yeah this type of Errors occur Rarely, But you need to use BAPI_Transaction_commit. Because this module is used only when the BAPI Function modules is used. I dont your Requirement, But usage of Commit work statement is not efficient, Even i experienced same problem for Account postings where for first time the first record was missing, The same thing happened where they have used Commit work statement. Instead of that i have used BAPI_TRANSACTION_COMMIT, It worked well.
Regards,
Hemanth.
‎2007 Mar 10 2:07 PM
Hi keerthipati,
if you look at the coding of BAPI_TRANSACTION_COMMIT
function bapi_transaction_commit.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(WAIT) LIKE BAPITA-WAIT OPTIONAL
*" EXPORTING
*" VALUE(RETURN) LIKE BAPIRET2 STRUCTURE BAPIRET2
*"----------------------------------------------------------------------
if wait eq space.
commit work.
else.
commit work and wait.
if sy-subrc ne 0.
call function 'BALW_BAPIRETURN_GET2'
exporting
type = 'E'
cl = 'S&'
number = '150'
importing
return = return.
endif.
endif.
call function 'BUFFER_REFRESH_ALL'.
endfunction.
you may notice that this FM does just a COMMIT WORK. The function 'BUFFER_REFRESH_ALL' will only do something, if
BUFFER_SUBSCRIBE_FOR_REFRESH has been called before.
In this case, Commit work and BAPI_TRANSACTION_COMMIT is just the same.
Regards,
Clemens
‎2007 Mar 10 10:32 PM
Hi Clemens,
I didnot get your point.
Can anyone suggest me as what i should with my problem. I would apperciate if you tell me with an example
thanks
‎2007 Mar 10 10:37 PM
‎2007 Mar 10 11:31 PM
Hi kajol,
I wrote a comment on keerthipati recommending BAPI_COMMIT as opposed to simple COMMIT WORK.
I recommended earlier not to call one program from the other.
What about the question Rich asked?
Regards,
Clemens
‎2007 Mar 11 4:26 AM
Hi ,
Is there a differnce between
COMMIT WORK.
WAIT FOR 1 SECONDS.
and
COMMIT WORK AND WAIT ,
i thought both function the same way.
I dodnot tried COMMIT WORK AND WAIT statment, AGAIN IT WORKS MOST OF THE TIMES BUT SOMETIMES IT DOESN'T
THANKS
‎2007 Mar 11 5:14 AM
HI kajol
How are u retreiving this record in your second program. If you are using a Select statement, then try to use BYPASSING BUFFER addition in your select statement. Check if this works out.
For example
SELECT *
FROM spfli
INTO TABLE t_spfli
BYPASSING BUFFER
WHERE carrid EQ 'AA'.