Dynamic record deletion from database table
Hi,
I need to delete selected records from database table(dynamic names). Table names are being passed from main program with some of their field names. The record to be deleted from the database table is being decided based on the fields passed for the table and their contains passed from the main program.
It is not possible to write dynamic where clause for DELETE statement directly.
So, I created a dynamic internal table and i am trying to fetch all records using SELECT statement(for which we can write dynamic where condition, something like...SELECT...WHERE (itab). ) which need to be deleted in the iternal table.
Piece of code :
CONCATENATE c_im v_tablefield1 INTO v_imprtfield1.
CONCATENATE v_tablefield1 c_in v_imprtfield1
into s_condition separated by space.
APPEND s_condition TO t_condition.
PERFORM GET_DYNAMIC_ITAB USING s_flds_agtab-tabname
changing t_itab.
ASSIGN t_itab->* TO <itab>.
*Select the data (to be deleted) from the database table
SELECT * FROM (s_flds_agtab-tabname) INTO TABLE <itab>
WHERE (t_condition).
*Delete the records from the table
IF SY-SUBRC = 0.
DELETE (s_flds_agtab-tabname) FROM TABLE <itab>.
ENDIF.
Here t_condition is of standard table of WHERETXT.
t_condition at the run time before giving dump was:
SPART IN IM_SPART
AND KUNNR IN IM_KUNNR
Here IM_SPART is renge type of SPART and IM_KUNNR is renge of KUNNR.
I am getting a DUMP:
The WHERE condition has an unexpected format.
Error analysis
The current ABAP/4 program attempted to execute an ABAP/4 Open SQL
statement containing a WHERE condition of the form WHERE (itab) or
WHERE ... AND (itab). The part of the WHERE condition specified at
runtime in the internal table itab contains the operator
IN (v1, ..., vn)
in incomplete form.
How to correct the error
If the error occurred in a non-modified SAP program, you may be
able to find a solution in the SAP note system.
If you have access to the note system yourself, use the following
search criteria:
"SAPSQL_IN_ILLEGAL_LIST"
"SAPLZSD_TAB_REFRESH " or "LZSD_TAB_REFRESHU01 "
"Z_SD_REFRESH_AGTABLES"
If you cannot solve the problem yourself, please send the
following documents to SAP:
I would like to know whether "IN" operator is allowed in (itab) of WHERE clause. While testing I changed the "IN" to "=" specifying a suitable value there. It worked. So please let me know if i can give "IN" operator using renge table in the dynamic where clause.
Thanking you,
Surya
Hi again, so if you can not use the IN in a dynamic where clause you might be forced to dynamically build the entire select statement, Here is a sample program which may give you some ideas, notice that we are writing the select statement code, putting it in another program and generating the subroutine at runtime, then call this routine. I'm sure that this will help you see what you need to do.
report zrich_0003 .
tables: kna1.
types: t_source(72).
data: routine(32) value 'DYNAMIC_SELECT',
program(8),
message(128),
line type i.
data: isource type table of t_source,
xsource type t_source.
ranges:
r_kunnr for kna1-kunnr.
data: ikna1 type table of kna1.
data: xkna1 type kna1.
r_kunnr-sign = 'I'.
r_kunnr-option = 'EQ'.
r_kunnr-low = '0001000500'.
append r_kunnr.
xsource = 'REPORT ZTEMP.'.
insert xsource into isource index 1.
xsource = 'FORM dynamic_select'.
insert xsource into isource index 2.
xsource = 'Tables r_kunnr ikna1.'.
append xsource to isource.
xsource = 'select * into table ikna1 from kna1'.
append xsource to isource.
xsource = 'where kunnr in r_kunnr.'.
append xsource to isource.
xsource = 'ENDFORM.'.
append xsource to isource.
generate subroutine pool isource name program
message message
line line.
if sy-subrc = 0.
perform (routine) in program (program) tables r_kunnr
ikna1.
else.
write:/ message.
endif.
loop at ikna1 into xkna1.
write:/ xkna1-kunnr.
endloop.
Regards,
Rich Heilman
Similar Messages
-
Hi,
To delete data from database table using internal table I am using following statement.
DELETE dbtab FROM TABLE itab.
Itab is a sorted table.Just wondering if table type matters while deleting database entries using internal table.which is efficient table type for deleting records from database table?
Regards
NileshHi Nilesh
The row type of the internal table must be a data object with at least the same length and alignment as the key structure of the database table. The key is read according to the structure of the table line, and not that of the row type. It is a good idea to define the row type with reference to the structure of the database table.
From SAP Help
DATA: BEGIN OF WA,
CARRID TYPE SPFLI-CARRID,
CONNID TYPE SPFLI-CONNID,
END OF WA,
ITAB LIKE HASHED TABLE OF WA
WITH UNIQUE KEY CARRID CONNID.
WA-CARRID = 'UA'. WA-CONNID = '0011'.
INSERT WA INTO TABLE ITAB.
WA-CARRID = 'LH'. WA-CONNID = '1245'.
INSERT WA INTO TABLE ITAB.
WA-CARRID = 'AA'. WA-CONNID = '4574'.
INSERT WA INTO TABLE ITAB.
DELETE SPFLI FROM TABLE ITAB.
Besides, it is so technical what algorithm is run to delete records from the DB table when an internal table is given. If you want you can have a quick test using GET TIME. However, it seems logical that if your internal table is sorted with respect to any index, especially the primary index, of the DB table this may increase performance.
Regards
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a> -
Need help for record deletion from custom table
Hi friends
I have to write a custom program which will be generic to delete any table record with date field.
This program needs to be generic (should be able to delete records from any custom table) in nature with selection screen parameters as:
Table Name and Number of Days prior to which records are deleted, both mandatory.
Program Flow:
1. From number of days calculate date before which records are deleted, ( current date u2013 no. of days = past date).
2. Custom table have date field, delete records prior to that date.
3. Program may be scheduled for background job, put default values for both fields. No. of days should not be less than 60.
4. Classical Report output with number of records deleted.
My query is how will I know the name of the Date field so that I can write a DELETE query.
If I use 'DDIF_FIELDINFO_GET' it gives me all field names but how to filter out?
with regards
samikhyaHi
I have added field on the selection screen as p_fieldname and got the F4 help for it , so that the user will get the field name run time as per the table name.
Now I am facing problem while writing the DELETE query.
I wrote like
DELETE (fp_tab)
where (fp_fieldname) LE date
It is not working. I also tried with taking a string to concatenate fp_fieldname, LE and date to l_string
when I write like this:
DELETE (fp_tab)
where (l_string) , sy-subrc is getting 4 and no records are getting deleted.
I do not understand where the dynamic Delete is failing??
with reagards
Samikhya -
DELETE FROM database table takes more time...
Hi Friends,
The below statement takes more time.
LOOP AT i_final.
DELETE FROM zcisconec WHERE werks = i_final-werks
AND aufnr = i_final-aufnr
AND vornr = i_final-vornr.
ENDLOOP.
Internal table I_FINAL will have more than 80,000 records.
DB Table zcisconec have 4 primary key fields out of 10 fields.
Below 4 fields are primary key fields
WERKS
AUFNR
VORNR
MATNR
Please guide me..How to optimize it?
Regards,
VijiHI,
Check this one ,
put a break point on that delete statement and add another line of code after, like .... CHECK SY-SUBRC = 0. Now got to debug and stop at the DELETE statement, check the number of records in your DB table, now hit F5 to step to the next statement, now go back to SE16 and refresh, do you see the number change? It should.........if you are selecting the data correctly, make sure that you are getting data into the IT_ table.
DELETE zcisconec from i_final.
CALL FUNCTION 'DB_COMMIT'.
Regards,
Ansari.
Edited by: Ansari Samsudeen on Sep 15, 2009 8:14 AM -
How to record the records deleted in a table
Hi Experts
I want to run a report as a batch which should deleted the records
which are sysdate - 60 and The report should log the number of records deleted
from each table at End Of Run.
Criteria for selecting records to be deleted are as follows:
1. ZINT_DATA
u2022 ZINT_DATA.CREATED_ON <= (Today u2013 60 Days)
and ZINT_DATA.STATUS = u2018OKu2019
So I want to create a table for log history recorded as
Delete Date Log description
01.01.2008 1500 rows deleted
30.03.2008 2000 rows deleted.
30.04.2008 300 rows deleted.
Eg The table are ZINT_DATA.
The report starts like this
REPORT z_eslp_command.
DATA:
fs_zint_data TYPE zint_data.
DATA:
t_zint_data TYPE
TABLE OF
ZINT_DATA.
START-OF-SELECTION.
SELECT *
FROM ZINT_DATA
INTO TABLE t_ZINT_DATA PACKAGE SIZE 10000.
ENDSELECT.
LOOP AT t_zint_data INTO fs_zint_data.
INSERT INTO ZINT_DATA_DEL
VALUES fs_zint_data.
select count(*) from zint_data_del.
ENDLOOP.
IF sy-subrc EQ 0.
WRITE:
'DATA INSERTED FROM ZINT_DATA into ZINT_DATA_DEL'.
ENDIF.
But Instead of creating another table , I want only log to be recorded as described.
Thanks
Regards
PirozHi Kiran
See the final modification of the report but I am getting an error as
Field " Corresponding_fields" is unknown, it is neithere in one of the specified tables nor defined by a
DATA statement, but I have already created an internal table itab1 , could you check and revert with the correction.
REPORT ZSD1DELETION .
TYPE-POOLS:SLIS.
*Used in ZSDI_INTERFACE1 Program.
TABLES:ZINT_DATA_DEL .
*DATA: BEGIN OF ITAB1 OCCURS 0.
*DATA: SL_NO TYPE SY-TABIX.
INCLUDE STRUCTURE zint_data_del.
*DATA:END OF ITAB1.
DATA: BEGIN OF ITAB1 occurs 0 ,
MANDT type zint_data_del-mandt,
ZINT_ID type zint_data_del-zint_id,
ZINT_TY type zint_data_del-zint_ty,
CREATED_ON type zint_data_del-created_on,
KEY_VAL type zint_data_del-key_val,
SEQUENCE type zint_data_del-sequence,
STATUS type zint_data_del-status,
LENGTH type zint_data_del-length,
RAW_DATA type zint_data_del-raw_data,
end of itab1.
*DATA: i_data TYPE TABLE OF ITAB1, " internal table
*wa_data TYPE ITAB1. " work area
DATA:LINE1(10) TYPE C,
LINE2(10) TYPE C,
date1(10) type c,
date2(10) type c,
name1(60),
string1(100),
title1(65),
title2(100) type c,
FNAME TYPE STRING.
*Declarations for ALV
DATA:itfieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA:itrepid TYPE sy-repid.
itrepid = sy-repid.
DATA:itevent TYPE slis_t_event.
DATA:itlistheader TYPE slis_t_listheader.
DATA:walistheader LIKE LINE OF itlistheader.
DATA:itlayout TYPE slis_layout_alv.
DATA:top TYPE slis_formname.
DATA:itsort TYPE slis_t_sortinfo_alv WITH HEADER LINE.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
*PARAMETERS:P_WERKS LIKE BSEG-WERKS.
SELECT-OPTIONS: S_DATE FOR ZINT_DATA_DEL-CREATED_ON OBLIGATORY.
SELECTION-SCREEN END OF BLOCK B1.
*Validations w.r.t the Date
AT SELECTION-SCREEN ON S_DATE.
IF S_DATE IS INITIAL.
MESSAGE 'Enter the Date' type 'E'.
*Records from 2007 can't be deleted.
ELSEIF S_DATE-LOW+0(4) >= '2007' AND
S_DATE-HIGH+0(4) >= '2007'.
MESSAGE 'Records from the Year 2007 cannot be Deleted' type 'E'.
ENDIF.
CONCATENATE s_DATE-low6(2) '.' s_DATE-low4(2) '.' s_DATE-low+0(4)
INTO date1.
CONCATENATE s_DATE-high6(2) '.' s_DATE-high4(2) '.' s_DATE-high+0(4)
INTO date2.
PERFORM GETDATA.
*& Form DOWNLOAD
text
--> p1 text
<-- p2 text
form GETDATA.
SELECT * FROM ZINT_DATA_DEL
INTO CORRESPONDING_FIELDS OF TABLE ITAB1
WHERE CREATED_ON IN S_DATE.
IF ITAB1[] IS NOT INITIAL.
DESCRIBE TABLE ITAB1 LINES LINE1.
PERFORM DELETION.
PERFORM ALV.
ELSE.
MESSAGE 'No Data' type 'S'.
ENDIF.
endform. " GETDATA
*& Form DELETION
text
--> p1 text
<-- p2 text
form DELETION .
DELETE FROM ZINT_DATA_DEL WHERE CREATED_ON IN S_DATE.
endform. " DELETION
*& Form alv
Fieldcatalog for ALV Report
FORM alv.
LOOP AT ITAB1.
ITAB1-SL_NO = SY-TABIX.
MODIFY ITAB1.
ENDLOOP.
DEFINE m_fieldcat.
itfieldcat-fieldname = &1.
itfieldcat-col_pos = &2.
itfieldcat-seltext_l = &3.
itfieldcat-do_sum = &4.
itfieldcat-outputlen = &5.
itfieldcat-edit = &6.
append itfieldcat to itfieldcat.
clear itfieldcat.
END-OF-DEFINITION.
m_fieldcat 'MANDT' '' 'Client' '' 03 ''.
m_fieldcat 'ZINT_ID' '' 'Id' '' 10 ''.
m_fieldcat 'ZINT_TY' '' 'Type.' '' 05 ''.
m_fieldcat 'CREATED_ON' '' 'Date Created on' '' 25 ''.
m_fieldcat 'KEY_VAL' '' 'key value' '' 04 ''.
m_fieldcat 'SEQUENCE' '' 'sequence' '' 06 '' .
m_fieldcat 'STATUS' '' 'status.' '' 10 ''.
m_fieldcat 'LENGTH' '' 'Length.' '' 18 ''.
m_fieldcat 'RAW_DATA' '' 'Raw Data' '' 15 '' .
itlayout-zebra = 'X'.
itlayout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = itlayout
i_callback_user_command = ' '
i_callback_top_of_page = 'TOP'
it_fieldcat = itfieldcat[]
i_save = 'A'
is_variant = ITVARIANT
it_events = itevent[]
is_print = ITPRINTPARAMS
it_sort = itsort[]
TABLES
t_outtab = itAB1
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.
ENDFORM. "alv
*& Form TOP
Top of page for ALV Report
FORM top.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = itevent
EXCEPTIONS
LIST_TYPE_WRONG = 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.
string1 = 'Records from'.
CONCATENATE string1 date1 'to' date2 INTO title1
SEPARATED BY space.
walistheader-typ = 'H'.
walistheader-info = title1.
APPEND walistheader TO itlistheader.
CONCATENATE 'Records Deleted' '-' LINE1 INTO title2.
walistheader-typ = 'H'.
walistheader-info = title2.
APPEND walistheader TO itlistheader.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = itlistheader
I_LOGO = ''.
I_END_OF_LIST_GRID =
ENDIF.
CLEAR itlistheader.
ENDIF.
ENDFORM. "TOP
Regrds
Piroz -
I want to delete the transactional record from database table
Hai,
I want to delete the transactional data from database table with out using the dialog programming is it there any trancation for this.
for master data we have the transaction code for delete the records. The t.code is 'OBR2'.
Plz help in that cse.
Thanks and regards,
P.Naganjana ReddyHai,
Plz help me urgent.
I am asking i want to delete transactional data from database table without using the dialog programming.
Thanks and Regards,
P.Naganjana -
Reg:How to delete the column in table control also from database table.
Hi Experts,
Once again thank u all for giving the responses.
one more doubt is how to delete the columns of table control and also the record shold delete from ztable.
With Regards,
Saroja.P.Hi,
If you want to delete the rows in the table control and simultaneously delete it from the database table, then you can implement a 'DELETE' functionality specific to your table control. Have a MARK field (you will find that in the screen attributes of the table control -> give a name for the MARK field, you will find an additional MARK column at the beginning of your table control). You can check whatever rows you want to delete from the table control, call the delete module.
"This portion of code inside the LOOP...ENDLOOP.
IF sy-ucomm eq 'F_DELETE'.
gt_itab2-check = mark. " Store the MARK field status into your internal table's correspoding field 'check'
MODIFY gt_itab INDEX tabcontrol-current_line.
ENDIF.
iF sy-ucomm eq 'DELETE1'.
DELETE gt_itab WHERE check eq 'X'. "Your internal table does not have rows that you want to delete
ENDIF.
Now you can modify your database table using the MODIFY statement.
MODIFY ZDB FROM TABLE gt_itab. -
How to delete a row from database table in facade client
Hi all,
I followed the tutorial in creating a persistence entity from database table, then a session facade. Then I followed the tutorial to create a sample client to test the model. In the session facade, I could use persistEntity method to insert a record to the database. I am just thinking of an extension to the tutorial, i.e., being able to delete the record too. So I created a new method removeEntity in the session facade
public void removeEntity(Object entity) {
entity=em.merge(entity);
em.remove(entity);
em.flush();
and called it in the sample client. It was executed without any error, but the record in the table still exists.
I tried to look around for a solution, but I did not find one. Would anybody here please help out? Many thanks in advance!Hi Frank,
I tried the code snippet, but I got the following exception when executing this code:
javax.ejb.EJBException: EJB Exception: ; nested exception is:
java.lang.IllegalStateException: The method public abstract javax.persistence.EntityTransaction javax.persistence.EntityManager.getTransaction() cannot be invoked in the context of a JTA EntityManager.; nested exception is: java.lang.IllegalStateException: The method public abstract javax.persistence.EntityTransaction javax.persistence.EntityManager.getTransaction() cannot be invoked in the context of a JTA EntityManager.
java.lang.IllegalStateException: The method public abstract javax.persistence.EntityTransaction javax.persistence.EntityManager.getTransaction() cannot be invoked in the context of a JTA EntityManager.
at weblogic.deployment.BasePersistenceContextProxyImpl.validateInvocation(BasePersistenceContextProxyImpl.java:121)
at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:86)
at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:91)
at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:80)
at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:26)
at $Proxy141.getTransaction(Unknown Source)
at model.SessionEJBBean.removeEntity(SessionEJBBean.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:55)
at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy143.removeEntity(Unknown Source)
at model.SessionEJB_qxt9um_SessionEJBImpl.removeEntity(SessionEJB_qxt9um_SessionEJBImpl.java:142)
at model.SessionEJB_qxt9um_SessionEJBImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
javax.ejb.EJBException: EJB Exception: ; nested exception is:
java.lang.IllegalStateException: The method public abstract javax.persistence.EntityTransaction javax.persistence.EntityManager.getTransaction() cannot be invoked in the context of a JTA EntityManager.; nested exception is: java.lang.IllegalStateException: The method public abstract javax.persistence.EntityTransaction javax.persistence.EntityManager.getTransaction() cannot be invoked in the context of a JTA EntityManager.
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.unwrapRemoteException(RemoteBusinessIntfProxy.java:109)
at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:91)
at $Proxy0.removeEntity(Unknown Source)
at model.SessionEJBClient.main(SessionEJBClient.java:71)
Caused by: java.lang.IllegalStateException: The method public abstract javax.persistence.EntityTransaction javax.persistence.EntityManager.getTransaction() cannot be invoked in the context of a JTA EntityManager.
at weblogic.deployment.BasePersistenceContextProxyImpl.validateInvocation(BasePersistenceContextProxyImpl.java:121)
at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:86)
at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:91)
at weblogic.deployment.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:80)
at weblogic.deployment.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:26)
at $Proxy141.getTransaction(Unknown Source)
at model.SessionEJBBean.removeEntity(SessionEJBBean.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
at weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:55)
at com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:50)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
at com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
at com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy143.removeEntity(Unknown Source)
at model.SessionEJB_qxt9um_SessionEJBImpl.removeEntity(SessionEJB_qxt9um_SessionEJBImpl.java:142)
at model.SessionEJB_qxt9um_SessionEJBImpl_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
at weblogic.rmi.cluster.ClusterableServerRef.invoke(ClusterableServerRef.java:230)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:473)
at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
Process exited with exit code 0. -
Deletion of Rec from Database table
Hi,
I need to delete records from database table based on a particular field as below.
DELETE FROM dbtable
WHERE specid = specid .
Can U please help me in the syntax of the code.
I promise to reward.
Thanks & regards.hi
try this
DELETE FROM ZICM_ORD_PRCTRC WHERE VBELN = WA_ZICM_ORD_PRCTRC-VBELN
AND
POSNR = WA_ZICM_ORD_PRCTRC-POSNR.
regards,
muralidhar. -
Access is not inserting, updating or deleting records in my database table on the server
I am having a problem with an application I developed using Dreamweaver 8 and Access 2000 several years ago which is no longer working correctly. The problem is that Access is not inserting, updating or deleting records in my database table on the server but is reflected in changes to my Web site. I used the Dreamweaver server behaviors: insert record, update record and delete record to make the changes to my Access table on the server. My Access table on the server shows all of the records I inserted or updated in the past, but not any of the newly inserted on updated records.
does any one have any ideas as to what my problem is?
JimNo, that has nothing to do with your problem. Let's make sure I understand the symptoms.
1) Your site is online at a remote host.
2) You use a dynamic page in your online site to update a database record (insert, delete, or update)
3) The update then appears correctly on your dynamic content page.
4) You download the mdb and it appears to not have any of the upates you just made.
Please correct any of these statements if they are wrong.
If the above is correct, then you must be looking at a cached mdb, or the mdb you are looking at is in the wrong location. Do this: search your entire drive for copies of the mdb, including in the Windows temp directories which is likely where the cached copy is located. Delete any extra copies and download again. -
Delete entries from Database table t71inp1
Hi,
I want to Delete entries from Database table t71inp1. Its a H R Table. I want to know the exact code.
i saw the cide delete bkpf where usnam = p_name.
Will it work the same here. Also.
Please let me know.
I hope to get reply from you soon.
where should i write the code. i.e. Tcode SE38 and directly deeleting write the code.
Please give me some inputs. I am new to H R ABAp
Shivakumar K B
919886920258hi
You can write a program in se38.
create a program.
use delete from t71inp1 where<condition> command in it. -
Delete entry from Database table
Hi,
I configured one PCR scenerio in SPRO node -> business Packakes/ funtional packages-> Manager self service-> Personal Change request -> Group Change request scenerio.
later I deleted that entry in backend, but still the same entry exist in db table "TWPC_PCR_Groups" .
How can we delete that entry?
thanksHi,
If you just want to delete a single entry from database table then you have to it in debug mode .
go to se11->Give table name->Press F7( ie: display table entries)-> Goto the table contents (CTRLSHIFTF10)->Select the entry you want to delete->Give /H in the command bar ->enter into debug mode-> Give code as DELE -> save it. and press enter. Your entry will be deleted from database.
Hope this helps.. -
Dear all experts,
I am able to populate all fields data from database table, using dynamic table creation.
eg,
SELECT * FROM (w_tabname) INTO TABLE <t_itab>.
where w_tabname is the table name given by the user, and t_itab is field symbol.
but some requirement is like that i need to pick up only few fields, <b>which user will give at the runtime.</b>
<b>I can</b> take those fields from file into any internal table,
but the problem is that instead of <b>select *</b>, i need to put selected the fields given by user.
i have tried with field symbol, it is not working (as per my knowledge.)
do i need to create any structures dynamically ?
Can anybody please help in this regards ?
Your help will be surely rewarded with points.
Waiting for reply..
Regards
VinayHi Vinay ,
Adding to the below code , you can use some more fields in the select stmt as below:-
REPORT ychatest.
PARAMETERS : p_field1 LIKE dd03l-fieldname,
P_field2 LIKE dd03l-fieldname,
p_table LIKE dd03l-tabname.
FIELD-SYMBOLS : <fs> TYPE STANDARD TABLE.
SELECT (p_field1) (p_field2) ( FROM (p_table) INTO TABLE <fs>.
Now p_field1 & p_field2 belong to the same table since you have give the user to enter only one table name.
This should work fine.
please try & let me know .
Thanks & Regards,
Daniel -
Retrive last inserted record from database table
Hi,
some body inserting a record into table 'A' through some procedure/java program.i want to retrive the last inserted record from database table.records are not stored in order.Can any body help me.In general, unless you are storing a timestamp as part of the row or you have some sort of auditing in place, Oracle has no idea what the "first" or "last" record in a table is. Nor does it track when a row was inserted.
- If you have the archived logs from the point in time when the row was inserted, you could use LogMiner to find the timestamp
- If the insert happened recently (i.e. within hours), you may be able to use flashback query to get the value
- If you're on 10g or later and the table was built with ROWDEPENDENCIES and the insert happened in the last few days and you can deal with a granularity of a few seconds and you don't need 100% accuracy, you could get the ORA_ROWSCN of the row and convert that to a timestamp.
If this is something you contemplate needing, you need to store the data in the row or set up some sort of auditing.
Justin -
Fetch last record from database table
hi,
how to fetch last record from database table.
plz reply earliest.
Regards,
Jyotsna
Moderator message - Please search before asking - post locked
Edited by: Rob Burbank on Dec 11, 2009 9:44 AMabhi,
just imagine the table to be BSEG or FAGLFLEXA... then what would be performance of the code ?
any ways,
jyotsna, first check if you have a pattern to follow like if the primary key field have a increasing number range or it would be great if you find a date field which stores the inserted date or some thing..
you can select max or that field or order by descending using select single.
or get all data.. sort in descending order.(again you need some criteria like date).
read the first entry. using read itab index 1
Maybe you are looking for
-
Custom meego ui on the n900 !!!!!!
Yes !! the digia custom meego ui running on the n900, thats right, not meego, a meego with the awesomest (if thats a word) custom ui i've ever seen . remember your looking at one months work by a single developer, its obviously nowhere near a finishe
-
"My Content"-link not working in MySite in 2010 mode
I'm trying out upgrading our Sharepoint 2010 to Sharepoint 2013 but keeping it in Sharepoint 2010 mode (or v14 mode if you will) until we've had a chance to educate our users on the new UI and Everything. Right now everything works good but there is
-
Sales report: Profit center wise includes net, gross and sales tax URGENT
Helllo Friends, Please help me on the below report Client requirement is: Sales report which includes the below 1. Profit center 2. Net sales 3. Sales tax 4. Gross sales 5. Period Please help me Thanks for your help in advance Narasim
-
I have been using Mozilla Firefox for ages on my laptop, using Windows 7. I use Yahoo mail for my e-mails. Today, when I booted up, I received a message from Yahoo saying that my "screen resolution is TOO LOW". Never had this before!!! I tried your h
-
if you have a .mac account - OR - you are posting your iWeb site on your own server - let us know the url so we can have a look at REAL WORLD examples. good would also be if you discribe how "easy" it was to create the site, or how difficult, what yo