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: 

Calling a standard SAP's function module?

former_member194142
Participant
0 Kudos

Hello

Pl. let us know can we call a standard SAP's UPDATE function module (FM --> Attributes --> Processing Type --> Update radio button selected) in a normal way, I mean, currently we are calling a standard SAP's update FM with out adding IN UPDATE TASK extension syntax in our Z report program and its working fine, pl. let us know is it OK/safe to call it with out extension?

Thank you

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor
0 Kudos

Calling the FM not in update task, may trigger invalid database if a simple database commit (implicit or  not) is triggered before a transaction commit the work, but this is one customer program, so that part is not a true problem if program correctly coded.

But those standard update FM usually update database almost whatever parameter you pass (just the records to update must exist or any error that trigger an error in open-sql execution, so raising an Abort message with the most beautiful effect) but usually using those (unreleased) update task FM to prevent usage of BAPI, IDoc, BDC or other tool is bad practice, those FM usually don't check data validity, no insure database consistency, usually SAP transactions perform some checks and calculations then trigger a batch of such FM IN UPDATE TASK and finally COMMIT the WORK. So YOU must do the whole job as the SAP transaction, and of course, in case of problem you are on your own, SAP will ask for "consulting service" (pay for it) - 7 - Error caused by customer modification/development with reference to 415983 - Modification/customer developments of SAP function modules

Regards,

Raymond

5 REPLIES 5

roberto_vacca2
Active Contributor
0 Kudos

Hi.

In UPDATE TASK means your FM sit and wait for a COMMIT WORK, before execution. When COMMIT arrives, the processing does not continue until the function module has finished.

Then Processing Type --> Update Immediately means in the same LUW (logic unit of work), committed together. Delayed means in separate LUW , committed in a separate way.


What are you trying to obtain?


Hope to help

Bye

0 Kudos

Thank you.

We want to UPDATE immediately and the said FM's attributes also same (IMMEDIATE radio button is selected), my program is not yet moved to production, but its working fine as expected in DEV and ACC with out adding of IN UPDATE TASK extension, hence we are guessing same (works well) in PRD as well

Pl. let us know is it OK/safe to call UPDATE FM with out IN UPDATE TASK extension?

0 Kudos

Hi.

You need to verify well your request. I don't know what's the process that you're executing and what's your function's purpose.

For example, suppose your function module do a COMMIT instruction. That's a bad thing if you're   inside a "PO creation" process. So you'll need "IN UPDATE TASK.

An other example would be  if you have 3 steps to complete a process and you want to commit only when all 3 steps are successfull. In this case you'll need CALL FM .. IN UPDATE TASK for all 3 of them. Once the 3rd step is successfull you'll do a COMMIT WORK statement to COMMIT all your changes to the database.

I hope it's clear.

Bye

raymond_giuseppi
Active Contributor
0 Kudos

Calling the FM not in update task, may trigger invalid database if a simple database commit (implicit or  not) is triggered before a transaction commit the work, but this is one customer program, so that part is not a true problem if program correctly coded.

But those standard update FM usually update database almost whatever parameter you pass (just the records to update must exist or any error that trigger an error in open-sql execution, so raising an Abort message with the most beautiful effect) but usually using those (unreleased) update task FM to prevent usage of BAPI, IDoc, BDC or other tool is bad practice, those FM usually don't check data validity, no insure database consistency, usually SAP transactions perform some checks and calculations then trigger a batch of such FM IN UPDATE TASK and finally COMMIT the WORK. So YOU must do the whole job as the SAP transaction, and of course, in case of problem you are on your own, SAP will ask for "consulting service" (pay for it) - 7 - Error caused by customer modification/development with reference to 415983 - Modification/customer developments of SAP function modules

Regards,

Raymond

0 Kudos

Thank you Roberto.

Thank you Raymond,

I totally agree with you bcz when I checked the said UPDATE FM, its the same as you said in your reply that its not released for customers, its directly updating the DB with out any validations/checks, they wrote below code in the FM,


IF it_itab[] IS NOT INITIAL.

  UPDATE std_sap_tbl FROM it_itab
ENDIF.

But, in our case/requirement, we don't need any kind of validations/checks/data consistency checks  bcz we want to UPDATE a single field on bunch of recs as one-time mass update, hence I guess I am OK