Delete modify in itab output display

hi,
i am create a query for delete data from database table by using an internal table i am delete data from DB table but a problem are come as in output display
i am showing  the
NUMBER OF ENTRIES ARE DELETE FROM TABLE: 2
NUMBER OF ENTRIES ARE REMAIN IN TABLE AFTER DELETEION:
seletion screen contains 
SELECT-OPTIONS: s_ordid FOR zapolp22-ordid,   "APO order id
                            s_matnr FOR zapolp22-matnr,   "Material Number
                 s_locto FOR zapolp22-locto.   "APO Destination location
PARAMETERS: p_days TYPE i. "Number of days
the problem are as:
if i am given only P-days parameter value 3
than it works as fine
showing output right as 2 rows are deleted
and 8 rows are remains in table
if i given all fields fill up in selection screen
as s_ordid----->4516 to 4517
    s_matnr---->85503 to 85505
   s_locto------> m100 to m101
p_days----> 2
then i get output display as
number of entries  are deleted   2
number of entries are remain in table  0.
but the 2 rows are deleted from DB table and 8 rows are remain in table but it not show the 8 rows on display screen it shows zero.
my code is as:
DATA:  lv_count  TYPE i,
       lv_count1 TYPE i.
DATA: lv_date TYPE sy-datum.
SELECT mandt
       ordid
       schedid
       matnr
       locto
       lfmng
       lfdat
       locfr
       rqmng
       rqdat AS lv_date
       prckz
       blkstk
       oppdelqty
       zzapologmod
       zzflagurgent
       zzapottype
       zzndays_l_time
FROM zapolp22 INTO TABLE lt_output
WHERE ordid IN s_ordid  AND
       matnr IN s_matnr  AND
       locto IN s_locto.
SORT lt_output[] BY rqdat.
>Number OF Days to be Counted
lv_date = sy-datum - p_days.
LOOP AT lt_output.
  IF lt_output-rqdat LT lv_date.
    MOVE-CORRESPONDING lt_output TO lt_delete.
    APPEND lt_delete.
    lv_count = lv_count + 1.
  ELSE.
    lv_count1 = lv_count1 + 1.
  ENDIF.
endloop.
DELETE FROM zapolp22  WHERE rqdat LT lv_date AND
                            ordid IN s_ordid AND
                            matnr IN s_matnr AND
                            locto IN s_locto.
IF sy-subrc = 0.
  WRITE:/25 'Number of entries deleted            :', lv_count.
  WRITE:/25 'Number of entries remaining          :', lv_count1.
ELSEIF sy-subrc NE 0.
  WRITE:/ 'No data are selected for delete'.
ENDIF.
Tell me where in this code i do mistake.
Thanks jayant.

I don't know the contents of the table, but if you increase the number of restrictions in the SELECT statement, it will probably have lesser entries.
Now, you are not really counting the total number of rows left in the table, but the total number of rows in the table that match the criterion.
Basically, the first time (with lesser options) 10 rows are put into internal table, and 2 are deleted. So 8 are left.
In the second time, only 4 rows are getting selected, of which 2 are deleted, and 2 are left in the internal table NOT in the database table. In the database table, more rows are left (because they never got selected into the itab)
But if you want to count the total number of rows left in the DB, its better to count the number of rows in the end of the program with:
SELECT COUNT(*) FROM dbtab INTO lv_integer.
This can be pretty slow if the table is huge.

Similar Messages

  • Delete modify in itab

    hi gurus,
    i am new in abap and i have a report in which in a selection screen
    has 3 fields as months cur. date and material no.
    and two parameters as chkbox on selection of these chkbox
    one for delete and other for modify data in table.
    plz send the codes abt delete and modify
    i make it this but have an error.
    TABLES: S225.
                           D A T A
    DATA: OK_CODE LIKE SY-UCOMM.
    *DATA: ITAB LIKE S225 OCCURS 0 WITH HEADER LINE.
                 SELECTION SCREEN / PARAMETERS                            *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    SELECT-OPTIONS:S_spmon FOR s225-spmon OBLIGATORY LOWER CASE,
                   s_sptag FOR s225-sptag OBLIGATORY,
                   S_MATNR FOR S225-MATNR OBLIGATORY.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS: P1 AS CHECKBOX DEFAULT 'X',
                P2 AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK b1.
                      START OF SELECTION
    START-OF-SELECTION.
    PERFORM GET_DATA.
    PERFORM DELETE_DATA.
    *forms to fetch data in fields
    FORM GET_DATA.
    SELECT spmon sptag matnr FROM s225
    *INTO CORRESPONDING FIELDS OF TABLE ITAB
    WHERE SPMON IN S_SPMON AND
          SPTAG IN S_SPTAG AND
          MATNR IN S_MATNR.
    ENDFORM.
    *form for delete data
    FORM DELETE_DATA.
    CASE OK_CODE.
    WHEN 'P1'.
    DELETE SPMON FROM s225.
    MESSAGE I002 WITH 'Data is Deleted'.
    *WHEN 'P2'.
    *INSERT: SPMON,SPTAG, MATNR INTO ITAB.
    *MESSAGE S004 WITH 'Data is Saved Successfully'.
    ENDCASE.
    ENDFORM.
    plz help me and send information to correct it.
    thanks.

    Hi Jayant
    Looks like your program is a report. Hence, don't handle the selection screen inputs through OKC_DE, which is generally forllowed for Dialog or Module Pool Program. You can change your code as below, that solve the problem,
    TABLES: S225.
    D A T A
    DATA: OK_CODE LIKE SY-UCOMM.
    *DATA: ITAB LIKE S225 OCCURS 0 WITH HEADER LINE.
    SELECTION SCREEN / PARAMETERS *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    SELECT-OPTIONS:S_spmon FOR s225-spmon OBLIGATORY LOWER CASE,
    s_sptag FOR s225-sptag OBLIGATORY,
    S_MATNR FOR S225-MATNR OBLIGATORY.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS: P1 AS CHECKBOX DEFAULT 'X',
    P2 AS CHECKBOX.
    SELECTION-SCREEN END OF BLOCK b1.
    START OF SELECTION
    START-OF-SELECTION.
    PERFORM GET_DATA.
    PERFORM DELETE_DATA.
    *forms to fetch data in fields
    FORM GET_DATA.
    SELECT spmon sptag matnr FROM s225
    *INTO CORRESPONDING FIELDS OF TABLE ITAB
    WHERE SPMON IN S_SPMON AND
    SPTAG IN S_SPTAG AND
    MATNR IN S_MATNR.
    ENDFORM.
    *form for delete data
    FORM DELETE_DATA.
    if P1 is not initial.
    DELETE SPMON FROM s225.
    MESSAGE I002 WITH 'Data is Deleted'.
    endif.
    if P2 is not initial.
    modify SPMON from S225.
    MESSAGE I002 WITH 'Data is Modified'.
    endif.
    ENDFORM.
    Hope this helps !
    Kind Regards
    Ranganath

  • How to use create, delete, modify butttons in a table

    hi all
    in my application i have emp table in my source view
    in that table i have inserted static data in columns i.e., empid, empname. i have 3 buttons create, delete, modify buttons in that table. when i press Create button it navigates to another view1 in which we have a emp form with create new emp button and labels empid, empname and 2 input fields.After filling the form when hit the create newemp button the form data should be displayed in the table.
    The same for Modify and delete.  i.e., when i select a particular empid row in my source view table and hit the modify button it should navigate to view2 in which the particular record form with data displays and after making necessary modifications the modified data should be display in the particular row .
    For delete button, when i select a particular record in the table and hit delete button it should be deleted from the table.
    any snippet of code is valuable
    Thanks in advance
    sravan

    Hi Sravan,
    I just need a clarification, are you getting the table data from the back-end system?
    On the second view, after the user input on click of the "Create New" or "Modify" button, update the back-end. Once the update is successful, fire a plug back to the first view and reload the table or execute the model again. The updated records will be fetched from back-end system.
    On click of "Delete" button, remove the record from the back-end and execute the model again.
    This holds good if you have the data fetched from the back-end.
    Regards,
    Santhosh.C

  • Delete Selected rows in ALV display

    Hi everyone,
    I have a requirement where in my output display, I will have 3 buttons, like Select all, Deselect all and Delete selected.
    For Select all and Deselect all I am able to write code and they are working fine. But for Delete selected I am not getting
    its actual functionality in the output.
    Please help me in this and provide some part of code which can fulfill this.
    Regards.
    Moderator Message: FAQ. Explore the already given answers and search the forum and the web for more.
    Edited by: kishan P on Sep 15, 2010 12:45 PM

    Hi Dieter,
    I think the problem is smwhr else...Delete is a stanard functionality in the ALV Grid and would not fire your own code...
    @Latha: I guess the row is getting deleted but your functionality is not working..If that is right then follow this approach:
    When u delete a row it doesnot call your event handler and hence your code is not executed...You have to implement the toolbar event for this...In the toolbar event put a breakpoint and see the sy-ucomm for delete...you will then have to manually change this standard delete sy-ucomm to your custom sy-ucomm...
    The code in the handle_toolbar method would be somthing like this
    loop at mt-toolbar.
    if sy-ucomm = standarad delete code
      replace with your own custom code for exapmle 'DELETE'.
    endif.
    endloop. 
    Once you have done this then the Delete row would fire your own code for delete event...
    Hope this helps...
    Regards,
    Sitakant

  • Re : ALV Output Display

    hi
    i'm doing an ALV Report. In the output  i'm double clicking on the Document field using user-command
    it is taking me to a particular Transaction and my requirement is if i change any field for ex : Description
    in that transaction and come back again to the output display the Changed Description should appear
    when i refresh the Output.how to get it?
    Regards

    1. create one icon on allication toolbar which is REFRESH icon, and give some function for it.
    2. write the code like:
        CASE SY_UCOMM.
          when 'FCODE'.
              refresh itab.
              perform get_data.
              perform_displaydata.
    it is nothing but u need to put the same code which u used earlier to show the data in output gaian after clicking on function code.
    Regards,
    Rajesh.

  • Trigger events when delete/modify certain folder in KM

    Dear Experts,
    I have a requirement like when certain folder is being deleted/modified I want an event need to be trigger, such that I will put some checks before these commands performed.
    Basically my requirement is, I have a custom iViews created and are using custom tables in databse.  When I create the folders in KM, I am creating/maintaining these folder reference in my custom tablese using my custom iView.
    Now when I delete the folder from KM, I want to show some warning message before deleting the folder and simulatenously these folder references should also be deleted from my custom tables.
    Please give me suggestions how to acheive the above scenario.
    Thanks in Advance,
    Chinna.

    Hi Yogalakshmi,
    I have created a Repository service using the document provided. I have registered the pre_delete_template  event using the below code         
    unregister(this,ResourceEvent.PRE_DELETE_TEMPLATE);
    I am printing some trace when this event occurs. Logs is being displayed after the folder gets deleted.
    Can you please provide me some code snippet for register predelete event, and on attempting to delete I would like to pop up a window with warning/confirmation message (confirmation popup window). Based on the confirmation from the popup window -- Ok/Cancel, I would like to perform few operations.
    I don't find any documents on Repository Services.
    Could you please provide me code/documents that fulfills my requirement.
    Thanks
    Chinna.

  • Help on output Display

    Help on output Display
    Thanks in Advance
    ID ROUTE STRT_NAME BEGIN_DESCRIPTION END_DESCRIPTION OVERLAP BEG_MP END_MP Hierarchy
    100899 CR ELM AVE EXT FUERA BUSH RD ELM AVE 1551 0 0.46 3
    100899 CR ELM AVE ELM AVE RT 910A 1551 0.46 0.95 3
    100899 CR ELM AVE ELM AVE DELMAR BYPASS 1551 0.46 0.83 3
    100290 NY32 ELM AVE EXT RT 910A FEURA BUSH RD ELM AVE 1551 16.85 17.31 1
    100290 NY32 ELM AVE ELM AVE DELMAR BYPASS 1551 17.31 17.68 1
    My output will be Based on Hierarchy Max valuewhich is "3"
    ID = Hierarchy Max value 3 =(100899)
    ROUTE = Hierarchy Min Value which is "NY32"
    STRT NAME = Hierarchy Max value (3) and Min of Beg_MP of Hierarchy Max value(3) = ELM AVE EXT
    Begin Description = Hierarchy Max value (3) and Min of Beg_MP (0) of Hierarchy Max value(3) = FUERA BUSH RD
    End_description =Hierarchy Max value (3) and Max of Beg_MP (0.95) of Hierarchy Max value(3) = RT 910A
    Beg_MP = Hierarchy Max value (3) and Min of Beg_MP (0) of Hierarchy Max value(3) =0
    end_mp = Hierarchy Max value (3) and Max of Beg_MP (0.95) of Hierarchy Max value(3) = 0.95
    ID ROUTE STRT_NAME BEGIN_DESCRIPTION END_DESCRIPTION BEG_MP END_MP
    100899 NY32 ELM AVE EXT FUERA BUSH RD RT 910A 0 0.95

    CREATE TABLE TABLE_query(ID NUMBER,ROUTE VARCHAR2(30),STR_NAME VARCHAR2(30), BEGIN_DESCRIPTION VARCHAR2(300),END_DESCRIPTION VARCHAR2(300),BEG_MP NUMBER,END_MP NUMBER,HIERARCHY NUMBER,overlap number);
    INSERT INTO TABLE_query(ID ,ROUTE,STR_NAME, BEGIN_DESCRIPTION,END_DESCRIPTION,BEG_MP,END_MP ,HIERARCHY,overlap)
    values(100899,'CR','ELM AVE EXT','FUERA BUSH RD','ELM AVE',0,0.46,3,1551);
    INSERT INTO TABLE_query(ID ,ROUTE,STR_NAME, BEGIN_DESCRIPTION,END_DESCRIPTION,BEG_MP,END_MP ,HIERARCHY,overlap)
    values(100899,'CR','ELM AVE','ELM AVE','DELMAR BYPASS',0.46,0.95,3,1551);
    INSERT INTO TABLE_query(ID ,ROUTE,STR_NAME, BEGIN_DESCRIPTION,END_DESCRIPTION,BEG_MP,END_MP ,HIERARCHY,overlap)
    values(100899,'CR','ELM AVE','ELM AVE','DELMAR BYPASS',0.46,0.83,3,1551);
    INSERT INTO TABLE_query(ID ,ROUTE,STR_NAME, BEGIN_DESCRIPTION,END_DESCRIPTION,BEG_MP,END_MP ,HIERARCHY,overlap)
    values(100290,'NY32','ELM AVE EXT','RT 910A FEURA BUSH RD','ELM AVE',16.85,17.31,1,1551);
    INSERT INTO TABLE_query(ID ,ROUTE,STR_NAME, BEGIN_DESCRIPTION,END_DESCRIPTION,BEG_MP,END_MP ,HIERARCHY,overlap)
    values(100290,'NY32','ELM AVE','ELM AVE','DELMAR BYPASS',17.31,17.68,1,1551);
    ID     ROUTE     STR_NAME     BEGIN_DESCRIPTION     END_DESCRIPTION     BEG_MP     END_MP     HIERARCHY     OVERLAP
    100899     CR     ELM AVE EXT     FUERA BUSH RD     ELM AVE     0     0.46     3     1551
    100899     CR     ELM AVE     ELM AVE     DELMAR BYPASS     0.46     0.95     3     1551
    100899     CR     ELM AVE     ELM AVE     DELMAR BYPASS     0.46     0.83     3     1551
    100290     NY32     ELM AVE EXT     RT 910A FEURA BUSH RD     ELM AVE     16.85     17.31     1     1551
    100290     NY32     ELM AVE     ELM AVE     DELMAR BYPASS     17.31     17.68     1     1551
    My output will be Based on Hierarchy Max valuewhich is "3"                         
    ID = Hierarchy Max value 3 =(100899)                                        
    ROUTE = Hierarchy Min Value which is "NY32"                                        
    STRT NAME = Hierarchy Max value (3) and Min of Beg_MP of Hierarchy Max value(3) = ELM AVE EXT                                        
    Begin Description = Hierarchy Max value (3) and Min of Beg_MP (0) of Hierarchy Max value(3) = FUERA BUSH RD                                        
    End_description =Hierarchy Max value (3) and Max of Beg_MP (0.95) of Hierarchy Max value(3) = DELMAR BYPASS                                        
    Beg_MP = Hierarchy Max value (3) and Min of Beg_MP (0) of Hierarchy Max value(3) =0                                        
    end_mp = Hierarchy Max value (3) and Max of Beg_MP (0.95) of Hierarchy Max value(3) = 0.95                                        
    ID     ROUTE     STRT_NAME     BEGIN_DESCRIPTION     END_DESCRIPTION     BEG_MP     END_MP          
    100899     NY32     ELM AVE EXT     FUERA BUSH RD     DELMAR BYPASS     0     0.95          
    I figured out how to get id,beg_mp and end_mp
    Can anyone help me getting the rest of data coumns please
    --route,str_name,begin_description,end_description,beg_mp,end_mp,hierarchy,
    select distinct max(id) keep (dense_rank last order by hierarchy) over (partition by overlap) ,
    min(beg_mp) keep (dense_rank last order by hierarchy) over (partition by overlap) beg_mp,
         max(end_mp) keep (dense_rank last order by hierarchy) over (partition by overlap) end_mp                              
    from table_query

  • WBS element field to Depreciation Simulation Report  output display

    Hi SAP Experts,
    We need to Add the WBS element field to Depreciation Simulation Report  output display (S_ALR_87012936)
    Could please give your valuable inputs
    Thanks
    Hari Pothula

    HI Javed,
    We have capitalized with WBS element but not displaying in simulation report.
    All configurations done in in ACSET and activation Account assignment objects
    Thanks
    Hari

  • How to redirect the output display on Ultra 5 box.

    Hello,
    Good day to you.
    I have issues with redirecting display output to my console server (which is configured with cyclades switch) on a newly installed solaris 10, Ultra 5 box.
    I could access the output display on the monitor when I connect it directly to the serial port. But I also have my parallel port connected to cyclades switch which is primarily being used for accessing multiple servers thro' one single console server.
    When I try to access my ultra 5 box thro' console server, the display not getting redirected over there..I did checked the port from cyclades switch front, it did work well with other machines.
    Looks like some work needs to be done at Ultra 5 box level so that the parallel port can send output signals to the respective port on cyclades switch and consequently to the console server.
    Any thoughts ??
    Thanks.

    Hi,
    Good day to you.
    Apologize for quoting "Parallel" port. It is a in-built 25pin serial connector placed next to regular 15 pin serial port.
    Just to make a point here, this 25 pin serial connector has an external converter attached with other side having RJ45 jack.
    CAT5 cable connected between switch port to this RJ45 jack.
    I did tested this converter with another machine and could able to access the display on my console server. So it seems to be the connectivity from serial port to switch port works fine.
    Adding to that, this ultra 5 box with the current connectivity set up was working fine until I rebuild this machine. I was very well accessing this box thro my console server. There was no changes done except rebuilding the operating system.
    I think some work needs to be done at the ultra 5 box level to get this 25pin serial connector to act.
    Thanks.

  • Trace  to find who out who has deleted / modified  the attendance record

    Dear All
    Some one has deleted the attendence record of a particular user of previous month , so how i can track who has deleted / modified the same in salary slip it is showing 1 leave record for the same month, but while checking throught pa30 there is no record shown for the same . can you please tell me how to trace that and which tables are updated once we update the attendence and while processing the salary slip , from which table it picks the leave availaed data .
    Thx
    Shilpa
    Edited by: Shilpa on Nov 13, 2009 11:31 AM

    Hi Shilpa,
    You have to activate the audit Trail.
    RPUAUD00 isthe program to see the changes in infotypes records, but before that you have to configure T585A, T585B, T585C
    Regards,
    Kapil Kaushal

  • Problem In report output display when i run in the background

    Hi,
    In a classical report i am printing around 17 fields  the width of the report out put is around 800 characters.
    If i run  the report in the  fore ground it running perfectly. But the thing is when i give large selection is it GETTING ' TIMED OUT ' as it is running more than an Hour.
    so i wanted to run it in the back ground to avoid TIME OUT problems.
    But when i run in the backgroud   i am not getting  full  out put in the SPOOL request(SIZE of the report output may causing the problem) .
    Pls come up with some solutions
    Thanks in advance

    Try increasing the spool length..
    Refer this link for doing so.
    Spool List output display > 255 char when the rpt is run in Background
    Thanks
    mahesh

  • For output display report is final_internal table or structure in wd ABAP?

    Hi all,
    for output display report is final_internal table or structure in wd ABAP?
    in wd java output display report -.> CALLING rfc and that RFC OUTPUT table
    finally in internal table is assigned to STRUCTURE .Same procdure?
    Thanks,
    RAMA

    Dear Madhu,
    thanks for guidence!
    its showing popup tht this BADI ( ME_CHANGE_OUTTAB_CUS ) is only use for "SAP Internal  use".
    Regards,
    Praphull

  • How to delete modified version datasource

    I have a datasource in M version and A version. I am getting datasource activation error in BI 7.0
    Please let me know how to delete Modified version.
    Thanks
    Liza

    I removed a field from LO datasource 2LIS_11_VAITM , activated, tested  successfully in R/3.
    I replicated the datasource successfully in BW. But when activate the data source I am getting short  dump ST22 ,the error message is  "  The ASSERT condition was violated".  I am BI 7.0.
    BW side in datasouece I found a not equal to sign ( which means M version is not equal to A version) and datasource is inactive.
    ST22 -
    Short text
        The ASSERT condition was violated.
    Error analysis
        The following checkpoint group was used: "No checkpoint group specified"
        If in the ASSERT statement the addition FIELDS was used, you can find
        the content of the first 8 specified fields in the following overview:
        " (not used) "
        " (not used) "
        " (not used) "
        " (not used) "
        " (not used) "
        " (not used) "
        " (not used) "
        " (not used) "
    Thanks
    Liza

  • Bold font in report output display

    Dear All,
    Will any one let me know how to set BOLD font in the report output display?
    Thanks,
    Ranjan

    <b>u cannot use this in 4.7</b>
    REPORT ZFONT NO STANDARD PAGE HEADING LINE-SIZE 80 LINE-COUNT 65.
    Start of print-control
    NEW-PAGE PRINT ON.
    PRINT-CONTROL FUNCTION 'SF000'.
    WRITE: / 'This is CPI 20'.
    SKIP.
    PRINT-CONTROL FUNCTION 'SF020'.
    WRITE: / 'This is CPI 6'.
    SKIP.
    PRINT-CONTROL FUNCTION 'SF008'.
    WRITE: / 'This is CPI 12'.
    Depending on your SAP printer device, this may also work
    PRINT-CONTROL FONT 1 LPI 6.
    you can try to change font and LPI numbers
    WRITE: / 'font 1 lpi 6'.
    PRINT-CONTROL FONT 2 LPI 6.
    WRITE: / 'font 2 lpi 6'.
    PRINT-CONTROL FONT 3 LPI 6.
    WRITE: / 'font 3 lpi 6'.
    End of print-control
    NEW-PAGE PRINT OFF.
    *--- End of Program

  • Download List output displayed

    Hi Friends,
    I want to donwload the list output displayed from the Report program with the exisitng formatting structure (displayed).
    1)From SAP menu we can click on System –> List –> Save –> Local file to download the file locally.
    2) I want to obtain same functionality as mentioned in point 1 through a button on tool bar.
    I dont want to prepare any internal table locally with the same data that is displayed on the screen, in the same formatting structure and Download, which is similar to a local download functionality.
    Please let me know ur suggestions.
    Regards,
    Lavanya.

    Then you have to  display your  O/p in the ALV   display  ...
    so that you can achive  your requirement  ..Because the ALV has the similar icon for downloading to pc  ..etc
    by Normal reporting  you cannot get this Option  .in the Application tool bar  .  one  is there as you menioned
    From SAP menu we can click on System –> List –> Save –> Local file to download the file locally.
    because   by pacing the  icon in  the Apllication bar it will not   call the  path ..etc.  you have to  do the coding  ...instead of that ALV is  best .
    But  in the ALV   it is there  in the standard  ALV  GRID    with   Downlaod icon , summation,scroldown ,sorting (A/D) ,etc...
    reward  points  if it is usefull ..
    Girish

Maybe you are looking for