Application Development 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: 

Update in initialization

Former Member
0 Kudos

Hello All,

Can we use update statement in initialization to update TVARVC table.

As I need to update a field in TVARVC table before running the program, and the same field is taken in background execution from tvarvc table.

If this is not possible or acceptable please provide an alternate solution for this.

Thanks in advance

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

you can take update statement under the initailization event and check the sy-subrc and put it that check as flag like if sy-subrc = 0 then status = 'X', so that you can know whethere update is happend or not

Reward with points if helpful.

Regards,

Vijay

6 REPLIES 6

Former Member
0 Kudos

Hi

You can write any abap code in Initialization event. But do not use error message as it would abend the report.

Regards

Navneet.

Former Member
0 Kudos

Hi

what ever the lines you define under the INITILIZATION event will execute only once through out the program

if you want to write the code then you can do under INITIALIZATION or AT SELECTION-SCREEN OUTPUT

these 2 events will trigger before the selection screen display

and after selection screen display also if you do any action on screen then AT SELCTION-SCREEN OUTPUT will trigger

<b>Reward if usefull</b>

Former Member
0 Kudos

Hi,

you can take update statement under the initailization event and check the sy-subrc and put it that check as flag like if sy-subrc = 0 then status = 'X', so that you can know whethere update is happend or not

Reward with points if helpful.

Regards,

Vijay

Former Member
0 Kudos

Hi Ramesh,

When you run an executable type program (Type '1') the first event that gets executed in 'LOAD-OF-PROGRAM'. You can update the field in your table under this event. You can use INITIALIZATION event too.

0 Kudos

Thanks All for your concern.

I need calrification whether this will cause any performance issue or at Q.A review is this going to get rejected.

Thanks in advance

0 Kudos

Ramesh,

Where you place your code (in which event) will in no way influence performance. You need to make sure that you are using the proper indexes while accessing the table to modify the records. It is also prudent to lock the table using function module ENQUEUE_ESVARVC before updating the table and unlock it using function module DEQUEUE_ESVARVC after updating the table. If you cannot lock the table using function module ENQUEUE_ESVARVC (sy-subrc NE 0) do not attempt to update the table.