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

Why should we use batch input instead of a SQL statement?

Former Member
0 Likes
878

Hi All,

I tried to use the SQL update statement to directly update a database field in my program.

But my boss said it is a poor practice.

Instead of using the SQL statement, we should use the batch input method.

Could you guys tell me why shouldn't we use the SQL statement directly?

Thanks.

6 REPLIES 6
Read only

Former Member
0 Likes
658

Hi Marcy,

if you are using batch input, you make sure that you are posting consistent data, because during batch input all field and program checks are processed. Using a simple update or insert statement might lead to inconsistencies.

But anyway there are still options/problems/requirements where it makes sense to do a insert or update by sql.

Hope this helps

regards

Siggi

Message was edited by: Siegfried Szameitat

Read only

0 Likes
658

Hi Siggi,

Could you tell what kinds of inconsistency there would be?

Could you elaborate it?

(For example, I'd like to update the lab/office (LABOR) in MARA.)

Thanks.

Read only

0 Likes
658

Hi Macy,

e.g. no change documents are written - with transaction MM02 (or MM42) CDHDR and CDPOS entries will be created - and further on change pointers be written - which can be used to trigger interfaces...

There might be a long list of dependent functions.

Regards,

Christian

Read only

0 Likes
658

MARA mainly deals with your Material Management(MM). For e.g. if you create a material using transaction MM01, there are a number of tables involved with this. Some of them are :

a) MARA

b) MAKT

c) T134

d) T024L

and the list goes on.

You have got the Basic View1, Basic View2, Purchasing and a number of views associated with the material. And since you and I have not developed this material management(MM) module, it would be ideal to have the basic checks provided by SAP to take place and then insert the data, since we only have a broad idea in which table, data goes.

So in case you update T024L directly , that deals with Lab/office details, chances are you have not made:

a) Sufficient validation

b) Not updated other tables related to lab/office

And thus you have an inconsistent database at your disposal.

Hope things are a little clearer.

Regards,

Subramanian V.

Read only

Former Member
0 Likes
658

hi,

which table do you want to update? standart table? or your own table?

If it is standart table of curse you need to use batch input or bapi or function.

Why? because the system will update all the necessary tables and make all checks necessary to the update

.

You <b>can't</b> say, for exemple, I want to update table <b>MARA</b> with a matarerial number, by using SQL, because there are more than one table you have to update and you even don't know theire names. But they have to be update for other processes.

And by updating yourself SAP table you may loose SAP support....

Read only

andreas_mann3
Active Contributor
0 Likes
658

Hi Macy,

have a look to that link :

<a href="http://help.sap.com/saphelp_47x200/helpdata/en/69/c250274ba111d189750000e8322d00/frameset.htm">Process Overview: Batch Input</a>

regards Andreas