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 ztable from database table directly

GauthamV
Active Contributor
0 Likes
2,432

hi all,

can u tell me the possible ways to update a ztable from database table directly.

i mean is there anyway to update ztable whenever entry is created in database table .

i dont want to update using insert,modify statements.

points will be rewarded to all hlpful answers.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,722

Hi Gautham,

I hope this can be done with events in table maintainenance generator.

Check the below for blog on events in table maintenance

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8129f164-0a01-0010-2a8e-87652872...

Thanks,

Vinay

14 REPLIES 14
Read only

Former Member
0 Likes
1,722

hi gautham,

Make your question clear. ZTABLE is nothing but a database table.

And abt which database table you are talking abt the new entry creation.Same table??

Read only

0 Likes
1,722

hi,

for example , if u have any new entry created in some database table like mara.

then it should be updated in Zmara .

i dont want to run any program using insert,modify statements continously.

but the table Zmara should get that values from mara when ever new records are created there.

hope this is clear.

Read only

Former Member
0 Likes
1,723

Hi Gautham,

I hope this can be done with events in table maintainenance generator.

Check the below for blog on events in table maintenance

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8129f164-0a01-0010-2a8e-87652872...

Thanks,

Vinay

Read only

0 Likes
1,722

hi ,

any other ways to acheive this.

Read only

Former Member
0 Likes
1,722

Gautam,

Are these tables external to SAP Business One and do not have a Business Object? If there is a Business Object available such as if you were to enter an order, that order would use the Documents object which abstracts you, the programmer, from the underlying tables that need to be updated. If you are handling multiple business objects you would need to wrap the transaction with the StartTransaction - EndTransaction methods. This information is detailed in the SAP Business One SDK Help Center that comes with the SDK.

Amit.

Read only

0 Likes
1,722

hi,

actually we have created a ztable with some fields from VWBEVI table and there is also a program written to update the data.

but the data gets updated only if we run that program.

so i wanted to know if there is any other alternative so that the table gets updated directly instead of using the program.

Read only

0 Likes
1,722

No, simply there is no such option.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,722

I don't think there are such "triggered" event in SAP, some database have these tools but this is not the forum ad hoc, in SAP you have to look for BADI or Business Event executed after update/insert into tables.

Another way would be to analyze in pseudo-real time, the table DBTABLOG or CDHDR/CDPOS and create new records in your Z-tables.

If you don't want to program this, look for your database, look for "triggering" event on database update.

Regards

Read only

0 Likes
1,722

You can ensure that the KEYs of ZMARA are correctly maintained automatically, by making it an APPEND table of MARA. ( You may have to use a different name ).

Read only

Former Member
0 Likes
1,722

Hi,

There is no such way to do this. Because your Ztable may contain some fields that are not present in DB table. So how these fields would be populated... So you have to write some logic behind this in your code for insert/update/modify.

What you can do is just create a Database view for that... This may solve your problem.

-Tushar

Read only

GauthamV
Active Contributor
0 Likes
1,722

i think their is no additional information available.

thanks for everyone.

Read only

Former Member
0 Likes
1,722

Prerequisites:

Each key field in the database table (except the client) must have a corresponding characteristic in the variant table.

The variant table must not contain interval values.

The characteristics must not be in exponential format 1 (standard) or 2 (Exponent entered).

The variant table must be linked to a database table. The link must be active.

Procedure

1. From the variant configuration menu, choose Tools ® Table entries ® Transfer to database table.

This function executes report program RCCUVTDB.

2. Enter the database operation you want to execute:

- Insert inserts new data records in the database.

- Insert and change inserts new data records in the database and changes existing records.

Read only

0 Likes
1,722

Hi all,

I am creating database view in production.using lips, likp, mara..for to view the delivery order details in that view. but in each line come 4 times .

eg:

in delivery order 80010010 contains 2 line item

DO# line item material qty

80010010 90001 AAAAAA 345

80010010 90002 AbbbA-df 456

in my view shows four line item as follows

80010010 90001 AAAAAA 345

80010010 90001 AAAAAA 345

80010010 90002 AbbbA-df 456

80010010 90002 AbbbA-df 456

some each line item show four the times actual line items...

how can i solve it

Read only

Former Member
0 Likes
1,722

A slightly dirty solution:

Use SAP functions for reading from CDHEADER and CDPOS tables [with enough filters such that you extract minimum records possible] to read changes to MARA table fields since last run of your program. Use this information to update your ZTABLE. I would recommend having a table maintainance generator on ZTABLE. The actual update should be by a BDC by calling transaction SM30 for ZTABLE maintainance. Now the program may be set up as a batch job running 1ce an hour. You get updates to the extent of 1 hour latency.

Alternatively, you may look if an opportunistic BADI / user Exit is there alongside MM01/02 transactions - assuming the latter are the only ones updating MARA. In this BADI you may write the code to update ZTABLE- again, look to do it by BDC call transaction sm30 to maintain ZTable. To lighten up the code -load on BADI you may simply raise a custom event and move on. You will configure a job that runs your program when that particular event is raised. This will need the 'burden' of figuring out the changes, though.

An elegant way would be to fire a MATMAS fIDOC for every change to Material, capture that and turn back the changes to ZTABLE. This will facilitate the delta load.