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

maintaining version in Z table

Former Member
0 Likes
737

Hi All!

I have a program which updated the Z table with certain rows every time it runs.I want to add a version number to the z table by adding a extra column which will distinguish me between program runs.

I mean if the program runs for the first time the version number will be 1 for the all the rows it updates the ztable.If it runs for a second time the version number will be two and so on...

Please advise how to achieve this..

Regards

Praneeth

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
682

Hi Praneeth,

Add a column to the ztable for the serial number also.

Then maintain it using the function module NUMBER_GET_NEXT in the pai section .

Regards,

Ravi

Hi All!

I have a program which updated the Z table with certain rows every time it runs.I want to add a version number to the z table by adding a extra column which will distinguish me between program runs.

I mean if the program runs for the first time the version number will be 1 for the all the rows it updates the ztable.If it runs for a second time the version number will be two and so on...

Please advise how to achieve this..

Regards

Praneeth

5 REPLIES 5
Read only

Former Member
0 Likes
682

Hi,

Instead of Version, you can think of having a date & time stamp which would help you to identify the latest run from the time & date,

Rgds,

Read only

0 Likes
682

You can maintain a field for Version in your Z table and use the internal table in the program (which updates all other fields in this table) to update this field each time the program runs.

You can give:

Itab-version = itab-version + 1.

Do this for each of the modified records and update to the table along with the other records.

The timestamp is also a good suggestion.

Hope this helps.

Sudha

Read only

Former Member
0 Likes
682

change the in SE11 to add the column. You can adjust the table using SE14.

After the alter the code wherever you inserting rows into the table, to update the new column as well.

Regards,

Ravi

Note :Please mark the helpful answers

Read only

Former Member
0 Likes
683

Hi Praneeth,

Add a column to the ztable for the serial number also.

Then maintain it using the function module NUMBER_GET_NEXT in the pai section .

Regards,

Ravi

Read only

Former Member
0 Likes
682

You can acheive this by creating a change document object for your custom table.

After creating the change document object you need to call the change document function module(generated when you create the change document object) with proper parameters in you application which updates the custom table.

Please refer SAP documentation for change document objects.

-Kiran