Commit statement in badi method
hi all,
i am using commit statement in badi method save_data, it is put after function module,
in function module i have used insert and update statement, if i do like that then the commit statement refresh the global data but update the table,
if i create one perform inside function module and put commit statement in that perform, then it shows message update was terminated,
i also want the global data for processing thats why i can't use commit statement after FM in method, please give Suggestion,
Points will be awarded.
Hi,
sounds as if you call that FM in update task. Update function modules do not allow all actions. They should only include the neccessary SQL statements and must include any COMMIT.
For more information read SAPDOCU of COMMIT WORK and everything of SAPS update concept (start immed. V1, start delayed V2 and so on).
ATTENTION. Most BADIs designed to save customers data may be used several times and standard data may be saved after them. To avoid inconsistent data inside those BADIs normally no COMMIT should be done.
Kind regards,
HP
Similar Messages
-
Print alv report directly to spool from a badi method
Hallo !
I am trying to save a log in spool on converting process
I am doing on Idoc data in Method of Badi implementation
(badi : HRALE00OUTBOUND_IDOC).
The spool request is created but the list there contains
no data.
Here is the code I put in the badi method :
DATA: LS_PRINT TYPE SLIS_PRINT_ALV,
LV_REPID LIKE SY-REPID,
LS_LAYOUT TYPE SLIS_LAYOUT_ALV,
LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
LS_FIELDCAT LIKE LINE OF LT_FIELDCAT.
LV_REPID = SY-REPID.
SET LS_LAYOUT :
CLEAR LS_LAYOUT.
SET LS_PRINT :
CLEAR LS_PRINT.
LS_PRINT-PRINT = 'N'.
SET LT_FIELDCAT :
REFRESH LT_FIELDCAT.
CLEAR LS_FIELDCAT.
LS_FIELDCAT-FIELDNAME = 'MESSAGE'.
LS_FIELDCAT-SELTEXT_L = 'MES'.
APPEND LS_FIELDCAT TO LT_FIELDCAT.
CREATE LOG IN SPOOL :
SY-BATCH = 'X'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = LV_REPID
IS_LAYOUT = LS_LAYOUT
IT_FIELDCAT = LT_FIELDCAT[]
I_DEFAULT = 'X'
I_SAVE = 'X'
IS_PRINT = LS_PRINT
TABLES
T_OUTTAB = PT_LOG[]
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
I have to remark that when I call this code in
an ABAP-PI function the log is created successfully in spool.
But here I call it from a method of IDOC Badi exit -
and the list is empty ....
The two cases are in processes that run in batch ...
Maybe ALV function can't be called from a method ?
Maybe I should use Object-Oriented ALV ?
Or maybe I fill the ALV function parameters in a wrong way ?
I really appreciate your help ,
Thanks in advance -
Nitzan S.Hey,
I am not sure if from the ALV list the SPOOL will be created properly. You said the spool is created but the spool is empty.
A Work around could be create a classical report with WRITE statements and then SUBMIT that report exporting the list into memory or you can even read the spool then.
Regards,
Ravi
Note :Please mark the helpful answers -
Hi All,
We found that while doing PGI , it takes some time to COMMIT the table VBUK. Due to which we are getting old values of VBUK-KOSTK field while executing select query at later point of time in the flow.
My question --
Can I use COMMIT WORK statement in user exit MV50AFZ1 --> FORM USEREXIT_SAVE_DOCUMENT so that all the related tables
get committed immediately.
Thanks
SaurabhHi Saurabh ,
Normally , you shoud not specify COMMIT stmt in any user exit , badi etc..
SAP has its own COMMIT statement while execuiting the standard transactions .
Addition of a COMMIT might lead to problems elsewhere .
Thanks
Supriya -
Is it possible we can write a perform statement in BADI?
Hi ,
Is it possible we can write a perform statement in BADI? Can any one please let me know .
Thanks.Sure it is possible, you just have to reference the program inwhich the FORM exists. Since the call is in a method, where do you put the actual FORM, well you need to put it in a separate program or subroutine pool, then you can call it from within the method.
perform some_form in program zsubroutine_pool.
Regards,
RIch Heilman -
COMMIT WORK on BADI BUPA_GENERAL_UPDATE
Hi all,
We're trying to propagate partner functions from the BP to associated business transactions.
We're using the instruction commit work in the BUPA_GENERAL_UPDATE. The problem comes when we propagate the partner functions more than once in the BP, because the first time works but the second causes a short dump (only in PC-UI, in SAP GUI it works properly).
We need to commit to unlock the modified opportunities.
Anyone knows the adecuate method to commit the work in PC-UI for transaction BP?
Thanks in advance, any help will be appreciated.
DavidHi David,
My first try would be to issue the COMMIT statement inside a Form (<i>commitroutine</i>)and call this form in as
PERFORM <i>commitroutine</i> ON COMMIT.
Let me know if it works.
Hope it helps.
Thanks, Debasish -
Can it be used commit statement in user-exits?
Can it be used commit statement in user-exits?
How to badi is different from other enhancement?
What are the two default components systems automatically creates when we create a new badi?
What is the business object for purchase order?Hi,
1) commit statement in userexit:
You should not do that.
After the user exits code is triggered, the transaction's own commits statements will commit the database anyway
2)You could say: BAdI = enhancement using interfaces
It is just the most up-to-date version of SAP's enhancement concept.
go thru this.
http://www.esnips.com/web/BAdI
http://www.allsaplinks.com/badi.html
New to Badi
Regards
Kiran Sure -
How to execute commit statement in a procedure optionally?
We have a procedure which has DML operations and at the end there is a commit statement.
I want to execute commit statement optionally.
Like, when procedure runs directly it must execute commit statement, but when this procedure is called from a trigger don't run commit.
As you know commit operation is not allowed in triggers.
How can I understant the code is triggered from a trigger or any other (manuel exec or from another procedure).
I am looking for the reserved word that solve my problem. Like INSERTING, DELETING ....
Serkan
Thanks.Hi oraserkan,
You do of course know it's dangerous to have a commit inside a procedure?
Consider this:
SQL> create table t (text varchar2(25))
Table created.
SQL> create or replace procedure p
as
begin
insert into t(text)
values ('Insert PROCEDURE');
commit;
end p;
Procedure created.
SQL> insert into t(text)
values ('Insert SQL')
1 row created.
SQL> exec p
PL/SQL procedure successfully completed.
SQL> rollback
Rollback complete.
SQL> select * from t
TEXT
Insert SQL
Insert PROCEDURE
2 rows selected.You should instead clearly state the procedure has a commit by making it autonomous, and then have two procedures, one that commits, and one that don't
SQL> drop procedure p
Procedure dropped.
SQL> drop table t purge
Table dropped.
SQL> create table t (text varchar2(25))
Table created.
SQL> create or replace procedure p_transactional
as
begin
insert into t(text)
values ('Insert PROCEDURE');
end p_transactional;
Procedure created.
SQL> create or replace procedure p_autonomous
as
pragma autonomous_transaction;
begin
p_transactional;
commit;
end p_autonomous;
Procedure created.
SQL> insert into t(text)
values ('Insert SQL')
1 row created.
SQL> exec p_autonomous
PL/SQL procedure successfully completed.
SQL> rollback
Rollback complete.
SQL> select * from t
TEXT
Insert PROCEDURE
1 row selected.
SQL> drop procedure p_transactional
Procedure dropped.
SQL> drop procedure p_autonomous
Procedure dropped.
SQL> drop table t purge
Table dropped.Regards
Peter -
Global variable in BADI methods..
Hi,
How can i declare a global variable in BADI method ,for example " Count type I".Can any one let me know ...
Regards,
VeeraHi,
BADI is a just an interface definition that needs to be implemented by the customer. The final implementation of a BADI is always found in a class.
You can define the variable as attribute and static if you want it to be accessed by all objects.
I hope this answers your question
Regards,
Saurabh -
Hi Guys,
I have a RFC function module which updates a field on the Portal side and no updates are done on the R/3 side. I pass parameters to the FM and it updates the field on the portal side.So do we need a COMMIT statement in this situation.
IS COMMIT statement necessary for every BAPI or RFC function module. What are the situation under which a COMMIT statement is used.Hi,
IF you are exporting a data from SAP to other system you doesn't need this but if you are importing a data from others systems to SAP you need to use the statement COMMIT WORK.
COMMIT WORK is required for transactions developed externally to the R/3 System that change data in the R/3 System via BAPI calls.
When you call BAPIs in your program that change data in the R/3 System, afterwards you must call this the FM "BAPI_TRANSACTION_COMMIT" to write the changes to the SAP database.
<b>Use function module BAPI_TRANSACTION_COMMIT to do this.</b>
Regards.
Marcelo Ramos -
Badi method for knb1-atlkn in customer master in ECC 6.0
Hi all,
in ECC 6.0 .., customer master under company code data under account management we have field named "Prev. acct no." ( KNB1-ALTKN ) .....I have to do some validations for that field ....can you ppl advise/suggest me the correct badi method for this purpose ???
because the control is not stopped in save_data badi method....can u pls advise on the same??????
pl. do th needful.
thanks in advance
jacktHANKS
-
Does SAP generate COMMIT WORKS when BAdIs end?
I want to call a function module "IN UPDATE TASK" from within a BAdI.
Will SAP generate a "COMMIT WORK" when the BAdI ends, so that the function module is triggered ?
If I do have to code a COMMIT WORK in the BAdI to trigger execution of the FM, won't this interfere with any commit schedules that SAP has in mind ????Hi Narendran -
I agree with you - that's why I asked the question about whether I had to code my own "commit" in the BAdI - I have never had to do this before.
But the good news is - even though I'm calling the FM "IN UPDATE TASK" from an SCM-APO CIF BAdI, SAP generates a commit work because my FM fires even when I don't have an explicit commit work in the BAdI.
So all is well that ends well.
Thanks again.
djh -
Call of a BADI method inside another BADI
Dear colleagues,
Could someone guide me with the information whether it is allowed to create/call a Badi inside an implementation of another Badi method?
Please let me know whether there are other alternatives or the Badi call within Badi acceptable as per SAP standards?
Many thanks in advance,
Best regards,
Srivatsahi Ganesh,
Check this out
<b>Calling a BADI from another BADI</b>
Regards,
Santosh -
Comment after the commit statement.
Hi Everyone,
Please do have a look at this.
Commenting on COMMIT: Example The following statement commits the current transaction and associates a comment with it:
COMMIT COMMENT 'In-doubt transaction Code 36, Call (415) 555-2637';
Now where can I see that comment? What is the data dictionary, which will have this detail?
Regards,
BS2012.If you look into the document for the COMMIT statement you will see this.
COMMENT Clause
Specify a comment to be associated with the current transaction. The 'text' is a quoted literal of up to 255 bytes that Oracle Database stores in the data dictionary view DBA_2PC_PENDING along with the transaction ID if a distributed transaction becomes in doubt. This comment can help you diagnose the failure of a distributed transaction. -
Each procedure have commit statement
I call five procedure individually, and each procedure have commit statement from .net environment i.e. click event of submitt button call five procedure
but now i want only one commit statement for all five proceduce if all procedure successfully
executed.
suppose first two procedure successfully execute then third procedure raise some exception, in that case previously execute procedure data successfully comitted, but i want them rollback because all five procedure does not successfully execute.What does this have to do with OCI? Sounds like a transaction control question...
The answer is to commit at the end of the transaction from the client code, and not at the end of each procedure call. -
Issue a commit statement for every 10000 rows updated
Hi,
I have a update statement, updating huge number of records.
I wanted to issue a commit statement for every 10000 rows updated.
Can this be done?
Thanks,
Dineshuser522952 wrote:
Hi,
I have a update statement, updating huge number of records.
I wanted to issue a commit statement for every 10000 rows updated.
Can this be done?
Thanks,
Dinesh Why do you want to issue commit statement frequently? Do you have a possible reason?
If you think it will improve performance, you are 200% wrong. It will not improve performance it will only degrade performance. It will destroy the integrity of your data. It will screw you up big time.
Ever heard of [ORA-01555 Snapshot too old|http://asktom.oracle.com/pls/asktom/f?p=100:11:4217554330904383::::P11_QUESTION_ID:275215756923] error? Your approach has a likely chance of getting that too.
Do it in a single UPDATE. How big the table is does not matter. Do it in a single update, Oracle is fully capable of doing it.
Maybe you are looking for
-
I have two ipad2s and two iPhone 4s on the same iTune account. I have a gift card balance of $25.78. I have purchased a song on one iPad and an app on a different iPad using the same iTunes account. Both times I have been charged the amount to my cre
-
Reading documents in Word 2010 from an external hard drive on my new HP 8.0
I have a new Windows 8.0 computer. I have multiple Word 2010 documents stored on an exteral hard drive that I need to access. How can I do this? I am given the options to use to open the documents but I don't know what to use. Help!!! I tried a
-
Report on Employees whose trips assigned check box not checked
Hi SAP Guru's, We have a requirement wherein we have to generate a report having list of those employee's whose trip assigned check box is not checked in infotype 0017 (Travel Privileges) at the same time who are having trips created in their name. I
-
Is there any way to pick and choose or define which line items will appear on an invoice?
-
How to re-store backgup from the flash card?
Hi My phone is Nokia 5800. After update to 20.x I found some contacts don't have voice labels anymore - I'm unable to call them via voice recognizer. The Nokia Care said it's possible to restore these labels after soft / hard reset. I did a backup on