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

Update in initialization

Former Member
0 Likes
909

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
Read only

Former Member
0 Likes
806

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
Read only

Former Member
0 Likes
806

Hi

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

Regards

Navneet.

Read only

Former Member
0 Likes
806

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>

Read only

Former Member
0 Likes
807

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

Read only

Former Member
0 Likes
806

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.

Read only

0 Likes
806

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

Read only

0 Likes
806

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.