Delete particular row with routine
Hi,
I have a report that the customer required that a particular row be deleted from the cube.
I have done the coding in start routine but the requirement is not meant
Data in report
DOC Num Flag Amount
001 # 100
002 X 200
002 # 200
003 X 500
003 # 500
004 # 300
Now the requirement is that since doc num 002 and 003 have 2 rows because of the flag, The # should be deleted while 001 and 004 should be kept.
I used Delete SOURCE_PACKAGE WHERE FLAG = ' ' in end routine but it didn't work as 001 and 004 were deleted from the report where as they should show.
how do I resolve this code
thanks
Hello,
Try the following code in the start routine:
data: itab_SP_1 type SOURCE_PACKAGE,
itab_SP_2 type SOURCE_PACKAGE.
wa_SOURCE_PACKAGE like line of SOURCE_PACKAGE,
itab_SP_1 = SOURCE_PACKAGE.
Delete itab_SP_1 WHERE FLAG = ' '.
itab_SP_2 = itab_SP_1.
loop at SOURCE_PACKAGE into wa_SOURCE_PACKAGE.
read table itab_SP_1 with key doc_co = wa_SOURCE_PACKAGE-doc_no.
if sy-subrc NE 0.
append wa_SOURCE_PACKAGE to itab_SP_2.
endif.
endloop.
clear SOURCE_PACKAGE.
append line of itab_SP_2 to SOURCE_PACAKGE.
Regards,
Shashank
Similar Messages
-
How to delete particular row in ALV list display
Hi All,
My requirement is :
I am displaying ouput using lav list dispplay befor the first colomn i am displaying check box. i defined my own pf status here . in pf status i have 3 buttons .
1 select all
2 deselect all
3 delete.
First two options are working fine when i click select all it is selecting all the rown in a program(selectiong all the check boxex) like working fine for deselecting all.
3 optioin Delete when i click delete option it has to delete partcular row in a list display and at the same time this entry should delete from the table. this is my requirement. for the third point(delete) option i dont have any logic. anybody can suggest me or send me the sameple code. i am sending my code below.if possible please modify the code and resend it to me.
type-pools : slis.
tables : zuser_secobjects.
data : t_header1 like zuser_secobjects.
data : begin of it_secobjects occurs 0.
include structure t_header1.
*data : box,
input(1) type c,
data : checkbox type c,
flag type c,
end of it_secobjects.
data : wa_ita like line of it_secobjects.
*data : it_secobjects like zuser_secobjects occurs 0 with header line.
data : i_field type slis_t_fieldcat_alv with header line.
data : w_field like line of i_field.
data : i_sort type slis_t_sortinfo_alv.
data : w_sort like line of i_sort.
data : it_filt1 type slis_t_filter_alv with header line.
data:
i_tabname type tabname,
i_repid like sy-repid,
is_lout type slis_layout_alv.
data : it_filt type slis_t_filter_alv with header line,
it_evts type slis_t_event with header line.
DATA : is_vari type disvariant.
constants : c_default_vari value 'X',
c_save_vari value 'U',
c_checkfield type slis_fieldname value 'ACTION',
c_f2code type sy-ucomm value '&ETA'.
data : chk_box type slis_fieldname.
selection-screen: begin of block b1 with frame title text-t01.
parameters : p_appln type zuser_secobjects-appln.
parameters : p_user type usr02-bname, "zuser_secobjects-appln_user,
p_partnr type zuser_secobjects-appln_partner,
p_ptype type zuser_secobjects-partner_type default '02',
p_upostn type zuser_secobjects-user_position,
p_sdate like likp-erdat default sy-datum,
p_edate(10) default '12/31/9999',
p_revnum type zuser_secobjects-revnum,
p_cted type zuser_secobjects-created_by,
p_cdate type zuser_secobjects-creation_date,
p_ctime type zuser_secobjects-creation_time,
p_chnby type zuser_secobjects-changed_by,
p_cdate1 type zuser_secobjects-changed_date,
p_ctime1 type zuser_secobjects-changed_time.
selection-screen: end of block b1.
form user_command using p_ucomm like sy-ucomm
rs_selfield type slis_selfield.
*DATA : it_filt type slis_t_filter_alv with header line.
case p_ucomm.
when 'SELECT_ALL'. " SELALL is the FCODE of ur push button
loop at it_secobjects into wa_ita.
wa_ita-checkbox = 'X'.
modify it_secobjects from wa_ita.
endloop.
rs_selfield-refresh = 'X'. "<- ADD THIS
when 'DESLCT_ALL'.
loop at it_secobjects into wa_ita.
wa_ita-checkbox = ' '.
modify it_secobjects from wa_ita.
endloop.
rs_selfield-refresh = 'X'. "<- ADD THIS
is_lout-f2code = c_f2code.
is_lout-box_fieldname = c_checkfield.
is_lout-get_selinfos = 'X'.
is_lout-detail_popup = 'X'.
is_lout-detail_initial_lines = 'X'.
when 'HIDE_DEL'.
rs_selfield-exit = 'X'.
it_filt-fieldname = 'ACTION'.
it_filt-tabname = '1'.
it_filt-valuf = 'X'.
it_filt-intlen = '1'.
it_filt-inttype = 'C'.
it_filt-datatype = 'CHAR'.
it_filt-valuf_int = 'X'.
it_filt-sign0 = 'E'.
it_filt-optio = 'EQ'.
if it_filt[] is initial.
append it_filt.
else.
modify it_filt index 1.
endif.
perform display using i_object.
PERForm ALV_LIST_DISPLAY.
WHEN 'SHOW_DEL'.
rs_selfield-exit = 'X'.
free it_filt.
PERForm ALV_LIST_DISPLAY.
when 'SAVE1'.
select * from zuser_secobjects where
appln = zuser_secobjects-appln
and appln_partner = zuser_secobjects-appln_partner
and partner_type = zuser_secobjects-partner_type
and start_date = zuser_secobjects-start_date
and end_date = zuser_secobjects-end_date.
endselect.
if sy-subrc eq 0.
message e000(ZV) with 'Duplicate Entry'.
endif.
endcase.
endform.
*& Form delete
form delete.
data : begin of is_secobjects occurs 0.
include structure zuser_secobjects.
data : checkbox type c.
data : end of is_secobjects.
is_secobjects-checkbox = 'X'.
modify is_secobjects
from it_secobjects
transporting checkbox
where checkbox = 'X'.
endform.
*& Form get_data
form get_data.
select * from zuser_secobjects
into table it_secobjects.
endform. " get_data
*& Form prepare_fieldcatalog
text
--> p1 text
<-- p2 text
form prepare_fieldcatalog.
clear: w_field,i_field.
refresh:i_field.
i_field-key = 'X'.
i_field-col_pos = 1.
i_field-ddictxt = 'S'.
i_field-seltext_s = '@11@'.
i_field-checkbox = 'X'.
i_field-input = 'X'.
i_field-fieldname = 'HEADER'.
i_field-outputlen = 0.
append i_field.
clear i_field.
w_field-fieldname = 'APPLN'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-seltext_l = text-m01.
w_field-outputlen = '10'.
w_field-col_pos = 1.
append w_field to i_field.
clear w_field.
w_field-fieldname = 'APPLN_USER'.
w_field-tabname = 'IT_SECOBJECTS'.
w_field-just = 'C'.
w_field-seltext_l = text-m02.
w_field-outputlen = '7'.
w_field-col_pos = 2.
append w_field to i_field.
clear w_field.
endform. " prepare_fieldcatalog
*& Form ALV_LIST_DISPLAY
text
--> p1 text
<-- p2 text
form alv_list_display.
i_repid = sy-repid.
is_lout-box_fieldname = 'CHECKBOX'.
it_filt-fieldname = 'ACTION'.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_callback_program = i_repid
i_callback_pf_status_set = 'PF_STATUS_SET'
i_callback_user_command = 'USER_COMMAND'
is_layout = is_lout
it_fieldcat = i_field[]
it_filter = it_filt[]
it_events = it_evts[]
i_default = c_default_vari
i_save = c_save_vari
is_variant = is_vari
tables
t_outtab = it_secobjects.
endform. " ALV_LIST_DISPLAY
*& Form display
text
-->P_I_OBJECT text
form display using object.
case object.
ENDCASE.
endform. " display
thanks,
maheedhar.tHI
In my program checkbox(before the record is displayed)
I used following lines to display checkbox .
i_field-key = 'X'.
i_field-col_pos = 1.
i_field-ddictxt = 'S'.
i_field-seltext_s = '@11@'.
i_field-checkbox = 'X'. <- Using this command i am getting checkbox
i_field-input = 'X'.
when i select this checkbox i press delete option then this entry will remove from internal table and refresh the screen and at the same time i will click on save button this ztable has to update according to that action.
this is my requirement.
thanks,
maheedhar. -
Can't delete a row with a long raw in it
I have a table with a long raw column. I am using the following
to try to delete the row from a copy of 8i Lite:
stmt.executeUpdate("delete from blobs where blobid="+blobId);
My application hangs at this point. Any theories?
I am using this driver: oracle.lite.poljdbc.POLJDBCDriver
I am using the 1.2.2 jdk.
-Justin
nullI opened activity monitor, closed all programs associated with pdf, preview, etc., however that didn't work. A simple restart did the trick. Even though I could see the pdfs on my destop the files were deleted. That explains why I couldn't manipulate the file. Somehow the file got caught in the graphics string.......????
-
Remove/delete the row with Report Name above header while exporting SSRS to excel
I wanted to make sure to delete the top most row with Report name in SSRS report while exporting to excel.
I didn't find any way to do so, My report don't need a report name actually i deleted the text still a blank row appears in excel.
Is there any property hidden i need to look for this requirement?Invalid definition.
The report definition is not valid.
Details: The report definition has an invalid target namespace
'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition'
which cannot be upgraded. (rsInvalidReportDefinition) -
Delete Command Button to delete particular row from VO
Hi,
I have dragged & dropped an VO into jspx page as table, from data-control pallete dragged Delete operation as a button on to the table as last column.
By pressing delete button, it is deleting top row from VO. I want to delete the particular row w.r.t delete button on the column list....?
regards.Iam using JDev 11.1.1.5 version,
Irespective of the row selected in VO and pressing delete button will delete only first row(starting row of VO).
Note: Each row of VO having delete button(bcoz, i dragged & dropped delete operation has a button as a last column of table)
regards. -
BC4J: Problem deleting a row with clob field
When I try to delete a row that contains a CLOB field.
When I call the function removeCurrentRow in my View object I get this exception:
JBO-25014: Another user has changed the row with primary key oracle.jbo.Key
Could anyone tell me why I can't remove the row? Thanks in advance!
nullThis looks like a bug in TreeBinding. Please file this as a bug/tar with OracleSupport with your reproducible testcase (or steps to reproduce). Thanks.
-
Delete multiple rows with BC4J
I can't find anything on multi-delete with ADF.
Is it supported?
ViewObjectImpl v = (ViewObjectImpl)am.findViewObject("X");
ViewCriteria vc = v.getViewCriteria("Y");
v.applyViewCriteria(vc);
v.executeQuery();
v.removeAllSelectedRows(); //Delete all rows selected by vc "Y"
getDBTransaction().commit();
ThanksThanks Timo, I had figured that one out, that's how we did it in the first place but its not acceptable for my Use Case.
The goal for me is to have something that can scale, I don't want to loop through my millions of records and remove them one by one, hence take a hit on performance.
I assume there is somehow a way to do mass update/deletes with ADF/BC4J?
Cheers
JP -
Urgent!! How to delete a row with OrdImage (New)!!!
I got a problem when I attempt to delete a row that contains a Image in a view object:
I am using JDeveloper 3.2. And also I use BC4J for my project. I use a web bean to delete a row from a view object:
For example, the web bean contain the following method "deletePic", the part code is following:
try {
JSPApplicationRegistry jr = JSPApplicationRegistry.getInstance ();
ApplicationModule ei = jr.getAppModuleFromContexts("Testpackage_Test_TestAM", session, null);
ViewObject s = ei.findViewObject ("PicVO");
s.executeQuery ();
if (s.hasNext ())
s.next ().remove ();
ei.getTransaction().commit();
} catch (java.lang.Exception e) {
System.out.println (e.toString ());
I simply use the Row remove method to delete a row that contain a ORDImage Field. But I got the following error that is:
oracle.jbo.DMLException: JBO-26041: Failed to post data to database during "Delete": SQL Statement " DELETE FROM TESTTABLE Testtable WHERE TESTID=:1".
I check for this error only know this error ocurr when try to commit the transaction, but don't know how to solve it....
pls help me..thx.
nullHi Akira,
I created a table using the following SQL statement:
create table timg (id number primary key, image ordsys.ordimage);
Then I inserted some records. Next, I populated the images in some rows.
Then, I created a Business Components project. At last, I created a web bean and used this web bean in a JSP page.
In the web bean, I used your code but modified the applicationId string and view name string to reflect the ones on my machine.
The JSP ran successfully. The rows were deleted from the table by the web bean. I didn't see the exception. The database I am using is 817, the JDeveloper version is 3.2.3.
thanks,
Richard -
How to delete the records with routine Z_AFRP4_DELETE as note [418584|
Hello Gurus,
I don't want to transfer data into HR and want to delete the records in table AFRP4 to business complete the Maintenance Orders
Component version- EHP7 for SAP ERP 6.0
Component-EA-APPL
Release-617
how can I delete these records
Thanks fro Help
AMHello All,
I found the solution, I copied the code in correction instruction number 0000282352 and create the report as programme Z_AFRP4_DELETEand the executed
*$*$----------------------------------------------------------------$*$*
*$ Correction Inst. 0120061532 0000282352 $*
*$--------------------------------------------------------------------$*
*$ Valid for : $*
*$ Software Component SAP_APPL SAP Application $*
*$ Release 40B All Support Package Levels $*
*$ Release 45B All Support Package Levels $*
*$ Release 46B All Support Package Levels $*
*$ Release 46C All Support Package Levels $*
*$ Release 470 All Support Package Levels $*
*$ Release 500 All Support Package Levels $*
*$ Release 600 All Support Package Levels $*
*$ Release 602 All Support Package Levels $*
*$ Release 603 All Support Package Levels $*
*$ Release 604 All Support Package Levels $*
*$ Release 605 All Support Package Levels $*
*$ Release 606 All Support Package Levels $*
*$--------------------------------------------------------------------$*
*$ Changes/Objects Not Contained in Standard SAP System $*
*$*$----------------------------------------------------------------$*$*
*& Object REPS Z_AFRP4_DELETE
*& Object Header PROG Z_AFRP4_DELETE
*& REPORT Z_AFRP4_DELETE
REPORT Z_AFRP4_DELETE .
* This report deletes confirmation records from table AFRP4 that are
* not longer needed. Run it without update flag first !!
tables: afrp4.
data: lt_afrp4 like afrp4 occurs 0,
ls_afrp4 like afrp4.
selection-screen begin of block order with frame.
select-options: zorders for afrp4-aufnr. "order number
selection-screen end of block order.
parameters: update as checkbox.
select * from afrp4 into table lt_afrp4
where aufnr in zorders.
if lt_afrp4[] is initial.
format color col_normal.
write: 'No HR confirmation background records read.'.
exit.
endif.
format color col_heading.
write: /5 'Order', 25 'Confirmation', 45 'Counter'.
skip. uline. skip.
* show corrections
loop at lt_afrp4 into ls_afrp4.
format color col_normal.
write: /5 ls_afrp4-aufnr, 25 ls_afrp4-rueck, 45 ls_afrp4-rmzhl.
endloop.
* update on data base table
if not update is initial.
skip. uline. skip.
delete afrp4 from table lt_afrp4.
if sy-subrc is initial.
format color col_positive.
write: 'HR-records deleted successfull'.
else.
format color col_negative.
write: 'Error when trying to update data base table AFRP4.'.
endif.
endif. -
How to delete the row from the ADF table using popup box
Hi,
I have one requirement like need to delete a record from the table, but that time need to show one popup window for confirmation of the deletion. I am using Delete buttom from the vo operations. I am able to delete the row with out popup but when i used the popup that time deletion is not happening.
Can any one help me in this.
Regards,Issue was resolved.
-
Deleting a row from matrix by context menu
Hi all
does anyone know how can i cause right click on mouse button. on a certain row within a matrix to show a context menu with the option to delete the row. and when pressing the menu item handling the event of deleting the row from the matrix?
appreciate the help
YoavHi Yoav,
Simply, 'context menu' have to be handled with 'menu event' object.
It can be done by 'flushToDataSource' method and some tricks.
Basically, method delete the row without any clause of addon code.
But it's only can be done in display side.
If you're using DBDataSource, you have to flush to the datasource.
I mean, you have to update datasource with the data displayed in the matrix.
and then, delete the last row of the datasource.
FlushToDataSource doesn't affect to the number of rows in the datasource.
You have to delete a row with a method of DBDatasource.. I can't remember the name.
If, the matrix uses userdatasource, you don't need to delete a row in datasource.
Because userdatasource doesn't have a concept of 'row', actually.
Hope this helpful for you.
Regards,
Hyunil Choi -
I have a database that has an the ID as the identity and it goes up by 1 each time a new row is added. When I delete a row, all of the ID's that come after it stay the same. For example if I delete the row with the ID of 2, the IDs will now go like 1, 3,
4 and so on, just having the 2 missing.
How do I make it so that when I delete a row, all of the IDs that follow it are brought down by one? For example when deleting the row with the ID of 2, rows 3 and 4's IDs become 2 and 3, making the data go 1, 2, 3 instead of 1, 3, 4.CREATE TABLE T1
id VARCHAR(10) NOT NULL PRIMARY KEY,
pos INT NOT NULL UNIQUE
INSERT INTO T1 VALUES('A', 1)
INSERT INTO T1 VALUES('B', 2)
INSERT INTO T1 VALUES('C', 3)
INSERT INTO T1 VALUES('D', 4)
INSERT INTO T1 VALUES('E', 5)
INSERT INTO T1 VALUES('F', 6)
DECLARE
@id AS VARCHAR(10),
@newpos AS INT
SET @id = 'd'
SET @newpos = 1
SELECT T1.*
FROM T1, (SELECT pos AS idpos FROM T1 WHERE id = @id) AS P
ORDER BY
CASE
WHEN id = @id THEN @newpos
WHEN pos BETWEEN idpos AND @newpos THEN pos - 1
WHEN pos BETWEEN @newpos AND idpos THEN pos + 1
ELSE pos
END
UPDATE T1 SET pos =CASE
WHEN id = @id THEN @newpos
WHEN pos BETWEEN @oldpos AND @newpos THEN pos - 1
WHEN pos BETWEEN @newpos AND @oldpos THEN pos + 1
ELSE pos
END
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
I have a JTable (theTable) with a DefaultTableModel (theValues). When I delete a row with the table model's removeRow(int x) method, and then click on one of the remaining rows, I get java.lang.ArrayIndexOutOfBoundsException: 2 >= 2 (in this case the table had three rows and I deleted the last row then clicked on the last row in the remaining table).
Can anyone tell me what is going on? Here is the code I have associated with a JButton. (I am using JDK 1.4.1_03.)
delBTN.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
int rowToDelete = theTable.getSelectedRow();
if(theTable.getRowCount() > 0 && rowToDelete > 0)
tableValues.removeRow(rowToDelete);
} } } );Hi,
the only way I can reproduce your error is if a cell is in editing mode. You should cancel all editing before removing a row. You also can not delete the first row w/ your code.
Perhaps you try this:
delBTN.addActionListener( new ActionListener()
public void actionPerformed(ActionEvent e) {
int rowToDelete = theTable.getSelectedRow();
if(theTable.getRowCount() > 0 && rowToDelete >= 0) // allow row 0 to be deleted
// cancel edits
theTable.editingCanceled(null);
tableValues.removeRow(rowToDelete);
}); Hope this helps.
Andre -
Deleting rows with missing values in field in start routine of update rule
Hello experts,
how can I delet rows with missing values in a specific field in the start routine of update rules?
I think ABAP code should look something like this:
delete ... from DATA_PACKAGE where Z_NO = ''.
thanks in advance for any suggestions!
hizaWrite:
delete data_package where field = value.
Hope it helps.
Regards -
How to delete a particular row in ALV table
Hi,
How to delete a particular row in ALV table based on some condition(by checking value for one of the columns in a row)
Thanks
Bala DuvvuriHello Bala,
Can you please be a bit more clear as to how you intend to delete the rows from your ALV? By the way deleting rows from an ALV is no different from deleting rows from a normal table. Suppose you have enabled selection property in ALV & then select multiple rows and click up on a button to delete the rows then below would be the coding: (Also keep in mind that you would have to maintain the Selection property of the context node that you are binding to your ALV to 0..n)
data : lr_table_settings TYPE REF TO if_salv_wd_table_settings,
lr_config TYPE REF TO cl_salv_wd_config_table.
lr_table_settings ?= lr_config.
** Setting the ALV selection to multiple selection with no lead selection
lr_table_settings->set_selection_mode( value = cl_wd_table=>e_selection_mode-multi_no_lead ).
Next delete the selected rows in the action triggered by the button:
METHOD onactiondelete_rows .
DATA: wd_node TYPE REF TO if_wd_context_node,
lt_node1 TYPE ig_componentcontroller=>elements_node,
wa_temp TYPE REF TO if_wd_context_element,
lt_temp TYPE wdr_context_element_set,
row_number TYPE i VALUE 0.
wd_node = wd_context->get_child_node( name = 'NODE' ).
CALL METHOD wd_node->get_selected_elements
RECEIVING
set = lt_temp.
LOOP AT lt_temp INTO wa_temp.
wd_node->remove_element( EXPORTING element = wa_temp ).
ENDLOOP.
CALL METHOD wd_node->get_static_attributes_table
EXPORTING
from = 1
to = 2147483647
IMPORTING
table = lt_node1.
wd_node->bind_table( new_items = lt_node1 ).
ENDMETHOD.
If in case this isn't your requirement please do let me know so that I can try come up with another analysis.
Regards,
Uday
Maybe you are looking for
-
Crystal Reports 2008 and Sharepoint Services in 64bit
Hi, I have searched and post questions about the problems with the fact that thera are no great support for 64 bit. And still no solution. Why? Why? Why? Now to my question. I have Crystal Reports 2008 in a Windows 2008 64 bit. Yes, I have got it run
-
Problems with text to .PNG
So after searching through all the forums about this problem, and chatting on the telephone with Apple about I have noticed a few consistencies. 1. People who are saying that you can get rid of the problem by switching to a common font or dropping sh
-
Dynamic text works in preview but not when uploaded
Can someone help me resolve as to why my dynamic text works in DW8 preview by I get an error after FTPing the page. Warning: require_once(/Connections/oneandone.php) [function.require-once]: failed to open stream: No such file or directory in /homepa
-
Hi, I am doing one scenario Sender involving proxy and receiver JDBC Adapter.SAP is sending one item to Oracle and getting some fields from Oracle corresponding to that item.While getting response we are using RFC Adapter in XI.This involves two asy
-
Im trying to find ilife but apparently I have to pay for it?? I thought it was already installed.