Problem in deleting detail records....
Hi!
i Have found CustomerInfo Object (with cascade="all" attribute in configuration file),and now trying to update it i do the following
Set a = customerInfo.getCustomerAccounts();
/*customerAccount1 with no primery key (i want to save this record for first time)
a.add(customerAccount1);
/*customerAccount2 with primery key i want this record to be updated in database
a.add(customerAccount2);
/*customerAccount3 with pk i want this record to be deleted
a.remove(customerAccount3);
but when i try to session.saveUpdate(customerInfo) and then session.close(),i get following exception.
net.sf.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: 474, of class: com.cstel.personalloan.hibernate.CustomerAccount
Can anybody plz tell me where i am doing something wrong.
also there is a case where i want to first delete all those old records in a set and then add new records to it , i am using a.clear() for that is that ok r i should have to do something else for it.
thanks in advance.
sorry but it is basically a hibernate related question nothing to do with jsp , but since i didnt find any hibernaet forum here i had to post it on this forum,sorry for that
Similar Messages
-
Problem in deleting child record
Hi,
I have a requirement to remove the child records.
I have two database tables (without any foreign key or database constraints). I have created EOs (ParentEO and ChildEO) and Association. I have created view objects (ParentVO with a transient attribute called "SelectFlag" and ChildVO) based on EOs.
I have created a MollyViewLink and created Application module (MollyAM) .VOs are associated with AM.
For detail records, I have created delete icon and I have written below code to handle the deleteChild event in detail region's controller:
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);
if ("deleteChild".equals(pageContext.getParameter(EVENT_PARAM)))
MollyAMImpl am = (MollyAMImpl)pageContext.getApplicationModule(webBean);
String rowReference = pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFERENCE);
System.out.println("Child ROW Reference =="+rowReference);
MollyUserDetailsVORowImpl voRow = (MollyUserDetailsVORowImpl)am.findRowByRef(rowReference);
String parentID = voRow.getId().toString();
System.out.println("ID is : "+ parentID);
voRow.remove();
System.out.println("Child row deleted successfully...");
am.getTransaction().commit();
When I click on delete icon at child record, I get below SOP messages:
Child ROW Reference ==MollyAM.MollyUserDetailsVO_MollyViewLink_MollyUserDetailsVO:MollyUserDetailsVO_MollyViewLink_MollyUserDetailsVO_0{null}
ID is : 52
Child row deleted successfully...
Child record is also being removed from UI. But when I query the database, I can still see the records there. For me, it seems like commit is not affecting the child table.
Similar code to delete the parent record is working fine.
Thanks!!!Hi Vinod ,
I am deleting condition record number if know any function module please let me know
problem happing in PRD for particular condition numer it showing INTERNAL ERROR (This is the condition table A923)
that condition number is their in KONH but not their in KONP because of that INTERNAL ERROR occuring
for that i have writen code for that deleting the condition number ....
if know any thing please let me know -
Problem after deleting the records........
Hi Folks,
Kindly help me with this report.
At one point I am deleting the itfinal internal table w.r.t
to HKONT.Before deleting I am having all the values for
LIFNR and AWKey,but once deleting(as mentioned earlier) I
am not getting these two values.The same Awkey is getting repeated
again and again.
Where I am going wrong.
REPORT zf14 no standard page heading line-size 134. .
TABLES: bkpf,bseg,lfa1,t001.
type-pools:slis.
TYPES : BEGIN OF x_bkpf,
bukrs TYPE bkpf-bukrs, " Company Code
belnr TYPE bkpf-belnr, " Document Number
gjahr TYPE bkpf-gjahr, " Fiscal year
awkey TYPE bkpf-awkey, " Object Key
bldat TYPE bkpf-bldat,
budat TYPE bkpf-budat,
END OF x_bkpf.
TYPES : BEGIN OF x_bseg,
bukrs TYPE bseg-bukrs, " Company Code
belnr TYPE bseg-belnr, " Document Number
gjahr TYPE bseg-gjahr, " Fiscal Year
koart TYPE bseg-koart,
hkont TYPE bseg-hkont, " G/L Account
ebeln TYPE bseg-ebeln, " Purchasing Document
lifnr TYPE bseg-lifnr, " Vendor Code
name1 type lfa1-name1,
ort01 type lfa1-ort01,
END OF x_bseg.
TYPES : BEGIN OF x_bseg1,
bukrs TYPE bseg-bukrs, " Company Code
belnr TYPE bsak-belnr, " Document Number
gjahr TYPE bsak-gjahr, " Fiscal Year
hkont TYPE bseg-hkont, " G/L Account
ebeln TYPE bseg-ebeln, " Purchasing Document
lifnr TYPE bseg-lifnr, " Vendor Code
wrbtr TYPE bseg-wrbtr, " Amt.in Doc.Curr
END OF x_bseg1.
types:begin of x_ven,
name1 type lfa1-name1,
ort01 type lfa1-ort01,
end of x_ven.
TYPES : BEGIN OF x_final,
bukrs TYPE bkpf-bukrs, " Company Code
belnr TYPE bkpf-belnr, " Document Number
gjahr TYPE bkpf-gjahr, " Fiscal year
blart TYPE bkpf-blart, " Document Type
awkey TYPE bkpf-awkey, " Object Key
bldat TYPE bkpf-bldat,
budat TYPE bkpf-budat,
mwskz TYPE bseg-mwskz,
qsskz TYPE bseg-qsskz,
wrbtr TYPE bseg-wrbtr, " Amount in Doc Curr
werks TYPE bseg-werks, " Recv Facility Code
hkont TYPE bseg-hkont, " G/L Account
ebeln TYPE bseg-ebeln, " Purchasing Document
ebeln1 type bseg-ebeln,
lifnr TYPE bseg-lifnr, " Vendor Code
lifnr1 type bseg-lifnr,
dmbtr TYPE bseg-dmbtr,
wrtbr type bseg-wrbtr,
vbill type bseg-wrbtr,
tdsamt type c,
tdsrate(4),
shkzg TYPE bseg-shkzg,
name1 TYPE lfa1-name1, "vendor Name
ort01 TYPE lfa1-ort01, "City
j_1icstno TYPE j_1imovend-j_1icstno, "CST
j_1ilstno TYPE j_1imovend-j_1ilstno ,"LST
END OF x_final.
DATA : it_bkpf TYPE TABLE OF x_bkpf WITH HEADER LINE .
DATA : it_bseg TYPE TABLE OF x_bseg WITH HEADER LINE .
DATA : it_bseg1 TYPE TABLE OF x_bseg1 WITH HEADER LINE .
DATA : itfinal TYPE TABLE OF x_final WITH HEADER LINE.
DATA : month_names LIKE t247 OCCURS 0 WITH HEADER LINE.
DATA :i(2), "month
y TYPE int4, "year
c(4),
v_bill LIKE bseg-dmbtr. " bill value
DATA : pos TYPE sy-tabix,
month(99),
month1(99).
data:sl_no(3) value 0.
*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.
DATA:itprintparams TYPE slis_print_alv.
DATA:itvariant TYPE disvariant.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_bukrs LIKE t001-bukrs OBLIGATORY. "Company code
SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr, "Vendor name
s_budat for sy-datum obligatory, "bkpf-budat OBLIGATORY, "Date
s_gjahr FOR bseg-gjahr NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN.
SELECT SINGLE bukrs
INTO t001-bukrs
FROM t001
WHERE bukrs = p_bukrs.
IF sy-subrc <> 0.
MESSAGE e000(z_ma) WITH 'Invalid Company Code'.
ENDIF.
IF NOT s_lifnr[] IS INITIAL.
SELECT SINGLE lifnr
INTO lfa1-lifnr
FROM lfa1
WHERE lifnr IN s_lifnr.
IF sy-subrc <> 0.
MESSAGE e000(z_ma) WITH 'Invalid Vendor'.
ENDIF.
ENDIF.
START-OF-SELECTION.
*13
if s_budat is not initial.
if s_budat-high is not initial.
while s_budat-low le s_budat-high.
i = s_budat+7(2).
if i > 3.
s_gjahr = s_budat+3(4).
append s_gjahr.
else.
c = s_budat+3(4).
S_GJAHR = C - 1.
append s_gjahr.
endif.
s_budat-low = s_budat-low + 1.
endwhile.
else.
i = s_budat+7(2).
if i > 3.
s_gjahr = s_budat+3(4).
append s_gjahr.
else.
c = s_budat+3(4).
S_GJAHR = C - 1.
append s_gjahr.
endif.
endif.
endif.
*13
SELECT bukrs belnr gjahr awkey bldat budat
INTO TABLE it_bkpf
FROM bkpf
WHERE bukrs = p_bukrs
AND budat IN s_budat
and gjahr = s_gjahr. "13
IF NOT it_bkpf[] IS INITIAL.
SELECT bukrs belnr dmbtr wrbtr hkont ebeln lifnr
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE it_bseg
FOR ALL ENTRIES IN it_bkpf
WHERE bukrs = it_bkpf-bukrs
and belnr = it_bkpf-belnr
AND gjahr = s_gjahr "13-it_bkpf-gjahr
AND koart = 'K'.
ENDIF.
IF NOT it_bseg[] IS INITIAL.
SELECT belnr gjahr dmbtr wrbtr hkont ebeln lifnr
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE it_bseg1
FOR ALL ENTRIES IN it_bkpf
WHERE bukrs = it_bkpf-bukrs "13it_bkpf-bukrs
AND belnr = it_bkpf-belnr "13it_bkpf-belnr
AND gjahr = s_gjahr. "13-it_bkpf-gjahr.
ENDIF.
LOOP AT it_bkpf.
MOVE-CORRESPONDING it_bkpf TO itfinal.
APPEND itfinal.
ENDLOOP.
LOOP AT it_bseg.
MOVE-CORRESPONDING it_bseg TO itfinal.
append itfinal.
select single name1 ort01 from lfa1 into (itfinal-name1 , itfinal-ort01) where lifnr = it_bseg-lifnr.
select single j_1icstno j_1ilstno into (itfinal-j_1icstno , itfinal-j_1ilstno) from j_1imovend
where lifnr = it_bseg-lifnr.
ENDLOOP.
LOOP AT it_bseg1.
MOVE-CORRESPONDING it_bseg1 TO itfinal.
APPEND itfinal.
ENDLOOP.
loop at it_bseg1.
itfinal-ebeln1 = it_bseg1-ebeln.
append itfinal.
endloop.
*Deleting the records from ITFINAL w.r.t HKONT.
<b>LOOP AT itfinal.
IF itfinal-hkont NE '0020106230' AND
itfinal-hkont NE '0020106330'.
DELETE itfinal.
endif.
clear itfinal.
ENDLOOP.</b>
*Caluculating Bill Value
loop at itfinal.
if itfinal-hkont = '0020106230'.
itfinal-tdsrate = '2%'.
itfinal-vbill = itfinal-wrbtr * 100 / 2.
modify itfinal.
elseif itfinal-hkont = '0020106330'.
itfinal-tdsrate = '4%'.
itfinal-vbill = itfinal-wrbtr * 100 / 4.
modify itfinal.
endif.
endloop.
sort itfinal by belnr.
delete adjacent duplicates from itfinal comparing belnr.
format reset.
format color col_normal.
LOOP AT itfinal.
sl_no = sl_no + 1.
write:/ sy-vline,
2 sl_no,
7 sy-vline,
10 itfinal-ebeln1,
21 sy-vline,
23 itfinal-awkey,
44 sy-vline,
45 itfinal-bldat,
57 sy-vline,
60 itfinal-vbill,
75 sy-vline,
76 itfinal-tdsrate,
85 sy-vline,
89 itfinal-wrbtr,
106 sy-vline,
109 itfinal-belnr,
121 sy-vline,
124 itfinal-budat,
134 sy-vline.
ENDLOOP.
write:/ sy-uline.
top-of-page.
data : name1(60).
data : month_text(127),
string(99).
call function 'MONTH_NAMES_GET'
exporting
language = sy-langu
IMPORTING
RETURN_CODE =
tables
month_names = month_names[]
exceptions
month_names_not_found = 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.
format reset.
format color col_positive.
if not s_budat-low is initial .
read table month_names with key mnr = s_budat-low+4(2).
if sy-subrc = 0.
month = month_names-ltx.
string = 'Details of TDS (2% / 4%) On Works Contract Deducted'.
concatenate string 'for the Month of' month into month_text
separated by space.
write :/ month_text.
skip 1.
endif.
endif.
concatenate itfinal-name1 ',' itfinal-ort01
into name1 separated by space.
write :/ 'Vendor Code :', itfinal-lifnr.
write :/ 'Vendor Name and City :', name1.
skip 1.
write :/ 'TNGST Registration No :', itfinal-j_1ilstno,
/ 'CST Registration No :', itfinal-j_1icstno.
skip 1.
Display the coloumn headings
format reset.
format color col_heading.
write :/ sy-uline.
write:/ sy-vline,
2 'Sl_no',
7 sy-vline,
10 'P.O. No',
21 sy-vline,
22 'Invoice No',
44 sy-vline,
45 'Inv Date',
57 sy-vline,
60 'Bill value',
75 sy-vline,
76 'TDS Rate',
85 sy-vline,
89 'TDS Amount' ,
106 sy-vline,
108 'Doc.No.',
121 sy-vline,
125 'Pos Date',
134 sy-vline,
sy-uline.
K.Kiran.Kiran,
I am pasting code here and i am sure that the code should work now
REPORT zf14 no standard page heading line-size 134. .
TABLES: bkpf,bseg,lfa1,t001.
type-pools:slis.
TYPES : BEGIN OF x_bkpf,
bukrs TYPE bkpf-bukrs, " Company Code
belnr TYPE bkpf-belnr, " Document Number
gjahr TYPE bkpf-gjahr, " Fiscal year
awkey TYPE bkpf-awkey, " Object Key
bldat TYPE bkpf-bldat,
budat TYPE bkpf-budat,
END OF x_bkpf.
TYPES : BEGIN OF x_bseg,
bukrs TYPE bseg-bukrs, " Company Code
belnr TYPE bseg-belnr, " Document Number
gjahr TYPE bseg-gjahr, " Fiscal Year
koart TYPE bseg-koart,
hkont TYPE bseg-hkont, " G/L Account
ebeln TYPE bseg-ebeln, " Purchasing Document
lifnr TYPE bseg-lifnr, " Vendor Code
name1 type lfa1-name1,
ort01 type lfa1-ort01,
END OF x_bseg.
TYPES : BEGIN OF x_bseg1,
bukrs TYPE bseg-bukrs, " Company Code
belnr TYPE bsak-belnr, " Document Number
gjahr TYPE bsak-gjahr, " Fiscal Year
hkont TYPE bseg-hkont, " G/L Account
ebeln TYPE bseg-ebeln, " Purchasing Document
lifnr TYPE bseg-lifnr, " Vendor Code
wrbtr TYPE bseg-wrbtr, " Amt.in Doc.Curr
END OF x_bseg1.
types:begin of x_ven,
name1 type lfa1-name1,
ort01 type lfa1-ort01,
end of x_ven.
TYPES : BEGIN OF x_final,
bukrs TYPE bkpf-bukrs, " Company Code
belnr TYPE bkpf-belnr, " Document Number
gjahr TYPE bkpf-gjahr, " Fiscal year
blart TYPE bkpf-blart, " Document Type
awkey TYPE bkpf-awkey, " Object Key
bldat TYPE bkpf-bldat,
budat TYPE bkpf-budat,
mwskz TYPE bseg-mwskz,
qsskz TYPE bseg-qsskz,
wrbtr TYPE bseg-wrbtr, " Amount in Doc Curr
werks TYPE bseg-werks, " Recv Facility Code
hkont TYPE bseg-hkont, " G/L Account
ebeln TYPE bseg-ebeln, " Purchasing Document
ebeln1 type bseg-ebeln,
lifnr TYPE bseg-lifnr, " Vendor Code
lifnr1 type bseg-lifnr,
dmbtr TYPE bseg-dmbtr,
wrtbr type bseg-wrbtr,
vbill type bseg-wrbtr,
tdsamt type c,
tdsrate(4),
shkzg TYPE bseg-shkzg,
name1 TYPE lfa1-name1, "vendor Name
ort01 TYPE lfa1-ort01, "City
j_1icstno TYPE j_1imovend-j_1icstno, "CST
j_1ilstno TYPE j_1imovend-j_1ilstno ,"LST
END OF x_final.
DATA : it_bkpf TYPE TABLE OF x_bkpf WITH HEADER LINE .
DATA : it_bseg TYPE TABLE OF x_bseg WITH HEADER LINE .
DATA : it_bseg1 TYPE TABLE OF x_bseg1 WITH HEADER LINE .
DATA : itfinal TYPE TABLE OF x_final WITH HEADER LINE.
DATA : month_names LIKE t247 OCCURS 0 WITH HEADER LINE.
DATA :i(2), "month
y TYPE int4, "year
c(4),
v_bill LIKE bseg-dmbtr. " bill value
DATA : pos TYPE sy-tabix,
month(99),
month1(99).
data:sl_no(3) value 0.
*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.
DATA:itprintparams TYPE slis_print_alv.
DATA:itvariant TYPE disvariant.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_bukrs LIKE t001-bukrs OBLIGATORY. "Company code
SELECT-OPTIONS : s_lifnr FOR lfa1-lifnr, "Vendor name
s_budat for sy-datum obligatory, "bkpf-budat OBLIGATORY, "Date
s_gjahr FOR bseg-gjahr NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN.
SELECT SINGLE bukrs
INTO t001-bukrs
FROM t001
WHERE bukrs = p_bukrs.
IF sy-subrc <> 0.
MESSAGE e000(z_ma) WITH 'Invalid Company Code'.
ENDIF.
IF NOT s_lifnr[] IS INITIAL.
SELECT SINGLE lifnr
INTO lfa1-lifnr
FROM lfa1
WHERE lifnr IN s_lifnr.
IF sy-subrc <> 0.
MESSAGE e000(z_ma) WITH 'Invalid Vendor'.
ENDIF.
ENDIF.
START-OF-SELECTION.
*13
if s_budat is not initial.
if s_budat-high is not initial.
while s_budat-low le s_budat-high.
i = s_budat+7(2).
if i > 3.
s_gjahr = s_budat+3(4).
append s_gjahr.
else.
c = s_budat+3(4).
S_GJAHR = C - 1.
append s_gjahr.
endif.
s_budat-low = s_budat-low + 1.
endwhile.
else.
i = s_budat+7(2).
if i > 3.
s_gjahr = s_budat+3(4).
append s_gjahr.
else.
c = s_budat+3(4).
S_GJAHR = C - 1.
append s_gjahr.
endif.
endif.
endif.
*13
SELECT bukrs belnr gjahr awkey bldat budat
INTO TABLE it_bkpf
FROM bkpf
WHERE bukrs = p_bukrs
AND budat IN s_budat
and gjahr = s_gjahr. "13
IF NOT it_bkpf[] IS INITIAL.
SELECT bukrs belnr dmbtr wrbtr hkont ebeln lifnr
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE it_bseg
FOR ALL ENTRIES IN it_bkpf
WHERE bukrs = it_bkpf-bukrs
and belnr = it_bkpf-belnr
AND gjahr = s_gjahr "13-it_bkpf-gjahr
AND koart = 'K'.
ENDIF.
IF NOT it_bseg[] IS INITIAL.
SELECT belnr gjahr dmbtr wrbtr hkont ebeln lifnr
FROM bseg
INTO CORRESPONDING FIELDS OF TABLE it_bseg1
FOR ALL ENTRIES IN it_bkpf
WHERE bukrs = it_bkpf-bukrs "13it_bkpf-bukrs
AND belnr = it_bkpf-belnr "13it_bkpf-belnr
AND gjahr = s_gjahr. "13-it_bkpf-gjahr.
ENDIF.
LOOP AT it_bkpf.
MOVE-CORRESPONDING it_bkpf TO itfinal.
APPEND itfinal.
ENDLOOP.
LOOP AT it_bseg.
MOVE-CORRESPONDING it_bseg TO itfinal.
append itfinal.
select single name1 ort01 from lfa1 into (itfinal-name1 , itfinal-ort01) where lifnr = it_bseg-lifnr.
select single j_1icstno j_1ilstno into (itfinal-j_1icstno , itfinal-j_1ilstno) from j_1imovend
where lifnr = it_bseg-lifnr.
ENDLOOP.
LOOP AT it_bseg1.
MOVE-CORRESPONDING it_bseg1 TO itfinal.
APPEND itfinal.
ENDLOOP.
loop at it_bseg1.
itfinal-ebeln1 = it_bseg1-ebeln.
append itfinal.
endloop.
*Deleting the records from ITFINAL w.r.t HKONT.
LOOP AT itfinal.
IF itfinal-hkont NE '0020106230' AND
itfinal-hkont NE '0020106330'.
DELETE itfinal.
clear itfinal.
continue.
else.
clear itfinal.
endif.
ENDLOOP.
*Caluculating Bill Value
loop at itfinal.
if itfinal-hkont = '0020106230'.
itfinal-tdsrate = '2%'.
itfinal-vbill = itfinal-wrbtr * 100 / 2.
modify itfinal.
elseif itfinal-hkont = '0020106330'.
itfinal-tdsrate = '4%'.
itfinal-vbill = itfinal-wrbtr * 100 / 4.
modify itfinal.
endif.
endloop.
sort itfinal by belnr.
delete adjacent duplicates from itfinal comparing belnr.
format reset.
format color col_normal.
LOOP AT itfinal.
sl_no = sl_no + 1.
write:/ sy-vline,
2 sl_no,
7 sy-vline,
10 itfinal-ebeln1,
21 sy-vline,
23 itfinal-awkey,
44 sy-vline,
45 itfinal-bldat,
57 sy-vline,
60 itfinal-vbill,
75 sy-vline,
76 itfinal-tdsrate,
85 sy-vline,
89 itfinal-wrbtr,
106 sy-vline,
109 itfinal-belnr,
121 sy-vline,
124 itfinal-budat,
134 sy-vline.
ENDLOOP.
write:/ sy-uline.
top-of-page.
data : name1(60).
data : month_text(127),
string(99).
call function 'MONTH_NAMES_GET'
exporting
language = sy-langu
IMPORTING
RETURN_CODE =
tables
month_names = month_names[]
exceptions
month_names_not_found = 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.
format reset.
format color col_positive.
if not s_budat-low is initial .
read table month_names with key mnr = s_budat-low+4(2).
if sy-subrc = 0.
month = month_names-ltx.
string = 'Details of TDS (2% / 4%) On Works Contract Deducted'.
concatenate string 'for the Month of' month into month_text
separated by space.
write :/ month_text.
skip 1.
endif.
endif.
concatenate itfinal-name1 ',' itfinal-ort01
into name1 separated by space.
write :/ 'Vendor Code :', itfinal-lifnr.
write :/ 'Vendor Name and City :', name1.
skip 1.
write :/ 'TNGST Registration No :', itfinal-j_1ilstno,
/ 'CST Registration No :', itfinal-j_1icstno.
skip 1.
Display the coloumn headings
format reset.
format color col_heading.
write :/ sy-uline.
write:/ sy-vline,
2 'Sl_no',
7 sy-vline,
10 'P.O. No',
21 sy-vline,
22 'Invoice No',
44 sy-vline,
45 'Inv Date',
57 sy-vline,
60 'Bill value',
75 sy-vline,
76 'TDS Rate',
85 sy-vline,
89 'TDS Amount' ,
106 sy-vline,
108 'Doc.No.',
121 sy-vline,
125 'Pos Date',
134 sy-vline,
sy-uline.
Thanks
seshu -
Getting Problem after Deleting a record from Record Store
I am trying to create a simple application for mobile device. This application storing some records. I used RMS for this. These records i show in a list. But i tried to show list of records after deleting any record then list shows only prior records of deleted records n then shows exception as
Recordsjavax.microedition.rms.InvalidRecordIDException
The code i written as follows
For storing data
public void storeExercise(String EName, String Etime)
try
//System.out.println("AAAA");
recordstore = RecordStore.openRecordStore("Test3",true);
catch (Exception error)
//System.out.println("EEEE");
System.out.println("Exception"+error);
try
byte[] outputRecord;
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
DataOutputStream outputdataStream = new DataOutputStream(outputStream);
outputdataStream.writeUTF(EName);
outputdataStream.writeUTF(Etime);
outputdataStream.flush();
outputRecord = outputStream.toByteArray();
recordstore.addRecord(outputRecord, 0, outputRecord.length);
outputStream.reset();
outputStream.close();
outputdataStream.close();
zlist.append(EName+Etime, null);
display.setCurrent(zlist);
catch (Exception error)
System.out.println("Exception in writing Records"+error);
for getting records
public void getExercise(ZimList zlist)
this.zlist = zlist;
try
//System.out.println("AAAA");
recordstore = RecordStore.openRecordStore("Test3",true);
//recordstore.closeRecordStore();
catch (Exception error)
//System.out.println("EEEE");
System.out.println("Exception"+error);
try
//System.out.println("Hello");
String Ename = null;
String Etime = null;
byte[] byteInputData = new byte[100];
ByteArrayInputStream inputStream = new ByteArrayInputStream(byteInputData);
DataInputStream inputDataStream = new DataInputStream(inputStream);
for (int x=1; x<= recordstore.getNumRecords() ; x++ )
System.out.println("Record Id ="+x);
//if (x != InvalidRecordID)
recordstore.getRecord(x, byteInputData, 0);
Ename = inputDataStream.readUTF();
Etime = inputDataStream.readUTF();
inputStream.reset();
Final = Ename + Etime;
System.out.println("Insert" + Final);
zlist.insert(x-1,Final,null);
inputStream.close();
inputDataStream.close();
//recordstore.closeRecordStore();
catch (Exception error)
System.out.println("Exception in Reading Records"+error);
/*if (recordstore.listRecordStores() != null)
try
recordstore.deleteRecordStore("My Record Store");
catch (Exception error)
System.out.println("Exception"+error);
And for deleting records I write
public void deleteExercise(int index)
try
//System.out.println("AAAA");
recordstore = RecordStore.openRecordStore("Test3",true);
//recordstore.closeRecordStore();
catch (Exception error)
//System.out.println("EEEE");
System.out.println("Exception"+error);
if (recordstore.listRecordStores() != null)
try
byte[] byteInputData = new byte[100];
ByteArrayInputStream inputStream = new ByteArrayInputStream(byteInputData);
DataInputStream inputDataStream = new DataInputStream(inputStream);
for (int x=1; x<= recordstore.getNumRecords() ; x++ )
recordstore.getRecord(x, byteInputData, 0);
if (x == index)
recordstore.deleteRecord(index);
//x--;
inputStream.reset();
break;
inputStream.close();
inputDataStream.close();
catch (Exception error)
System.out.println("Exception in Deleting Records"+error);
Please Help me bcz i am new in j2me development n having no experienceOk ...
When you add records in you store, the J2ME implementation create an ID.
In the database, there is a list like that with ID <--> ]byte[ ]
You can get back a record with a this ID.
When you delete a record, it deletes the row. Lets say you have stored 3 records and that the ID are 1, 2, 3 ... if you delete the second one, then you have still in the database IDs 1 and 3.
That's why you have this exception : you are iterating with an ID 1, 2, 3, 4, 5 ... if one is delete there is no reorganization. (If you add an other record, it could be stored with ID 2).
To read all the records, you should get a list of existing IDs. Take a look at the API. Here is a piece of code, that you work but I have not tested :
RecordStore rs;
RecordEnumeration re = rs.enumerateRecords(null, null, false);
while (re.hasNextElement()) {
String str = new String(re.nextRecord());
System.out.println("Record: " + str);
} Hope it will help you.
Regards -
Problem with Sorting Detail Records
Hello All,
I have an ODBC connection to our AS400 System and I am able to retrieve records in Crystal. I am trying to perform a sort on the Cost Center field and then on the Salaries Account field. These two fields are Alpha Numeric fields. I went to the Record Sort Expert and selected these two fields. However,the Salaries Account field does not sort. When I do Browse data for the Salaries Account (field 2) it is in Ascending Order. When the report prints the detail records within each cost center (the primary sort) the Salaries accounts do not appear sequentially. For example account 510110 appears before 510105. I do not understand why the Salaries Account would not sort?
I appreciate you input as to why this could be happening and how I could resolve this? I have exhausted evey thing I could think of but I just cant' get it to sort. You input is much appreicated.
thanks in advance.
Imty.Hi Abhiash,
I don't see any dashes. The Cost Center sorts fine and is also Alphanumeric. The accounts are 6 digits. When I do Browse Data they appear in ascending order. So, It baffles me why it would be out of sequence when the detail prints out. See output below. Account 510110 appears before account 510105. This is in the account group view.
THIS IS BY COST CENTER AND ACCOUNT GROUPING *********
11002001 510100 LEE,DONNA R 01/29/2012
Sub Total 510100
11002001 510110 BEKKAIR,RADIA 01/29/2012
11002001 510110 BROWN,JILLEE S 01/29/2012
11002001 510110 SASPA,MADONNA T 01/29/2012
11002001 510110 THOMPSON,LISA Y 01/29/2012
11002001 510110 VAIL,SHEENA M 01/29/2012
11002001 510110 VANG,CHEN T 01/29/2012
Sub Total 510110
11002001 510105 COURTRIGHT,EMILY E 01/29/2012
11002001 510105 HUMPHRIES,CHRISTINA L 01/29/2012
11002001 510105 KALIFA-MAMAE,SILEPA T 01/29/2012
11002001 510105 MARTIN,KATHRYN M 01/29/2012
11002001 510105 MEYER,TRACY L 01/29/2012
11002001 510105 RODRIGUEZ,MICHELLE 01/29/2012
11002001 510105 SEXTON,JASMINE N 01/29/2012
11002001 510105 WILLARD,LISA 01/29/2012
Sub Total 510105
"Total11002001
THESE ARE THE DETAIL RECORDS. YOU CAN SEE CENTER 510110 APPEARS BEFORE 510105 EVEN THOUGH I HAVE
SPECIFIED COST CENTER AND SALARIES ACCOUNT IN THE RECORD SORT *******
11002001 510100 LEE,DONNA R
11002001 510110 BEKKAIR,RADIA
11002001 510110 BROWN,JILLEE S
11002001 510110 SASPA,MADONNA T
11002001 510110 THOMPSON,LISA Y
11002001 510110 VAIL,SHEENA M
11002001 510110 VANG,CHEN T
11002001 510105 COURTRIGHT,EMILY E
11002001 510105 HUMPHRIES,CHRISTINA L
11002001 510105 KALIFA-MAMAE,SILEPA T
11002001 510105 MARTIN,KATHRYN M
11002001 510105 MEYER,TRACY L
11002001 510105 RODRIGUEZ,MICHELLE
11002001 510105 SEXTON,JASMINE N
11002001 510105 WILLARD,LISA -
Problem When deleting record from database
Hi ,
I have a question. Firstly I'm using VB
I have a problem about deleting any record from access database , That's the code I'm use it for add new item and it's work but it's not work when I tried to edit any rows " it's not want to Save" but work for add new Item.
Try
Me.Validate()
Me.CustomerBindingSource.EndEdit()
Me.CustomerTableAdapter.Update(Me.KonoDataSet.Customer)
MsgBox("Update Successful")
Catch ex As Exception
MsgBox("Update Failed")
End Try
And That's my code for Deleting any record from database But it's not work and that's a problem.
CustomerBindingSource.RemoveCurrent()
CustomerBindingSource.EndEdit()
Me.CustomerTableAdapter.Update(Me.KonoDataSet.Customer)
Can anybody help me about that issue ?Hi kono20006000,
Your issue seems really strange. I would recommend you make a troubleshooting.
1.Made sure your code works with the single copy of the database. You could check if it scans hard drive for the database file name and check if it modifies dates on found files. You could check if you operate with the same database.
2. Use the application update the record at the form_load event to see if it would work correctly.
3.Check the table in update statement and the table in add statement.
Best Regards,
Edward
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey. -
DELETING THE RECORDS IN THE FORM
Dear Friends
I have a problem for deleting the records in my form
on the form I have button for deleting the record
and this button has
when-button-pressed trigger
And it has this contains
Do_Key('DELETE_RECORD');
COMMIT_FORM;
The system displayed this message after pressing the delete button
FRM-40400 : transaction complete: 1 record applied and saved
But when I inquiry, about this record it is not deleted .
Can any one tell me why the record is not deleted .
I am using this version of form
Forms [32 Bit] Version 6.0.8.11.3 (Production)
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining
waiting for your valuable replay.
Best regards
JamilDear Pavel
Yes the ON-DELETE trigger , it is exists in the block ,and because of that, it was not saving the deleted record and this code was in the
on-delete trigger
DECLARE
V_LOC VARCHAR(25);
BEGIN
SELECT CAR_NO INTO V_LOC
FROM CAR_FILE
WHERE CAR_NO = :J_CAR_NO ;
IF V_LOC IS NOT NULL THEN
UPDATE CAR_FILE
SET CAR_STATUS =2
WHERE CAR_NO = :J_CAR_NO;
ELSE
NULL;
END IF;
END ;
Why it is not working with ON-DELETE TRIGGER
But it is working with POST-DELETE TRIGGER.
Best regards
jamil -
Delete master record if detail records are empty
I have a simple question and response system
the user enters their details (record stored in table called source - pkey as id_src)
the user then goes on to answer questions (in a form)
those responses are kept in a separate table (responses)
with a foreign key in each response row telling me the ID of the source ie fk_id_src
the form has a SUBMIT and CANCEL button
PROBLEM
If a user registers their details (created a source record with an ID)
but fails to answer and questions (the response table does not have any foreign keys to that ID source)
what is the best way to AUTOMATICALLY delete the user record (if there are no detail records in the response table)
(note: the main response form IS NOT an ADDT form)
the checking process needs to be triggered by the CANCEL button
ie if the user presses submit - responses will be made to the questions - ie they will be empy answers - but in this case it is valid to do so
I was wondering about a custom transaction - with delete SQL -
or using check detail records - but cant see how to get that to fire the delete record transaction?
any guidance appreciated
tia
PaulOK
I can create a separate page that checks if a detail record exists
and display an error if it does
on the same page I can add a delete transaction
pass the master record id
Both work, all OK so far
BUT, the check detail throws its error message if detail records DOES EXIST
I need to allow the delete transaction to run, if detail records DO NOT EXIST
AND then
redirect then page - wether the delete occurs or not
any ideas?
Paul -
How to delete the record of saved HRA Details...
Hi Experts,
I have put the details of HRA Correctly.But while updating HRA In 0008 Infotype i wrongly updated the wagetype,How should i change the Wagetype.
When i m trying to delete it is showing RECORD CAN NOT BE DELETED (TIME CONSTRAINT 1).
How can delete the record.
Thanking u .
SaiHi
Hope doing well ........ No need to delete any infotype but u can go to PA30 and in change mode their u can delete the wagetype which is wrongly entered
Rajeshk -
Facing problem while deleting a child record in hibernate.
I am trying to update a child records i have following scenario
master record (having one to many assciation with child table cascade=all in .hbm.xml configuration file) ===> customerInfo
detail record set (having many to one assciation with master table cascade=all in .hbm.xml configuration file) ===> customerAccountsSet
i do following steps to update a record
1) get the customerInfo objetc from session successfully
2) get the customerAccountsSet = customerInfo.getCustomerAccounts();
3) traying to add a new customerAccount say customerAccount1 to be saved for the first time without primery key in it
4) traying to update a customerAccount say customerAccount2 to be updated with primery key in it
5) traying to add a delete customerAccount say customerAccount3 with primery key in it
only step 5 is not executed properly as i can still see the deleted record in db , although save and update steps have been successfully completed in db.
can anybody tell me whats going wrong here.code for steps 2,3,4,5 is as follows in the same order
2)Set customerAccountSet = (Set) customerInfo.getCustomerAccounts();
3)customerAccountSet.add(customerAccount);
4)customerAccountSet.add(customerAccount);
5)customerAccountSet.remove(customerAccount);Hi Nitesh,
1) Java stack should be up while trying to connect to R/3 backend.
2) You can check the JCOs by doing the following:
Type the following url http://<server name>:<port number>
Click on Webdynpro Console
Enter the user name and password.(You need the system admin right on the EP to do the same)
You can find the JCOs.
3) Better you contact the basis guy who had created the JCOs earlier and get the JCOs tested.
Hope it helps.
Regards.
Rajat
Edited by: Rajat Jain on Oct 12, 2009 1:47 PM -
How to delete the master records when corresponding details records exist.
What is the SQL statement to delete the records of master when the corresponding detail records are present.
Note: No Cascade clause was used at the time of creation of referential integrity constraint.
"M"- Master Table
"D"- Detail Table
I used, "Delete from M cascade". This statement is not working.
Your favour in this will be deeply appreciated.
Cheers
PremChinHi folk,
i appreciate your suggestion,
my crux of the situation is to know whether there is a way to make it without disabling,removing or modifying the referential integrity constraint.
If so, modifying, please help me out how to modify the constraint in order to remove the master records keeping detail records in-tact.
Cheers
Premz -
Problem in Master-Details - Inserting Records to same Table
I have 3 column of one table in master as primary key and 3 column of same table in detail as primay key. These 6 column collection as the composite primary key. when i try to insert the records in detail table it showing me Too many objects match the primary key oracle.jbo.Key Error.
I have done the Following things:
In HR Schema, I have created one Transient View Object for Master and Employee View Object for Details.
I have taken EmployeeId, FirstName and LastName columns in the Master i.e., From Transient View Object and droped it as the Form.
And I have taken E-mail, JobId, ManagerId columns in Details i.e From and droped it as the Table.
When I entered values in master and click CreateInsert in the details record. It showing me Too many objects match the primary key errors.
Help me out!!! for this problem.Hi Kumar,
I was not in office for couple of days. Thats you couldnt reply for your earlier post. You had mentioned how can we set the value of the import parameter.
What i wanted to tell you is not to set the value for that Binary_flag, but that flag influences the data download in ASCII FORMAT.
You just try this: Try attaching a file through CL_CRM_DOCUMENTS~CREATE_WITH_TABLE. Before read the contents of a file into SAP using GUI_DOWNLOAD and read it in ASCII mode. Now when you try to pass this to Ascii internal table of the method specifing the MIME type, it will attach the document to the opportunity, but the document content will be still in ASCII.
If you try to download this file using GET_WITH_TABLE, then you can see BINARY_FILE is not set to 'X' and the content gets downloaded to Ascii internal table.
This is my observation.
I think when attaching documents in Opportunities by default, it reads the file in Binary mode. Because when i tried to attach a file directly in Opportunity transaction, and tried the method GET_WITH_TABLE, the BINARY_FLAG was set.
Hope now you understood, why i was mentioning that BINARY_FLAG influences the download of content in binary and Ascii format.
Regards,
karthik. -
Can't delete master record when matching when matching detail record exist
Hi
on the rel. property:
Delete Record Behaviour = cascading
Prevent masterless Operation =yes
Automatic Query = yesCan't delete Record Master & Detail...
On delete getting error msg.
Can't delete master record when matching when matching detail record exist
am i missing something...!
Regards,
Abdetu...First of all, remember the ripple affect of cascading deletes and updates.
Oracle database allows creating master/detail relationship between tables using foreign keys and allows cascading deletes by defining the FOREIGN KEY constraint with ON DELETE CASCADE clause.
Oracle Forms on the other hand, handle cascade delete thing internally when you set the relation properties.
Now if you have 3 tables with MASTER->DETAIL1->DETAIL2 relationship and you have a form defined with MASTER->DETAIL1 relationship only, it won't let you delete (and save) master or detail record since the third table (DETAIL2) is referencing the rows from DETAIL1 which you are trying to delete.
If DETAIL2 were present on the form, it would have deleted with relation property CASCADING. If you really want that when you delete a master record, all its details should be deleted too, then consider defining FOREIGN KEY constraints with ON DELETE CASCADE and on the form set relation property CASCADING.
And if all master/detail tables are on your form and still it is not allowing you to delete master with cascading, there must be some code preventing it. Check triggers like ON-DELETE, KEY-COMMIT etc what they are doing. -
Problem with deleting record from the report.
This is my first post here, just to let you know I just started playing with Apex.
Here we go:
I have a page with report where the link to the record I have changed with ULR to the javascript:
javascript:doDelete(#RECORD_ID#)
I have created javascript in the HTML Header of the page
<script>
function doDelete(id) {
if (confirm("Are you sure you want to delete selected record?"))
$x('P3_DEL_ID').value=id;
doSubmit('DELETE');
</script>
and finally created a process for the page On Submit - After Computations and Validations.
declare
var_id number := :p3_del_id;
begin
commit;
Delete from mytable where record_id = var_id;
commit;
end;
I don't get error messages but record is not deleted.
Thanks for help in advance.
RobertRobert,
That's the problem. With that type selected, change the value in the textbox to just: DELETE
Regards,
Dan
http://danielmcghan.us
http://sourceforge.net/projects/tapigen
http://sourceforge.net/projects/plrecur
You can reward this reply by marking it as either Helpful or Correct ;-) -
I need to delete header record automaticaly when deleting detail
Hi all
I have to master-detail tables
The relation between the header and details is one-to-one.
on my form i want to do the following:
When user delete the detail record the header record must be automatically deleted.
on the trigger key_delrecord on the form level i write this code
BEGIN
IF :SYSTEM.CURSOR_BLOCK = 'DETAILS' THEN
Delete_record;
FORMS_DDL('COMMIT');
Go_block('Data');
Delete_record;
FORMS_DDL('COMMIT');
ELSE
Delete_record;
END IF;
END;
but this does not work
an error message appear on the runtime " can not delete header while dependent detail exists"
Please how can I archive this
Thanks in advance
Edited by: [email protected] on Oct 4, 2009 11:01 AMHi!
May set the Delete Record Behavior Relation Property to Cascading.
And change your trigger to:
BEGIN
IF :SYSTEM.CURSOR_BLOCK = 'DETAILS' THEN
Go_block('Data');
END IF;
Delete_record;
END; But, may do not use the forms_dll build-in for a commit.
Use the commit_form build-in so forms recognize that you commit the form.
Regards
Maybe you are looking for
-
How to delete records from MTL_SYSTEM_ITEMS table
Hello Experts, BANNER ======= Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production PL/SQL Release 8.1.7.4.0 - Production CORE 8.1.7.0.0 Production TNS for IBM/AIX RISC System/6000: Version 8.1.7.4.0 - Production NLSRTL Version 3.4.1.0.0
-
How many times a char showed up in a string
Hi assume that i have this String: String s = "I have son and he has son and his son that has a son also" how can i determine how many times 's' showed up in this string? thanks
-
Sales tax in PO but not included at the time of GR
Hi, i have creted the PO including sales tax amount, is there any way when i post the GR against this PO the sales tax amount not calculated.
-
Connecting to an LCD HDTV: DVI to HDMI male or female?
Unwilling to plunk down $40 at Best Buy I bought a cable advertised on eBay for $2 described as HDMI male to DVI male. However, when I got it, it turned out to be DVI male to HDMI FEMALE. I want to be able to use my LCD HDTV (46" Sharp Aquos, 1080p,
-
Chinese localization account name display in Crystal Reports
Hi experts, The account names (Chart of Accounts) in Chinese localization is in Chinese + English like this: 流动资产 (Current Assets). But this account name field, when shown in the Details sections does not display correctly. What is the solution to th