cancel
Showing results for 
Search instead for 
Did you mean: 

TVARVC table not getting updated due to Buffer Synchronization

Former Member
0 Kudos

Hi Experts,

The design of my data loads are as follows-

1. Sequence ID Generation program- This program generates the Sequence ID and stores the generated id in TVARVC table lets say variable used as 'SEQUENCE_NO'

2. DTP: exactly after Sequence ID Generation, the DTP loads the data to cube and the Sequence ID from TVARVC table is read and updated via routine.

ISSUE:

I observed a strange behavior, with the data records being updated in the cube. Lets say the initial VALUE of 'SEQUENCE_NO' is 1012. The Program updates the TVARVC table variable and the DTP is triggered. Now the DTP updates few records with Sequence ID as '1012' and few with '1013'.

I searched online for this issue and came to a conclusion that this is happening because of SAP Buffer Synchronization. The program might be updating the table variable at database level but does not commit the work.

I have come across a solution to modify the ABAP code as follows-

MOVE 'SEQUENCE_NO' to c_vname.

UPDATE tvarvc
     SET sign    = c_i
         opti    = c_eq
         low     = w_seqid
   WHERE name EQ c_vname
     AND type EQ c_type.

   IF sy-subrc IS INITIAL.

     COMMIT WORK AND WAIT.

   ENDIF.


Can you let me know if the above solution will work (to COMMIT the work exactly after the TABLE update).

Please provide your views on the solution or suggest any alternate solution..

Accepted Solutions (1)

Accepted Solutions (1)

raymond_giuseppi
Active Contributor
0 Kudos

Try to explicitly bypass buffer in the read program (DTP)


* sender

MOVE 'SEQUENCE_NO' TO c_vname.

UPDATE tvarvc

     SET sign   = c_i

         opti   = c_eq

         low    = w_seqid

   WHERE name EQ c_vname

     AND type EQ c_type.

IF sy-subrc IS INITIAL.

  CALL FUNCTION 'DB_COMMIT'.

ENDIF.

* receiver

MOVE 'SEQUENCE_NO' TO c_vname.

SELECT SINGLE * FROM tvarvc BYPASSING BUFFER

   WHERE name EQ c_vname

     AND type EQ c_type.

Regards,

Raymond

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi.

1. Not DTP, but rotine updates fields. So I think you have an error in routine's logic: if your records must have one value of sequence number, define it in 2nd global part of transformation and fill it once!

2. Always use COMMIT/ROLLBACK statement after group of linked DML statements to make code clean and predictable (something that you call after your update may call ROLLBACK so you will loose your changes).

3. As Raimond says - use BYPASSING BUFFER for buffered tables.

4. Why you need such strange logic... why you need to generate ID's in warehouse... and if you really need it - why not using SNRO and FM NUMBER_GET*

Former Member
0 Kudos

Hi Danil,

As per client requirement, the SEQUENCE NO has to be stored in some table which will be referred by various other applications, so we came up with a solution to store a variable in TVARVC table. I think BYPASSING BUFFER should work here..

Still I have a doubt on what exactly is Buffer Synchronization? Why this is introduced? How does it work?

raymond_giuseppi
Active Contributor
0 Kudos

Did you look in online help (ABAP Programming Tools ) for ABAP Dictionary, Tables , Database Table Buffers , Local Buffer Synchronization. Mostly used for performance reasons.

TVARVC was buffered by SAP as "Only tables that are rarely written (mostly read) or for which temporary inconsistencies are of no significance shall be buffered".

Regards,

Raymond

sander_vanwilligen
Active Contributor
0 Kudos

Hi,

I suggest to move the (ABAP releated) discussion to .

Best regards,

Sander