Application Development and Automation 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: 
Read only

help req with table updation

Former Member
0 Likes
1,015

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
986

Hi,

INstead of

COMMIT WORK.

WAIT FOR 1 SECONDS.

Use

COMMIT WORK AND WAIT.

Thanks,

Naren

12 REPLIES 12
Read only

Former Member
0 Likes
987

Hi,

INstead of

COMMIT WORK.

WAIT FOR 1 SECONDS.

Use

COMMIT WORK AND WAIT.

Thanks,

Naren

Read only

Former Member
0 Likes
986

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

Read only

former_member187255
Active Contributor
0 Likes
986

After you update the table ztab1 use

<b>commit work and wait</b>

Read only

Clemenss
Active Contributor
0 Likes
986

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

Read only

Former Member
0 Likes
986

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

Read only

Former Member
0 Likes
986

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.

Read only

0 Likes
986

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

Read only

0 Likes
986

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

Read only

0 Likes
985

Hi Kajol, are you saying that COMMIT WORK AND WAIT does not work?

REgards,

RIch Heilman

Read only

0 Likes
985

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

Read only

0 Likes
985

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

Read only

Former Member
0 Likes
985

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'.