2006 Sep 26 9:22 AM
Hi SDN's
I have a table contorl in which i enter new items or delete the existing items, so while adding items am able to update the Z table perfectly fine, but while deleting the line i can see the exact data in internal table while debugging, but it gives a runtime error while modifying the Ztable
my code is below
modify ZES_RFQ_SVC from table IT_RFQSVC.
if i c in debug mode i see the exact data in IT_RFQSVC, but while updating the Z table its giving a runtime error as
Error analysis
An invalid request was made to the SAP database interface in a statement
in which the table "ZES_RFQ_SVC " was accessed.
The situation points to an internal error in the SAP software
or to an incorrect status of the respective work process.
For further analysis the SAP system log should be examined
(transaction SM21).
For a precise analysis of the error, you should supply
documents with as many details as possible.
Please help me.
Regards
Pratyusha
Hi SDN's
I have a table contorl in which i enter new items or delete the existing items, so while adding items am able to update the Z table perfectly fine, but while deleting the line i can see the exact data in internal table while debugging, but it gives a runtime error while modifying the Ztable
my code is below
modify ZES_RFQ_SVC from table IT_RFQSVC.
if i c in debug mode i see the exact data in IT_RFQSVC, but while updating the Z table its giving a runtime error as
Error analysis
An invalid request was made to the SAP database interface in a statement
in which the table "ZES_RFQ_SVC " was accessed.
The situation points to an internal error in the SAP software
or to an incorrect status of the respective work process.
For further analysis the SAP system log should be examined
(transaction SM21).
For a precise analysis of the error, you should supply
documents with as many details as possible.
Please help me.
Regards
Pratyusha
2006 Sep 26 9:26 AM
Hi,
use <b>delete ZES_RFQ_SVC from table IT_RFQSVC.</b>
Regards
amole
2006 Sep 26 9:53 AM
Hi amole,
IT_RFQSVC contains the records which i need to update the Z table.
initially when i start i might have 3 rows in service items, user might delete the rows, so i modify the IT_RFQSVC, and then modify the ZES_RFQ_SVC from table IT_RFQSVC.
please clarify me if i explained u correctly
Thanks alot
Pratyusha
2006 Sep 26 10:03 AM
hi,
instead of using modify for all cases, check out the function code of the button.
if the user hits delete.
if sy-ucomm = 'DEL'.
"delete the row from internal table
if the user hits update.
elseif sy-ucomm = 'UPD'.
"modify the row in the internal table.
endif.And then you can update the internal table
Regards,
Richa
2006 Sep 26 10:03 AM
Hi pratyu,
1. suppose your internal table has 3 rows.
2. The user deletes the 2nd row on the screen.
3. Hence, u also delete the 2nd row, from the internal table.
4. In such cases,
its always best to delete
all 3 records from ZTABLE
(with that particular primary key)
5. And then again insert the 2 rows.
LOOP AT IT_RFQSVC .
MODIFY ZES_RFQ_SVC FROM IT_RFQSVC .
ENDLOOP.
6. Modify will automatically take care
of insert/update based upon the
value of the primary key
found/not found
in database table.
*----
7. If we don't follow the above procedure
of deleting all 3 rows, and again inserting 2 rows,
then we have to write logic
to KEEP TRACK of
a) modified rows (records)
b) new inserted rows
c) deleted rows,
and accordingly fire sql statements,
for all the corresponding rows in the table control(internal table)
regards,
amit m.
2006 Sep 26 10:24 AM
Hi Amit,
thanks for the reply.
this is what i was writing in the PAI module of the table control between loop and endloop
module READ_TC2 input.
if TC2-CURRENT_LINE le FILL2.
clear ZES_RFQ_SVC.
read table IT_RFQSVC into IS_RFQSVC index TC2-CURRENT_LINE. " with key RFQ_LN = ITEMLIST.
if SY-SUBRC = 0.
if SVC_SEL = 'X'.
IS_RFQSVC-CHK = 'X'.
endif.
IS_RFQSVC-SVC_LTEXT = ZES_RFQ_SVC-SVC_LTEXT.
IS_RFQSVC-SVC_QTY = ZES_RFQ_SVC-SVC_QTY.
L_SQTY = L_SQTY + IS_RFQSVC-SVC_QTY.
IS_RFQSVC-SVC_UOM = ZES_RFQ_SVC-SVC_UOM.
IS_RFQSVC-SVC_LAMT = ZES_RFQ_SVC-SVC_LAMT.
L_SAMT = L_SAMT + IS_RFQSVC-SVC_LAMT.
IS_RFQSVC-WAERS = 'SGD'.
modify IT_RFQSVC from IS_RFQSVC index TC2-CURRENT_LINE.
clear : IS_RFQSVC.
endif.
else.
if not ZES_RFQ_SVC-SVC_NO is initial and not ZES_RFQ_SVC-SVC_LN is initial.
IS_RFQSVC-RFQ_NO = ZES_RFQ-RFQ_NO.
IS_RFQSVC-SER_NO = ZES_RFQ-SER_NO.
IS_RFQSVC-RFQ_LN = ITEMLIST.
IS_RFQSVC-SVC_NO = ZES_RFQ_SVC-SVC_NO.
IS_RFQSVC-SVC_LN = ZES_RFQ_SVC-SVC_LN.
IS_RFQSVC-SVC_STEXT = ZES_RFQ_SVC-SVC_STEXT.
IS_RFQSVC-SVC_LTEXT = ZES_RFQ_SVC-SVC_LTEXT.
IS_RFQSVC-SVC_QTY = ZES_RFQ_SVC-SVC_QTY.
L_SQTY = L_SQTY + IS_RFQSVC-SVC_QTY.
IS_RFQSVC-SVC_UOM = ZES_RFQ_SVC-SVC_UOM.
IS_RFQSVC-SVC_LAMT = ZES_RFQ_SVC-SVC_LAMT.
L_SAMT = L_SAMT + IS_RFQSVC-SVC_LAMT.
IS_RFQSVC-WAERS = 'SGD'.
append IS_RFQSVC to IT_RFQSVC. " index TC2-CURRENT_LINE.
modify IT_RFQSVC from IS_RFQSVC index TC2-CURRENT_LINE.
clear IS_RFQSVC.
FILL2 = FILL2 + 1.
endif.
endif.
endmodule. " READ_tC2 INPUT
and in the USER Command for DELETE of row.
i just wrote
when 'delete'.
delete IT_RFQSVC where CHK = 'X'.
and when i save it.
when 'save'.
modify ZES_RFQ_SVC from table IT_RFQSVC. ( which is giving dump)
As suggested i ll try to implement the way u told for deleting
Please suggest me is there a better way of appending new records to the table control.
Thanks alot for ur time
Pratyusha
2006 Sep 26 10:38 AM
Hello,
U can try in the SAVE option, first to DELETE the entries from ZES_RFQ_SVC data related to the selected key..and than use MODIFY.
I think that should work.
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |